New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-more-types

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-more-types - npm Package Compare versions

Comparing version 2.12.1 to 2.13.0

11

check-more-types.js

@@ -736,3 +736,2 @@ (function checkMoreTypes() {

promiseSchema['catch'] = isFn;
promiseSchema['finally'] = isFn;

@@ -757,4 +756,14 @@ var hasPromiseApi = schema.bind(null, promiseSchema);

/**
Really simple email sanity check
@method email
*/
function email(s) {
return isString(s) &&
/^.+@.+\..+$/.test(s);
}
// new predicates to be added to check object. Use object to preserve names
var predicates = {
email: email,
nulled: isNull,

@@ -761,0 +770,0 @@ fn: isFn,

2

check-more-types.min.js

@@ -5,2 +5,2 @@ /*! check-more-types - v0.0.0

!function(){"use strict";function a(a,b){return function(c){if(b&&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(b){return a(c,b)}}}function b(a){return"function"==typeof a}function c(a){return"string"==typeof a}function d(a){return c(a)&&Boolean(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){return a instanceof RegExp}function o(a){return a instanceof Error}function p(a,b){return a instanceof b}function q(a,b){return"number"==typeof a&&"number"!=typeof b?q(b,a):(Array.isArray(a)||c(a))&&a.length===b}function r(a){return a>=0}function s(a,b){return c(a)&&c(b)&&0===b.indexOf(a)}function t(a,b){return typeof b===a}function u(a){return c(a)&&ja(a)}function v(a){return c(a)&&ka(a)}function w(a){return c(a)&&(ja(a)||ka(a))}function x(a){var b,c;for(b in a)if(a.hasOwnProperty(b)){if(c=a[b],e(c)&&x(c)===!1)return!1;if(c===!1)return!1}return!0}function y(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]=y(a[d],f)));return g}function z(a){return"undefined"!=typeof a}function A(a){return la.date(a)&&la.number(Number(a))}function B(a){return la.unemptyString(a)&&/^\d+\.\d+\.\d+$/.test(a)}function C(a){var b=typeof a;return"number"===b||"boolean"===b||"string"===b||"symbol"===b}function D(a){return"number"==typeof a&&0===a}function E(a,b){return a===b}function F(a,b){return z(a)&&M(a,"length")&&b>=0&&b<a.length}function G(a,b){return typeof a==typeof b&&a&&b&&a.length===b.length}function H(a){if(!la.array(a))return!1;if(!a.length)return!0;var b=a[0];return a.every(function(a){return a===b})}function I(a,b){return la.verify.array(a,"expected an array"),-1!==a.indexOf(b)}function J(a){return la.unemptyString(a)&&/^git@/.test(a)}function K(a){return 0===a||1===a}function L(a){return"boolean"==typeof a}function M(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 N(a){return la.string(a)&&a.toLowerCase()===a}function O(a){return la.array(a)&&a.length>0}function P(a,b){return la.array(b)&&b.every(a)}function Q(a,b){return la.verify.array(b,"expected array to find bad items"),b.filter(ga(a))}function R(a,b){var c=la.array(a)&&a.every(la.string);return c&&la.bool(b)&&b?a.every(la.lowerCase):c}function S(a,b){return la.array(a)&&a.every(function(a){return la.arrayOfStrings(a,b)})}function T(a,b){return la.verify.fn(la.every,"missing check.every method"),la.verify.fn(la.map,"missing check.map method"),la.verify.object(a,"missing object to check"),la.verify.object(b,"missing predicates object"),Object.keys(b).forEach(function(a){if(!la.fn(b[a]))throw new Error("not a predicate function for "+a+" but "+b[a])}),la.every(la.map(a,b))}function U(a,b){return T(b,a)}function V(a,b){la.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 W(a){return""===a}function X(a){var b="string"==typeof a||Array.isArray(a);return b?!a.length:a instanceof Object?!Object.keys(a).length:!1}function Y(a){var b="string"==typeof a||Array.isArray(a);return b?a.length:a instanceof Object?Object.keys(a).length:!0}function Z(a){return la.positive(a)&&65535>=a}function $(a){return la.positive(a)&&1024>=a}function _(a){return Z(a)&&a>1024}function aa(a){return la.number(a)&&a>=0&&1>=a}function ba(a){return la.string(a)&&ma.test(a)}function ca(a){return la.string(a)&&40===a.length&&na.test(a)}function da(a){return la.string(a)&&7===a.length&&oa.test(a)}function ea(){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 la.fn(a)?a.apply(null,b):Boolean(a)}catch(c){return!1}})}}function fa(){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 la.fn(a)?a.apply(null,b):Boolean(a)})}}function ga(a){return function(){return!a.apply(null,arguments)}}function ha(a){return la.object(a)&&ra(a)}function ia(a,b){return a===b}if("function"!=typeof Function.prototype.bind)throw new Error("Missing Function.prototype.bind, please load es5-shim first");var ja=s.bind(null,"http://"),ka=s.bind(null,"https://"),la={maybe:{},verify:{},not:{},every:x,map:y},ma=/^#(?:[0-9a-fA-F]{3}){1,2}$/,na=/^[0-9a-f]{40}$/,oa=/^[0-9a-f]{7}$/;if(!la.defend){var pa=function(a,b,c){la.verify.fn(a,"expected a function"),la.verify.array(b,"expected list of predicates"),la.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(la.fn(g)){if(!g.call(null,c[e])){var h="Argument "+(e+1)+": "+c[e]+" does not pass predicate";throw la.unemptyString(b[d+1])&&(h+=": "+b[d+1]),new Error(h)}e+=1}}return a.apply(null,c)};la.defend=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return pa(a,b,arguments)}}}la.mixin||(la.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!la.defined(arguments[0])||la.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(la.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(la,f,a),g(la.maybe,f,h(a)),g(la.not,f,ga(a)),g(la.verify,f,i(a,f+" failed"))}),la.then||(la.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 qa={then:b};qa["catch"]=b,qa["finally"]=b;var ra=U.bind(null,qa),sa={nulled:j,fn:b,string:c,unemptyString:d,object:e,number:g,array:Array.isArray,positiveNumber:k,negativeNumber:l,positive:k,negative:l,defined:z,same:E,allSame:H,bit:K,bool:L,has:M,lowerCase:N,unemptyArray:O,arrayOfStrings:R,arrayOfArraysOfStrings:S,all:T,schema:a(U),raises:V,empty:X,found:r,emptyString:W,unempty:Y,unit:aa,hexRgb:ba,sameLength:G,commitId:ca,shortCommitId:da,index:F,git:J,arrayOf:P,badItems:Q,oneOf:a(I,!0),promise:ha,validDate:A,equal:a(ia),or:ea,and:fa,primitive:C,zero:D,date:m,regexp:n,instance:p,emptyObject:f,length:a(q),floatNumber:i,intNumber:h,startsWith:s,webUrl:w,semver:B,type:a(t),http:u,https:v,secure:v,error:o,port:Z,systemPort:$,userPort:_};Object.keys(sa).forEach(function(a){la.mixin(sa[a],a)}),"object"==typeof module&&(module.exports=la),"object"==typeof window&&(window.check=la),"object"==typeof global&&(global.check=la)}();
!function(){"use strict";function a(a,b){return function(c){if(b&&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(b){return a(c,b)}}}function b(a){return"function"==typeof a}function c(a){return"string"==typeof a}function d(a){return c(a)&&Boolean(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){return a instanceof RegExp}function o(a){return a instanceof Error}function p(a,b){return a instanceof b}function q(a,b){return"number"==typeof a&&"number"!=typeof b?q(b,a):(Array.isArray(a)||c(a))&&a.length===b}function r(a){return a>=0}function s(a,b){return c(a)&&c(b)&&0===b.indexOf(a)}function t(a,b){return typeof b===a}function u(a){return c(a)&&ka(a)}function v(a){return c(a)&&la(a)}function w(a){return c(a)&&(ka(a)||la(a))}function x(a){var b,c;for(b in a)if(a.hasOwnProperty(b)){if(c=a[b],e(c)&&x(c)===!1)return!1;if(c===!1)return!1}return!0}function y(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]=y(a[d],f)));return g}function z(a){return"undefined"!=typeof a}function A(a){return ma.date(a)&&ma.number(Number(a))}function B(a){return ma.unemptyString(a)&&/^\d+\.\d+\.\d+$/.test(a)}function C(a){var b=typeof a;return"number"===b||"boolean"===b||"string"===b||"symbol"===b}function D(a){return"number"==typeof a&&0===a}function E(a,b){return a===b}function F(a,b){return z(a)&&M(a,"length")&&b>=0&&b<a.length}function G(a,b){return typeof a==typeof b&&a&&b&&a.length===b.length}function H(a){if(!ma.array(a))return!1;if(!a.length)return!0;var b=a[0];return a.every(function(a){return a===b})}function I(a,b){return ma.verify.array(a,"expected an array"),-1!==a.indexOf(b)}function J(a){return ma.unemptyString(a)&&/^git@/.test(a)}function K(a){return 0===a||1===a}function L(a){return"boolean"==typeof a}function M(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 N(a){return ma.string(a)&&a.toLowerCase()===a}function O(a){return ma.array(a)&&a.length>0}function P(a,b){return ma.array(b)&&b.every(a)}function Q(a,b){return ma.verify.array(b,"expected array to find bad items"),b.filter(ga(a))}function R(a,b){var c=ma.array(a)&&a.every(ma.string);return c&&ma.bool(b)&&b?a.every(ma.lowerCase):c}function S(a,b){return ma.array(a)&&a.every(function(a){return ma.arrayOfStrings(a,b)})}function T(a,b){return ma.verify.fn(ma.every,"missing check.every method"),ma.verify.fn(ma.map,"missing check.map method"),ma.verify.object(a,"missing object to check"),ma.verify.object(b,"missing predicates object"),Object.keys(b).forEach(function(a){if(!ma.fn(b[a]))throw new Error("not a predicate function for "+a+" but "+b[a])}),ma.every(ma.map(a,b))}function U(a,b){return T(b,a)}function V(a,b){ma.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 W(a){return""===a}function X(a){var b="string"==typeof a||Array.isArray(a);return b?!a.length:a instanceof Object?!Object.keys(a).length:!1}function Y(a){var b="string"==typeof a||Array.isArray(a);return b?a.length:a instanceof Object?Object.keys(a).length:!0}function Z(a){return ma.positive(a)&&65535>=a}function $(a){return ma.positive(a)&&1024>=a}function _(a){return Z(a)&&a>1024}function aa(a){return ma.number(a)&&a>=0&&1>=a}function ba(a){return ma.string(a)&&na.test(a)}function ca(a){return ma.string(a)&&40===a.length&&oa.test(a)}function da(a){return ma.string(a)&&7===a.length&&pa.test(a)}function ea(){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 ma.fn(a)?a.apply(null,b):Boolean(a)}catch(c){return!1}})}}function fa(){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 ma.fn(a)?a.apply(null,b):Boolean(a)})}}function ga(a){return function(){return!a.apply(null,arguments)}}function ha(a){return ma.object(a)&&sa(a)}function ia(a,b){return a===b}function ja(a){return c(a)&&/^.+@.+\..+$/.test(a)}if("function"!=typeof Function.prototype.bind)throw new Error("Missing Function.prototype.bind, please load es5-shim first");var ka=s.bind(null,"http://"),la=s.bind(null,"https://"),ma={maybe:{},verify:{},not:{},every:x,map:y},na=/^#(?:[0-9a-fA-F]{3}){1,2}$/,oa=/^[0-9a-f]{40}$/,pa=/^[0-9a-f]{7}$/;if(!ma.defend){var qa=function(a,b,c){ma.verify.fn(a,"expected a function"),ma.verify.array(b,"expected list of predicates"),ma.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(ma.fn(g)){if(!g.call(null,c[e])){var h="Argument "+(e+1)+": "+c[e]+" does not pass predicate";throw ma.unemptyString(b[d+1])&&(h+=": "+b[d+1]),new Error(h)}e+=1}}return a.apply(null,c)};ma.defend=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return qa(a,b,arguments)}}}ma.mixin||(ma.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!ma.defined(arguments[0])||ma.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(ma.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(ma,f,a),g(ma.maybe,f,h(a)),g(ma.not,f,ga(a)),g(ma.verify,f,i(a,f+" failed"))}),ma.then||(ma.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 ra={then:b};ra["catch"]=b;var sa=U.bind(null,ra),ta={email:ja,nulled:j,fn:b,string:c,unemptyString:d,object:e,number:g,array:Array.isArray,positiveNumber:k,negativeNumber:l,positive:k,negative:l,defined:z,same:E,allSame:H,bit:K,bool:L,has:M,lowerCase:N,unemptyArray:O,arrayOfStrings:R,arrayOfArraysOfStrings:S,all:T,schema:a(U),raises:V,empty:X,found:r,emptyString:W,unempty:Y,unit:aa,hexRgb:ba,sameLength:G,commitId:ca,shortCommitId:da,index:F,git:J,arrayOf:P,badItems:Q,oneOf:a(I,!0),promise:ha,validDate:A,equal:a(ia),or:ea,and:fa,primitive:C,zero:D,date:m,regexp:n,instance:p,emptyObject:f,length:a(q),floatNumber:i,intNumber:h,startsWith:s,webUrl:w,semver:B,type:a(t),http:u,https:v,secure:v,error:o,port:Z,systemPort:$,userPort:_};Object.keys(ta).forEach(function(a){ma.mixin(ta[a],a)}),"object"==typeof module&&(module.exports=ma),"object"==typeof window&&(window.check=ma),"object"==typeof global&&(global.check=ma)}();
{
"name": "check-more-types",
"description": "Large collection of predicates.",
"version": "2.12.1",
"version": "2.13.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Gleb Bahmutov",

@@ -53,2 +53,3 @@ # check-more-types

* **API**
* [check.email](#checkemail)
* [check.port](#checkport)

@@ -129,2 +130,11 @@ * [check.systemPort](#checksystemport)

#### check.email
Really simple regex email check. Should not be relied to be robust.
```js
check.email('me@foo.bar') // true
check.email('me.foo.bar') // false
```
#### check.port

@@ -131,0 +141,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc