New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

isnot

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isnot - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

11

lib/generic.js

@@ -5,3 +5,3 @@ const {isEmptyObject} = require('./objects')

var isEmpty = arg => {
const isEmpty = module.exports.isEmpty = arg => {
if(isEmptyObject(arg))

@@ -21,11 +21,6 @@ return true;

return true;
return false;
}
var isNotEmpty = arg => !isEmpty(arg)
module.exports = {
isEmpty: isEmpty,
isNotEmpty: isNotEmpty
}
const isNotEmpty = module.exports.isNotEmpty = arg => !isEmpty(arg)

@@ -1,20 +0,15 @@

var isNumber = arg => typeof arg === 'number' && isFinite(arg)
const isNumber = module.exports.isNumber = arg => typeof arg === 'number' && isFinite(arg)
var isNotNumber = arg => !isNumber(arg)
const isNotNumber = module.exports.isNotNumber = arg => !isNumber(arg)
var isInt = arg => Number.isInteger(arg)
const isInt = module.exports.isInt = arg => Number.isInteger(arg)
var isNotInt = arg => !isInt(arg)
const isNotInt = module.exports.isNotInt = arg => !isInt(arg)
var isEven = arg => isInt(arg) && !(arg % 2)
const isEven = module.exports.isEven = arg => isInt(arg) && !(arg % 2)
var isOdd = arg => isInt(arg) && !!(arg % 2)
const isOdd = module.exports.isOdd = arg => isInt(arg) && !!(arg % 2)
module.exports = {
isNumber: isNumber,
isNotNumber: isNotNumber,
isInt: isInt,
isNotInt: isNotInt,
isEven: isEven,
isOdd: isOdd
}
const isPositive = module.exports.isPositive = arg => isInt(arg) && arg > 0
const isNotPositive = module.exports.isNotPositive = arg => isNotInt(arg) || arg < 1
{
"name": "isnot",
"version": "0.6.0",
"version": "0.7.0",
"description": "All imaginable type checking utils with negation",

@@ -15,2 +15,3 @@ "main": "index.js",

"type",
"javascript type check",
"test",

@@ -20,6 +21,12 @@ "bool",

"not",
"undefined"
"undefined",
"null",
"number",
"string",
"object",
"array",
"date"
],
"author": "Orlando Groppo",
"license": "ISC",
"author": "Orlando Groppo <orlando.groppo@gmail.com>",
"license": "UNLICENCED",
"devDependencies": {

@@ -26,0 +33,0 @@ "chai": "^4.1.1",

@@ -1,9 +0,8 @@

var expect = require("chai").expect;
const expect = require("chai").expect;
const {isEmpty} = require("../lib/generic");
describe("Test Generic utilities", function() {
describe("isEmpty", function() {
describe("isEmpty", function() {
it("checks correctly", function() {
expect(isEmpty('')).to.equal(true);
expect(isEmpty(' ')).to.equal(true);
expect(isEmpty([])).to.equal(true);

@@ -19,3 +18,3 @@ expect(isEmpty({})).to.equal(true);

});
});
});
});
});

@@ -1,82 +0,97 @@

