Socket
Socket
Sign inDemoInstall

checkjs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checkjs - npm Package Compare versions

Comparing version 3.2.0-0 to 3.3.1

20

index.js

@@ -47,2 +47,22 @@ "use strict";

check.and = function(input, operand) {
return !!input && !!operand;
}
check.nand = function(input, operand) {
return !check.and(input, operand);
}
check.or = function(input, operand) {
return !!input || !!operand;
}
check.nor = function(input, operand) {
return !check.or(input, operand);
}
check.xor = function(input, operand) {
return !!(!!input ^ !!operand);
}
// EXISTANCE

@@ -49,0 +69,0 @@

7

package.json
{
"name": "checkjs",
"version": "3.2.0-0",
"version": "3.3.1",
"description": "Yet another value-validator in JavaScript ... Or is it?",

@@ -24,6 +24,3 @@ "main": "index.js",

},
"homepage": "https://github.com/parzh/check#readme",
"directories": {
"test": "test"
}
"homepage": "https://github.com/parzh/check#readme"
}

@@ -52,2 +52,71 @@ [← Back to `README.md`](../README.md)

- ### check.and(input, operand): boolean
Returns `true` if both agruments are truthy
@param `input` Test value
@param `operand` Comparison value
#### Examples:
```javascript
check.and(true, true); // true
check.and(42, ""); // false
check.and(0, "text"); // false
check.and("", null); // false
```
- ### check.nand(input, operand): boolean
Returns `false` if both agruments are truthy
@param `input` Test value
@param `operand` Comparison value
#### Examples:
```javascript
check.nand(true, true); // false
check.nand(42, ""); // true
check.nand(0, "text"); // true
check.nand("", null); // true
```
_reversed `check.and()`_
- ### check.or(input, operand): boolean
Returns `true` if at least one of agruments is truthy
@param `input` Test value
@param `operand` Comparison value
#### Examples:
```javascript
check.or(true, true); // true
check.or(42, ""); // true
check.or(0, "text"); // true
check.or("", null); // false
```
- ### check.nor(input, operand): boolean
Returns `true` if both agruments are falsy
@param `input` Test value
@param `operand` Comparison value
#### Examples:
```javascript
check.nor(true, true); // false
check.nor(42, ""); // false
check.nor(0, "text"); // false
check.nor("", null); // true
```
_reversed `check.or()`_
- ### check.xor(input, operand): boolean
Returns `true` if agruments are not equal
@param `input` Test value
@param `operand` Comparison value
#### Examples:
```javascript
check.xor(true, true); // false
check.xor(42, ""); // true
check.xor(0, "text"); // true
check.xor("", null); // false
```
[← Back to `README.md`](../README.md)

@@ -38,2 +38,47 @@ let assert = require("assert");

});
describe("check.and(input, operand)", function() {
it("returns `true` if both agruments are truthy", function() {
assert(check.and(true, true));
assert(!check.and(42, ""));
assert(!check.and(0, "text"));
assert(!check.and("", null));
});
});
describe("check.nand(input, operand)", function() {
it("returns `false` if both agruments are truthy", function() {
assert(!check.nand(true, true));
assert(check.nand(42, ""));
assert(check.nand(0, "text"));
assert(check.nand("", null));
});
});
describe("check.or(input, operand)", function() {
it("returns `true` if at least one of agruments is truthy", function() {
assert(check.or(true, true));
assert(check.or(42, ""));
assert(check.or(0, "text"));
assert(!check.or("", null));
});
});
describe("check.nor(input, operand)", function() {
it("returns `true` if both agruments are falsy", function() {
assert(!check.nor(true, true));
assert(!check.nor(42, ""));
assert(!check.nor(0, "text"));
assert(check.nor("", null));
});
});
describe("check.xor(input, operand)", function() {
it("returns `true` if agruments are not equal", function() {
assert(!check.xor(true, true));
assert(check.xor(42, ""));
assert(check.xor(0, "text"));
assert(!check.xor("", null));
});
});
});
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