ezobjects
Advanced tools
Comparing version 0.6.2 to 0.6.3
const ezobjects = require('./index'); | ||
/** Create a customized object on the global (node) or window (browser) namespace, complete with constructor/init/getters/setters */ | ||
/** Create a customized object on the global (node) or window (browser) namespace */ | ||
ezobjects({ | ||
name: 'DatabaseRecord', | ||
fields: [ | ||
properties: [ | ||
{ name: 'id', type: 'int' } | ||
@@ -20,3 +20,3 @@ ] | ||
extends: DatabaseRecord, | ||
fields: [ | ||
properties: [ | ||
{ name: 'firstName', type: 'string' }, | ||
@@ -23,0 +23,0 @@ { name: 'lastName', type: 'string' }, |
14
index.js
@@ -28,3 +28,3 @@ /** | ||
/** Loop through each field in the obj */ | ||
obj.fields.forEach((col) => { | ||
obj.properties.forEach((col) => { | ||
/** Initialize 'int' and 'float' types to zero */ | ||
@@ -54,4 +54,4 @@ if ( col.type == 'int' || col.type == 'float' ) | ||
/** Loop through each field in the obj */ | ||
obj.fields.forEach((col) => { | ||
/** For 'int' type fields */ | ||
obj.properties.forEach((col) => { | ||
/** For 'int' type properties */ | ||
if ( col.type == 'int' ) { | ||
@@ -76,3 +76,3 @@ parent[obj.name].prototype[col.name] = function (arg) { | ||
/** For 'float' type fields */ | ||
/** For 'float' type properties */ | ||
else if ( col.type == 'float' ) { | ||
@@ -97,3 +97,3 @@ parent[obj.name].prototype[col.name] = function (arg) { | ||
/** For 'boolean' type fields */ | ||
/** For 'boolean' type properties */ | ||
else if ( col.type == 'boolean' ) { | ||
@@ -118,3 +118,3 @@ parent[obj.name].prototype[col.name] = function (arg) { | ||
/** For 'string' type fields */ | ||
/** For 'string' type properties */ | ||
else if ( col.type == 'string' ) { | ||
@@ -139,3 +139,3 @@ parent[obj.name].prototype[col.name] = function (arg) { | ||
/** For 'Array' type fields */ | ||
/** For 'Array' type properties */ | ||
else if ( col.type == 'Array' ) { | ||
@@ -142,0 +142,0 @@ parent[obj.name].prototype[col.name] = function (arg) { |
{ | ||
"name": "ezobjects", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "Easy dynamic object generation with strict typing and set chaining", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# EZ Objects v0.6.2 | ||
# EZ Objects v0.6.3 | ||
@@ -12,3 +12,3 @@ Under development, but completely useable. | ||
* extends - An object that you wish the class to extend from (optional, note this is the class itself, not the name) | ||
* fields - An array of fields (properties) that the class will have getters/setters/initialization for (optional) | ||
* properties - An array of properties for which the class will have getters/setters/initialization implemented (optional) | ||
@@ -41,6 +41,6 @@ Each field in the array is an object that can have the following keys: | ||
/** Create a customized object on the global (node) or window (browser) namespace, complete with constructor/init/getters/setters */ | ||
/** Create a customized object on the global (node) or window (browser) namespace */ | ||
ezobjects({ | ||
name: 'DatabaseRecord', | ||
fields: [ | ||
properties: [ | ||
{ name: 'id', type: 'int' } | ||
@@ -59,3 +59,3 @@ ] | ||
extends: DatabaseRecord, | ||
fields: [ | ||
properties: [ | ||
{ name: 'firstName', type: 'string' }, | ||
@@ -62,0 +62,0 @@ { name: 'lastName', type: 'string' }, |
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
14057