mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(fast-isnumeric): new type definition v1.1 (#43659)
Small helper function From Plotly project: - definition file - tests https://github.com/plotly/fast-isnumeric#api Thanks!
This commit is contained in:
parent
b1896394f3
commit
51269623f0
6
types/fast-isnumeric/fast-isnumeric-tests.ts
Normal file
6
types/fast-isnumeric/fast-isnumeric-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import isNumeric = require('fast-isnumeric');
|
||||
|
||||
// tslint:disable-next-line: no-construct
|
||||
isNumeric(new String('1')); // $ExpectType boolean
|
||||
isNumeric(1); // $ExpectType boolean
|
||||
isNumeric('1'); // $ExpectType boolean
|
||||
16
types/fast-isnumeric/index.d.ts
vendored
Normal file
16
types/fast-isnumeric/index.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// Type definitions for fast-isnumeric 1.1
|
||||
// Project: https://github.com/plotly/fast-isnumeric#readme
|
||||
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* The fast way to check if a JS object is numeric
|
||||
* Inspired by is-number <https://github.com/jonschlinkert/is-number>
|
||||
* but significantly simplified and sped up by ignoring number and string constructors
|
||||
* ie these return false:
|
||||
* new Number(1)
|
||||
* new String('1')
|
||||
*/
|
||||
declare function isNumeric(n: any): boolean;
|
||||
|
||||
export = isNumeric;
|
||||
23
types/fast-isnumeric/tsconfig.json
Normal file
23
types/fast-isnumeric/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"fast-isnumeric-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/fast-isnumeric/tslint.json
Normal file
1
types/fast-isnumeric/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user