Socket
Socket
Sign inDemoInstall

tcomb

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcomb - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

5

CHANGELOG.md

@@ -13,2 +13,7 @@ # Changelog

## v1.0.3
- **Internal**
+ fix tcomb lists don't currently play nice with es6 classes due to inability to invoke classes without new #92
## v1.0.2

@@ -15,0 +20,0 @@

22

index.js

@@ -163,2 +163,6 @@ (function (root, factory) {

function create(type, value, mut) {
return type.meta.kind === 'struct' ? new type(value, mut) : type(value, mut);
}
//

@@ -261,3 +265,3 @@ // irreducibles

var actual = value[k];
this[k] = expected(actual, mut);
this[k] = create(expected, actual, mut);
}

@@ -313,3 +317,3 @@ }

assert(Type.is(type), 'The `dispatch()` function of union type `%s` returns no type constructor', name);
return type(value, mut);
return create(type, value, mut);
}

@@ -355,3 +359,3 @@

blockNew(this, Maybe);
return Nil.is(value) ? null : type(value, mut);
return Nil.is(value) ? null : create(type, value, mut);
}

@@ -435,3 +439,3 @@

var actual = value[i];
arr.push(expected(actual, mut));
arr.push(create(expected, actual, mut));
}

@@ -473,3 +477,3 @@ if (frozen) {

blockNew(this, Subtype);
var x = type(value, mut);
var x = create(type, value, mut);
assert(predicate(x), 'Invalid argument `value` = `%s` supplied to subtype type `%s`', value, name);

@@ -519,3 +523,3 @@ return x;

var actual = value[i];
arr.push(type(actual, mut));
arr.push(create(type, actual, mut));
}

@@ -573,5 +577,5 @@ if (frozen) {

if (value.hasOwnProperty(k)) {
k = domain(k);
k = create(domain, k);
var actual = value[k];
obj[k] = codomain(actual, mut);
obj[k] = create(codomain, actual, mut);
}

@@ -662,3 +666,3 @@ }

