check-more-types
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -713,11 +713,3 @@ (function checkMoreTypes() { | ||
function equal(a, b) { | ||
if (arguments.length === 2) { | ||
return a === b; | ||
} else if (arguments.length === 1) { | ||
return function equalTo(b) { | ||
return a === b; | ||
}; | ||
} else { | ||
throw new Error('Expected at least 1 or 2 arguments to check.equal'); | ||
} | ||
return a === b; | ||
} | ||
@@ -761,6 +753,6 @@ | ||
badItems: badItems, | ||
oneOf: oneOf, | ||
oneOf: curry2(oneOf), | ||
promise: isPromise, | ||
validDate: validDate, | ||
equal: equal, | ||
equal: curry2(equal), | ||
or: or, | ||
@@ -767,0 +759,0 @@ and: and, |
@@ -5,2 +5,2 @@ /*! check-more-types - v0.0.0 | ||
!function(){"use strict";function a(a){return function(b){if(arguments.length>2)throw new Error("Curry2 function "+a.name+" called with too many arguments "+arguments.length);return 2===arguments.length?a(arguments[0],arguments[1]):function(c){return a(b,c)}}}function b(a){return"function"==typeof a}function c(a){return"string"==typeof a}function d(a){return c(a)&&a}function e(a){return"object"==typeof a&&!Array.isArray(a)&&!j(a)&&!m(a)}function f(a){return e(a)&&0===Object.keys(a).length}function g(a){return"number"==typeof a&&!isNaN(a)&&a!==1/0&&a!==-(1/0)}function h(a){return g(a)&&a%1===0}function i(a){return g(a)&&a%1!==0}function j(a){return null===a}function k(a){return g(a)&&a>0}function l(a){return g(a)&&0>a}function m(a){return a instanceof Date}function n(a,b){return a instanceof b}function o(a,b){return(Array.isArray(a)||c(a))&&a.length===b}function p(a,b){return c(a)&&c(b)&&0===b.indexOf(a)}function q(a,b){return typeof b===a}function r(a){return c(a)&&(ba(a)||ca(a))}function s(a){var b,c;for(b in a)if(a.hasOwnProperty(b)){if(c=a[b],e(c)&&s(c)===!1)return!1;if(c===!1)return!1}return!0}function t(a,c){var d,f,g={};for(d in c)c.hasOwnProperty(d)&&(f=c[d],b(f)?g[d]=f(a[d]):e(f)&&(g[d]=t(a[d],f)));return g}function u(a){return"undefined"!=typeof a}function v(a){return da.date(a)&&da.number(Number(a))}function w(a){return da.unemptyString(a)&&/^\d+\.\d+\.\d+$/.test(a)}function x(a){var b=typeof a;return"number"===b||"boolean"===b||"string"===b}function y(a){return"number"==typeof a&&0===a}function z(a,b){return a===b}function A(a,b){return u(a)&&H(a,"length")&&b>=0&&b<a.length}function B(a,b){return typeof a==typeof b&&a&&b&&a.length===b.length}function C(a){if(!da.array(a))return!1;if(!a.length)return!0;var b=a[0];return a.every(function(a){return a===b})}function D(a,b){return da.verify.array(a,"expected an array"),-1!==a.indexOf(b)}function E(a){return da.unemptyString(a)&&/^git@/.test(a)}function F(a){return 0===a||1===a}function G(a){return"boolean"==typeof a}function H(a,b){if(2!==arguments.length)throw new Error("Expected two arguments to check.has, got only "+arguments.length);return Boolean(a&&b&&"string"==typeof b&&"undefined"!=typeof a[b])}function I(a){return da.string(a)&&a.toLowerCase()===a}function J(a){return da.array(a)&&a.length>0}function K(a,b){return da.array(b)&&b.every(a)}function L(a,b){return da.verify.array(b,"expected array to find bad items"),b.filter($(a))}function M(a,b){var c=da.array(a)&&a.every(da.string);return c&&da.bool(b)&&b?a.every(da.lowerCase):c}function N(a,b){return da.array(a)&&a.every(function(a){return da.arrayOfStrings(a,b)})}function O(a,b){return da.verify.fn(da.every,"missing check.every method"),da.verify.fn(da.map,"missing check.map method"),da.verify.object(a,"missing object to check"),da.verify.object(b,"missing predicates object"),Object.keys(b).forEach(function(a){if(!da.fn(b[a]))throw new Error("not a predicate function for "+a+" but "+b[a])}),da.every(da.map(a,b))}function P(a,b){return O(b,a)}function Q(a,b){da.verify.fn(a,"expected function that raises");try{a()}catch(c){return"undefined"==typeof b?!0:"function"==typeof b?b(c):!1}return!1}function R(a){return""===a}function S(a){var b="string"==typeof a||Array.isArray(a);return b?!a.length:a instanceof Object?!Object.keys(a).length:!1}function T(a){var b="string"==typeof a||Array.isArray(a);return b?a.length:a instanceof Object?Object.keys(a).length:!0}function U(a){return da.number(a)&&a>=0&&1>=a}function V(a){return da.string(a)&&ea.test(a)}function W(a){return da.string(a)&&40===a.length&&fa.test(a)}function X(a){return da.string(a)&&7===a.length&&ga.test(a)}function Y(){var a=Array.prototype.slice.call(arguments,0);if(!a.length)throw new Error("empty list of arguments to or");return function(){var b=Array.prototype.slice.call(arguments,0);return a.some(function(a){try{return da.fn(a)?a.apply(null,b):Boolean(a)}catch(c){return!1}})}}function Z(){var a=Array.prototype.slice.call(arguments,0);if(!a.length)throw new Error("empty list of arguments to or");return function(){var b=Array.prototype.slice.call(arguments,0);return a.every(function(a){return da.fn(a)?a.apply(null,b):Boolean(a)})}}function $(a){return function(){return!a.apply(null,arguments)}}function _(a){return da.object(a)&&ja(a)}function aa(a,b){if(2===arguments.length)return a===b;if(1===arguments.length)return function(b){return a===b};throw new Error("Expected at least 1 or 2 arguments to check.equal")}if("function"!=typeof Function.prototype.bind)throw new Error("Missing Function.prototype.bind, please load es5-shim first");var ba=p.bind(null,"http://"),ca=p.bind(null,"https://"),da={maybe:{},verify:{},not:{},every:s,map:t},ea=/^#(?:[0-9a-fA-F]{3}){1,2}$/,fa=/^[0-9a-f]{40}$/,ga=/^[0-9a-f]{7}$/;if(!da.defend){var ha=function(a,b,c){da.verify.fn(a,"expected a function"),da.verify.array(b,"expected list of predicates"),da.verify.defined(c,"missing args");var d=0,e=0,f=b.length;for(d=0;f>d;d+=1){var g=b[d];if(da.fn(g)){if(!g.call(null,c[e])){var h="Argument "+(e+1)+": "+c[e]+" does not pass predicate";throw da.unemptyString(b[d+1])&&(h+=": "+b[d+1]),new Error(h)}e+=1}}return a.apply(null,c)};da.defend=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return ha(a,b,arguments)}}}da.mixin||(da.mixin=function(a,f){function g(a,c,f){if(!e(a))throw new Error("missing object "+a);if(!d(c))throw new Error("missing name");if(!b(f))throw new Error("missing function");a[c]||(a[c]=f)}function h(a){return function(){return!da.defined(arguments[0])||da.nulled(arguments[0])?!0:a.apply(null,arguments)}}function i(a,b){return function(){var c;if(a.apply(null,arguments)===!1)throw c=arguments[arguments.length-1],new Error(da.unemptyString(c)?c:b)}}if(c(a)&&b(f)){var j=a;a=f,f=j}if(!b(a))throw new Error("expected predicate function");if(d(f)||(f=a.name),!d(f))throw new Error("predicate function missing name\n"+a.toString());g(da,f,a),g(da.maybe,f,h(a)),g(da.not,f,$(a)),g(da.verify,f,i(a,f+" failed"))}),da.then||(da.then=function(a,b){return function(){var c="function"==typeof a?a.apply(null,arguments):a;return c?b.apply(null,arguments):void 0}});var ia={then:b};ia["catch"]=b,ia["finally"]=b;var ja=P.bind(null,ia),ka={nulled:j,fn:b,string:c,unemptyString:d,object:e,number:g,array:Array.isArray,positiveNumber:k,negativeNumber:l,defined:u,same:z,allSame:C,bit:F,bool:G,has:H,lowerCase:I,unemptyArray:J,arrayOfStrings:M,arrayOfArraysOfStrings:N,all:O,schema:P,raises:Q,empty:S,emptyString:R,unempty:T,unit:U,hexRgb:V,sameLength:B,commitId:W,shortCommitId:X,index:A,git:E,arrayOf:K,badItems:L,oneOf:D,promise:_,validDate:v,equal:aa,or:Y,and:Z,primitive:x,zero:y,date:m,instance:n,emptyObject:f,length:o,floatNumber:i,intNumber:h,startsWith:p,webUrl:r,semver:w,type:a(q)};Object.keys(ka).forEach(function(a){da.mixin(ka[a],a)}),"object"==typeof module&&(module.exports=da),"object"==typeof window&&(window.check=da),"object"==typeof global&&(global.check=da)}(); | ||
!function(){"use strict";function a(a){return function(b){if(arguments.length>2)throw new Error("Curry2 function "+a.name+" called with too many arguments "+arguments.length);return 2===arguments.length?a(arguments[0],arguments[1]):function(c){return a(b,c)}}}function b(a){return"function"==typeof a}function c(a){return"string"==typeof a}function d(a){return c(a)&&a}function e(a){return"object"==typeof a&&!Array.isArray(a)&&!j(a)&&!m(a)}function f(a){return e(a)&&0===Object.keys(a).length}function g(a){return"number"==typeof a&&!isNaN(a)&&a!==1/0&&a!==-(1/0)}function h(a){return g(a)&&a%1===0}function i(a){return g(a)&&a%1!==0}function j(a){return null===a}function k(a){return g(a)&&a>0}function l(a){return g(a)&&0>a}function m(a){return a instanceof Date}function n(a,b){return a instanceof b}function o(a,b){return(Array.isArray(a)||c(a))&&a.length===b}function p(a,b){return c(a)&&c(b)&&0===b.indexOf(a)}function q(a,b){return typeof b===a}function r(a){return c(a)&&(ba(a)||ca(a))}function s(a){var b,c;for(b in a)if(a.hasOwnProperty(b)){if(c=a[b],e(c)&&s(c)===!1)return!1;if(c===!1)return!1}return!0}function t(a,c){var d,f,g={};for(d in c)c.hasOwnProperty(d)&&(f=c[d],b(f)?g[d]=f(a[d]):e(f)&&(g[d]=t(a[d],f)));return g}function u(a){return"undefined"!=typeof a}function v(a){return da.date(a)&&da.number(Number(a))}function w(a){return da.unemptyString(a)&&/^\d+\.\d+\.\d+$/.test(a)}function x(a){var b=typeof a;return"number"===b||"boolean"===b||"string"===b}function y(a){return"number"==typeof a&&0===a}function z(a,b){return a===b}function A(a,b){return u(a)&&H(a,"length")&&b>=0&&b<a.length}function B(a,b){return typeof a==typeof b&&a&&b&&a.length===b.length}function C(a){if(!da.array(a))return!1;if(!a.length)return!0;var b=a[0];return a.every(function(a){return a===b})}function D(a,b){return da.verify.array(a,"expected an array"),-1!==a.indexOf(b)}function E(a){return da.unemptyString(a)&&/^git@/.test(a)}function F(a){return 0===a||1===a}function G(a){return"boolean"==typeof a}function H(a,b){if(2!==arguments.length)throw new Error("Expected two arguments to check.has, got only "+arguments.length);return Boolean(a&&b&&"string"==typeof b&&"undefined"!=typeof a[b])}function I(a){return da.string(a)&&a.toLowerCase()===a}function J(a){return da.array(a)&&a.length>0}function K(a,b){return da.array(b)&&b.every(a)}function L(a,b){return da.verify.array(b,"expected array to find bad items"),b.filter($(a))}function M(a,b){var c=da.array(a)&&a.every(da.string);return c&&da.bool(b)&&b?a.every(da.lowerCase):c}function N(a,b){return da.array(a)&&a.every(function(a){return da.arrayOfStrings(a,b)})}function O(a,b){return da.verify.fn(da.every,"missing check.every method"),da.verify.fn(da.map,"missing check.map method"),da.verify.object(a,"missing object to check"),da.verify.object(b,"missing predicates object"),Object.keys(b).forEach(function(a){if(!da.fn(b[a]))throw new Error("not a predicate function for "+a+" but "+b[a])}),da.every(da.map(a,b))}function P(a,b){return O(b,a)}function Q(a,b){da.verify.fn(a,"expected function that raises");try{a()}catch(c){return"undefined"==typeof b?!0:"function"==typeof b?b(c):!1}return!1}function R(a){return""===a}function S(a){var b="string"==typeof a||Array.isArray(a);return b?!a.length:a instanceof Object?!Object.keys(a).length:!1}function T(a){var b="string"==typeof a||Array.isArray(a);return b?a.length:a instanceof Object?Object.keys(a).length:!0}function U(a){return da.number(a)&&a>=0&&1>=a}function V(a){return da.string(a)&&ea.test(a)}function W(a){return da.string(a)&&40===a.length&&fa.test(a)}function X(a){return da.string(a)&&7===a.length&&ga.test(a)}function Y(){var a=Array.prototype.slice.call(arguments,0);if(!a.length)throw new Error("empty list of arguments to or");return function(){var b=Array.prototype.slice.call(arguments,0);return a.some(function(a){try{return da.fn(a)?a.apply(null,b):Boolean(a)}catch(c){return!1}})}}function Z(){var a=Array.prototype.slice.call(arguments,0);if(!a.length)throw new Error("empty list of arguments to or");return function(){var b=Array.prototype.slice.call(arguments,0);return a.every(function(a){return da.fn(a)?a.apply(null,b):Boolean(a)})}}function $(a){return function(){return!a.apply(null,arguments)}}function _(a){return da.object(a)&&ja(a)}function aa(a,b){return a===b}if("function"!=typeof Function.prototype.bind)throw new Error("Missing Function.prototype.bind, please load es5-shim first");var ba=p.bind(null,"http://"),ca=p.bind(null,"https://"),da={maybe:{},verify:{},not:{},every:s,map:t},ea=/^#(?:[0-9a-fA-F]{3}){1,2}$/,fa=/^[0-9a-f]{40}$/,ga=/^[0-9a-f]{7}$/;if(!da.defend){var ha=function(a,b,c){da.verify.fn(a,"expected a function"),da.verify.array(b,"expected list of predicates"),da.verify.defined(c,"missing args");var d=0,e=0,f=b.length;for(d=0;f>d;d+=1){var g=b[d];if(da.fn(g)){if(!g.call(null,c[e])){var h="Argument "+(e+1)+": "+c[e]+" does not pass predicate";throw da.unemptyString(b[d+1])&&(h+=": "+b[d+1]),new Error(h)}e+=1}}return a.apply(null,c)};da.defend=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return ha(a,b,arguments)}}}da.mixin||(da.mixin=function(a,f){function g(a,c,f){if(!e(a))throw new Error("missing object "+a);if(!d(c))throw new Error("missing name");if(!b(f))throw new Error("missing function");a[c]||(a[c]=f)}function h(a){return function(){return!da.defined(arguments[0])||da.nulled(arguments[0])?!0:a.apply(null,arguments)}}function i(a,b){return function(){var c;if(a.apply(null,arguments)===!1)throw c=arguments[arguments.length-1],new Error(da.unemptyString(c)?c:b)}}if(c(a)&&b(f)){var j=a;a=f,f=j}if(!b(a))throw new Error("expected predicate function");if(d(f)||(f=a.name),!d(f))throw new Error("predicate function missing name\n"+a.toString());g(da,f,a),g(da.maybe,f,h(a)),g(da.not,f,$(a)),g(da.verify,f,i(a,f+" failed"))}),da.then||(da.then=function(a,b){return function(){var c="function"==typeof a?a.apply(null,arguments):a;return c?b.apply(null,arguments):void 0}});var ia={then:b};ia["catch"]=b,ia["finally"]=b;var ja=P.bind(null,ia),ka={nulled:j,fn:b,string:c,unemptyString:d,object:e,number:g,array:Array.isArray,positiveNumber:k,negativeNumber:l,defined:u,same:z,allSame:C,bit:F,bool:G,has:H,lowerCase:I,unemptyArray:J,arrayOfStrings:M,arrayOfArraysOfStrings:N,all:O,schema:P,raises:Q,empty:S,emptyString:R,unempty:T,unit:U,hexRgb:V,sameLength:B,commitId:W,shortCommitId:X,index:A,git:E,arrayOf:K,badItems:L,oneOf:a(D),promise:_,validDate:v,equal:a(aa),or:Y,and:Z,primitive:x,zero:y,date:m,instance:n,emptyObject:f,length:o,floatNumber:i,intNumber:h,startsWith:p,webUrl:r,semver:w,type:a(q)};Object.keys(ka).forEach(function(a){da.mixin(ka[a],a)}),"object"==typeof module&&(module.exports=da),"object"==typeof window&&(window.check=da),"object"==typeof global&&(global.check=da)}(); |
{ | ||
"name": "check-more-types", | ||
"description": "Large collection of predicates.", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -201,2 +201,4 @@ # check-more-types | ||
Function is curried | ||
--- | ||
@@ -203,0 +205,0 @@ |
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
783
50398
723