RAHHH
This commit is contained in:
16
backend/frontend/node_modules/tcomb/lib/isIdentity.js
generated
vendored
Normal file
16
backend/frontend/node_modules/tcomb/lib/isIdentity.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var assert = require('./assert');
|
||||
var Boolean = require('./Boolean');
|
||||
var isType = require('./isType');
|
||||
var getTypeName = require('./getTypeName');
|
||||
|
||||
// return true if the type constructor behaves like the identity function
|
||||
module.exports = function isIdentity(type) {
|
||||
if (isType(type)) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
assert(Boolean.is(type.meta.identity), function () { return 'Invalid meta identity ' + assert.stringify(type.meta.identity) + ' supplied to type ' + getTypeName(type); });
|
||||
}
|
||||
return type.meta.identity;
|
||||
}
|
||||
// for tcomb the other constructors, like ES6 classes, are identity-like
|
||||
return true;
|
||||
};
|
||||
Reference in New Issue
Block a user