var expect = require("chai").expect;
const {isInt, isNotInt, isNumber, isNotNumber, isOdd, isEven} = require("../lib/numbers");
const expect = require("chai").expect;
const {isInt, isNotInt, isNumber, isNotNumber, isOdd, isEven, isPositive, isNotPositive} = require("../lib/numbers");
describe("Test Numbers utilities", function() {
describe("isNumber", function() {
it("checks correctly", function() {
expect(isNumber('string')).to.equal(false);
expect(isNumber('33')).to.equal(false);
expect(isNumber('-33')).to.equal(false);
expect(isNumber('2e12')).to.equal(false);
expect(isNumber('\t\t')).to.equal(false);
expect(isNumber('\n\r')).to.equal(false);
expect(isNumber(Infinity)).to.equal(false);
expect(isNumber(-Infinity)).to.equal(false);
expect(isNumber(null)).to.equal(false);
expect(isNumber(undefined)).to.equal(false);
expect(isNumber({})).to.equal(false);
expect(isNumber([])).to.equal(false);
expect(isNumber(0)).to.equal(true);
expect(isNumber(000)).to.equal(true);
expect(isNumber(0912312)).to.equal(true);
expect(isNumber(12.44)).to.equal(true);
expect(isNumber(-1244)).to.equal(true);
expect(isNumber(2e12)).to.equal(true);
});
describe("isNumber", function() {
it("checks correctly", function() {
expect(isNumber('string')).to.equal(false);
expect(isNumber('33')).to.equal(false);
expect(isNumber('-33')).to.equal(false);
expect(isNumber('2e12')).to.equal(false);
expect(isNumber('\t\t')).to.equal(false);
expect(isNumber('\n\r')).to.equal(false);
expect(isNumber(Infinity)).to.equal(false);
expect(isNumber(-Infinity)).to.equal(false);
expect(isNumber(null)).to.equal(false);
expect(isNumber(undefined)).to.equal(false);
expect(isNumber({})).to.equal(false);
expect(isNumber([])).to.equal(false);
expect(isNumber(0)).to.equal(true);
expect(isNumber(000)).to.equal(true);
expect(isNumber(0912312)).to.equal(true);
expect(isNumber(12.44)).to.equal(true);
expect(isNumber(-1244)).to.equal(true);
expect(isNumber(2e12)).to.equal(true);
});
describe("isNotNumber", function() {
it("checks correctly", function() {
expect(isNotNumber('string')).to.equal(true);
expect(isNotNumber(1)).to.equal(false);
});
});
describe("isNotNumber", function() {
it("checks correctly", function() {
expect(isNotNumber('string')).to.equal(true);
expect(isNotNumber(1)).to.equal(false);
});
describe("isInt", function() {
it("checks correctly", function() {
expect(isInt('string')).to.equal(false);
expect(isInt('33')).to.equal(false);
expect(isInt('-33')).to.equal(false);
expect(isInt('2e12')).to.equal(false);
expect(isInt('\t\t')).to.equal(false);
expect(isInt('\n\r')).to.equal(false);
expect(isInt(Infinity)).to.equal(false);
expect(isInt(-Infinity)).to.equal(false);
expect(isInt(null)).to.equal(false);
expect(isInt(undefined)).to.equal(false);
expect(isInt({})).to.equal(false);
expect(isInt([])).to.equal(false);
expect(isInt(0)).to.equal(true);
expect(isInt(000)).to.equal(true);
expect(isInt(0912312)).to.equal(true);
expect(isInt(12.44)).to.equal(false);
expect(isInt(-1244)).to.equal(true);
expect(isInt(2e12)).to.equal(true);
expect(isInt(2.44e1)).to.equal(false);
});
});
describe("isInt", function() {
it("checks correctly", function() {
expect(isInt('string')).to.equal(false);
expect(isInt('33')).to.equal(false);
expect(isInt('-33')).to.equal(false);
expect(isInt('2e12')).to.equal(false);
expect(isInt('\t\t')).to.equal(false);
expect(isInt('\n\r')).to.equal(false);
expect(isInt(Infinity)).to.equal(false);
expect(isInt(-Infinity)).to.equal(false);
expect(isInt(null)).to.equal(false);
expect(isInt(undefined)).to.equal(false);
expect(isInt({})).to.equal(false);
expect(isInt([])).to.equal(false);
expect(isInt(0)).to.equal(true);
expect(isInt(000)).to.equal(true);
expect(isInt(0912312)).to.equal(true);
expect(isInt(12.44)).to.equal(false);
expect(isInt(-1244)).to.equal(true);
expect(isInt(2e12)).to.equal(true);
expect(isInt(2.44e1)).to.equal(false);
});
describe("isNotInt", function() {
it("checks correctly", function() {
expect(isNotInt('string')).to.equal(true);
expect(isNotInt(1.1)).to.equal(true);
expect(isNotInt(1)).to.equal(false);
});
});
describe("isNotInt", function() {
it("checks correctly", function() {
expect(isNotInt('string')).to.equal(true);
expect(isNotInt(1.1)).to.equal(true);
expect(isNotInt(1)).to.equal(false);
});
describe("isOdd", function() {
it("checks correctly", function() {
expect(isOdd('string')).to.equal(false);
expect(isOdd(1)).to.equal(true);
expect(isOdd(1.1)).to.equal(false);
expect(isOdd(-1-2)).to.equal(true);
});
});
describe("isOdd", function() {
it("checks correctly", function() {
expect(isOdd('string')).to.equal(false);
expect(isOdd(1)).to.equal(true);
expect(isOdd(1.1)).to.equal(false);
expect(isOdd(-1-2)).to.equal(true);
});
describe("isEven", function() {
it("checks correctly", function() {
expect(isEven('string')).to.equal(false);
expect(isEven(1)).to.equal(false);
expect(isEven(0)).to.equal(true);
expect(isEven(Infinity)).to.equal(false);
expect(isEven(-0)).to.equal(true);
});
});
describe("isEven", function() {
it("checks correctly", function() {
expect(isEven('string')).to.equal(false);
expect(isEven(1)).to.equal(false);
expect(isEven(0)).to.equal(true);
expect(isEven(Infinity)).to.equal(false);
expect(isEven(-0)).to.equal(true);
});
});
describe("isPositive", function() {
it("checks correctly", function() {
expect(isPositive('string')).to.equal(false);
expect(isPositive(1)).to.equal(true);
expect(isPositive(0)).to.equal(false);
expect(isPositive(Infinity)).to.equal(false);
expect(isPositive(-0)).to.equal(false);
expect(isPositive('0')).to.equal(false);
});
});
describe("isNotPositive", function() {
it("checks correctly", function() {
expect(isNotPositive(0)).to.equal(true);
expect(isNotPositive(1)).to.equal(false);
expect(isNotPositive(0.99)).to.equal(true);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc