Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
is-negative-zero
Advanced tools
Package description
The is-negative-zero npm package is a utility that provides a simple function to check if a given number is -0. In JavaScript, -0 and +0 are considered distinct values (due to IEEE 754 floating point), and this package helps in identifying if a number is specifically -0.
Check if a number is -0
This feature allows you to check if a given number is exactly -0. It returns true if the number is -0, and false otherwise. This can be particularly useful in mathematical computations and graphics programming where the distinction between -0 and +0 can have implications.
const isNegativeZero = require('is-negative-zero');
console.log(isNegativeZero(-0)); // true
console.log(isNegativeZero(0)); // false
console.log(isNegativeZero(-1)); // false
Similar to is-negative-zero, is-zero is a utility for checking if a number is 0. However, it does not distinguish between -0 and +0, making it less specific for cases where the sign of zero matters.
While not specifically designed for checking -0, lodash's isEqual function can accurately compare -0 and +0, among many other complex equality checks. It's more versatile but also much larger and more complex than is-negative-zero, which is focused solely on the -0 check.
Changelog
v2.0.0 - 2015-07-24
tape
, eslint
; use my personal shared eslint
config. 648d002
npm run eslint
5a52d80
5a667d9
npm run lint
9a85ed9
tape
, covert
, jscs
c6cd3a6
eslint
e9c9b6e
io.js
2f7c8a9
717087a
481295d
io.js
v2.1
139a84a
eslint
2f5fbfb
eslint
53cb4c5
io.js
v2.2
98a1824
node
/iojs
versions now ship with an npm
that understands ^
. 772d6cd
travis-ci
tests on iojs
and node
v0.12; speed up builds; allow 0.8 failures. 3e6147e
d986cb4
tape
, jscs
9f9d7e7
jscs
079eaf6
tape
, jscs
cffe3fc
tape
, jscs
3a16616
9509a81
io.js
v2.4
a9150a3
io.js
v2.3
36d7acf
29d8917
fe09c8a
5877bc7
9e77756
520a695
Readme
Is this value negative zero? === will lie to you.
var isNegativeZero = require('is-negative-zero');
var assert = require('assert');
assert.notOk(isNegativeZero(undefined));
assert.notOk(isNegativeZero(null));
assert.notOk(isNegativeZero(false));
assert.notOk(isNegativeZero(true));
assert.notOk(isNegativeZero(0));
assert.notOk(isNegativeZero(42));
assert.notOk(isNegativeZero(Infinity));
assert.notOk(isNegativeZero(-Infinity));
assert.notOk(isNegativeZero(NaN));
assert.notOk(isNegativeZero('foo'));
assert.notOk(isNegativeZero(function () {}));
assert.notOk(isNegativeZero([]));
assert.notOk(isNegativeZero({}));
assert.ok(isNegativeZero(-0));
Simply clone the repo, npm install
, and run npm test
FAQs
Is this value negative zero? === will lie to you
The npm package is-negative-zero receives a total of 25,067,331 weekly downloads. As such, is-negative-zero popularity was classified as popular.
We found that is-negative-zero demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.