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.2.5 to 0.3.0

2

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

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

@@ -15,2 +15,3 @@ let { defined } = require('./lib/Statics')

const DEFINITIONS = { }
const QUANSTRUCTORS = { }

@@ -56,2 +57,3 @@ let PROPERTIES_TO_IGNORE = [ '_allowNull', '_reform', '_preserve', '_derivations' ]

DEFINITIONS[ this.name ] = this.specs
QUANSTRUCTORS[ this.name ] = this
return this

@@ -107,4 +109,9 @@ },

for (let prop in obj) {
if ( !this.specs[ prop ] || !this.specs[ prop ].validation ) continue
if ( !this.specs[ prop ] ) continue
if ( this.specs[ prop ].Quanstructor )
return QUANSTRUCTORS[ this.specs[ prop ].Quanstructor ].validate( obj[prop] )
if ( !this.specs[ prop ].validation ) return
let res = v.validate( obj[prop], this.specs[ prop ].validation )

@@ -122,5 +129,9 @@ if (res && Object.keys(res).length > 0 )

for (let attrib of this.attributes) {
let value = obj[attrib] || ( this.specs[ attrib ].hasOwnProperty('default') ? this.assigner.cloneObject( this.specs[ attrib ].default ) : v.defaultValue( this.specs[ attrib ].validation ) )
if ( this.specs[ attrib ]._allowNull || defined(value) )
res[ attrib ] = value
if ( this.specs[ attrib ].Quanstructor )
res[ attrib ] = await QUANSTRUCTORS[ this.specs[ attrib ].Quanstructor ].build( obj[ attrib ], projection, options )
else {
let value = obj[attrib] || ( this.specs[ attrib ].hasOwnProperty('default') ? this.assigner.cloneObject( this.specs[ attrib ].default ) : v.defaultValue( this.specs[ attrib ].validation ) )
if ( this.specs[ attrib ]._allowNull || defined(value) )
res[ attrib ] = value
}
}

@@ -169,5 +180,9 @@ for (let space of this.projections[ projection ] ) {

for (let attrib of this.views[ space ] ) {
let value = this.specs[ attrib ].hasOwnProperty('default') ? this.specs[ attrib ].default : v.defaultValue( this.specs[ attrib ].validation )
if ( this.specs[ attrib ]._allowNull || defined(value) )
ref[ attrib ] = value
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 )
if ( this.specs[ attrib ]._allowNull || defined(value) )
ref[ attrib ] = value
}
}

@@ -174,0 +189,0 @@ }

@@ -57,2 +57,13 @@ const Quastructor = require( '../Quanstructor' )

} )
it('Embed Data', async function () {
let Absoluter = Quastructor.newQuanstructor( 'Employee', {
employeeID: { validation: REQUIRED },
person: { space: SPACE_SUPP, Quanstructor: 'Person' }
} )
console.log( await Absoluter.build( {
employeeID: '121212',
person: PERSON_PROTO_DB
} ) )
} )
} )

@@ -59,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