intertype
Advanced tools
Comparing version 203.0.0 to 203.1.0
(function() { | ||
'use strict'; | ||
var E, Intertype, Intertype_minimal, WG, _TMP_basetype_names, _TMP_basetype_names_matcher, _TMP_isa_minimal_type/* TAINT unfortunate choice of name */, _TMP_minimal_types, __type_of, _isa, basetypes, debug, deepmerge, default_declarations, default_types, hide, nameit, rpr, set, types, walk_prefixes, | ||
var E, Intertype, Intertype_minimal, WG, _TMP_basetype_names, _TMP_basetype_names_matcher, _TMP_isa_minimal_type/* TAINT unfortunate choice of name */, _TMP_minimal_types, __type_of, _context_from_test_method_map, _isa, basetypes, debug, deepmerge, default_declarations, default_types, hide, nameit, rpr, set, types, walk_prefixes, | ||
modulo = function(a, b) { return (+a % (b = +b) + b) % b; }; | ||
@@ -453,3 +453,3 @@ | ||
if (!_isa.object(collection)) { | ||
throw new E.Intertype_validation_error('^declare@1^', 'object', __type_of(_isa, collection)); | ||
throw new E.Intertype_validation_error('^declare@1^', 'object', __type_of(this, _isa, collection)); | ||
} | ||
@@ -622,3 +622,3 @@ for (type in collection) { | ||
//..................................................................................................... | ||
throw new E.Intertype_wrong_type_for_test_method('^_compile_declaration_object@4^', __type_of(_isa, R.test)); | ||
throw new E.Intertype_wrong_type_for_test_method('^_compile_declaration_object@4^', __type_of(this, _isa, R.test)); | ||
} | ||
@@ -634,3 +634,3 @@ //....................................................................................................... | ||
if (!_isa.function(x)) { | ||
throw new E.Intertype_test_must_be_function('^_validate_test_method@1^', type, __type_of(_isa, x)); | ||
throw new E.Intertype_test_must_be_function('^_validate_test_method@1^', type, __type_of(this, _isa, x)); | ||
} | ||
@@ -647,3 +647,3 @@ if (x.length !== 1) { | ||
if (!_isa.text(type)) { | ||
throw new E.Intertype_internal_error('^_extract_first_basetype_name@1^', `expected text, got a ${__type_of(_isa, type)}`); | ||
throw new E.Intertype_internal_error('^_extract_first_basetype_name@1^', `expected text, got a ${__type_of(this, _isa, type)}`); | ||
} | ||
@@ -839,3 +839,3 @@ if ((match = type.match(_TMP_basetype_names_matcher)) == null) { | ||
} | ||
throw new E.Intertype_validation_error(`^${method_name}@1^`, type, __type_of(_isa, x)); | ||
throw new E.Intertype_validation_error(`^${method_name}@1^`, type, __type_of(this, _isa, x)); | ||
}); | ||
@@ -857,3 +857,3 @@ } | ||
} | ||
throw new E.Intertype_optional_validation_error(`^${method_name}@1^`, type, __type_of(_isa, x)); | ||
throw new E.Intertype_optional_validation_error(`^${method_name}@1^`, type, __type_of(this, _isa, x)); | ||
}); | ||
@@ -875,3 +875,3 @@ } | ||
} | ||
return __type_of(this._tests_for_type_of, x); | ||
return __type_of(this, this._tests_for_type_of, x); | ||
} | ||
@@ -913,3 +913,3 @@ | ||
method_name = `create_${type}`; | ||
// debug '^3234^', declaration, { use_assign, type: ( __type_of _isa, ) } if declaration.type is 'q' | ||
// debug '^3234^', declaration, { use_assign, type: ( __type_of @, _isa, ) } if declaration.type is 'q' | ||
//....................................................................................................... | ||
@@ -985,3 +985,8 @@ if (_isa.function(template)) { | ||
//=========================================================================================================== | ||
__type_of = function(test_method_map, x) { | ||
_context_from_test_method_map = function(map) { | ||
return null; | ||
}; | ||
//=========================================================================================================== | ||
__type_of = function(ctx, test_method_map, x) { | ||
var test, type; | ||
@@ -994,5 +999,8 @@ if (x === null) { | ||
} | ||
if (ctx == null) { | ||
ctx = _context_from_test_method_map(test_method_map); | ||
} | ||
for (type in test_method_map) { | ||
test = test_method_map[type]; | ||
if (test(x)) { | ||
if (test.call(ctx, x)) { | ||
return type; | ||
@@ -1014,3 +1022,3 @@ } | ||
if (!_isa.object(p)) { | ||
throw new E.Intertype_wrong_type("^deepmerge@1^", 'an object', __type_of(_isa, p)); | ||
throw new E.Intertype_wrong_type("^deepmerge@1^", 'an object', __type_of(null, _isa, p)); | ||
} | ||
@@ -1034,3 +1042,3 @@ for (key in p) { | ||
if (!_isa.text(fq_name)) { | ||
throw new E.Intertype_wrong_type("^walk_prefixes@1^", 'a text', __type_of(_isa, p)); | ||
throw new E.Intertype_wrong_type("^walk_prefixes@1^", 'a text', __type_of(null, _isa, p)); | ||
} | ||
@@ -1037,0 +1045,0 @@ parts = fq_name.split('.'); |
{ | ||
"name": "intertype", | ||
"version": "203.0.0", | ||
"version": "203.1.0", | ||
"description": "A JavaScript typechecker", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
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
194042
1184