check-types
Advanced tools
Comparing version 10.1.2 to 11.0.0
# History | ||
## 11.0.0 | ||
### Breaking changes | ||
* api: remove trim option from emptyString and nonEmptyString (3747900) | ||
### New features | ||
* predicates: implement float (b6bf1dc) | ||
* predicates: implement throws (018f50a) | ||
* predicates: implement one (3fb7424) | ||
### Bug fixes | ||
* lib: stop object predicates throwing when prototypes is null (b0bab07) | ||
### Other changes | ||
* tests: add missing test case for assert.throws (6f9c2f7) | ||
* docs: update author list (81ab8a9) | ||
## 10.1.2 | ||
@@ -4,0 +25,0 @@ |
{ | ||
"name": "check-types", | ||
"version": "10.1.2", | ||
"version": "11.0.0", | ||
"description": "A little library for asserting types and values.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://gitlab.com/philbooth/check-types.js", |
@@ -49,3 +49,3 @@ # check-types.js | ||
to check arguments | ||
and throw exceptions | ||
and throw errors | ||
is a task that | ||
@@ -64,3 +64,3 @@ swiftly becomes tiresome | ||
23 kb unminified with comments, 6.9 kb minified, 2.5 kb minified + gzipped. | ||
24 kb unminified with comments, 7 kb minified, 2.5 kb minified + gzipped. | ||
@@ -259,6 +259,2 @@ ## How do I install it? | ||
`false` otherwise. | ||
If `options.trim` is truthy | ||
and `thing` is a string, | ||
`thing.trim()` will be called | ||
before making the comparison. | ||
@@ -269,6 +265,2 @@ * `check.nonEmptyString(thing, options)`: | ||
`false` otherwise. | ||
If `options.trim` is truthy | ||
and `thing` is a string, | ||
`thing.trim()` will be called | ||
before making the comparison. | ||
@@ -307,2 +299,7 @@ * `check.contains(string, substring)`: | ||
* `check.float(thing)`: | ||
Returns `true` | ||
if `thing` is a non-integer number, | ||
`false` otherwise. | ||
* `check.zero(thing)`: | ||
@@ -313,2 +310,7 @@ Returns `true` | ||
* `check.one(thing)`: | ||
Returns `true` | ||
if `thing` is one, | ||
`false` otherwise. | ||
* `check.infinity(thing)`: | ||
@@ -497,2 +499,7 @@ Returns `true` | ||
* `check.throws(() => thing())`: | ||
Returns `true` | ||
if `thing` is a function that throws, | ||
`false` otherwise. | ||
#### Modifiers | ||
@@ -709,2 +716,16 @@ | ||
```javascript | ||
check.throws(() => { | ||
testFunction({called: 'with wrong parameters'}); // Throws on wrong parameters | ||
}); | ||
// Returns true | ||
``` | ||
```javascript | ||
await check.rejects(async() => { | ||
await testFunction({called: 'with wrong parameters'}); // Throws on wrong parameters | ||
}); | ||
// Returns true | ||
``` | ||
## Are there TypeScript definitions? | ||
@@ -744,2 +765,22 @@ | ||
## What changed from 10.x to 11.x? | ||
Breaking changes | ||
were made to the API | ||
in version 11.0.0. | ||
Specifically, | ||
the `options` argument was removed | ||
from the `emptyString` and `nonEmptyString` predicates | ||
because it caused problematic behaviour in the `assert` modifier. | ||
Callers who were previously using `options.trim` with these predicates | ||
should call `check.match` instead: | ||
```js | ||
check.match(stringWithSpaces, /^\s*$/); | ||
``` | ||
See the [history][history11] | ||
for more details. | ||
## What changed from 9.x to 10.x? | ||
@@ -746,0 +787,0 @@ |
@@ -8,3 +8,4 @@ /*globals define, module, Symbol, Map, Set */ | ||
var messages, predicates, functions, assert, not, maybe, collections, | ||
slice, neginf, posinf, isArray, keys, haveSymbols, haveMaps, haveSets; | ||
hasOwnProperty, toString, keys, slice, isArray, neginf, posinf, | ||
haveSymbols, haveMaps, haveSets; | ||
@@ -25,5 +26,7 @@ messages = {}; | ||
{ n: 'zero', f: zero, s: 'be 0' }, | ||
{ n: 'one', f: one, s: 'be 1' }, | ||
{ n: 'infinity', f: infinity, s: 'be infinity' }, | ||
{ n: 'number', f: number, s: 'be Number' }, | ||
{ n: 'integer', f: integer, s: 'be integer' }, | ||
{ n: 'float', f: float, s: 'be non-integer number' }, | ||
{ n: 'even', f: even, s: 'be even number' }, | ||
@@ -58,2 +61,3 @@ { n: 'odd', f: odd, s: 'be odd number' }, | ||
{ n: 'hasLength', f: hasLength, s: 'have length {e}' }, | ||
{ n: 'throws', f: throws, s: 'throw' } | ||
].map(function (data) { | ||
@@ -72,7 +76,9 @@ var n = data.n; | ||
collections = [ 'array', 'arrayLike', 'iterable', 'object' ]; | ||
hasOwnProperty = Object.prototype.hasOwnProperty; | ||
toString = Object.prototype.toString; | ||
keys = Object.keys; | ||
slice = Array.prototype.slice; | ||
isArray = Array.isArray; | ||
neginf = Number.NEGATIVE_INFINITY; | ||
posinf = Number.POSITIVE_INFINITY; | ||
isArray = Array.isArray; | ||
keys = Object.keys; | ||
haveSymbols = typeof Symbol === 'function'; | ||
@@ -167,2 +173,11 @@ haveMaps = typeof Map === 'function'; | ||
/** | ||
* Public function `one`. | ||
* | ||
* Returns true if `data` is one, false otherwise. | ||
*/ | ||
function one (data) { | ||
return data === 1; | ||
} | ||
/** | ||
* Public function `infinity`. | ||
@@ -195,2 +210,11 @@ * | ||
/** | ||
* Public function `float`. | ||
* | ||
* Returns true if `data` is a non-integer number, false otherwise. | ||
*/ | ||
function float (data) { | ||
return number(data) && data % 1 !== 0; | ||
} | ||
/** | ||
* Public function `even`. | ||
@@ -309,7 +333,3 @@ * | ||
*/ | ||
function emptyString (data, options) { | ||
if (options && options.trim && string(data)) { | ||
return data.trim() === ''; | ||
} | ||
function emptyString (data) { | ||
return data === ''; | ||
@@ -323,7 +343,3 @@ } | ||
*/ | ||
function nonEmptyString (data, options) { | ||
if (options && options.trim) { | ||
return string(data) && data.trim() !== ''; | ||
} | ||
function nonEmptyString (data) { | ||
return string(data) && data !== ''; | ||
@@ -356,3 +372,3 @@ } | ||
function object (data) { | ||
return Object.prototype.toString.call(data) === '[object Object]'; | ||
return toString.call(data) === '[object Object]'; | ||
} | ||
@@ -373,3 +389,3 @@ | ||
for (var key in data) { | ||
if (data.hasOwnProperty(key)) { | ||
if (hasOwnProperty.call(data, key)) { | ||
if (predicate(key, data[key])) { | ||
@@ -419,3 +435,3 @@ return true; | ||
data.constructor.name === prototype.name || | ||
Object.prototype.toString.call(data) === '[object ' + prototype.name + ']'; | ||
toString.call(data) === '[object ' + prototype.name + ']'; | ||
} catch (error) { | ||
@@ -436,4 +452,4 @@ return false; | ||
for (name in archetype) { | ||
if (archetype.hasOwnProperty(name)) { | ||
if (data.hasOwnProperty(name) === false || typeof data[name] !== typeof archetype[name]) { | ||
if (hasOwnProperty.call(archetype, name)) { | ||
if (hasOwnProperty.call(data, name) === false || typeof data[name] !== typeof archetype[name]) { | ||
return false; | ||
@@ -612,2 +628,21 @@ } | ||
/** | ||
* Public function `throws`. | ||
* | ||
* Returns true if `data` is a function that throws, false otherwise. | ||
*/ | ||
function throws (data) { | ||
if (! isFunction(data)) { | ||
return false; | ||
} | ||
try { | ||
data(); | ||
} catch (error) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
* Public function `map`. | ||
@@ -665,3 +700,3 @@ * | ||
for (var key in object) { | ||
if (object.hasOwnProperty(key)) { | ||
if (hasOwnProperty.call(object, key)) { | ||
action(key, object[key]); | ||
@@ -704,3 +739,3 @@ } | ||
for (key in data) { | ||
if (data.hasOwnProperty(key)) { | ||
if (hasOwnProperty.call(data, key)) { | ||
value = data[key]; | ||
@@ -707,0 +742,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(n){"use strict";var f,r,e,i,c,t,u,o,a,s,l,b,p,y,m,h;function g(n){return null!=n}function d(n){return"number"==typeof n&&a<n&&n<s}function v(n){return"number"==typeof n&&n%1==0}function j(n,e){return d(n)&&e<n}function O(n,e){return d(n)&&n<e}function E(n,e){return d(n)&&e<=n}function w(n,e){return d(n)&&n<=e}function S(n){return"string"==typeof n}function k(n,e){return e&&e.trim?S(n)&&""!==n.trim():S(n)&&""!==n}function I(n){return"[object Object]"===Object.prototype.toString.call(n)}function N(n,e){for(var t in n)if(n.hasOwnProperty(t)&&e(t,n[t]))return!0;return!1}function A(n,e){try{return n instanceof e}catch(n){return!1}}function P(n,e){var t;for(t in e)if(e.hasOwnProperty(t)){if(!1===n.hasOwnProperty(t)||typeof n[t]!=typeof e[t])return!1;if(I(n[t])&&!1===P(n[t],e[t]))return!1}return!0}function q(n){return g(n)&&0<=n.length}function x(n){return p?g(n)&&L(n[Symbol.iterator]):q(n)}function T(n,t){var e,r;if(!g(n))return!1;if(m&&A(n,Set))return n.has(t);if(S(n))return-1!==n.indexOf(t);if(p&&n[Symbol.iterator]&&L(n.values)){e=n.values();do{if((r=e.next()).value===t)return!0}while(!r.done);return!1}return N(n,function(n,e){return e===t})}function F(n,e){return!!g(n)&&(y&&A(n,Map)?n.has(e):!(x(n)&&!d(+e))&&!!n[e])}function L(n){return"function"==typeof n}function D(n,e){for(var t in n)n.hasOwnProperty(t)&&e(t,n[t])}function M(n,e){var t;for(t=0;t<n.length;t+=1)if(n[t]===e)return e;return!e}function R(n,e){var t,r;for(t in n)if(n.hasOwnProperty(t)){if(I(r=n[t])&&R(r,e)===e)return e;if(r===e)return e}return!e}function V(t,n){return D(n,function(n,e){t[n]=e}),t}function Y(u,o){return function(){var e=arguments,n=u.l||u.length,t=e[n],r=e[n+1];return z(u.apply(null,e),k(t)?t:o.replace("{a}",_(e[0])).replace("{e}",_(e[1])).replace("{e2}",_(e[2])).replace("{t}",function(){var n=e[1];return n&&n.name?n.name:n}),L(r)?r:TypeError),e[0]}}function _(n){return function(){return S(n)?'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"':n&&n.constructor&&!A(n,RegExp)&&"number"!=typeof n?n.constructor.name:n}}function z(n,e,t){if(n)return n;throw new(t||Error)(e||"assert failed")}function B(n){var e=function(){return G(n.apply(null,arguments))};return e.l=n.length,e}function G(n){return!n}function K(t,r,u){var n=function(){var n,e;if(n=arguments[0],"maybe"===t&&c.assigned(n))return!0;if(!r(n))return!1;n=function(n,e){switch(n){case q:return o.call(e);case I:return b(e).map(function(n){return e[n]});default:return e}}(r,n),e=o.call(arguments,1);try{n.forEach(function(n){if(("maybe"!==t||g(n))&&!u.apply(null,[n].concat(e)))throw 0})}catch(n){return!1}return!0};return n.l=u.length,n}function C(n,e){return H([n,r,e,""])}function H(r){var u,o,i;return u=r.shift(),o=r.pop(),i=r.pop(),D(r.pop(),function(n,e){var t=f[n];t&&o&&(t=t.replace("to",o+"to")),Object.defineProperty(i,n,{configurable:!1,enumerable:!0,writable:!1,value:u.apply(null,r.concat(e,t))})}),i}function J(n,e,t){return H([n,e,{},t])}function Q(e,t){u.forEach(function(n){e[n].of=J(t,r[n].of)})}f={},r={},[{n:"equal",f:function(n,e){return n===e},s:"equal {e}"},{n:"undefined",f:function(n){return void 0===n},s:"be undefined"},{n:"null",f:function(n){return null===n},s:"be null"},{n:"assigned",f:g,s:"be assigned"},{n:"primitive",f:function(n){var e;switch(n){case null:case void 0:case!1:case!0:return!0}return"string"==(e=typeof n)||"number"===e||p&&"symbol"===e},s:"be primitive type"},{n:"contains",f:T,s:"contain {e}"},{n:"in",f:function(n,e){return T(e,n)},s:"be in {e}"},{n:"containsKey",f:F,s:"contain key {e}"},{n:"keyIn",f:function(n,e){return F(e,n)},s:"be key in {e}"},{n:"zero",f:function(n){return 0===n},s:"be 0"},{n:"infinity",f:function(n){return n===a||n===s},s:"be infinity"},{n:"number",f:d,s:"be Number"},{n:"integer",f:v,s:"be integer"},{n:"even",f:function(n){return"number"==typeof n&&n%2==0},s:"be even number"},{n:"odd",f:function(n){return v(n)&&n%2!=0},s:"be odd number"},{n:"greater",f:j,s:"be greater than {e}"},{n:"less",f:O,s:"be less than {e}"},{n:"between",f:function(n,e,t){if(e<t)return j(n,e)&&n<t;return O(n,e)&&t<n},s:"be between {e} and {e2}"},{n:"greaterOrEqual",f:E,s:"be greater than or equal to {e}"},{n:"lessOrEqual",f:w,s:"be less than or equal to {e}"},{n:"inRange",f:function(n,e,t){if(e<t)return E(n,e)&&n<=t;return w(n,e)&&t<=n},s:"be in the range {e} to {e2}"},{n:"positive",f:function(n){return j(n,0)},s:"be positive number"},{n:"negative",f:function(n){return O(n,0)},s:"be negative number"},{n:"string",f:S,s:"be String"},{n:"emptyString",f:function(n,e){if(e&&e.trim&&S(n))return""===n.trim();return""===n},s:"be empty string"},{n:"nonEmptyString",f:k,s:"be non-empty string"},{n:"match",f:function(n,e){return S(n)&&!!n.match(e)},s:"match {e}"},{n:"boolean",f:function(n){return!1===n||!0===n},s:"be Boolean"},{n:"object",f:I,s:"be Object"},{n:"emptyObject",f:function(n){return I(n)&&!N(n,function(){return!0})},s:"be empty object"},{n:"nonEmptyObject",f:function(n){return I(n)&&N(n,function(){return!0})},s:"be non-empty object"},{n:"instanceStrict",f:A,s:"be instanceof {t}"},{n:"instance",f:function(n,e){try{return A(n,e)||n.constructor.name===e.name||Object.prototype.toString.call(n)==="[object "+e.name+"]"}catch(n){return!1}},s:"be {t}"},{n:"like",f:P,s:"be like {e}"},{n:"array",f:function(n){return l(n)},s:"be Array"},{n:"emptyArray",f:function(n){return l(n)&&0===n.length},s:"be empty array"},{n:"nonEmptyArray",f:function(n){return l(n)&&0<n.length},s:"be non-empty array"},{n:"arrayLike",f:q,s:"be array-like"},{n:"iterable",f:x,s:"be iterable"},{n:"date",f:function(n){return A(n,Date)&&v(n.getTime())},s:"be valid Date"},{n:"function",f:L,s:"be Function"},{n:"hasLength",f:function(n,e){return g(n)&&n.length===e},s:"have length {e}"}].map(function(n){var e=n.n;f[e]="assert failed: expected {a} to "+n.s,r[e]=n.f}),e={map:function e(r,t){var u;u=l(r)?[]:{};if(L(t))D(r,function(n,e){u[n]=t(e)});else{l(t)||i.object(t);var o=b(r||{});D(t,function(t,n){o.some(function(n,e){return n===t&&(o.splice(e,1),!0)}),L(n)?c.assigned(r)?u[t]=!!n.m:u[t]=n(r[t]):u[t]=e(r[t],n)})}return u},all:function(n){if(l(n))return M(n,!1);return i.object(n),R(n,!1)},any:function(n){if(l(n))return M(n,!0);return i.object(n),R(n,!0)}},u=["array","arrayLike","iterable","object"],o=Array.prototype.slice,a=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Array.isArray,b=Object.keys,p="function"==typeof Symbol,y="function"==typeof Map,m="function"==typeof Set,e=V(e,r),i=C(Y,z),c=C(B,G),t=C(function(n){var e=function(){return!!c.assigned(arguments[0])||n.apply(null,arguments)};return e.l=n.length,e.m=!0,e},function(n){return!1===g(n)||n}),i.not=J(Y,c,"not "),i.maybe=J(Y,t,"maybe "),u.forEach(function(n){r[n].of=H([K.bind(null,null),r[n],r,{},""])}),Q(i,Y),Q(c,B),u.forEach(function(n){t[n].of=H([K.bind(null,"maybe"),r[n],r,{},""]),i.maybe[n].of=J(Y,t[n].of),i.not[n].of=J(Y,c[n].of)}),h=V(e,{assert:i,not:c,maybe:t}),"function"==typeof define&&define.amd?define(function(){return h}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=h:n.check=h}(this); | ||
!function(n){"use strict";var i,r,e,f,c,t,u,o,a,l,s,b,y,p,m,h,g,d;function v(n){return null!=n}function j(n){return"number"==typeof n&&y<n&&n<p}function E(n){return"number"==typeof n&&n%1==0}function O(n,e){return j(n)&&e<n}function w(n,e){return j(n)&&n<e}function S(n,e){return j(n)&&e<=n}function k(n,e){return j(n)&&n<=e}function I(n){return"string"==typeof n}function N(n){return I(n)&&""!==n}function A(n){return"[object Object]"===a.call(n)}function q(n,e){for(var t in n)if(o.call(n,t)&&e(t,n[t]))return!0;return!1}function x(n,e){try{return n instanceof e}catch(n){return!1}}function T(n,e){var t;for(t in e)if(o.call(e,t)){if(!1===o.call(n,t)||typeof n[t]!=typeof e[t])return!1;if(A(n[t])&&!1===T(n[t],e[t]))return!1}return!0}function F(n){return v(n)&&0<=n.length}function L(n){return m?v(n)&&M(n[Symbol.iterator]):F(n)}function P(n,t){var e,r;if(!v(n))return!1;if(g&&x(n,Set))return n.has(t);if(I(n))return-1!==n.indexOf(t);if(m&&n[Symbol.iterator]&&M(n.values)){e=n.values();do{if((r=e.next()).value===t)return!0}while(!r.done);return!1}return q(n,function(n,e){return e===t})}function D(n,e){return!!v(n)&&(h&&x(n,Map)?n.has(e):!(L(n)&&!j(+e))&&!!n[e])}function M(n){return"function"==typeof n}function R(n,e){for(var t in n)o.call(n,t)&&e(t,n[t])}function V(n,e){var t;for(t=0;t<n.length;t+=1)if(n[t]===e)return e;return!e}function Y(n,e){var t,r;for(t in n)if(o.call(n,t)){if(A(r=n[t])&&Y(r,e)===e)return e;if(r===e)return e}return!e}function _(t,n){return R(n,function(n,e){t[n]=e}),t}function z(u,o){return function(){var e=arguments,n=u.l||u.length,t=e[n],r=e[n+1];return G(u.apply(null,e),N(t)?t:o.replace("{a}",B(e[0])).replace("{e}",B(e[1])).replace("{e2}",B(e[2])).replace("{t}",function(){var n=e[1];return n&&n.name?n.name:n}),M(r)?r:TypeError),e[0]}}function B(n){return function(){return I(n)?'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"':n&&n.constructor&&!x(n,RegExp)&&"number"!=typeof n?n.constructor.name:n}}function G(n,e,t){if(n)return n;throw new(t||Error)(e||"assert failed")}function K(n){var e=function(){return C(n.apply(null,arguments))};return e.l=n.length,e}function C(n){return!n}function H(t,r,u){var n=function(){var n,e;if(n=arguments[0],"maybe"===t&&c.assigned(n))return!0;if(!r(n))return!1;n=function(n,e){switch(n){case F:return s.call(e);case A:return l(e).map(function(n){return e[n]});default:return e}}(r,n),e=s.call(arguments,1);try{n.forEach(function(n){if(("maybe"!==t||v(n))&&!u.apply(null,[n].concat(e)))throw 0})}catch(n){return!1}return!0};return n.l=u.length,n}function J(n,e){return Q([n,r,e,""])}function Q(r){var u,o,f;return u=r.shift(),o=r.pop(),f=r.pop(),R(r.pop(),function(n,e){var t=i[n];t&&o&&(t=t.replace("to",o+"to")),Object.defineProperty(f,n,{configurable:!1,enumerable:!0,writable:!1,value:u.apply(null,r.concat(e,t))})}),f}function U(n,e,t){return Q([n,e,{},t])}function W(e,t){u.forEach(function(n){e[n].of=U(t,r[n].of)})}i={},r={},[{n:"equal",f:function(n,e){return n===e},s:"equal {e}"},{n:"undefined",f:function(n){return void 0===n},s:"be undefined"},{n:"null",f:function(n){return null===n},s:"be null"},{n:"assigned",f:v,s:"be assigned"},{n:"primitive",f:function(n){var e;switch(n){case null:case void 0:case!1:case!0:return!0}return"string"==(e=typeof n)||"number"===e||m&&"symbol"===e},s:"be primitive type"},{n:"contains",f:P,s:"contain {e}"},{n:"in",f:function(n,e){return P(e,n)},s:"be in {e}"},{n:"containsKey",f:D,s:"contain key {e}"},{n:"keyIn",f:function(n,e){return D(e,n)},s:"be key in {e}"},{n:"zero",f:function(n){return 0===n},s:"be 0"},{n:"one",f:function(n){return 1===n},s:"be 1"},{n:"infinity",f:function(n){return n===y||n===p},s:"be infinity"},{n:"number",f:j,s:"be Number"},{n:"integer",f:E,s:"be integer"},{n:"float",f:function(n){return j(n)&&n%1!=0},s:"be non-integer number"},{n:"even",f:function(n){return"number"==typeof n&&n%2==0},s:"be even number"},{n:"odd",f:function(n){return E(n)&&n%2!=0},s:"be odd number"},{n:"greater",f:O,s:"be greater than {e}"},{n:"less",f:w,s:"be less than {e}"},{n:"between",f:function(n,e,t){if(e<t)return O(n,e)&&n<t;return w(n,e)&&t<n},s:"be between {e} and {e2}"},{n:"greaterOrEqual",f:S,s:"be greater than or equal to {e}"},{n:"lessOrEqual",f:k,s:"be less than or equal to {e}"},{n:"inRange",f:function(n,e,t){if(e<t)return S(n,e)&&n<=t;return k(n,e)&&t<=n},s:"be in the range {e} to {e2}"},{n:"positive",f:function(n){return O(n,0)},s:"be positive number"},{n:"negative",f:function(n){return w(n,0)},s:"be negative number"},{n:"string",f:I,s:"be String"},{n:"emptyString",f:function(n){return""===n},s:"be empty string"},{n:"nonEmptyString",f:N,s:"be non-empty string"},{n:"match",f:function(n,e){return I(n)&&!!n.match(e)},s:"match {e}"},{n:"boolean",f:function(n){return!1===n||!0===n},s:"be Boolean"},{n:"object",f:A,s:"be Object"},{n:"emptyObject",f:function(n){return A(n)&&!q(n,function(){return!0})},s:"be empty object"},{n:"nonEmptyObject",f:function(n){return A(n)&&q(n,function(){return!0})},s:"be non-empty object"},{n:"instanceStrict",f:x,s:"be instanceof {t}"},{n:"instance",f:function(n,e){try{return x(n,e)||n.constructor.name===e.name||a.call(n)==="[object "+e.name+"]"}catch(n){return!1}},s:"be {t}"},{n:"like",f:T,s:"be like {e}"},{n:"array",f:function(n){return b(n)},s:"be Array"},{n:"emptyArray",f:function(n){return b(n)&&0===n.length},s:"be empty array"},{n:"nonEmptyArray",f:function(n){return b(n)&&0<n.length},s:"be non-empty array"},{n:"arrayLike",f:F,s:"be array-like"},{n:"iterable",f:L,s:"be iterable"},{n:"date",f:function(n){return x(n,Date)&&E(n.getTime())},s:"be valid Date"},{n:"function",f:M,s:"be Function"},{n:"hasLength",f:function(n,e){return v(n)&&n.length===e},s:"have length {e}"},{n:"throws",f:function(n){if(!M(n))return!1;try{n()}catch(n){return!0}return!1},s:"throw"}].map(function(n){var e=n.n;i[e]="assert failed: expected {a} to "+n.s,r[e]=n.f}),e={map:function e(r,t){var u;u=b(r)?[]:{};if(M(t))R(r,function(n,e){u[n]=t(e)});else{b(t)||f.object(t);var o=l(r||{});R(t,function(t,n){o.some(function(n,e){return n===t&&(o.splice(e,1),!0)}),M(n)?c.assigned(r)?u[t]=!!n.m:u[t]=n(r[t]):u[t]=e(r[t],n)})}return u},all:function(n){if(b(n))return V(n,!1);return f.object(n),Y(n,!1)},any:function(n){if(b(n))return V(n,!0);return f.object(n),Y(n,!0)}},u=["array","arrayLike","iterable","object"],o=Object.prototype.hasOwnProperty,a=Object.prototype.toString,l=Object.keys,s=Array.prototype.slice,b=Array.isArray,y=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY,m="function"==typeof Symbol,h="function"==typeof Map,g="function"==typeof Set,e=_(e,r),f=J(z,G),c=J(K,C),t=J(function(n){var e=function(){return!!c.assigned(arguments[0])||n.apply(null,arguments)};return e.l=n.length,e.m=!0,e},function(n){return!1===v(n)||n}),f.not=U(z,c,"not "),f.maybe=U(z,t,"maybe "),u.forEach(function(n){r[n].of=Q([H.bind(null,null),r[n],r,{},""])}),W(f,z),W(c,K),u.forEach(function(n){t[n].of=Q([H.bind(null,"maybe"),r[n],r,{},""]),f.maybe[n].of=U(z,t[n].of),f.not[n].of=U(z,c[n].of)}),d=_(e,{assert:f,not:c,maybe:t}),"function"==typeof define&&define.amd?define(function(){return d}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=d:n.check=d}(this); |
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
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
63430
852
991