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 3.2.4 to 3.2.5

5

CHANGELOG.md

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

# v3.2.5
- **Polish**
- prevent bugs when enums are defined through `t.declare` (@gcanti)
# v3.2.4

@@ -17,0 +22,0 @@

2

lib/create.js

@@ -9,3 +9,3 @@ var isType = require('./isType');

if (isType(type)) {
return type.meta.identity ? type(value, path): new type(value, path);
return !type.meta.identity && typeof value === 'object' ? new type(value, path): type(value, path);
}

@@ -12,0 +12,0 @@

@@ -39,4 +39,3 @@ var assert = require('./assert');

}
// ensure identity is still false
Declare.meta.identity = false;
Declare.meta.identity = type.meta.identity;
Declare.prototype = type.prototype;

@@ -43,0 +42,0 @@ return Declare;

@@ -8,2 +8,3 @@ var assert = require('./assert');

var getTypeName = require('./getTypeName');
var isIdentity = require('./isIdentity');

@@ -22,2 +23,3 @@ function getDefaultName(types) {

var displayName = name || getDefaultName(types);
var identity = types.every(isIdentity);

@@ -27,3 +29,5 @@ function Intersection(value, path) {

if (process.env.NODE_ENV !== 'production') {
forbidNewOperator(this, Intersection);
if (identity) {
forbidNewOperator(this, Intersection);
}
path = path || [displayName];

@@ -40,3 +44,3 @@ assert(Intersection.is(value), function () { return 'Invalid value ' + assert.stringify(value) + ' supplied to ' + path.join('/'); });

name: name,
identity: true
identity: identity
};

@@ -43,0 +47,0 @@

@@ -5,2 +5,3 @@ var assert = require('./assert');

var isMaybe = require('./isMaybe');
var isIdentity = require('./isIdentity');
var Any = require('./Any');

@@ -29,6 +30,9 @@ var create = require('./create');

var displayName = name || getDefaultName(type);
var identity = isIdentity(type);
function Maybe(value, path) {
if (process.env.NODE_ENV !== 'production') {
forbidNewOperator(this, Maybe);
if (identity) {
forbidNewOperator(this, Maybe);
}
}

@@ -42,3 +46,3 @@ return Nil.is(value) ? value : create(type, value, path);

name: name,
identity: true
identity: identity
};

@@ -45,0 +49,0 @@

@@ -29,3 +29,5 @@ var assert = require('./assert');

if (process.env.NODE_ENV !== 'production') {
forbidNewOperator(this, Refinement);
if (identity) {
forbidNewOperator(this, Refinement);
}
path = path || [displayName];

@@ -32,0 +34,0 @@ }

@@ -42,3 +42,5 @@ var assert = require('./assert');

if (process.env.NODE_ENV !== 'production') {
forbidNewOperator(this, Union);
if (identity) {
forbidNewOperator(this, Union);
}
path = path || [displayName];

@@ -45,0 +47,0 @@ assert(isType(type), function () { return 'Invalid value ' + assert.stringify(value) + ' supplied to ' + path.join('/') + ' (no constructor returned by dispatch)'; });

{
"name": "tcomb",
"version": "3.2.4",
"version": "3.2.5",
"description": "Type checking and DDD for JavaScript",

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

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