mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-15 14:30:22 +00:00
Merge pull request #33253 from adamzerella/types/is-natural-number
[is-natural-number] Add is-natural-number typing
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for is-natural-number 4.0
|
||||
// Project: https://github.com/shinnn/is-natural-number.js
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Setting this option true makes 0 regarded as a natural number.
|
||||
*/
|
||||
includeZero: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rreturns true if the first argument is one of the natural numbers.
|
||||
* If not, or the argument is not a number, it returns false.
|
||||
*/
|
||||
declare function isNaturalNumber(number: number|string, option?: Options): boolean;
|
||||
|
||||
export = isNaturalNumber;
|
||||
@@ -0,0 +1,6 @@
|
||||
import isNaturalNumber = require("is-natural-number");
|
||||
|
||||
isNaturalNumber(5);
|
||||
isNaturalNumber("5");
|
||||
isNaturalNumber(0, {includeZero: true});
|
||||
isNaturalNumber("0", {includeZero: true});
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-natural-number-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user