
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).
A strict TypeScript-only utility to check if a number is odd, with modern type safety.
A strict TypeScript utility to check if a number is odd, with modern type safety and support for edge cases.
Welcome to is-odd-ts
, a lightweight utility for checking if a number is odd, built specifically with strict TypeScript settings. Whether you're working with everyday integers or hitting edge cases like NaN
, Infinity
, or very large numbers, this package has you covered.
is-odd-ts
?NaN
, Infinity
, and numbers beyond JavaScript’s safe integer range.You can install it with npm
:
npm install is-odd-ts
Or with yarn:
yarn add is-odd-ts
This package is ESM-only and requires Node 22+.
import { isOdd } from 'is-odd-ts';
console.log(isOdd(1)); // true
console.log(isOdd(2)); // false
console.log(isOdd(-3)); // true
console.log(isOdd(0)); // false
isOdd(NaN); // Throws: "Expected a finite number"
isOdd(Infinity); // Throws: "Expected a finite number"
isOdd(-Infinity); // Throws: "Expected a finite number"
isOdd(1.5); // Throws: "Expected an integer"
isOdd(Number.MAX_SAFE_INTEGER); // true
isOdd(Number.MIN_SAFE_INTEGER); // true
Infinity
& NaN
: Throws errors for invalid inputs like NaN
, Infinity
, and -Infinity
.Number.MAX_SAFE_INTEGER
and Number.MIN_SAFE_INTEGER
.I've put effort into testing this utility across a variety of scenarios to make sure it behaves consistently and handles edge cases properly. The tests cover:
Number.MAX_SAFE_INTEGER
and Number.MIN_SAFE_INTEGER
.NaN
, Infinity
, floats, and values beyond safe integer limits.Tests have been written using Node's native test runner. Run the tests locally with:
npm run test
If you find something missing or think the utility could be improved, feel free to contribute. Open an issue or submit a pull request, and let's keep it simple and efficient.
This project is licensed under the MIT License, so feel free to use it in your own projects.
Links:
FAQs
A strict TypeScript-only utility to check if a number is odd, with modern type safety.
The npm package is-odd-ts receives a total of 72 weekly downloads. As such, is-odd-ts popularity was classified as not popular.
We found that is-odd-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.