check-types
Advanced tools
Comparing version 7.0.1 to 7.1.0
# History | ||
## 7.1 | ||
* Implement `nonEmptyObject`. Thanks to [Victor Bakke][gipphe]. | ||
* Implement `nonEmptyArray`. Thanks to [Victor Bakke][gipphe]. | ||
* Fix error messages on assertions that take a string as their last argument. | ||
* Add support for custom error types in assertions. | ||
* Throw TypeErrors by default. | ||
## 7.0 | ||
@@ -159,2 +166,3 @@ | ||
[ryantemple]: https://github.com/ryantemple | ||
[gipphe]: https://github.com/Gipphe | ||
{ | ||
"name": "check-types", | ||
"version": "7.0.1", | ||
"version": "7.1.0", | ||
"description": "A little library for asserting types and values.", | ||
@@ -33,5 +33,5 @@ "homepage": "https://github.com/philbooth/check-types.js", | ||
"jshint": "2.9.x", | ||
"mocha": "2.5.x", | ||
"mocha": "3.2.x", | ||
"chai": "3.5.x", | ||
"uglify-js": "2.6.x" | ||
"uglify-js": "2.7.x" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
# check-types.js | ||
[![Build status][ci-image]][ci-status] | ||
[![Package status](https://img.shields.io/npm/v/check-types.svg?style=flat-square)](https://www.npmjs.com/package/check-types) | ||
[![Build status](https://img.shields.io/travis/philbooth/check-types.js.svg?style=flat-square)](https://travis-ci.org/philbooth/check-types.js) | ||
[![License](https://img.shields.io/github/license/philbooth/check-types.js.svg?style=flat-square)](https://opensource.org/licenses/MIT) | ||
@@ -28,3 +30,3 @@ A little JavaScript library | ||
* [Where can I use it?](#where-can-i-use-it) | ||
* [What changed from 6.x to 7.x?](#what-changed-from-5x-to-6x) | ||
* [What changed from 6.x to 7.x?](#what-changed-from-6x-to-7x) | ||
* [What changed from 5.x to 6.x?](#what-changed-from-5x-to-6x) | ||
@@ -58,3 +60,3 @@ * [What changed from 4.x to 5.x?](#what-changed-from-4x-to-5x) | ||
20 kb unminified with comments, 5.8 kb minified, 2.1 kb minified + gzipped. | ||
20 kb unminified with comments, 5.5 kb minified, 2 kb minified + gzipped. | ||
@@ -370,2 +372,7 @@ ## How do I install it? | ||
* `check.nonEmptyObject(thing)`: | ||
Returns `true` | ||
if `thing` is a non-empty object, | ||
`false` otherwise. | ||
* `check.instanceStrict(thing, prototype)`: | ||
@@ -402,2 +409,7 @@ Returns `true` | ||
* `check.nonEmptyArray(thing)`: | ||
Returns `true` | ||
if `thing` is a non-empty array, | ||
`false` otherwise. | ||
* `check.arrayLike(thing)`: | ||
@@ -479,14 +491,19 @@ Returns `true` | ||
* `check.assert(value, message)`: | ||
Throws an `Error` | ||
if `value` is `false`, | ||
setting `message` | ||
on the `Error` instance. | ||
* `check.assert(value, message, ErrorType)`: | ||
Throws a `TypeError` | ||
if `value` is `false`. | ||
`message` and `ErrorType` | ||
are optional arguments | ||
that control | ||
the message and type | ||
of the thrown error object. | ||
* `check.assert.xxx(...)`: | ||
Throws an `Error` | ||
Throws a `TypeError` | ||
if the predicate returns false. | ||
The last argument | ||
is an optional message | ||
to be set on the `Error` instance. | ||
The last two arguments | ||
are an optional message and error type | ||
that control | ||
the message and type | ||
of the thrown error object. | ||
Also works with the `not`, `maybe` and `...of` modifiers. | ||
@@ -547,8 +564,8 @@ | ||
```javascript | ||
check.assert.like({ foo: 'bar' }, { baz: 'qux' }, 'Invalid object'); | ||
// Throws new Error('Invalid object') | ||
check.assert.like({ foo: 'bar' }, { baz: 'qux' }); | ||
// Throws `new TypeError('Invalid type')` | ||
``` | ||
```javascript | ||
check.assert.not.like({ foo: 'bar' }, { baz: 'qux' }, 'Invalid object'); | ||
check.assert.not.like({ foo: 'bar' }, { baz: 'qux' }); | ||
// Doesn't throw | ||
@@ -558,3 +575,3 @@ ``` | ||
```javascript | ||
check.assert.maybe.like(undefined, { foo: 'bar' }, 'Invalid object'); | ||
check.assert.maybe.like(undefined, { foo: 'bar' }); | ||
// Doesn't throw | ||
@@ -564,4 +581,4 @@ ``` | ||
```javascript | ||
check.assert(myFunction(), 'Something went wrong'); | ||
// Throws if myFunction returns `false` | ||
check.assert(myFunction(), 'Something went wrong', CustomError); | ||
// Throws `new CustomError('Something went wrong')` if myFunction returns `false` | ||
``` | ||
@@ -769,6 +786,4 @@ | ||
[ci-image]: https://secure.travis-ci.org/philbooth/check-types.js.png?branch=master | ||
[ci-status]: http://travis-ci.org/#!/philbooth/check-types.js | ||
[releases]: https://github.com/philbooth/check-types.js/releases | ||
[history6]: HISTORY.md#70 | ||
[history7]: HISTORY.md#70 | ||
[history6]: HISTORY.md#60 | ||
@@ -775,0 +790,0 @@ [history5]: HISTORY.md#50 |
@@ -28,42 +28,45 @@ /*globals define, module, Symbol */ | ||
[ | ||
{ n: 'equal', f: equal, s: 'v' }, | ||
{ f: equal, s: 'v' }, | ||
{ n: 'undefined', f: isUndefined, s: 'v' }, | ||
{ n: 'null', f: isNull, s: 'v' }, | ||
{ n: 'assigned', f: assigned, s: 'v' }, | ||
{ n: 'includes', f: includes, s: 'v' }, | ||
{ n: 'zero', f: zero, s: 'n' }, | ||
{ n: 'infinity', f: infinity, s: 'n' }, | ||
{ n: 'number', f: number, s: 'n' }, | ||
{ n: 'integer', f: integer, s: 'n' }, | ||
{ n: 'even', f: even, s: 'n' }, | ||
{ n: 'odd', f: odd, s: 'n' }, | ||
{ n: 'greater', f: greater, s: 'n' }, | ||
{ n: 'less', f: less, s: 'n' }, | ||
{ n: 'between', f: between, s: 'n' }, | ||
{ n: 'greaterOrEqual', f: greaterOrEqual, s: 'n' }, | ||
{ n: 'lessOrEqual', f: lessOrEqual, s: 'n' }, | ||
{ n: 'inRange', f: inRange, s: 'n' }, | ||
{ n: 'positive', f: positive, s: 'n' }, | ||
{ n: 'negative', f: negative, s: 'n' }, | ||
{ n: 'string', f: string, s: 's' }, | ||
{ n: 'emptyString', f: emptyString, s: 's' }, | ||
{ n: 'nonEmptyString', f: nonEmptyString, s: 's' }, | ||
{ n: 'contains', f: contains, s: 's' }, | ||
{ n: 'match', f: match, s: 's' }, | ||
{ n: 'boolean', f: boolean, s: 'b' }, | ||
{ n: 'object', f: object, s: 'o' }, | ||
{ n: 'emptyObject', f: emptyObject, s: 'o' }, | ||
{ n: 'instanceStrict', f: instanceStrict, s: 't' }, | ||
{ n: 'instance', f: instance, s: 't' }, | ||
{ n: 'like', f: like, s: 't' }, | ||
{ n: 'array', f: array, s: 'a' }, | ||
{ n: 'emptyArray', f: emptyArray, s: 'a' }, | ||
{ n: 'arrayLike', f: arrayLike, s: 'al' }, | ||
{ n: 'iterable', f: iterable, s: 'i' }, | ||
{ n: 'date', f: date, s: 'd' }, | ||
{ f: assigned, s: 'v' }, | ||
{ f: includes, s: 'v' }, | ||
{ f: zero }, | ||
{ f: infinity }, | ||
{ f: number }, | ||
{ f: integer }, | ||
{ f: even }, | ||
{ f: odd }, | ||
{ f: greater }, | ||
{ f: less }, | ||
{ f: between }, | ||
{ f: greaterOrEqual }, | ||
{ f: lessOrEqual }, | ||
{ f: inRange }, | ||
{ f: positive }, | ||
{ f: negative }, | ||
{ f: string, s: 's' }, | ||
{ f: emptyString, s: 's' }, | ||
{ f: nonEmptyString, s: 's' }, | ||
{ f: contains, s: 's' }, | ||
{ f: match, s: 's' }, | ||
{ f: boolean, s: 'b' }, | ||
{ f: object, s: 'o' }, | ||
{ f: emptyObject, s: 'o' }, | ||
{ f: nonEmptyObject, s: 'o' }, | ||
{ f: instanceStrict, s: 't' }, | ||
{ f: instance, s: 't' }, | ||
{ f: like, s: 't' }, | ||
{ f: array, s: 'a' }, | ||
{ f: emptyArray, s: 'a' }, | ||
{ f: nonEmptyArray, s: 'a' }, | ||
{ f: arrayLike, s: 'al' }, | ||
{ f: iterable, s: 'i' }, | ||
{ f: date, s: 'd' }, | ||
{ n: 'function', f: isFunction, s: 'f' }, | ||
{ n: 'hasLength', f: hasLength, s: 'l' }, | ||
{ f: hasLength, s: 'l' }, | ||
].map(function (data) { | ||
messages[data.n] = 'Invalid ' + strings[data.s]; | ||
predicates[data.n] = data.f; | ||
var n = data.n || data.f.name; | ||
messages[n] = 'Invalid ' + strings[data.s || 'n']; | ||
predicates[n] = data.f; | ||
}); | ||
@@ -349,2 +352,11 @@ | ||
/** | ||
* Public function `nonEmptyObject`. | ||
* | ||
* Returns true if `data` is a non-empty object, false otherwise. | ||
*/ | ||
function nonEmptyObject (data) { | ||
return object(data) && Object.keys(data).length > 0; | ||
} | ||
/** | ||
* Public function `instanceStrict`. | ||
@@ -422,2 +434,11 @@ * | ||
/** | ||
* Public function `nonEmptyArray`. | ||
* | ||
* Returns true if `data` is a non-empty array, false otherwise. | ||
*/ | ||
function nonEmptyArray (data) { | ||
return array(data) && data.length > 0; | ||
} | ||
/** | ||
* Public function `arrayLike`. | ||
@@ -680,9 +701,15 @@ * | ||
function assertPredicate (predicate, args, defaultMessage) { | ||
var message = args[args.length - 1]; | ||
assertImpl(predicate.apply(null, args), nonEmptyString(message) ? message : defaultMessage); | ||
var argCount = predicate.length; | ||
var message = args[argCount]; | ||
var ErrorType = args[argCount + 1]; | ||
assertImpl( | ||
predicate.apply(null, args), | ||
nonEmptyString(message) ? message : defaultMessage, | ||
isFunction(ErrorType) ? ErrorType : TypeError | ||
); | ||
} | ||
function assertImpl (value, message) { | ||
function assertImpl (value, message, ErrorType) { | ||
if (value === false) { | ||
throw new Error(message || 'Assertion failed'); | ||
throw new ErrorType(message || 'Assertion failed'); | ||
} | ||
@@ -689,0 +716,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(n){"use strict";function t(n,t){return n===t}function r(n){return void 0===n}function e(n){return null===n}function u(n){return!r(n)&&!e(n)}function f(n){return 0===n}function o(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY}function i(n){return"number"==typeof n&&isNaN(n)===!1&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY}function c(n){return i(n)&&n%1===0}function a(n){return i(n)&&n%2===0}function s(n){return c(n)&&!a(n)}function l(n,t){return i(n)&&n>t}function y(n,t){return i(n)&&t>n}function b(n,t,r){return r>t?l(n,t)&&y(n,r):y(n,t)&&l(n,r)}function p(n,t){return i(n)&&n>=t}function d(n,t){return i(n)&&t>=n}function h(n,t,r){return r>t?p(n,t)&&d(n,r):d(n,t)&&p(n,r)}function m(n){return l(n,0)}function g(n){return y(n,0)}function v(n){return"string"==typeof n}function j(n){return""===n}function O(n){return v(n)&&""!==n}function E(n,t){return v(n)&&-1!==n.indexOf(t)}function I(n,t){return v(n)&&!!n.match(t)}function N(n){return n===!1||n===!0}function k(n){return"[object Object]"===Object.prototype.toString.call(n)}function w(n){return k(n)&&0===Object.keys(n).length}function S(n,t){try{return n instanceof t}catch(r){return!1}}function T(n,t){try{return S(n,t)||n.constructor.name===t.name||Object.prototype.toString.call(n)==="[object "+t.name+"]"}catch(r){return!1}}function A(n,t){var r;for(r in t)if(t.hasOwnProperty(r)){if(n.hasOwnProperty(r)===!1||typeof n[r]!=typeof t[r])return!1;if(k(n[r])&&A(n[r],t[r])===!1)return!1}return!0}function P(n){return Array.isArray(n)}function _(n){return P(n)&&0===n.length}function x(n){return u(n)&&i(n.length)}function F(n){return"undefined"==typeof Symbol?x(n):u(n)&&q(n[Symbol.iterator])}function L(n,t){var r,e;if(dn.assigned(n))return!1;try{if("undefined"!=typeof Symbol&&n[Symbol.iterator]&&q(n.values)){r=n.values();do if(e=r.next(),e.value===t)return!0;while(!e.done);return!1}Object.keys(n).forEach(function(r){if(n[r]===t)throw 0})}catch(u){return!0}return!1}function V(n,t){return u(n)&&n.length===t}function Y(n){try{return T(n,Date)&&c(n.getTime())}catch(t){return!1}}function q(n){return"function"==typeof n}function G(n,t){return pn.array(n),q(t)?n.map(function(n){return t(n)}):(pn.array(t),pn.hasLength(n,t.length),n.map(function(n,r){return t[r](n)}))}function M(n,t){return pn.object(n),q(t)?z(n,t):(pn.object(t),D(n,t))}function z(n,t){var r={};return Object.keys(n).forEach(function(e){r[e]=t(n[e])}),r}function D(n,t){var r={};return Object.keys(t).forEach(function(e){var u=t[e];q(u)?dn.assigned(n)?r[e]=!!u._isMaybefied:r[e]=u(n[e]):k(u)&&(r[e]=D(n[e],u))}),r}function R(n){return P(n)?B(n,!1):(pn.object(n),C(n,!1))}function B(n,t){var r;for(r=0;r<n.length;r+=1)if(n[r]===t)return t;return!t}function C(n,t){var r,e;for(r in n)if(n.hasOwnProperty(r)){if(e=n[r],k(e)&&C(e,t)===t)return t;if(e===t)return t}return!t}function H(n){return P(n)?B(n,!0):(pn.object(n),C(n,!0))}function J(n,t){return Object.keys(t).forEach(function(r){n[r]=t[r]}),n}function K(n,t){return function(){Q(n,arguments,t)}}function Q(n,t,r){var e=t[t.length-1];U(n.apply(null,t),O(e)?e:r)}function U(n,t){if(n===!1)throw new Error(t||"Assertion failed")}function W(n){return function(){return X(n.apply(null,arguments))}}function X(n){return!n}function Z(n){var t=function(){return dn.assigned(arguments[0])?!0:n.apply(null,arguments)};return t._isMaybefied=!0,t}function $(n){return u(n)===!1?!0:n}function nn(n,t,r){return function(){var e,f;if(e=arguments[0],"maybe"===n&&dn.assigned(e))return!0;if(!t(e))return!1;e=tn(t,e),f=gn.call(arguments,1);try{e.forEach(function(t){if(("maybe"!==n||u(t))&&!r.apply(null,[t].concat(f)))throw 0})}catch(o){return!1}return!0}}function tn(n,t){switch(n){case x:return gn.call(t);case k:return Object.keys(t).map(function(n){return t[n]});default:return t}}function rn(n,t){return en([n,yn,t])}function en(n){var t,r,e,u;return t=n.shift(),r=n.pop(),e=n.pop(),u=r||{},Object.keys(e).forEach(function(r){Object.defineProperty(u,r,{configurable:!1,enumerable:!0,writable:!1,value:t.apply(null,n.concat(e[r],ln[r]))})}),u}function un(n,t){return en([n,t,null])}function fn(n){yn[n].of=en([nn.bind(null,null),yn[n],yn,null])}function on(n,t){mn.forEach(function(r){n[r].of=un(t,yn[r].of)})}function cn(n){hn[n].of=en([nn.bind(null,"maybe"),yn[n],yn,null]),pn.maybe[n].of=un(K,hn[n].of),pn.not[n].of=un(K,dn[n].of)}function an(t){"function"==typeof define&&define.amd?define(function(){return t}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=t:n.check=t}var sn,ln,yn,bn,pn,dn,hn,mn,gn;sn={v:"value",n:"number",s:"string",b:"boolean",o:"object",t:"type",a:"array",al:"array-like",i:"iterable",d:"date",f:"function",l:"length"},ln={},yn={},[{n:"equal",f:t,s:"v"},{n:"undefined",f:r,s:"v"},{n:"null",f:e,s:"v"},{n:"assigned",f:u,s:"v"},{n:"includes",f:L,s:"v"},{n:"zero",f:f,s:"n"},{n:"infinity",f:o,s:"n"},{n:"number",f:i,s:"n"},{n:"integer",f:c,s:"n"},{n:"even",f:a,s:"n"},{n:"odd",f:s,s:"n"},{n:"greater",f:l,s:"n"},{n:"less",f:y,s:"n"},{n:"between",f:b,s:"n"},{n:"greaterOrEqual",f:p,s:"n"},{n:"lessOrEqual",f:d,s:"n"},{n:"inRange",f:h,s:"n"},{n:"positive",f:m,s:"n"},{n:"negative",f:g,s:"n"},{n:"string",f:v,s:"s"},{n:"emptyString",f:j,s:"s"},{n:"nonEmptyString",f:O,s:"s"},{n:"contains",f:E,s:"s"},{n:"match",f:I,s:"s"},{n:"boolean",f:N,s:"b"},{n:"object",f:k,s:"o"},{n:"emptyObject",f:w,s:"o"},{n:"instanceStrict",f:S,s:"t"},{n:"instance",f:T,s:"t"},{n:"like",f:A,s:"t"},{n:"array",f:P,s:"a"},{n:"emptyArray",f:_,s:"a"},{n:"arrayLike",f:x,s:"al"},{n:"iterable",f:F,s:"i"},{n:"date",f:Y,s:"d"},{n:"function",f:q,s:"f"},{n:"hasLength",f:V,s:"l"}].map(function(n){ln[n.n]="Invalid "+sn[n.s],yn[n.n]=n.f}),bn={apply:G,map:M,all:R,any:H},mn=["array","arrayLike","iterable","object"],gn=Array.prototype.slice,bn=J(bn,yn),pn=rn(K,U),dn=rn(W,X),hn=rn(Z,$),pn.not=un(K,dn),pn.maybe=un(K,hn),mn.forEach(fn),on(pn,K),on(dn,W),mn.forEach(cn),an(J(bn,{assert:pn,not:dn,maybe:hn}))}(this); | ||
!function(n){"use strict";function t(n,t){return n===t}function r(n){return void 0===n}function e(n){return null===n}function u(n){return!r(n)&&!e(n)}function f(n){return 0===n}function o(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY}function i(n){return"number"==typeof n&&isNaN(n)===!1&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY}function c(n){return i(n)&&n%1===0}function a(n){return i(n)&&n%2===0}function l(n){return c(n)&&!a(n)}function s(n,t){return i(n)&&n>t}function y(n,t){return i(n)&&n<t}function b(n,t,r){return t<r?s(n,t)&&y(n,r):y(n,t)&&s(n,r)}function p(n,t){return i(n)&&n>=t}function h(n,t){return i(n)&&n<=t}function d(n,t,r){return t<r?p(n,t)&&h(n,r):h(n,t)&&p(n,r)}function m(n){return s(n,0)}function v(n){return y(n,0)}function g(n){return"string"==typeof n}function j(n){return""===n}function I(n){return g(n)&&""!==n}function O(n,t){return g(n)&&n.indexOf(t)!==-1}function E(n,t){return g(n)&&!!n.match(t)}function N(n){return n===!1||n===!0}function k(n){return"[object Object]"===Object.prototype.toString.call(n)}function w(n){return k(n)&&0===Object.keys(n).length}function T(n){return k(n)&&Object.keys(n).length>0}function S(n,t){try{return n instanceof t}catch(n){return!1}}function A(n,t){try{return S(n,t)||n.constructor.name===t.name||Object.prototype.toString.call(n)==="[object "+t.name+"]"}catch(n){return!1}}function P(n,t){var r;for(r in t)if(t.hasOwnProperty(r)){if(n.hasOwnProperty(r)===!1||typeof n[r]!=typeof t[r])return!1;if(k(n[r])&&P(n[r],t[r])===!1)return!1}return!0}function _(n){return Array.isArray(n)}function x(n){return _(n)&&0===n.length}function F(n){return _(n)&&n.length>0}function V(n){return u(n)&&i(n.length)}function Y(n){return"undefined"==typeof Symbol?V(n):u(n)&&D(n[Symbol.iterator])}function G(n,t){var r,e;if(mn.assigned(n))return!1;try{if("undefined"!=typeof Symbol&&n[Symbol.iterator]&&D(n.values)){r=n.values();do if(e=r.next(),e.value===t)return!0;while(!e.done);return!1}Object.keys(n).forEach(function(r){if(n[r]===t)throw 0})}catch(n){return!0}return!1}function L(n,t){return u(n)&&n.length===t}function M(n){try{return A(n,Date)&&c(n.getTime())}catch(n){return!1}}function D(n){return"function"==typeof n}function q(n,t){return dn.array(n),D(t)?n.map(function(n){return t(n)}):(dn.array(t),dn.hasLength(n,t.length),n.map(function(n,r){return t[r](n)}))}function z(n,t){return dn.object(n),D(t)?B(n,t):(dn.object(t),C(n,t))}function B(n,t){var r={};return Object.keys(n).forEach(function(e){r[e]=t(n[e])}),r}function C(n,t){var r={};return Object.keys(t).forEach(function(e){var u=t[e];D(u)?mn.assigned(n)?r[e]=!!u._isMaybefied:r[e]=u(n[e]):k(u)&&(r[e]=C(n[e],u))}),r}function H(n){return _(n)?J(n,!1):(dn.object(n),K(n,!1))}function J(n,t){var r;for(r=0;r<n.length;r+=1)if(n[r]===t)return t;return!t}function K(n,t){var r,e;for(r in n)if(n.hasOwnProperty(r)){if(e=n[r],k(e)&&K(e,t)===t)return t;if(e===t)return t}return!t}function Q(n){return _(n)?J(n,!0):(dn.object(n),K(n,!0))}function R(n,t){return Object.keys(t).forEach(function(r){n[r]=t[r]}),n}function U(n,t){return function(){W(n,arguments,t)}}function W(n,t,r){var e=n.length,u=t[e],f=t[e+1];X(n.apply(null,t),I(u)?u:r,D(f)?f:TypeError)}function X(n,t,r){if(n===!1)throw new r(t||"Assertion failed")}function Z(n){return function(){return $(n.apply(null,arguments))}}function $(n){return!n}function nn(n){var t=function(){return!!mn.assigned(arguments[0])||n.apply(null,arguments)};return t._isMaybefied=!0,t}function tn(n){return u(n)===!1||n}function rn(n,t,r){return function(){var e,f;if(e=arguments[0],"maybe"===n&&mn.assigned(e))return!0;if(!t(e))return!1;e=en(t,e),f=jn.call(arguments,1);try{e.forEach(function(t){if(("maybe"!==n||u(t))&&!r.apply(null,[t].concat(f)))throw 0})}catch(n){return!1}return!0}}function en(n,t){switch(n){case V:return jn.call(t);case k:return Object.keys(t).map(function(n){return t[n]});default:return t}}function un(n,t){return fn([n,pn,t])}function fn(n){var t,r,e,u;return t=n.shift(),r=n.pop(),e=n.pop(),u=r||{},Object.keys(e).forEach(function(r){Object.defineProperty(u,r,{configurable:!1,enumerable:!0,writable:!1,value:t.apply(null,n.concat(e[r],bn[r]))})}),u}function on(n,t){return fn([n,t,null])}function cn(n){pn[n].of=fn([rn.bind(null,null),pn[n],pn,null])}function an(n,t){gn.forEach(function(r){n[r].of=on(t,pn[r].of)})}function ln(n){vn[n].of=fn([rn.bind(null,"maybe"),pn[n],pn,null]),dn.maybe[n].of=on(U,vn[n].of),dn.not[n].of=on(U,mn[n].of)}function sn(t){"function"==typeof define&&define.amd?define(function(){return t}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=t:n.check=t}var yn,bn,pn,hn,dn,mn,vn,gn,jn;yn={v:"value",n:"number",s:"string",b:"boolean",o:"object",t:"type",a:"array",al:"array-like",i:"iterable",d:"date",f:"function",l:"length"},bn={},pn={},[{f:t,s:"v"},{n:"undefined",f:r,s:"v"},{n:"null",f:e,s:"v"},{f:u,s:"v"},{f:G,s:"v"},{f:f},{f:o},{f:i},{f:c},{f:a},{f:l},{f:s},{f:y},{f:b},{f:p},{f:h},{f:d},{f:m},{f:v},{f:g,s:"s"},{f:j,s:"s"},{f:I,s:"s"},{f:O,s:"s"},{f:E,s:"s"},{f:N,s:"b"},{f:k,s:"o"},{f:w,s:"o"},{f:T,s:"o"},{f:S,s:"t"},{f:A,s:"t"},{f:P,s:"t"},{f:_,s:"a"},{f:x,s:"a"},{f:F,s:"a"},{f:V,s:"al"},{f:Y,s:"i"},{f:M,s:"d"},{n:"function",f:D,s:"f"},{f:L,s:"l"}].map(function(n){var t=n.n||n.f.name;bn[t]="Invalid "+yn[n.s||"n"],pn[t]=n.f}),hn={apply:q,map:z,all:H,any:Q},gn=["array","arrayLike","iterable","object"],jn=Array.prototype.slice,hn=R(hn,pn),dn=un(U,X),mn=un(Z,$),vn=un(nn,tn),dn.not=on(U,mn),dn.maybe=on(U,vn),gn.forEach(cn),an(dn,U),an(mn,Z),gn.forEach(ln),sn(R(hn,{assert:dn,not:mn,maybe:vn}))}(this); |
Sorry, the diff of this file is not supported yet
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
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
50377
751
794
0