mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 14:38:20 +08:00
[float-regex] add definition (#26073)
This commit is contained in:
committed by
Mohamed Hegazy
parent
9004146f8e
commit
09bf36d49d
12
types/float-regex/float-regex-tests.ts
Normal file
12
types/float-regex/float-regex-tests.ts
Normal file
@@ -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);
|
||||
17
types/float-regex/index.d.ts
vendored
Normal file
17
types/float-regex/index.d.ts
vendored
Normal file
@@ -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;
|
||||
23
types/float-regex/tsconfig.json
Normal file
23
types/float-regex/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/float-regex/tslint.json
Normal file
1
types/float-regex/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user