Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

check-types

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-types - npm Package Compare versions

Comparing version 10.1.1 to 10.1.2

6

HISTORY.md
# History
## 10.1.2
### Performance improvements
* lib: shortcut unnecessary iteration for Sets in contains (522f073)
## 10.1.1

@@ -4,0 +10,0 @@

2

package.json
{
"name": "check-types",
"version": "10.1.1",
"version": "10.1.2",
"description": "A little library for asserting types and values.",

@@ -5,0 +5,0 @@ "homepage": "https://gitlab.com/philbooth/check-types.js",

@@ -63,3 +63,3 @@ # check-types.js

23 kb unminified with comments, 6.8 kb minified, 2.4 kb minified + gzipped.
23 kb unminified with comments, 6.9 kb minified, 2.5 kb minified + gzipped.

@@ -66,0 +66,0 @@ ## How do I install it?

@@ -1,2 +0,2 @@

/*globals define, module, Symbol, Map */
/*globals define, module, Symbol, Map, Set */
/*jshint -W056 */

@@ -8,3 +8,3 @@

var messages, predicates, functions, assert, not, maybe, collections,
slice, neginf, posinf, isArray, keys, haveSymbols, haveMaps;
slice, neginf, posinf, isArray, keys, haveSymbols, haveMaps, haveSets;

@@ -77,2 +77,3 @@ messages = {};

haveMaps = typeof Map === 'function';
haveSets = typeof Set === 'function';

@@ -503,2 +504,6 @@ functions = mixin(functions, predicates);

if (haveSets && instanceStrict(data, Set)) {
return data.has(value);
}
if (string(data)) {

@@ -505,0 +510,0 @@ return data.indexOf(value) !== -1;

@@ -1,1 +0,1 @@

!function(n){"use strict";var f,r,e,i,c,t,u,o,a,s,l,b,p,y,m;function h(n){return null!=n}function g(n){return"number"==typeof n&&a<n&&n<s}function d(n){return"number"==typeof n&&n%1==0}function v(n,e){return g(n)&&e<n}function j(n,e){return g(n)&&n<e}function O(n,e){return g(n)&&e<=n}function E(n,e){return g(n)&&n<=e}function w(n){return"string"==typeof n}function k(n,e){return e&&e.trim?w(n)&&""!==n.trim():w(n)&&""!==n}function I(n){return"[object Object]"===Object.prototype.toString.call(n)}function S(n,e){for(var t in n)if(n.hasOwnProperty(t)&&e(t,n[t]))return!0;return!1}function N(n,e){try{return n instanceof e}catch(n){return!1}}function A(n,e){var t;for(t in e)if(e.hasOwnProperty(t)){if(!1===n.hasOwnProperty(t)||typeof n[t]!=typeof e[t])return!1;if(I(n[t])&&!1===A(n[t],e[t]))return!1}return!0}function P(n){return h(n)&&0<=n.length}function q(n){return p?h(n)&&F(n[Symbol.iterator]):P(n)}function x(n,t){var e,r;if(!h(n))return!1;if(w(n))return-1!==n.indexOf(t);if(p&&n[Symbol.iterator]&&F(n.values)){e=n.values();do{if((r=e.next()).value===t)return!0}while(!r.done);return!1}return S(n,function(n,e){return e===t})}function T(n,e){return!!h(n)&&(y&&N(n,Map)?n.has(e):!(q(n)&&!g(+e))&&!!n[e])}function F(n){return"function"==typeof n}function L(n,e){for(var t in n)n.hasOwnProperty(t)&&e(t,n[t])}function D(n,e){var t;for(t=0;t<n.length;t+=1)if(n[t]===e)return e;return!e}function M(n,e){var t,r;for(t in n)if(n.hasOwnProperty(t)){if(I(r=n[t])&&M(r,e)===e)return e;if(r===e)return e}return!e}function R(t,n){return L(n,function(n,e){t[n]=e}),t}function V(u,o){return function(){var e=arguments,n=u.l||u.length,t=e[n],r=e[n+1];return _(u.apply(null,e),k(t)?t:o.replace("{a}",Y(e[0])).replace("{e}",Y(e[1])).replace("{e2}",Y(e[2])).replace("{t}",function(){var n=e[1];return n&&n.name?n.name:n}),F(r)?r:TypeError),e[0]}}function Y(n){return function(){return w(n)?'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"':n&&n.constructor&&!N(n,RegExp)&&"number"!=typeof n?n.constructor.name:n}}function _(n,e,t){if(n)return n;throw new(t||Error)(e||"assert failed")}function z(n){var e=function(){return B(n.apply(null,arguments))};return e.l=n.length,e}function B(n){return!n}function G(t,r,u){var n=function(){var n,e;if(n=arguments[0],"maybe"===t&&c.assigned(n))return!0;if(!r(n))return!1;n=function(n,e){switch(n){case P:return o.call(e);case I:return b(e).map(function(n){return e[n]});default:return e}}(r,n),e=o.call(arguments,1);try{n.forEach(function(n){if(("maybe"!==t||h(n))&&!u.apply(null,[n].concat(e)))throw 0})}catch(n){return!1}return!0};return n.l=u.length,n}function K(n,e){return C([n,r,e,""])}function C(r){var u,o,i;return u=r.shift(),o=r.pop(),i=r.pop(),L(r.pop(),function(n,e){var t=f[n];t&&o&&(t=t.replace("to",o+"to")),Object.defineProperty(i,n,{configurable:!1,enumerable:!0,writable:!1,value:u.apply(null,r.concat(e,t))})}),i}function H(n,e,t){return C([n,e,{},t])}function J(e,t){u.forEach(function(n){e[n].of=H(t,r[n].of)})}f={},r={},[{n:"equal",f:function(n,e){return n===e},s:"equal {e}"},{n:"undefined",f:function(n){return void 0===n},s:"be undefined"},{n:"null",f:function(n){return null===n},s:"be null"},{n:"assigned",f:h,s:"be assigned"},{n:"primitive",f:function(n){var e;switch(n){case null:case void 0:case!1:case!0:return!0}return"string"==(e=typeof n)||"number"===e||p&&"symbol"===e},s:"be primitive type"},{n:"contains",f:x,s:"contain {e}"},{n:"in",f:function(n,e){return x(e,n)},s:"be in {e}"},{n:"containsKey",f:T,s:"contain key {e}"},{n:"keyIn",f:function(n,e){return T(e,n)},s:"be key in {e}"},{n:"zero",f:function(n){return 0===n},s:"be 0"},{n:"infinity",f:function(n){return n===a||n===s},s:"be infinity"},{n:"number",f:g,s:"be Number"},{n:"integer",f:d,s:"be integer"},{n:"even",f:function(n){return"number"==typeof n&&n%2==0},s:"be even number"},{n:"odd",f:function(n){return d(n)&&n%2!=0},s:"be odd number"},{n:"greater",f:v,s:"be greater than {e}"},{n:"less",f:j,s:"be less than {e}"},{n:"between",f:function(n,e,t){if(e<t)return v(n,e)&&n<t;return j(n,e)&&t<n},s:"be between {e} and {e2}"},{n:"greaterOrEqual",f:O,s:"be greater than or equal to {e}"},{n:"lessOrEqual",f:E,s:"be less than or equal to {e}"},{n:"inRange",f:function(n,e,t){if(e<t)return O(n,e)&&n<=t;return E(n,e)&&t<=n},s:"be in the range {e} to {e2}"},{n:"positive",f:function(n){return v(n,0)},s:"be positive number"},{n:"negative",f:function(n){return j(n,0)},s:"be negative number"},{n:"string",f:w,s:"be String"},{n:"emptyString",f:function(n,e){if(e&&e.trim&&w(n))return""===n.trim();return""===n},s:"be empty string"},{n:"nonEmptyString",f:k,s:"be non-empty string"},{n:"match",f:function(n,e){return w(n)&&!!n.match(e)},s:"match {e}"},{n:"boolean",f:function(n){return!1===n||!0===n},s:"be Boolean"},{n:"object",f:I,s:"be Object"},{n:"emptyObject",f:function(n){return I(n)&&!S(n,function(){return!0})},s:"be empty object"},{n:"nonEmptyObject",f:function(n){return I(n)&&S(n,function(){return!0})},s:"be non-empty object"},{n:"instanceStrict",f:N,s:"be instanceof {t}"},{n:"instance",f:function(n,e){try{return N(n,e)||n.constructor.name===e.name||Object.prototype.toString.call(n)==="[object "+e.name+"]"}catch(n){return!1}},s:"be {t}"},{n:"like",f:A,s:"be like {e}"},{n:"array",f:function(n){return l(n)},s:"be Array"},{n:"emptyArray",f:function(n){return l(n)&&0===n.length},s:"be empty array"},{n:"nonEmptyArray",f:function(n){return l(n)&&0<n.length},s:"be non-empty array"},{n:"arrayLike",f:P,s:"be array-like"},{n:"iterable",f:q,s:"be iterable"},{n:"date",f:function(n){return N(n,Date)&&d(n.getTime())},s:"be valid Date"},{n:"function",f:F,s:"be Function"},{n:"hasLength",f:function(n,e){return h(n)&&n.length===e},s:"have length {e}"}].map(function(n){var e=n.n;f[e]="assert failed: expected {a} to "+n.s,r[e]=n.f}),e={map:function e(r,t){var u;u=l(r)?[]:{};if(F(t))L(r,function(n,e){u[n]=t(e)});else{l(t)||i.object(t);var o=b(r||{});L(t,function(t,n){o.some(function(n,e){return n===t&&(o.splice(e,1),!0)}),F(n)?c.assigned(r)?u[t]=!!n.m:u[t]=n(r[t]):u[t]=e(r[t],n)})}return u},all:function(n){if(l(n))return D(n,!1);return i.object(n),M(n,!1)},any:function(n){if(l(n))return D(n,!0);return i.object(n),M(n,!0)}},u=["array","arrayLike","iterable","object"],o=Array.prototype.slice,a=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Array.isArray,b=Object.keys,p="function"==typeof Symbol,y="function"==typeof Map,e=R(e,r),i=K(V,_),c=K(z,B),t=K(function(n){var e=function(){return!!c.assigned(arguments[0])||n.apply(null,arguments)};return e.l=n.length,e.m=!0,e},function(n){return!1===h(n)||n}),i.not=H(V,c,"not "),i.maybe=H(V,t,"maybe "),u.forEach(function(n){r[n].of=C([G.bind(null,null),r[n],r,{},""])}),J(i,V),J(c,z),u.forEach(function(n){t[n].of=C([G.bind(null,"maybe"),r[n],r,{},""]),i.maybe[n].of=H(V,t[n].of),i.not[n].of=H(V,c[n].of)}),m=R(e,{assert:i,not:c,maybe:t}),"function"==typeof define&&define.amd?define(function(){return m}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=m:n.check=m}(this);
!function(n){"use strict";var f,r,e,i,c,t,u,o,a,s,l,b,p,y,m,h;function g(n){return null!=n}function d(n){return"number"==typeof n&&a<n&&n<s}function v(n){return"number"==typeof n&&n%1==0}function j(n,e){return d(n)&&e<n}function O(n,e){return d(n)&&n<e}function E(n,e){return d(n)&&e<=n}function w(n,e){return d(n)&&n<=e}function S(n){return"string"==typeof n}function k(n,e){return e&&e.trim?S(n)&&""!==n.trim():S(n)&&""!==n}function I(n){return"[object Object]"===Object.prototype.toString.call(n)}function N(n,e){for(var t in n)if(n.hasOwnProperty(t)&&e(t,n[t]))return!0;return!1}function A(n,e){try{return n instanceof e}catch(n){return!1}}function P(n,e){var t;for(t in e)if(e.hasOwnProperty(t)){if(!1===n.hasOwnProperty(t)||typeof n[t]!=typeof e[t])return!1;if(I(n[t])&&!1===P(n[t],e[t]))return!1}return!0}function q(n){return g(n)&&0<=n.length}function x(n){return p?g(n)&&L(n[Symbol.iterator]):q(n)}function T(n,t){var e,r;if(!g(n))return!1;if(m&&A(n,Set))return n.has(t);if(S(n))return-1!==n.indexOf(t);if(p&&n[Symbol.iterator]&&L(n.values)){e=n.values();do{if((r=e.next()).value===t)return!0}while(!r.done);return!1}return N(n,function(n,e){return e===t})}function F(n,e){return!!g(n)&&(y&&A(n,Map)?n.has(e):!(x(n)&&!d(+e))&&!!n[e])}function L(n){return"function"==typeof n}function D(n,e){for(var t in n)n.hasOwnProperty(t)&&e(t,n[t])}function M(n,e){var t;for(t=0;t<n.length;t+=1)if(n[t]===e)return e;return!e}function R(n,e){var t,r;for(t in n)if(n.hasOwnProperty(t)){if(I(r=n[t])&&R(r,e)===e)return e;if(r===e)return e}return!e}function V(t,n){return D(n,function(n,e){t[n]=e}),t}function Y(u,o){return function(){var e=arguments,n=u.l||u.length,t=e[n],r=e[n+1];return z(u.apply(null,e),k(t)?t:o.replace("{a}",_(e[0])).replace("{e}",_(e[1])).replace("{e2}",_(e[2])).replace("{t}",function(){var n=e[1];return n&&n.name?n.name:n}),L(r)?r:TypeError),e[0]}}function _(n){return function(){return S(n)?'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"':n&&n.constructor&&!A(n,RegExp)&&"number"!=typeof n?n.constructor.name:n}}function z(n,e,t){if(n)return n;throw new(t||Error)(e||"assert failed")}function B(n){var e=function(){return G(n.apply(null,arguments))};return e.l=n.length,e}function G(n){return!n}function K(t,r,u){var n=function(){var n,e;if(n=arguments[0],"maybe"===t&&c.assigned(n))return!0;if(!r(n))return!1;n=function(n,e){switch(n){case q:return o.call(e);case I:return b(e).map(function(n){return e[n]});default:return e}}(r,n),e=o.call(arguments,1);try{n.forEach(function(n){if(("maybe"!==t||g(n))&&!u.apply(null,[n].concat(e)))throw 0})}catch(n){return!1}return!0};return n.l=u.length,n}function C(n,e){return H([n,r,e,""])}function H(r){var u,o,i;return u=r.shift(),o=r.pop(),i=r.pop(),D(r.pop(),function(n,e){var t=f[n];t&&o&&(t=t.replace("to",o+"to")),Object.defineProperty(i,n,{configurable:!1,enumerable:!0,writable:!1,value:u.apply(null,r.concat(e,t))})}),i}function J(n,e,t){return H([n,e,{},t])}function Q(e,t){u.forEach(function(n){e[n].of=J(t,r[n].of)})}f={},r={},[{n:"equal",f:function(n,e){return n===e},s:"equal {e}"},{n:"undefined",f:function(n){return void 0===n},s:"be undefined"},{n:"null",f:function(n){return null===n},s:"be null"},{n:"assigned",f:g,s:"be assigned"},{n:"primitive",f:function(n){var e;switch(n){case null:case void 0:case!1:case!0:return!0}return"string"==(e=typeof n)||"number"===e||p&&"symbol"===e},s:"be primitive type"},{n:"contains",f:T,s:"contain {e}"},{n:"in",f:function(n,e){return T(e,n)},s:"be in {e}"},{n:"containsKey",f:F,s:"contain key {e}"},{n:"keyIn",f:function(n,e){return F(e,n)},s:"be key in {e}"},{n:"zero",f:function(n){return 0===n},s:"be 0"},{n:"infinity",f:function(n){return n===a||n===s},s:"be infinity"},{n:"number",f:d,s:"be Number"},{n:"integer",f:v,s:"be integer"},{n:"even",f:function(n){return"number"==typeof n&&n%2==0},s:"be even number"},{n:"odd",f:function(n){return v(n)&&n%2!=0},s:"be odd number"},{n:"greater",f:j,s:"be greater than {e}"},{n:"less",f:O,s:"be less than {e}"},{n:"between",f:function(n,e,t){if(e<t)return j(n,e)&&n<t;return O(n,e)&&t<n},s:"be between {e} and {e2}"},{n:"greaterOrEqual",f:E,s:"be greater than or equal to {e}"},{n:"lessOrEqual",f:w,s:"be less than or equal to {e}"},{n:"inRange",f:function(n,e,t){if(e<t)return E(n,e)&&n<=t;return w(n,e)&&t<=n},s:"be in the range {e} to {e2}"},{n:"positive",f:function(n){return j(n,0)},s:"be positive number"},{n:"negative",f:function(n){return O(n,0)},s:"be negative number"},{n:"string",f:S,s:"be String"},{n:"emptyString",f:function(n,e){if(e&&e.trim&&S(n))return""===n.trim();return""===n},s:"be empty string"},{n:"nonEmptyString",f:k,s:"be non-empty string"},{n:"match",f:function(n,e){return S(n)&&!!n.match(e)},s:"match {e}"},{n:"boolean",f:function(n){return!1===n||!0===n},s:"be Boolean"},{n:"object",f:I,s:"be Object"},{n:"emptyObject",f:function(n){return I(n)&&!N(n,function(){return!0})},s:"be empty object"},{n:"nonEmptyObject",f:function(n){return I(n)&&N(n,function(){return!0})},s:"be non-empty object"},{n:"instanceStrict",f:A,s:"be instanceof {t}"},{n:"instance",f:function(n,e){try{return A(n,e)||n.constructor.name===e.name||Object.prototype.toString.call(n)==="[object "+e.name+"]"}catch(n){return!1}},s:"be {t}"},{n:"like",f:P,s:"be like {e}"},{n:"array",f:function(n){return l(n)},s:"be Array"},{n:"emptyArray",f:function(n){return l(n)&&0===n.length},s:"be empty array"},{n:"nonEmptyArray",f:function(n){return l(n)&&0<n.length},s:"be non-empty array"},{n:"arrayLike",f:q,s:"be array-like"},{n:"iterable",f:x,s:"be iterable"},{n:"date",f:function(n){return A(n,Date)&&v(n.getTime())},s:"be valid Date"},{n:"function",f:L,s:"be Function"},{n:"hasLength",f:function(n,e){return g(n)&&n.length===e},s:"have length {e}"}].map(function(n){var e=n.n;f[e]="assert failed: expected {a} to "+n.s,r[e]=n.f}),e={map:function e(r,t){var u;u=l(r)?[]:{};if(L(t))D(r,function(n,e){u[n]=t(e)});else{l(t)||i.object(t);var o=b(r||{});D(t,function(t,n){o.some(function(n,e){return n===t&&(o.splice(e,1),!0)}),L(n)?c.assigned(r)?u[t]=!!n.m:u[t]=n(r[t]):u[t]=e(r[t],n)})}return u},all:function(n){if(l(n))return M(n,!1);return i.object(n),R(n,!1)},any:function(n){if(l(n))return M(n,!0);return i.object(n),R(n,!0)}},u=["array","arrayLike","iterable","object"],o=Array.prototype.slice,a=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Array.isArray,b=Object.keys,p="function"==typeof Symbol,y="function"==typeof Map,m="function"==typeof Set,e=V(e,r),i=C(Y,z),c=C(B,G),t=C(function(n){var e=function(){return!!c.assigned(arguments[0])||n.apply(null,arguments)};return e.l=n.length,e.m=!0,e},function(n){return!1===g(n)||n}),i.not=J(Y,c,"not "),i.maybe=J(Y,t,"maybe "),u.forEach(function(n){r[n].of=H([K.bind(null,null),r[n],r,{},""])}),Q(i,Y),Q(c,B),u.forEach(function(n){t[n].of=H([K.bind(null,"maybe"),r[n],r,{},""]),i.maybe[n].of=J(Y,t[n].of),i.not[n].of=J(Y,c[n].of)}),h=V(e,{assert:i,not:c,maybe:t}),"function"==typeof define&&define.amd?define(function(){return h}):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=h:n.check=h}(this);
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