Socket
Socket
Sign inDemoInstall

intertype

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intertype - npm Package Compare versions

Comparing version 0.117.0 to 0.118.0

37

lib/main.js

@@ -456,3 +456,3 @@ (function() {

_create(type, cfg) {
var R, create, ref1, t, type_dsc;
var create, template, type_dsc;
create = null;

@@ -467,15 +467,26 @@ //.......................................................................................................

if ((create = GUY.props.get(type_dsc, 'create', null)) === null) {
if ((R = GUY.props.get(type_dsc, 'template', H.signals.nothing)) === H.signals.nothing) {
if ((template = 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`);
}
}
//.......................................................................................................
return this._validate(type, this._create_no_validation({
create,
template,
freeze: type_dsc.freeze,
cfg
}));
}
//---------------------------------------------------------------------------------------------------------
_create_no_validation({create, template, freeze, cfg}) {
var R, t;
//.......................................................................................................
if (create != null) {
R = create.call(this, cfg);
} else {
/* If `create` is given, call it to obtain template value: */
//.......................................................................................................
R = create.call(this, cfg);
}
//.......................................................................................................
if (create == null) {
if (cfg != null) {
if ((t = H.js_type_of(R)) === '[object Object]' || t === '[object Array]') {
R = Object.assign(H.deep_copy(R), cfg);
if ((t = H.js_type_of(template)) === '[object Object]' || t === '[object Array]') {
R = Object.assign(H.deep_copy(template), cfg);
} else {

@@ -485,13 +496,13 @@ R = cfg;

} else {
R = H.deep_copy(R);
R = H.deep_copy(template);
}
}
//.......................................................................................................
if ((ref1 = type_dsc.freeze) === true || ref1 === 'shallow') {
if (freeze === true || freeze === 'shallow') {
R = Object.freeze(R);
} else if (type_dsc.freeze === 'deep') {
} else if (freeze === 'deep') {
R = GUY.lft.freeze(H.deep_copy(R));
}
//.......................................................................................................
return this._validate(type, R);
return R;
}

@@ -498,0 +509,0 @@

{
"name": "intertype",
"version": "0.117.0",
"version": "0.118.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

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