/* jshint validthis: true */
return codomain(f.apply(this, args));
return create(codomain, f.apply(this, args));
} else {

@@ -665,0 +669,0 @@ var curried = Function.prototype.bind.apply(f, [this].concat(args));

{
"name": "tcomb",
"version": "1.0.2",
"version": "1.0.3",
"description": "Type checking for JavaScript",

@@ -5,0 +5,0 @@ "main": "index.js",

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

// tcomb 1.0.2
// tcomb 1.0.3
// https://github.com/gcanti/tcomb
// (c) 2014 Giulio Canti <giulio.canti@gmail.com>
// tcomb may be freely distributed under the MIT license.
!function(a,b){"use strict";"function"==typeof define&&define.amd&&"undefined"==typeof __fbBatchedBridgeConfig?define([],b):"object"==typeof exports?module.exports=b():a.t=b()}(this,function(){"use strict";function a(a){throw new TypeError(a)}function b(a,b){a!==!0&&(b=b?d.apply(null,v.call(arguments,1)):"assert failed",I.fail(b))}function c(a,c,d){if(x.is(c))return a;for(var e in c)c.hasOwnProperty(e)&&(d!==!0&&b(!a.hasOwnProperty(e),"Cannot overwrite property %s",e),a[e]=c[e]);return a}function d(){function a(a,f){if("%%"===a)return"%";if(e>=c)return a;var g=d.formatters[f];return g?g(b[e++]):a}var b=v.call(arguments),c=b.length,e=1,f=b[0],g=f.replace(/%([a-z%])/g,a);return c>e&&(g+=" "+b.slice(e).join(" ")),g}function e(a){return b("function"==typeof a,"Invalid argument `f` = `%s` supplied to `getFunctionName()`",a),a.displayName||a.name||d("<function%s>",a.length)}function f(a,b){return D.is(b)?e(b):b}function g(a){return b(H.is(a),"Invalid argument `type` = `%s` supplied to `getTypeName()`",a),a.meta.name}function h(a,c){b(!(a instanceof c),"Operator `new` is forbidden for type `%s`",g(c))}function i(a){return B.is(a)?a.concat():C.is(a)?c({},a):a}function j(a,c){b(C.is(c));var d=i(a);for(var e in c)if(c.hasOwnProperty(e)){if(j.commands.hasOwnProperty(e))return b(1===Object.keys(c).length),j.commands[e](c[e],d);d[e]=j(d[e],c[e])}return d}function k(a,c){function d(e){return h(this,d),b(c(e),"Invalid argument `value` = `%s` supplied to irreducible type `%s`",e,a),e}return b("string"==typeof a,"Invalid argument `name` = `%s` supplied to `irreducible()`",a),b("function"==typeof c,"Invalid argument `is` = `%s` supplied to `irreducible()`",c),d.meta={kind:"irreducible",name:a},d.displayName=a,d.is=c,d}function l(a,e){function f(c,d){if(f.is(c))return c;if(b(C.is(c),"Invalid argument `value` = `%s` supplied to struct type `%s`",c,e),!(this instanceof f))return new f(c,d);for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=c[g];this[g]=h(i,d)}d!==!0&&Object.freeze(this)}return b(s(y,H).is(a),"Invalid argument `props` = `%s` supplied to `struct` combinator",a),b(n(y).is(e),"Invalid argument `name` = `%s` supplied to `struct` combinator",e),e=e||d("{%s}",Object.keys(a).map(function(b){return d("%s: %s",b,g(a[b]))}).join(", ")),f.meta={kind:"struct",props:a,name:e},f.displayName=e,f.is=function(a){return a instanceof f},f.update=function(a,b){return new f(I.update(a,b))},f.extend=function(b,d){b=[].concat(b).map(function(a){return C.is(a)?a:a.meta.props}),b.unshift(a);var e=l(b.reduce(c,{}),d);return c(e.prototype,f.prototype),e},f}function m(a,c){function d(a,e){h(this,d),b(D.is(d.dispatch),"Unimplemented `dispatch()` function for union type `%s`",c);var f=d.dispatch(a);return b(H.is(f),"The `dispatch()` function of union type `%s` returns no type constructor",c),f(a,e)}b(r(H).is(a),"Invalid argument `types` = `%s` supplied to `union` combinator",a);var e=a.length,f=a.map(g).join(" | ");return b(e>=2,"Invalid argument `types` = `%s` supplied to `union` combinator, provide at least two types",f),b(n(y).is(c),"Invalid argument `name` = `%s` supplied to `union` combinator",c),c=c||f,d.meta={kind:"union",types:a,name:c},d.displayName=c,d.is=function(b){return a.some(function(a){return a.is(b)})},d.dispatch=function(b){for(var c=0;e>c;c++)if(a[c].is(b))return a[c]},d}function n(a,c){function d(b,c){return h(this,d),x.is(b)?null:a(b,c)}return b(H.is(a),"Invalid argument `type` = `%s` supplied to `maybe` combinator",a),"maybe"===a.meta.kind||a===w||a===x?a:(b(x.is(c)||y.is(c),"Invalid argument `name` = `%s` supplied to `maybe` combinator",c),c=c||"?"+g(a),d.meta={kind:"maybe",type:a,name:c},d.displayName=c,d.is=function(b){return x.is(b)||a.is(b)},d)}function o(a,c){function d(a){return h(this,d),b(d.is(a),"Invalid argument `value` = `%s` supplied to enums type `%s`, expected one of %j",a,c,e),a}b(C.is(a),"Invalid argument `map` = `%s` supplied to `enums` combinator",a),b(n(y).is(c),"Invalid argument `name` = `%s` supplied to `enums` combinator",c);var e=Object.keys(a);return c=c||e.map(function(a){return JSON.stringify(a)}).join(" | "),d.meta={kind:"enums",map:a,name:c},d.displayName=c,d.is=function(b){return y.is(b)&&a.hasOwnProperty(b)},d}function p(a,c){function e(b){return a.every(function(a,c){return a.is(b[c])})}function f(d,f){b(B.is(d)&&d.length===h,"Invalid argument `value` = `%s` supplied to tuple type `%s`, expected an `Arr` of length `%s`",d,c,h);var g=f!==!0;if(e(d)&&Object.isFrozen(d)===g)return d;for(var i=[],j=0;h>j;j++){var k=a[j],l=d[j];i.push(k(l,f))}return g&&Object.freeze(i),i}b(r(H).is(a),"Invalid argument `types` = `%s` supplied to `tuple` combinator",a);var h=a.length;return b(n(y).is(c),"Invalid argument `name` = `%s` supplied to `tuple` combinator",c),c=c||d("[%s]",a.map(g).join(", ")),f.meta={kind:"tuple",types:a,length:h,name:c},f.displayName=c,f.is=function(a){return B.is(a)&&a.length===h&&e(a)},f.update=function(a,b){return f(I.update(a,b))},f}function q(a,c,f){function i(d,e){h(this,i);var g=a(d,e);return b(c(g),"Invalid argument `value` = `%s` supplied to subtype type `%s`",d,f),g}return b(H.is(a),"Invalid argument `type` = `%s` supplied to `subtype` combinator",a),b(D.is(c),"Invalid argument `predicate` = `%s` supplied to `subtype` combinator",c),b(n(y).is(f),"Invalid argument `name` = `%s` supplied to `subtype` combinator",f),f=f||d("{%s | %s}",g(a),e(c)),i.meta={kind:"subtype",type:a,predicate:c,name:f},i.displayName=f,i.is=function(b){return a.is(b)&&c(b)},i.update=function(a,b){return i(I.update(a,b))},i}function r(a,c){function e(b){return b.every(a.is)}function f(d,f){b(B.is(d),"Invalid argument `value` = `%s` supplied to list type `%s`",d,c);var g=f!==!0;if(e(d)&&Object.isFrozen(d)===g)return d;for(var h=[],i=0,j=d.length;j>i;i++){var k=d[i];h.push(a(k,f))}return g&&Object.freeze(h),h}return b(H.is(a),"Invalid argument `type` = `%s` supplied to `list` combinator",a),b(n(y).is(c),"Invalid argument `name` = `%s` supplied to `list` combinator",c),c=c||d("Array<%s>",g(a)),f.meta={kind:"list",type:a,name:c},f.displayName=c,f.is=function(a){return B.is(a)&&e(a)},f.update=function(a,b){return f(I.update(a,b))},f}function s(a,c,e){function f(b){for(var d in b)if(b.hasOwnProperty(d)&&(!a.is(d)||!c.is(b[d])))return!1;return!0}function h(d,g){b(C.is(d),"Invalid argument `value` = `%s` supplied to dict type `%s`",d,e);var h=g!==!0;if(f(d)&&Object.isFrozen(d)===h)return d;var i={};for(var j in d)if(d.hasOwnProperty(j)){j=a(j);var k=d[j];i[j]=c(k,g)}return h&&Object.freeze(i),i}return b(H.is(a),"Invalid argument `domain` = `%s` supplied to `dict` combinator",a),b(H.is(c),"Invalid argument `codomain` = `%s` supplied to `dict` combinator",c),b(n(y).is(e),"Invalid argument `name` = `%s` supplied to `dict` combinator",e),e=e||d("{[key:%s]: %s}",g(a),g(c)),h.meta={kind:"dict",domain:a,codomain:c,name:e},h.displayName=e,h.is=function(a){return C.is(a)&&f(a)},h.update=function(a,b){return h(I.update(a,b))},h}function t(a){return D.is(a)&&C.is(a.type)}function u(a,c,f){function h(a){return t(a)?(b(h.is(a),"Invalid argument `value` = `%s` supplied to func type `%s`",a,f),a):h.of(a)}a=B.is(a)?a:[a],b(r(H).is(a),"Invalid argument `domain` = `%s` supplied to `func` combinator",a),b(H.is(c),"Invalid argument `codomain` = `%s` supplied to `func` combinator",c),b(n(y).is(f),"Invalid argument `name` = `%s` supplied to `func` combinator",f),f=f||d("(%s) => %s",a.map(g).join(", "),g(c));var i=a.length;return h.meta={kind:"func",domain:a,codomain:c,name:f},h.displayName=f,h.is=function(b){return t(b)&&b.type.domain.length===i&&b.type.domain.every(function(b,c){return b===a[c]})&&b.type.codomain===c},h.of=function(d){function f(){var b=v.call(arguments),e=b.length,f=p(a.slice(0,e));if(b=f(b),e===i)return c(d.apply(this,b));var g=Function.prototype.bind.apply(d,[this].concat(b)),h=u(a.slice(e),c);return h.of(g)}return b("function"==typeof d),h.is(d)?d:(f.type={domain:a,codomain:c,f:d},f.displayName=e(d),f)},h}var v=Array.prototype.slice;d.formatters={s:function(a){return String(a)},j:function(a){try{return JSON.stringify(a,f)}catch(b){return String(a)}}},j.commands={$apply:function(a,c){return b(D.is(a)),a(c)},$push:function(a,c){return b(B.is(a)),b(B.is(c)),c.concat(a)},$remove:function(a,c){b(B.is(a)),b(C.is(c));for(var d=0,e=a.length;e>d;d++)delete c[a[d]];return c},$set:function(a){return a},$splice:function(a,c){return b(r(B).is(a)),b(B.is(c)),a.reduce(function(a,b){return a.splice.apply(a,b),a},c)},$swap:function(a,c){b(C.is(a)),b(z.is(a.from)),b(z.is(a.to)),b(B.is(c));var d=c[a.to];return c[a.to]=c[a.from],c[a.from]=d,c},$unshift:function(a,c){return b(B.is(a)),b(B.is(c)),a.concat(c)},$merge:function(a,b){return c(c({},b),a,!0)}};var w=k("Any",function(){return!0}),x=k("Nil",function(a){return null===a||void 0===a}),y=k("Str",function(a){return"string"==typeof a}),z=k("Num",function(a){return"number"==typeof a&&isFinite(a)&&!isNaN(a)}),A=k("Bool",function(a){return a===!0||a===!1}),B=k("Arr",function(a){return a instanceof Array}),C=k("Obj",function(a){return!x.is(a)&&"object"==typeof a&&!B.is(a)}),D=k("Func",function(a){return"function"==typeof a}),E=k("Err",function(a){return a instanceof Error}),F=k("Re",function(a){return a instanceof RegExp}),G=k("Dat",function(a){return a instanceof Date}),H=k("Type",function(a){return D.is(a)&&C.is(a.meta)});o.of=function(a,b){a=y.is(a)?a.split(" "):a;var c={};return a.forEach(function(a){c[a]=a}),o(c,b)};var I={format:d,getFunctionName:e,getTypeName:g,mixin:c,slice:v,shallowCopy:i,update:j,assert:b,fail:a,Any:w,Nil:x,Str:y,Num:z,Bool:A,Arr:B,Obj:C,Func:D,Err:E,Re:F,Dat:G,Type:H,irreducible:k,struct:l,enums:o,union:m,maybe:n,tuple:p,subtype:q,list:r,dict:s,func:u};return I});
!function(a,b){"use strict";"function"==typeof define&&define.amd&&"undefined"==typeof __fbBatchedBridgeConfig?define([],b):"object"==typeof exports?module.exports=b():a.t=b()}(this,function(){"use strict";function a(a){throw new TypeError(a)}function b(a,b){a!==!0&&(b=b?d.apply(null,w.call(arguments,1)):"assert failed",J.fail(b))}function c(a,c,d){if(y.is(c))return a;for(var e in c)c.hasOwnProperty(e)&&(d!==!0&&b(!a.hasOwnProperty(e),"Cannot overwrite property %s",e),a[e]=c[e]);return a}function d(){function a(a,f){if("%%"===a)return"%";if(e>=c)return a;var g=d.formatters[f];return g?g(b[e++]):a}var b=w.call(arguments),c=b.length,e=1,f=b[0],g=f.replace(/%([a-z%])/g,a);return c>e&&(g+=" "+b.slice(e).join(" ")),g}function e(a){return b("function"==typeof a,"Invalid argument `f` = `%s` supplied to `getFunctionName()`",a),a.displayName||a.name||d("<function%s>",a.length)}function f(a,b){return E.is(b)?e(b):b}function g(a){return b(I.is(a),"Invalid argument `type` = `%s` supplied to `getTypeName()`",a),a.meta.name}function h(a,c){b(!(a instanceof c),"Operator `new` is forbidden for type `%s`",g(c))}function i(a){return C.is(a)?a.concat():D.is(a)?c({},a):a}function j(a,c){b(D.is(c));var d=i(a);for(var e in c)if(c.hasOwnProperty(e)){if(j.commands.hasOwnProperty(e))return b(1===Object.keys(c).length),j.commands[e](c[e],d);d[e]=j(d[e],c[e])}return d}function k(a,b,c){return"struct"===a.meta.kind?new a(b,c):a(b,c)}function l(a,c){function d(e){return h(this,d),b(c(e),"Invalid argument `value` = `%s` supplied to irreducible type `%s`",e,a),e}return b("string"==typeof a,"Invalid argument `name` = `%s` supplied to `irreducible()`",a),b("function"==typeof c,"Invalid argument `is` = `%s` supplied to `irreducible()`",c),d.meta={kind:"irreducible",name:a},d.displayName=a,d.is=c,d}function m(a,e){function f(c,d){if(f.is(c))return c;if(b(D.is(c),"Invalid argument `value` = `%s` supplied to struct type `%s`",c,e),!(this instanceof f))return new f(c,d);for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=c[g];this[g]=k(h,i,d)}d!==!0&&Object.freeze(this)}return b(t(z,I).is(a),"Invalid argument `props` = `%s` supplied to `struct` combinator",a),b(o(z).is(e),"Invalid argument `name` = `%s` supplied to `struct` combinator",e),e=e||d("{%s}",Object.keys(a).map(function(b){return d("%s: %s",b,g(a[b]))}).join(", ")),f.meta={kind:"struct",props:a,name:e},f.displayName=e,f.is=function(a){return a instanceof f},f.update=function(a,b){return new f(J.update(a,b))},f.extend=function(b,d){b=[].concat(b).map(function(a){return D.is(a)?a:a.meta.props}),b.unshift(a);var e=m(b.reduce(c,{}),d);return c(e.prototype,f.prototype),e},f}function n(a,c){function d(a,e){h(this,d),b(E.is(d.dispatch),"Unimplemented `dispatch()` function for union type `%s`",c);var f=d.dispatch(a);return b(I.is(f),"The `dispatch()` function of union type `%s` returns no type constructor",c),k(f,a,e)}b(s(I).is(a),"Invalid argument `types` = `%s` supplied to `union` combinator",a);var e=a.length,f=a.map(g).join(" | ");return b(e>=2,"Invalid argument `types` = `%s` supplied to `union` combinator, provide at least two types",f),b(o(z).is(c),"Invalid argument `name` = `%s` supplied to `union` combinator",c),c=c||f,d.meta={kind:"union",types:a,name:c},d.displayName=c,d.is=function(b){return a.some(function(a){return a.is(b)})},d.dispatch=function(b){for(var c=0;e>c;c++)if(a[c].is(b))return a[c]},d}function o(a,c){function d(b,c){return h(this,d),y.is(b)?null:k(a,b,c)}return b(I.is(a),"Invalid argument `type` = `%s` supplied to `maybe` combinator",a),"maybe"===a.meta.kind||a===x||a===y?a:(b(y.is(c)||z.is(c),"Invalid argument `name` = `%s` supplied to `maybe` combinator",c),c=c||"?"+g(a),d.meta={kind:"maybe",type:a,name:c},d.displayName=c,d.is=function(b){return y.is(b)||a.is(b)},d)}function p(a,c){function d(a){return h(this,d),b(d.is(a),"Invalid argument `value` = `%s` supplied to enums type `%s`, expected one of %j",a,c,e),a}b(D.is(a),"Invalid argument `map` = `%s` supplied to `enums` combinator",a),b(o(z).is(c),"Invalid argument `name` = `%s` supplied to `enums` combinator",c);var e=Object.keys(a);return c=c||e.map(function(a){return JSON.stringify(a)}).join(" | "),d.meta={kind:"enums",map:a,name:c},d.displayName=c,d.is=function(b){return z.is(b)&&a.hasOwnProperty(b)},d}function q(a,c){function e(b){return a.every(function(a,c){return a.is(b[c])})}function f(d,f){b(C.is(d)&&d.length===h,"Invalid argument `value` = `%s` supplied to tuple type `%s`, expected an `Arr` of length `%s`",d,c,h);var g=f!==!0;if(e(d)&&Object.isFrozen(d)===g)return d;for(var i=[],j=0;h>j;j++){var l=a[j],m=d[j];i.push(k(l,m,f))}return g&&Object.freeze(i),i}b(s(I).is(a),"Invalid argument `types` = `%s` supplied to `tuple` combinator",a);var h=a.length;return b(o(z).is(c),"Invalid argument `name` = `%s` supplied to `tuple` combinator",c),c=c||d("[%s]",a.map(g).join(", ")),f.meta={kind:"tuple",types:a,length:h,name:c},f.displayName=c,f.is=function(a){return C.is(a)&&a.length===h&&e(a)},f.update=function(a,b){return f(J.update(a,b))},f}function r(a,c,f){function i(d,e){h(this,i);var g=k(a,d,e);return b(c(g),"Invalid argument `value` = `%s` supplied to subtype type `%s`",d,f),g}return b(I.is(a),"Invalid argument `type` = `%s` supplied to `subtype` combinator",a),b(E.is(c),"Invalid argument `predicate` = `%s` supplied to `subtype` combinator",c),b(o(z).is(f),"Invalid argument `name` = `%s` supplied to `subtype` combinator",f),f=f||d("{%s | %s}",g(a),e(c)),i.meta={kind:"subtype",type:a,predicate:c,name:f},i.displayName=f,i.is=function(b){return a.is(b)&&c(b)},i.update=function(a,b){return i(J.update(a,b))},i}function s(a,c){function e(b){return b.every(a.is)}function f(d,f){b(C.is(d),"Invalid argument `value` = `%s` supplied to list type `%s`",d,c);var g=f!==!0;if(e(d)&&Object.isFrozen(d)===g)return d;for(var h=[],i=0,j=d.length;j>i;i++){var l=d[i];h.push(k(a,l,f))}return g&&Object.freeze(h),h}return b(I.is(a),"Invalid argument `type` = `%s` supplied to `list` combinator",a),b(o(z).is(c),"Invalid argument `name` = `%s` supplied to `list` combinator",c),c=c||d("Array<%s>",g(a)),f.meta={kind:"list",type:a,name:c},f.displayName=c,f.is=function(a){return C.is(a)&&e(a)},f.update=function(a,b){return f(J.update(a,b))},f}function t(a,c,e){function f(b){for(var d in b)if(b.hasOwnProperty(d)&&(!a.is(d)||!c.is(b[d])))return!1;return!0}function h(d,g){b(D.is(d),"Invalid argument `value` = `%s` supplied to dict type `%s`",d,e);var h=g!==!0;if(f(d)&&Object.isFrozen(d)===h)return d;var i={};for(var j in d)if(d.hasOwnProperty(j)){j=k(a,j);var l=d[j];i[j]=k(c,l,g)}return h&&Object.freeze(i),i}return b(I.is(a),"Invalid argument `domain` = `%s` supplied to `dict` combinator",a),b(I.is(c),"Invalid argument `codomain` = `%s` supplied to `dict` combinator",c),b(o(z).is(e),"Invalid argument `name` = `%s` supplied to `dict` combinator",e),e=e||d("{[key:%s]: %s}",g(a),g(c)),h.meta={kind:"dict",domain:a,codomain:c,name:e},h.displayName=e,h.is=function(a){return D.is(a)&&f(a)},h.update=function(a,b){return h(J.update(a,b))},h}function u(a){return E.is(a)&&D.is(a.type)}function v(a,c,f){function h(a){return u(a)?(b(h.is(a),"Invalid argument `value` = `%s` supplied to func type `%s`",a,f),a):h.of(a)}a=C.is(a)?a:[a],b(s(I).is(a),"Invalid argument `domain` = `%s` supplied to `func` combinator",a),b(I.is(c),"Invalid argument `codomain` = `%s` supplied to `func` combinator",c),b(o(z).is(f),"Invalid argument `name` = `%s` supplied to `func` combinator",f),f=f||d("(%s) => %s",a.map(g).join(", "),g(c));var i=a.length;return h.meta={kind:"func",domain:a,codomain:c,name:f},h.displayName=f,h.is=function(b){return u(b)&&b.type.domain.length===i&&b.type.domain.every(function(b,c){return b===a[c]})&&b.type.codomain===c},h.of=function(d){function f(){var b=w.call(arguments),e=b.length,f=q(a.slice(0,e));if(b=f(b),e===i)return k(c,d.apply(this,b));var g=Function.prototype.bind.apply(d,[this].concat(b)),h=v(a.slice(e),c);return h.of(g)}return b("function"==typeof d),h.is(d)?d:(f.type={domain:a,codomain:c,f:d},f.displayName=e(d),f)},h}var w=Array.prototype.slice;d.formatters={s:function(a){return String(a)},j:function(a){try{return JSON.stringify(a,f)}catch(b){return String(a)}}},j.commands={$apply:function(a,c){return b(E.is(a)),a(c)},$push:function(a,c){return b(C.is(a)),b(C.is(c)),c.concat(a)},$remove:function(a,c){b(C.is(a)),b(D.is(c));for(var d=0,e=a.length;e>d;d++)delete c[a[d]];return c},$set:function(a){return a},$splice:function(a,c){return b(s(C).is(a)),b(C.is(c)),a.reduce(function(a,b){return a.splice.apply(a,b),a},c)},$swap:function(a,c){b(D.is(a)),b(A.is(a.from)),b(A.is(a.to)),b(C.is(c));var d=c[a.to];return c[a.to]=c[a.from],c[a.from]=d,c},$unshift:function(a,c){return b(C.is(a)),b(C.is(c)),a.concat(c)},$merge:function(a,b){return c(c({},b),a,!0)}};var x=l("Any",function(){return!0}),y=l("Nil",function(a){return null===a||void 0===a}),z=l("Str",function(a){return"string"==typeof a}),A=l("Num",function(a){return"number"==typeof a&&isFinite(a)&&!isNaN(a)}),B=l("Bool",function(a){return a===!0||a===!1}),C=l("Arr",function(a){return a instanceof Array}),D=l("Obj",function(a){return!y.is(a)&&"object"==typeof a&&!C.is(a)}),E=l("Func",function(a){return"function"==typeof a}),F=l("Err",function(a){return a instanceof Error}),G=l("Re",function(a){return a instanceof RegExp}),H=l("Dat",function(a){return a instanceof Date}),I=l("Type",function(a){return E.is(a)&&D.is(a.meta)});p.of=function(a,b){a=z.is(a)?a.split(" "):a;var c={};return a.forEach(function(a){c[a]=a}),p(c,b)};var J={format:d,getFunctionName:e,getTypeName:g,mixin:c,slice:w,shallowCopy:i,update:j,assert:b,fail:a,Any:x,Nil:y,Str:z,Num:A,Bool:B,Arr:C,Obj:D,Func:E,Err:F,Re:G,Dat:H,Type:I,irreducible:l,struct:m,enums:p,union:n,maybe:o,tuple:q,subtype:r,list:s,dict:t,func:v};return J});
//# sourceMappingURL=tcomb.min.js.map

Sorry, the diff of this file is not supported yet

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