Files
common/packages/util/src/is/number.ts
T
2021-01-03 11:20:22 +01:00

21 lines
491 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
/**
* @name isNumber
* @summary Tests for a JavaScript number.
* @description
* Checks to see if the input value is a valid number.
* @example
* <BR>
*
* ```javascript
* import { isNumber } from '@polkadot/util';
*
* console.log('isNumber', isNumber(1234)); // => true
* ```
*/
export function isNumber (value: unknown): value is number {
return typeof value === 'number';
}