Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quanstructor

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quanstructor - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "quanstructor",
"version": "0.3.0",
"version": "0.3.1",
"description": "Exceptionally powerful object model builder for complex architectures",

@@ -5,0 +5,0 @@ "keywords": [

@@ -109,4 +109,7 @@ let { defined } = require('./lib/Statics')

if ( this.specs[ prop ].Quanstructor )
return QUANSTRUCTORS[ this.specs[ prop ].Quanstructor ].validate( obj[prop] )
if ( this.specs[ prop ].Quanstructor ) {
return _.isArray( obj[ prop ] )
? obj[ prop ].map( (item) => { return QUANSTRUCTORS[ this.specs[ prop ].Quanstructor ].validate( item ) } )
: QUANSTRUCTORS[ this.specs[ prop ].Quanstructor ].validate( obj[prop] )
}

@@ -128,3 +131,5 @@ if ( !this.specs[ prop ].validation ) return

if ( this.specs[ attrib ].Quanstructor )
res[ attrib ] = await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].build( obj[ attrib ], projection, options )
res[ attrib ] = _.isArray( obj[ attrib ] ) ? await Promise.all(
obj[ attrib ].map( (item) => { return QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].build( item, projection, options ) } )
) : await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].build( obj[ attrib ], projection, options )
else {

@@ -178,6 +183,8 @@ let value = obj[attrib] || ( this.specs[ attrib ].hasOwnProperty('default') ? this.assigner.cloneObject( this.specs[ attrib ].default ) : v.defaultValue( this.specs[ attrib ].validation ) )

for (let attrib of this.views[ space ] ) {
if ( this.specs[ attrib ].Quanstructor )
res[ attrib ] = await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].proto( projection, options )
else {
let value = this.specs[ attrib ].hasOwnProperty('default') ? this.specs[ attrib ].default : v.defaultValue( this.specs[ attrib ].validation )
let value = this.specs[ attrib ].hasOwnProperty('default') ? this.specs[ attrib ].default : v.defaultValue( this.specs[ attrib ].validation )
if ( this.specs[ attrib ].Quanstructor ) {
res[ attrib ] = _.isArray( value )
? [ await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].proto( projection, options ) ]
: await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].proto( projection, options )
} else {
if ( this.specs[ attrib ]._allowNull || defined(value) )

@@ -184,0 +191,0 @@ ref[ attrib ] = value

@@ -61,7 +61,9 @@ const Quastructor = require( '../Quanstructor' )

employeeID: { validation: REQUIRED },
person: { space: SPACE_SUPP, Quanstructor: 'Person' }
person: { space: SPACE_SUPP, Quanstructor: 'Person' },
people: { default: [], space: SPACE_SUPP, Quanstructor: 'Person' }
} )
console.log( await Absoluter.build( {
employeeID: '121212',
person: PERSON_PROTO_DB
person: PERSON_PROTO_DB,
people: [ PERSON_PROTO_DB ]
} ) )

@@ -68,0 +70,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