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 @@ |
{ | ||
"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)); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
68636
944
0
0
1