@fvilers/is-number
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@fvilers/is-number

A TypeScript type guard that validates if the given value is a string

Installation

npm install @fvilers/is-number

or

yarn add @fvilers/is-number

ECMAScript module

Starting with version 2.0.0, this library will be published as an ECMAScript module.

Usage

import isNumber from "@fvilers/is-number";

const variable: any = 42;

if (isNumber(variable)) {
  // From here, variable is strongly typed as a number
  console.log(
    "Variable is a number with an exponential value of",
    variable.toExponential(10)
  );
} else {
  console.log("Variable is not a number");
}

It will output:

Variable is a number with an exponential value of 4.2000000000e+1

Package Sidebar

Install

npm i @fvilers/is-number

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

2.91 kB

Total Files

7

Last publish

Collaborators

  • fvilers