check-types
Advanced tools
Comparing version 7.1.2 to 7.1.3
{ | ||
"name": "check-types", | ||
"version": "7.1.2", | ||
"version": "7.1.3", | ||
"description": "A little library for asserting types and values.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/philbooth/check-types.js", |
@@ -59,3 +59,3 @@ # check-types.js | ||
20 kb unminified with comments, 5.9 kb minified, 2.6 kb minified + gzipped. | ||
20 kb unminified with comments, 5.9 kb minified, 2.1 kb minified + gzipped. | ||
@@ -62,0 +62,0 @@ ## How do I install it? |
@@ -598,3 +598,3 @@ /*globals define, module, Symbol */ | ||
if (not.assigned(data)) { | ||
result[key] = !!predicate._isMaybefied; | ||
result[key] = !!predicate.m; | ||
} else { | ||
@@ -699,3 +699,3 @@ result[key] = predicate(data[key]); | ||
function assertPredicate (predicate, args, defaultMessage) { | ||
var argCount = predicate.length; | ||
var argCount = predicate.l || predicate.length; | ||
var message = args[argCount]; | ||
@@ -722,5 +722,7 @@ var ErrorType = args[argCount + 1]; | ||
function notModifier (predicate) { | ||
return function () { | ||
var modifiedPredicate = function () { | ||
return notImpl(predicate.apply(null, arguments)); | ||
}; | ||
modifiedPredicate.l = predicate.length; | ||
return modifiedPredicate; | ||
} | ||
@@ -746,2 +748,3 @@ | ||
}; | ||
modifiedPredicate.l = predicate.length; | ||
@@ -752,3 +755,3 @@ // Hackishly indicate that this is a maybe.xxx predicate. | ||
// which would be time-consuming. | ||
modifiedPredicate._isMaybefied = true; | ||
modifiedPredicate.m = true; | ||
@@ -772,3 +775,3 @@ return modifiedPredicate; | ||
function ofModifier (target, type, predicate) { | ||
return function () { | ||
var modifiedPredicate = function () { | ||
var collection, args; | ||
@@ -805,2 +808,4 @@ | ||
}; | ||
modifiedPredicate.l = predicate.length; | ||
return modifiedPredicate; | ||
} | ||
@@ -807,0 +812,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 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 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)&&n.indexOf(t)!==-1}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){return k(n)&&Object.keys(n).length>0}function T(n,t){try{return n instanceof t}catch(n){return!1}}function A(n,t){try{return T(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 L(n){return u(n)&&i(n.length)}function V(n){return"undefined"==typeof Symbol?L(n):u(n)&&M(n[Symbol.iterator])}function Y(n,t){var r,e;if(mn.assigned(n))return!1;try{if("undefined"!=typeof Symbol&&n[Symbol.iterator]&&M(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 q(n,t){return u(n)&&n.length===t}function G(n){try{return A(n,Date)&&c(n.getTime())}catch(n){return!1}}function M(n){return"function"==typeof n}function z(n,t){return dn.array(n),M(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 D(n,t){return dn.object(n),M(t)?R(n,t):(dn.object(t),B(n,t))}function R(n,t){var r={};return Object.keys(n).forEach(function(e){r[e]=t(n[e])}),r}function B(n,t){var r={};return Object.keys(t).forEach(function(e){var u=t[e];M(u)?mn.assigned(n)?r[e]=!!u._isMaybefied:r[e]=u(n[e]):k(u)&&(r[e]=B(n[e],u))}),r}function C(n){return _(n)?H(n,!1):(dn.object(n),J(n,!1))}function H(n,t){var r;for(r=0;r<n.length;r+=1)if(n[r]===t)return t;return!t}function J(n,t){var r,e;for(r in n)if(n.hasOwnProperty(r)){if(e=n[r],k(e)&&J(e,t)===t)return t;if(e===t)return t}return!t}function K(n){return _(n)?H(n,!0):(dn.object(n),J(n,!0))}function Q(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),O(u)?u:r,M(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 L: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){vn.forEach(function(r){n[r].of=on(t,pn[r].of)})}function ln(n){gn[n].of=fn([rn.bind(null,"maybe"),pn[n],pn,null]),dn.maybe[n].of=on(U,gn[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,gn,vn,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={},[{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:Y,s:"v"},{n:"zero",f:f},{n:"infinity",f:o},{n:"number",f:i},{n:"integer",f:c},{n:"even",f:a},{n:"odd",f:l},{n:"greater",f:s},{n:"less",f:y},{n:"between",f:b},{n:"greaterOrEqual",f:p},{n:"lessOrEqual",f:h},{n:"inRange",f:d},{n:"positive",f:m},{n:"negative",f:g},{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:"nonEmptyObject",f:S,s:"o"},{n:"instanceStrict",f:T,s:"t"},{n:"instance",f:A,s:"t"},{n:"like",f:P,s:"t"},{n:"array",f:_,s:"a"},{n:"emptyArray",f:x,s:"a"},{n:"nonEmptyArray",f:F,s:"a"},{n:"arrayLike",f:L,s:"al"},{n:"iterable",f:V,s:"i"},{n:"date",f:G,s:"d"},{n:"function",f:M,s:"f"},{n:"hasLength",f:q,s:"l"}].map(function(n){var t=n.n;bn[t]="Invalid "+yn[n.s||"n"],pn[t]=n.f}),hn={apply:z,map:D,all:C,any:K},vn=["array","arrayLike","iterable","object"],jn=Array.prototype.slice,hn=Q(hn,pn),dn=un(U,X),mn=un(Z,$),gn=un(nn,tn),dn.not=on(U,mn),dn.maybe=on(U,gn),vn.forEach(cn),an(dn,U),an(mn,Z),vn.forEach(ln),sn(Q(hn,{assert:dn,not:mn,maybe:gn}))}(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 m(n,t,r){return t<r?p(n,t)&&h(n,r):h(n,t)&&p(n,r)}function d(n){return s(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)&&n.indexOf(t)!==-1}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){return k(n)&&Object.keys(n).length>0}function T(n,t){try{return n instanceof t}catch(n){return!1}}function A(n,t){try{return T(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 x(n){return Array.isArray(n)}function F(n){return x(n)&&0===n.length}function L(n){return x(n)&&n.length>0}function V(n){return u(n)&&i(n.length)}function Y(n){return"undefined"==typeof Symbol?V(n):u(n)&&z(n[Symbol.iterator])}function _(n,t){var r,e;if(dn.assigned(n))return!1;try{if("undefined"!=typeof Symbol&&n[Symbol.iterator]&&z(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 q(n,t){return u(n)&&n.length===t}function G(n){try{return A(n,Date)&&c(n.getTime())}catch(n){return!1}}function z(n){return"function"==typeof n}function D(n,t){return mn.array(n),z(t)?n.map(function(n){return t(n)}):(mn.array(t),mn.hasLength(n,t.length),n.map(function(n,r){return t[r](n)}))}function R(n,t){return mn.object(n),z(t)?B(n,t):(mn.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];z(u)?dn.assigned(n)?r[e]=!!u.m:r[e]=u(n[e]):k(u)&&(r[e]=C(n[e],u))}),r}function H(n){return x(n)?J(n,!1):(mn.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 M(n){return x(n)?J(n,!0):(mn.object(n),K(n,!0))}function Q(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.l||n.length,u=t[e],f=t[e+1];X(n.apply(null,t),O(u)?u:r,z(f)?f:TypeError)}function X(n,t,r){if(n===!1)throw new r(t||"Assertion failed")}function Z(n){var t=function(){return $(n.apply(null,arguments))};return t.l=n.length,t}function $(n){return!n}function nn(n){var t=function(){return!!dn.assigned(arguments[0])||n.apply(null,arguments)};return t.l=n.length,t.m=!0,t}function tn(n){return u(n)===!1||n}function rn(n,t,r){var e=function(){var e,f;if(e=arguments[0],"maybe"===n&&dn.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};return e.l=r.length,e}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){vn.forEach(function(r){n[r].of=on(t,pn[r].of)})}function ln(n){gn[n].of=fn([rn.bind(null,"maybe"),pn[n],pn,null]),mn.maybe[n].of=on(U,gn[n].of),mn.not[n].of=on(U,dn[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,mn,dn,gn,vn,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={},[{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:_,s:"v"},{n:"zero",f:f},{n:"infinity",f:o},{n:"number",f:i},{n:"integer",f:c},{n:"even",f:a},{n:"odd",f:l},{n:"greater",f:s},{n:"less",f:y},{n:"between",f:b},{n:"greaterOrEqual",f:p},{n:"lessOrEqual",f:h},{n:"inRange",f:m},{n:"positive",f:d},{n:"negative",f:g},{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:"nonEmptyObject",f:S,s:"o"},{n:"instanceStrict",f:T,s:"t"},{n:"instance",f:A,s:"t"},{n:"like",f:P,s:"t"},{n:"array",f:x,s:"a"},{n:"emptyArray",f:F,s:"a"},{n:"nonEmptyArray",f:L,s:"a"},{n:"arrayLike",f:V,s:"al"},{n:"iterable",f:Y,s:"i"},{n:"date",f:G,s:"d"},{n:"function",f:z,s:"f"},{n:"hasLength",f:q,s:"l"}].map(function(n){var t=n.n;bn[t]="Invalid "+yn[n.s||"n"],pn[t]=n.f}),hn={apply:D,map:R,all:H,any:M},vn=["array","arrayLike","iterable","object"],jn=Array.prototype.slice,hn=Q(hn,pn),mn=un(U,X),dn=un(Z,$),gn=un(nn,tn),mn.not=on(U,dn),mn.maybe=on(U,gn),vn.forEach(cn),an(mn,U),an(dn,Z),vn.forEach(ln),sn(Q(hn,{assert:mn,not:dn,maybe:gn}))}(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
756
51613
6