mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
[float-regex] add definition (#26073)
This commit is contained in:
committed by
Mohamed Hegazy
parent
9004146f8e
commit
09bf36d49d
@@ -0,0 +1,12 @@
|
||||
import regexp = require('float-regex');
|
||||
|
||||
const foo: RegExp = regexp;
|
||||
|
||||
const anchor = RegExp(`^${regexp.source}$`);
|
||||
anchor.test('1.23e24'); // true
|
||||
anchor.test('1.23e24.55'); // false
|
||||
|
||||
const freg = regexp.source;
|
||||
const capture = RegExp(`\\b(${freg})\\b`, 'g');
|
||||
const str = '1.2 555 beep boop 4.2.1.5 66.2e99 22.54e23 qrs2';
|
||||
str.match(capture);
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for float-regex 1.0
|
||||
// Project: https://github.com/substack/float-regex
|
||||
// Definitions by: Anjun Wang <https://github.com/wanganjun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* regular expression for real floating point values in javascript notation:
|
||||
* ```
|
||||
* /[-+]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][-+]?\d+)?/
|
||||
* ```
|
||||
*
|
||||
* does not match:
|
||||
* * +/- Infinity
|
||||
* * NaN
|
||||
*/
|
||||
declare const regexp: RegExp;
|
||||
export = regexp;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"float-regex-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user