
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Check for a valid Number value.
Numbers, and values that can be cast or evaluated to numbers will return true
.
All other values will return false
.
$ npm install --save num-or-not
const isNumber = require('num-or-not');
// Integers
isNumber(5); // => true
isNumber(-5); // => true
isNumber('5'); // => true
isNumber('-5'); // => true
// Floats (Decimal & Comma)
isNumber(5.0); // => true
isNumber('5.0'); // => true
isNumber('5,0'); // => true
// Octal (ES6)
isNumber(0o144); // => true
isNumber(0O144); // => true
isNumber('0o144'); // => true
isNumber('0O144'); // => true
// Binary (ES6)
isNumber(0b0); // => true
isNumber('0b0'); // => true
// Hexadecimal
isNumber(0xFF); // => true
isNumber('0xFF'); // => true
// Exponential
isNumber(6e3); // => true
isNumber(12e-2); // => true
isNumber('6e3'); // => true
isNumber('12e-2'); // => true
// Currency Values
isNumber('12,456,789'); // => true
isNumber('45,678.123'); // => true
// "Evaluates to Int" values
isNumber(+''); // => true
isNumber(+[]); // => true
isNumber(+[0]); // => true
isNumber(+true); // => true
isNumber(+new Date); // => true
These binary and octal formats are only supported in ES6 environments:
Binary: 0b0
Octal: 0o144
& 0O144
In order to support numbers with commas or decimals (currencies, Dewey Decimal System, etc), some unique values can pass as valid numbers (see Issue #1):
1,2,3.4.5
1,2,3,4.5
Open a pull request or issue if you think we need tighter control over these limitations.
Why do we need another open source number validator in Javascript? We don't, but I wanted one to help keep me accountable of the data type nuances in JS.
MIT @ Michael Wuergler
FAQs
Check for a valid Number value.
The npm package num-or-not receives a total of 1,602 weekly downloads. As such, num-or-not popularity was classified as popular.
We found that num-or-not demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.