quanstructor
Advanced tools
Comparing version 0.2.0 to 0.2.5
{ | ||
"name": "quanstructor", | ||
"version": "0.2.0", | ||
"version": "0.2.5", | ||
"description": "Exceptionally powerful object model builder for complex architectures", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,2 +12,4 @@ let { defined } = require('./lib/Statics') | ||
const PRIMUS = 'PRIMUS' | ||
const DEFINITIONS = { } | ||
@@ -17,4 +19,2 @@ | ||
let _preserve, _reform | ||
function Quanstructor (name, specs = {}, ...derivations) { | ||
@@ -27,8 +27,8 @@ this.assigner = new Assigner() | ||
this._derivations = derivations | ||
this._derivations = [PRIMUS] | ||
this._derivations.push( ...derivations ) | ||
this.specs = { } | ||
this.expand( ...derivations ) | ||
this.expand( ...this._derivations ) | ||
this.expand( specs ) | ||
@@ -135,8 +135,7 @@ | ||
if ( !options.ignorePreserve ) { | ||
if ( _preserve ) await _preserve( res, options ) | ||
for ( let sup of this._derivations ) | ||
if ( DEFINITIONS[ sup ] && DEFINITIONS[ sup ]._preserve ) | ||
await DEFINITIONS[ sup ]._preserve( res, options ) | ||
if ( this.specs._preserve ) await this.specs._preserve( res, options ) | ||
await DEFINITIONS[ sup ]._preserve( res, projection, options ) | ||
if ( this.specs._preserve ) | ||
await this.specs._preserve( res, projection, options ) | ||
} | ||
@@ -177,8 +176,6 @@ | ||
if ( !options.ignoreReform ) { | ||
if ( _reform ) await _reform( res, options ) | ||
for ( let sup of this._derivations ) | ||
if ( DEFINITIONS[ sup ] && DEFINITIONS[ sup ]._reform ) | ||
await DEFINITIONS[ sup ]._reform( res, options ) | ||
if ( this.specs._reform ) await this.specs._reform( res, options ) | ||
await DEFINITIONS[ sup ]._reform( res, projection, options ) | ||
if ( this.specs._reform ) await this.specs._reform( res, projection, options ) | ||
} | ||
@@ -204,8 +201,6 @@ | ||
if ( !options.ignoreReform ) { | ||
if ( _reform ) await _reform( res, options ) | ||
for ( let sup of this._derivations ) | ||
if ( DEFINITIONS[ sup ] && DEFINITIONS[ sup ]._reform ) | ||
await DEFINITIONS[ sup ]._reform( res, options ) | ||
if ( this.specs._reform ) await this.specs._reform( res, options ) | ||
await DEFINITIONS[ sup ]._reform( res, projection, options ) | ||
if ( this.specs._reform ) await this.specs._reform( res, projection, options ) | ||
} | ||
@@ -220,9 +215,6 @@ | ||
DEFINITIONS, | ||
reform ( _fn ) { | ||
_reform = _fn | ||
addPrimus (specs = {}) { | ||
DEFINITIONS[ PRIMUS ] = specs | ||
}, | ||
preserve (_fn) { | ||
_preserve = _fn | ||
}, | ||
addProto (name, specs) { | ||
addProto (name, specs = {}) { | ||
DEFINITIONS[ name ] = specs | ||
@@ -229,0 +221,0 @@ }, |
@@ -37,3 +37,3 @@ const Quastructor = require( '../Quanstructor' ) | ||
it('Define Data', async function () { | ||
let Absoluter = Quastructor.newAbsoluter( 'Person', { | ||
let Absoluter = Quastructor.newQuanstructor( 'Person', { | ||
passportID: { spaces: [ 'database', 'secret' ], validation: REQUIRED }, | ||
@@ -56,3 +56,3 @@ address: { space: SPACE_SUPP, default: { street: '', county: '', country: '', postal: '' }, validation: { | ||
console.log( await Absoluter.build( PERSON_PROTO_DB, 'database' ) ) | ||
console.log( await Absoluter.derive( PERSON_PROTO_DB, 'database' ) ) | ||
console.log( await Absoluter.derive( PERSON_PROTO_DB, 'database', 'secret' ) ) | ||
} ) | ||
@@ -59,0 +59,0 @@ } ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16087
451