intertype
Advanced tools
Comparing version 0.114.0 to 0.115.0
@@ -13,3 +13,3 @@ (function() { | ||
}, | ||
default: null | ||
template: null | ||
}); | ||
@@ -21,3 +21,3 @@ //......................................................................................................... | ||
}, | ||
default: void 0 | ||
template: void 0 | ||
}); | ||
@@ -29,3 +29,3 @@ //......................................................................................................... | ||
}, | ||
default: void 0 | ||
template: void 0 | ||
}); | ||
@@ -52,3 +52,3 @@ //--------------------------------------------------------------------------------------------------------- | ||
}, | ||
default: '' | ||
template: '' | ||
}); | ||
@@ -60,3 +60,3 @@ //......................................................................................................... | ||
}, | ||
default: '\x00' | ||
template: '\x00' | ||
}); | ||
@@ -68,3 +68,3 @@ //......................................................................................................... | ||
}, | ||
default: '\x00' | ||
template: '\x00' | ||
}); | ||
@@ -76,3 +76,3 @@ //......................................................................................................... | ||
}, | ||
default: new RegExp('') | ||
template: new RegExp('') | ||
}); | ||
@@ -96,3 +96,3 @@ //......................................................................................................... | ||
}, | ||
default: [] | ||
template: [] | ||
}); | ||
@@ -115,3 +115,3 @@ //......................................................................................................... | ||
}, | ||
default: [] | ||
template: [] | ||
}); | ||
@@ -123,3 +123,3 @@ //......................................................................................................... | ||
}, | ||
default: [] | ||
template: [] | ||
}); | ||
@@ -131,3 +131,3 @@ //......................................................................................................... | ||
}, | ||
default: [] | ||
template: [] | ||
}); | ||
@@ -141,3 +141,3 @@ //--------------------------------------------------------------------------------------------------------- | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
@@ -149,3 +149,3 @@ //......................................................................................................... | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
@@ -157,3 +157,3 @@ //......................................................................................................... | ||
}, | ||
default: 0n | ||
template: 0n | ||
}); | ||
@@ -165,3 +165,3 @@ //......................................................................................................... | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
@@ -173,3 +173,3 @@ //......................................................................................................... | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
@@ -181,3 +181,3 @@ //......................................................................................................... | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
@@ -189,3 +189,3 @@ //......................................................................................................... | ||
}, | ||
default: 0/0 | ||
template: 0/0 | ||
}); | ||
@@ -197,7 +197,7 @@ //......................................................................................................... | ||
}, | ||
default: 0 | ||
template: 0 | ||
}); | ||
//......................................................................................................... | ||
declare.even({ | ||
default: 0, | ||
template: 0, | ||
isa: function(x) { | ||
@@ -214,3 +214,3 @@ if (Number.isInteger(x)) { | ||
declare.odd({ | ||
default: 1, | ||
template: 1, | ||
isa: function(x) { | ||
@@ -232,3 +232,3 @@ if (Number.isInteger(x)) { | ||
}, | ||
default: false | ||
template: false | ||
}); | ||
@@ -240,3 +240,3 @@ //......................................................................................................... | ||
}, | ||
default: {} | ||
template: {} | ||
}); | ||
@@ -248,3 +248,3 @@ //......................................................................................................... | ||
}, | ||
default: function() {} | ||
template: function() {} | ||
}); | ||
@@ -258,3 +258,3 @@ //......................................................................................................... | ||
}); | ||
// default: -> | ||
// template: -> | ||
//......................................................................................................... | ||
@@ -265,3 +265,3 @@ declare.asyncfunction({ | ||
}, | ||
default: function() {} | ||
template: function() {} | ||
}); | ||
@@ -273,3 +273,3 @@ //......................................................................................................... | ||
}, | ||
default: Symbol(''), | ||
template: Symbol(''), | ||
create: function(x) { | ||
@@ -276,0 +276,0 @@ return Symbol(x); |
@@ -246,4 +246,4 @@ (function() { | ||
}, | ||
"if extras is false, default must be an object": function(x) { | ||
return x.extras || (this.isa.object(x.default)); | ||
"if extras is false, template must be an object": function(x) { | ||
return x.extras || (this.isa.object(x.template)); | ||
}, | ||
@@ -286,3 +286,3 @@ "@isa_optional.function x.create": function(x) { | ||
test: null, | ||
/* `default` omitted on purpose */ | ||
/* `template` omitted on purpose */ | ||
create: null, | ||
@@ -331,4 +331,4 @@ // copy: false | ||
}, | ||
"if extras is false, default must be an object": function(x) { | ||
return x.extras || (this.isa.object(x.default)); | ||
"if extras is false, template must be an object": function(x) { | ||
return x.extras || (this.isa.object(x.template)); | ||
}, | ||
@@ -354,3 +354,3 @@ "@isa_optional.function x.create": function(x) { | ||
collection: false, | ||
/* `default` omitted on purpose */ | ||
/* `template` omitted on purpose */ | ||
create: null, // refers to result of `type.create()` | ||
@@ -357,0 +357,0 @@ // copy: false # refers to result of `type.create()` |
@@ -95,3 +95,3 @@ (function() { | ||
extras: GUY.props.get(dsc, 'extras', H.defaults.Type_factory_type_dsc.extras), | ||
default: GUY.props.get(dsc, 'default', H.defaults.Type_factory_type_dsc.default), | ||
template: GUY.props.get(dsc, 'template', H.defaults.Type_factory_type_dsc.template), | ||
override: GUY.props.get(dsc, 'override', H.defaults.Type_factory_type_dsc.override) | ||
@@ -109,3 +109,3 @@ }); | ||
_initialize_state(cfg) { | ||
/* TAINT should use deep copy of default object */ | ||
/* TAINT should use deep copy of template object */ | ||
return this.state = { | ||
@@ -465,10 +465,10 @@ ...H.defaults.Intertype_state, | ||
//....................................................................................................... | ||
/* Try to get `create` method, or, should that fail, the `default` value. Throw error when neither | ||
`create` nor `default` are given: */ | ||
/* Try to get `create` method, or, should that fail, the `template` value. Throw error when neither | ||
`create` nor `template` are given: */ | ||
if ((create = GUY.props.get(type_dsc, 'create', null)) === null) { | ||
if ((R = GUY.props.get(type_dsc, 'default', H.signals.nothing)) === H.signals.nothing) { | ||
throw new E.Intertype_ETEMPTBD('^intertype.create@12^', `type ${rpr(type)} does not have a \`default\` value or a \`create()\` method`); | ||
if ((R = GUY.props.get(type_dsc, 'template', H.signals.nothing)) === H.signals.nothing) { | ||
throw new E.Intertype_ETEMPTBD('^intertype.create@12^', `type ${rpr(type)} does not have a \`template\` value or a \`create()\` method`); | ||
} | ||
} else { | ||
/* If `create` is given, call it to obtain default value: */ | ||
/* If `create` is given, call it to obtain template value: */ | ||
//....................................................................................................... | ||
@@ -475,0 +475,0 @@ R = create.call(this, cfg); |
@@ -312,4 +312,4 @@ (function() { | ||
_create_has_extras(dsc) { | ||
var R, default_keys; | ||
default_keys = new Set(Object.keys(dsc.default)); | ||
var R, default_keys, ref; | ||
default_keys = new Set(Object.keys((ref = dsc.template) != null ? ref : dsc.default)); | ||
R = function(x) { | ||
@@ -316,0 +316,0 @@ var extra_keys, x_keys; |
{ | ||
"name": "intertype", | ||
"version": "0.114.0", | ||
"version": "0.115.0", | ||
"description": "A JavaScript typechecker", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -638,4 +638,2 @@ | ||
should return `null` | ||
* **[–]** change `default` to `defaults` (as in, 'field defaults') to avoid clash with JS reserved word. | ||
Alternative: <del>`paragon`</del> <ins>`template`</ins> | ||
* **[–]** do not use `$`-prefixed fieldnames, define fields in `fields` sub-object | ||
@@ -756,1 +754,3 @@ * **[–]** allow list as enumeration of allowed values as in `color: [ 'red', 'green', 'blue', ]` | ||
that way we don't need yet another cfg setting and can still handle precedence of overrides | ||
* **[+]** change `default` to <del>`defaults` (as in, 'field defaults') to avoid clash with JS reserved word. | ||
Alternative: `paragon`</del> <ins>`template`</ins> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
361456