intertype
Advanced tools
Comparing version 0.107.0 to 0.108.0
@@ -350,6 +350,6 @@ (function() { | ||
freeze: false, // refers to result of `type.create()` | ||
extras: true // refers to result of `type.create()` | ||
extras: true, // refers to result of `type.create()` | ||
override: false | ||
}; | ||
//----------------------------------------------------------------------------------------------------------- | ||
@@ -356,0 +356,0 @@ this.types.declare('Intertype_iterable', function(x) { |
@@ -32,5 +32,12 @@ (function() { | ||
constructor(cfg) { | ||
var clone, dsc, other, ref1, type; | ||
super(); | ||
this.type_of = this.type_of.bind(this); | ||
this.data = {}; | ||
//....................................................................................................... | ||
clone = false; | ||
if (cfg instanceof this.constructor) { | ||
clone = true; | ||
[cfg, other] = [{...cfg.cfg}, cfg]; | ||
} | ||
GUY.props.hide(this, 'cfg', {...H.defaults.Intertype_constructor_cfg, ...cfg}); | ||
@@ -66,3 +73,28 @@ H.types.validate.Intertype_constructor_cfg(this.cfg); | ||
this._register_hedges(); | ||
DECLARATIONS._provisional_declare_basic_types(this); | ||
//....................................................................................................... | ||
if (clone) { | ||
ref1 = other.registry; | ||
for (type in ref1) { | ||
dsc = ref1[type]; | ||
if (GUY.props.has(this.registry, type)) { | ||
continue; | ||
} | ||
/* TAINT this is a kludge */ | ||
this.declare[type]({ | ||
isa: dsc, | ||
name: GUY.props.get(dsc, 'name', H.defaults.Type_factory_type_dsc.name), | ||
typename: GUY.props.get(dsc, 'typename', H.defaults.Type_factory_type_dsc.typename), | ||
fields: GUY.props.get(dsc, 'fields', H.defaults.Type_factory_type_dsc.fields), | ||
collection: GUY.props.get(dsc, 'collection', H.defaults.Type_factory_type_dsc.collection), | ||
create: GUY.props.get(dsc, 'create', H.defaults.Type_factory_type_dsc.create), | ||
freeze: GUY.props.get(dsc, 'freeze', H.defaults.Type_factory_type_dsc.freeze), | ||
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), | ||
override: GUY.props.get(dsc, 'override', H.defaults.Type_factory_type_dsc.override) | ||
}); | ||
} | ||
} else { | ||
DECLARATIONS._provisional_declare_basic_types(this); | ||
} | ||
//....................................................................................................... | ||
return void 0; | ||
@@ -69,0 +101,0 @@ } |
{ | ||
"name": "intertype", | ||
"version": "0.107.0", | ||
"version": "0.108.0", | ||
"description": "A JavaScript typechecker", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -734,2 +734,4 @@ | ||
consumer can perform additional checking in `isa()` knowing that the general shape of the value is | ||
conformant. | ||
conformant. | ||
* **[+]** implement `override` option for `declare` to cause types that take precedence over others when | ||
using `type_of()` |
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
347387
1844
737