New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

archetype-js

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archetype-js - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

2

package.json
{
"name": "archetype-js",
"version": "0.4.2",
"version": "0.4.3",
"author": "Valeri Karpov <val@boosterfuels.com>",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -48,1 +48,8 @@ # archetype

Archetypes are composable, inspectable, and extendable via `extends`.
The returned function can be called without "new" keyword
```javascript
const Person = new Archetype({name: 'string'}).compile('Person');
const p = Person({name: 'test'});
```

@@ -16,2 +16,5 @@ 'use strict';

const type = function(obj, projection) {
if (!(this instanceof type)) {
return new type(obj, projection);
}
Object.assign(this, unmarshal(_.cloneDeep(obj), _this, projection));

@@ -18,0 +21,0 @@ };

@@ -14,3 +14,3 @@ 'use strict';

}
return res
return res;
},

@@ -47,4 +47,8 @@ string: v => {

if (v == null) {
return
return;
}
if (type === 'number' && Number.isNaN(v)) {
return CAST_PRIMITIVES[type](v);
}
if (typeof v === type) {

@@ -51,0 +55,0 @@ return v;

@@ -538,2 +538,9 @@ 'use strict';

it('compiled function can be called without "new" keyword', function() {
const Person = new Archetype({
name: 'string'
}).compile('Person');
assert.ok(Person({}) instanceof Person);
});
it('validation with arrays and nested objects', function() {

@@ -601,2 +608,9 @@ const Band = new Archetype({

});
it('handles NaN', function() {
const Test = new Archetype({ num: 'number' }).compile('Test');
assert.throws(function() {
new Test({ num: 'a' * 2 });
}, /to number/);
});
});

@@ -603,0 +617,0 @@

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