check-types
Advanced tools
Comparing version 5.0.0 to 5.1.0
{ | ||
"name": "check-types", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"main": "src/check-types.min.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
{ | ||
"name": "check-types", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "A tiny library for asserting types and values.", | ||
@@ -5,0 +5,0 @@ "repo": "philbooth/check-types.js", |
# History | ||
## 5.1 | ||
* Fix broken implementation of `maybe.array.of`. | ||
## 5.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "check-types", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "A little library for asserting types and values.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/philbooth/check-types.js", |
@@ -28,2 +28,3 @@ # check-types.js | ||
* [Where can I use it?](#where-can-i-use-it) | ||
* [What changed from 4.x to 5.x?](#what-changed-from-4x-to-5x) | ||
* [What changed from 3.x to 4.x?](#what-changed-from-3x-to-4x) | ||
@@ -642,2 +643,17 @@ * [What changed from 2.x to 3.x?](#what-changed-from-2x-to-3x) | ||
## What changed from 4.x to 5.x? | ||
Breaking changes | ||
were made to the API | ||
in version 5.0.0. | ||
Specifically, | ||
the predicates `isMap` and `error` were removed | ||
in favour of the new predicate `builtIn`, | ||
which can be used to test for | ||
all built-in objects. | ||
See the [history][history5] | ||
for more details. | ||
## What changed from 3.x to 4.x? | ||
@@ -656,2 +672,5 @@ | ||
See the [history][history4] | ||
for more details. | ||
## What changed from 2.x to 3.x? | ||
@@ -740,2 +759,4 @@ | ||
[releases]: https://github.com/philbooth/check-types.js/releases | ||
[history5]: HISTORY.md#50 | ||
[history4]: HISTORY.md#40 | ||
[history3]: HISTORY.md#30 | ||
@@ -742,0 +763,0 @@ [history2]: HISTORY.md#20 |
@@ -772,3 +772,3 @@ /*globals define, module, Symbol */ | ||
var modifiedPredicate = function () { | ||
if (!assigned(arguments[0])) { | ||
if (not.assigned(arguments[0])) { | ||
return true; | ||
@@ -832,2 +832,6 @@ } | ||
if (target === 'maybe' && not.assigned(collection)) { | ||
return true; | ||
} | ||
if (!type(collection)) { | ||
@@ -834,0 +838,0 @@ return false; |
@@ -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 i(n){return 0===n}function a(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY}function o(n){return"number"==typeof n&&isNaN(n)===!1&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY}function c(n){return o(n)&&n%1===0}function f(n){return o(n)&&n%2===0}function l(n){return c(n)&&!f(n)}function d(n,t){return o(n)&&n>t}function s(n,t){return o(n)&&t>n}function y(n,t,r){return r>t?d(n,t)&&s(n,r):s(n,t)&&d(n,r)}function b(n,t){return o(n)&&n>=t}function v(n,t){return o(n)&&t>=n}function m(n,t,r){return r>t?b(n,t)&&v(n,r):v(n,t)&&b(n,r)}function p(n){return d(n,0)}function I(n){return s(n,0)}function g(n){return"string"==typeof n}function h(n){return""===n}function j(n){return g(n)&&""!==n}function O(n,t){return g(n)&&-1!==n.indexOf(t)}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 S(n,t){try{return n instanceof t}catch(r){return!1}}function T(n,t){try{return S(n,t)||Object.prototype.toString.call(n)==="[object "+t.name+"]"}catch(r){return!1}}function A(n,t){try{return S(n,t)||n.constructor.name===t.name}catch(r){return!1}}function q(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])&&q(n[r],t[r])===!1)return!1}return!0}function L(n){return Array.isArray(n)}function P(n){return L(n)&&0===n.length}function _(n){return u(n)&&o(n.length)}function x(n){return"undefined"==typeof Symbol?_(n):u(n)&&D(n[Symbol.iterator])}function F(n,t){var r,e;if(pn.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(u){return!0}return!1}function V(n,t){return u(n)&&n.length===t}function Y(n){return T(n,Date)&&!isNaN(n.getTime())}function D(n){return"function"==typeof n}function z(n,t){return mn.array(n),D(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 G(n,t){return mn.object(n),D(t)?M(n,t):(mn.object(t),R(n,t))}function M(n,t){var r={};return Object.keys(n).forEach(function(e){r[e]=t(n[e])}),r}function R(n,t){var r={};return Object.keys(t).forEach(function(e){var u=t[e];D(u)?pn.assigned(n)?r[e]=!!u._isMaybefied:r[e]=u(n[e]):k(u)&&(r[e]=R(n[e],u))}),r}function B(n){return L(n)?C(n,!1):(mn.object(n),H(n,!1))}function C(n,t){var r;for(r=0;r<n.length;r+=1)if(n[r]===t)return t;return!t}function H(n,t){var r,e;for(r in n)if(n.hasOwnProperty(r)){if(e=n[r],k(e)&&H(e,t)===t)return t;if(e===t)return t}return!t}function J(n){return L(n)?C(n,!0):(mn.object(n),H(n,!0))}function K(n,t){return Object.keys(t).forEach(function(r){n[r]=t[r]}),n}function Q(n,t){return function(){U(n,arguments,t)}}function U(n,t,r){var e=t[t.length-1];W(n.apply(null,t),j(e)?e:r)}function W(n,t){if(n===!1)throw new Error(t||"Assertion failed")}function X(n,t){return function(){function r(n,t){return n[t]=function(){if(e&&!bn[t].apply(null,arguments))throw e},n}var e;try{U(n,arguments,t)}catch(u){e=u}return{or:Object.keys(bn).reduce(r,{})}}}function Z(n){return function(){return $(n.apply(null,arguments))}}function $(n){return!n}function nn(n){var t=function(){return u(arguments[0])?n.apply(null,arguments):!0};return t._isMaybefied=!0,t}function tn(n){return u(n)===!1?!0:n}function rn(n){function t(){return!0}return function(){function r(n,r){return n[r]=e?t:bn[r],n}var e=n.apply(null,arguments);return{or:Object.keys(bn).reduce(r,{})}}}function en(n,t,r){return function(){var e,i;if(e=arguments[0],!t(e))return!1;e=un(t,e),i=jn.call(arguments,1);try{e.forEach(function(t){if(("maybe"!==n||u(t))&&!r.apply(null,[t].concat(i)))throw 0})}catch(a){return!1}return!0}}function un(n,t){switch(n){case _:return jn.call(t);case k:return Object.keys(t).map(function(n){return t[n]});default:return t}}function an(n,t){return on([n,bn,t])}function on(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],yn[r]))})}),u}function cn(n,t){return on([n,t,null])}function fn(n){bn[n].of=on([en.bind(null,null),bn[n],bn,null])}function ln(n,t){hn.forEach(function(r){n[r].of=cn(t,bn[r].of)})}function dn(n){In[n].of=on([en.bind(null,"maybe"),bn[n],bn,null]),mn.maybe[n].of=cn(Q,In[n].of),mn.not[n].of=cn(Q,pn[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,vn,mn,pn,In,gn,hn,jn;yn={equal:"Invalid value",undefined:"Invalid value","null":"Invalid value",assigned:"Invalid value",zero:"Invalid number",infinity:"Invalid number",number:"Invalid number",integer:"Invalid number",even:"Invalid number",odd:"Invalid number",greater:"Invalid number",less:"Invalid number",between:"Invalid number",greaterOrEqual:"Invalid number",lessOrEqual:"Invalid number",inRange:"Invalid number",positive:"Invalid number",negative:"Invalid number",string:"Invalid string",emptyString:"Invalid string",nonEmptyString:"Invalid string",contains:"Invalid string",match:"Invalid string","boolean":"Invalid boolean",object:"Invalid object",emptyObject:"Invalid object",instance:"Invalid type",builtIn:"Invalid type",userDefined:"Invalid type",like:"Invalid type",array:"Invalid array",emptyArray:"Invalid array",arrayLike:"Invalid array-like object",iterable:"Invalid iterable",includes:"Invalid value",hasLength:"Invalid length",date:"Invalid date","function":"Invalid function"},bn={equal:t,undefined:r,"null":e,assigned:u,zero:i,infinity:a,number:o,integer:c,even:f,odd:l,greater:d,less:s,between:y,greaterOrEqual:b,lessOrEqual:v,inRange:m,positive:p,negative:I,string:g,emptyString:h,nonEmptyString:j,contains:O,match:E,"boolean":N,object:k,emptyObject:w,instance:S,builtIn:T,userDefined:A,like:q,array:L,emptyArray:P,arrayLike:_,iterable:x,includes:F,hasLength:V,date:Y,"function":D},vn={apply:z,map:G,all:B,any:J},hn=["array","arrayLike","iterable","object"],jn=Array.prototype.slice,vn=K(vn,bn),mn=an(Q,W),pn=an(Z,$),In=an(nn,tn),gn=an(rn),mn.not=cn(Q,pn),mn.maybe=cn(Q,In),mn.either=cn(X,bn),hn.forEach(fn),ln(mn,Q),ln(pn,Z),hn.forEach(dn),sn(K(vn,{assert:mn,not:pn,maybe:In,either:gn}))}(this); | ||
!function(n){"use strict";function t(n,t){return n===t}function e(n){return void 0===n}function r(n){return null===n}function u(n){return!e(n)&&!r(n)}function i(n){return 0===n}function a(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY}function o(n){return"number"==typeof n&&isNaN(n)===!1&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY}function c(n){return o(n)&&n%1===0}function f(n){return o(n)&&n%2===0}function l(n){return c(n)&&!f(n)}function d(n,t){return o(n)&&n>t}function s(n,t){return o(n)&&t>n}function y(n,t,e){return e>t?d(n,t)&&s(n,e):s(n,t)&&d(n,e)}function b(n,t){return o(n)&&n>=t}function v(n,t){return o(n)&&t>=n}function m(n,t,e){return e>t?b(n,t)&&v(n,e):v(n,t)&&b(n,e)}function p(n){return d(n,0)}function I(n){return s(n,0)}function g(n){return"string"==typeof n}function h(n){return""===n}function j(n){return g(n)&&""!==n}function O(n,t){return g(n)&&-1!==n.indexOf(t)}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 S(n,t){try{return n instanceof t}catch(e){return!1}}function T(n,t){try{return S(n,t)||Object.prototype.toString.call(n)==="[object "+t.name+"]"}catch(e){return!1}}function A(n,t){try{return S(n,t)||n.constructor.name===t.name}catch(e){return!1}}function q(n,t){var e;for(e in t)if(t.hasOwnProperty(e)){if(n.hasOwnProperty(e)===!1||typeof n[e]!=typeof t[e])return!1;if(k(n[e])&&q(n[e],t[e])===!1)return!1}return!0}function L(n){return Array.isArray(n)}function P(n){return L(n)&&0===n.length}function _(n){return u(n)&&o(n.length)}function x(n){return"undefined"==typeof Symbol?_(n):u(n)&&D(n[Symbol.iterator])}function F(n,t){var e,r;if(pn.assigned(n))return!1;try{if("undefined"!=typeof Symbol&&n[Symbol.iterator]&&D(n.values)){e=n.values();do if(r=e.next(),r.value===t)return!0;while(!r.done);return!1}Object.keys(n).forEach(function(e){if(n[e]===t)throw 0})}catch(u){return!0}return!1}function V(n,t){return u(n)&&n.length===t}function Y(n){return T(n,Date)&&!isNaN(n.getTime())}function D(n){return"function"==typeof n}function z(n,t){return mn.array(n),D(t)?n.map(function(n){return t(n)}):(mn.array(t),mn.hasLength(n,t.length),n.map(function(n,e){return t[e](n)}))}function G(n,t){return mn.object(n),D(t)?M(n,t):(mn.object(t),R(n,t))}function M(n,t){var e={};return Object.keys(n).forEach(function(r){e[r]=t(n[r])}),e}function R(n,t){var e={};return Object.keys(t).forEach(function(r){var u=t[r];D(u)?pn.assigned(n)?e[r]=!!u._isMaybefied:e[r]=u(n[r]):k(u)&&(e[r]=R(n[r],u))}),e}function B(n){return L(n)?C(n,!1):(mn.object(n),H(n,!1))}function C(n,t){var e;for(e=0;e<n.length;e+=1)if(n[e]===t)return t;return!t}function H(n,t){var e,r;for(e in n)if(n.hasOwnProperty(e)){if(r=n[e],k(r)&&H(r,t)===t)return t;if(r===t)return t}return!t}function J(n){return L(n)?C(n,!0):(mn.object(n),H(n,!0))}function K(n,t){return Object.keys(t).forEach(function(e){n[e]=t[e]}),n}function Q(n,t){return function(){U(n,arguments,t)}}function U(n,t,e){var r=t[t.length-1];W(n.apply(null,t),j(r)?r:e)}function W(n,t){if(n===!1)throw new Error(t||"Assertion failed")}function X(n,t){return function(){function e(n,t){return n[t]=function(){if(r&&!bn[t].apply(null,arguments))throw r},n}var r;try{U(n,arguments,t)}catch(u){r=u}return{or:Object.keys(bn).reduce(e,{})}}}function Z(n){return function(){return $(n.apply(null,arguments))}}function $(n){return!n}function nn(n){var t=function(){return pn.assigned(arguments[0])?!0:n.apply(null,arguments)};return t._isMaybefied=!0,t}function tn(n){return u(n)===!1?!0:n}function en(n){function t(){return!0}return function(){function e(n,e){return n[e]=r?t:bn[e],n}var r=n.apply(null,arguments);return{or:Object.keys(bn).reduce(e,{})}}}function rn(n,t,e){return function(){var r,i;if(r=arguments[0],"maybe"===n&&pn.assigned(r))return!0;if(!t(r))return!1;r=un(t,r),i=jn.call(arguments,1);try{r.forEach(function(t){if(("maybe"!==n||u(t))&&!e.apply(null,[t].concat(i)))throw 0})}catch(a){return!1}return!0}}function un(n,t){switch(n){case _:return jn.call(t);case k:return Object.keys(t).map(function(n){return t[n]});default:return t}}function an(n,t){return on([n,bn,t])}function on(n){var t,e,r,u;return t=n.shift(),e=n.pop(),r=n.pop(),u=e||{},Object.keys(r).forEach(function(e){Object.defineProperty(u,e,{configurable:!1,enumerable:!0,writable:!1,value:t.apply(null,n.concat(r[e],yn[e]))})}),u}function cn(n,t){return on([n,t,null])}function fn(n){bn[n].of=on([rn.bind(null,null),bn[n],bn,null])}function ln(n,t){hn.forEach(function(e){n[e].of=cn(t,bn[e].of)})}function dn(n){In[n].of=on([rn.bind(null,"maybe"),bn[n],bn,null]),mn.maybe[n].of=cn(Q,In[n].of),mn.not[n].of=cn(Q,pn[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,vn,mn,pn,In,gn,hn,jn;yn={equal:"Invalid value",undefined:"Invalid value","null":"Invalid value",assigned:"Invalid value",zero:"Invalid number",infinity:"Invalid number",number:"Invalid number",integer:"Invalid number",even:"Invalid number",odd:"Invalid number",greater:"Invalid number",less:"Invalid number",between:"Invalid number",greaterOrEqual:"Invalid number",lessOrEqual:"Invalid number",inRange:"Invalid number",positive:"Invalid number",negative:"Invalid number",string:"Invalid string",emptyString:"Invalid string",nonEmptyString:"Invalid string",contains:"Invalid string",match:"Invalid string","boolean":"Invalid boolean",object:"Invalid object",emptyObject:"Invalid object",instance:"Invalid type",builtIn:"Invalid type",userDefined:"Invalid type",like:"Invalid type",array:"Invalid array",emptyArray:"Invalid array",arrayLike:"Invalid array-like object",iterable:"Invalid iterable",includes:"Invalid value",hasLength:"Invalid length",date:"Invalid date","function":"Invalid function"},bn={equal:t,undefined:e,"null":r,assigned:u,zero:i,infinity:a,number:o,integer:c,even:f,odd:l,greater:d,less:s,between:y,greaterOrEqual:b,lessOrEqual:v,inRange:m,positive:p,negative:I,string:g,emptyString:h,nonEmptyString:j,contains:O,match:E,"boolean":N,object:k,emptyObject:w,instance:S,builtIn:T,userDefined:A,like:q,array:L,emptyArray:P,arrayLike:_,iterable:x,includes:F,hasLength:V,date:Y,"function":D},vn={apply:z,map:G,all:B,any:J},hn=["array","arrayLike","iterable","object"],jn=Array.prototype.slice,vn=K(vn,bn),mn=an(Q,W),pn=an(Z,$),In=an(nn,tn),gn=an(en),mn.not=cn(Q,pn),mn.maybe=cn(Q,In),mn.either=cn(X,bn),hn.forEach(fn),ln(mn,Q),ln(pn,Z),hn.forEach(dn),sn(K(vn,{assert:mn,not:pn,maybe:In,either:gn}))}(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
120169
2418
769