ezobjects
Advanced tools
Comparing version 5.0.1 to 5.1.0
const docket = require(`docket-parser`); | ||
docket.title(`EZ Objects v5.0.1`); | ||
docket.title(`EZ Objects v5.1.0`); | ||
docket.linkClass(`text-success`); | ||
docket.parseFiles([`index.js`]); | ||
docket.generateDocs(`docs`); |
211
index.js
@@ -115,8 +115,27 @@ /** | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => isNaN(y) && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-numeric value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-numeric value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : parseInt(y)); | ||
let arr = x.map(y => y === null ? null : parseInt(y)); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setIntArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setIntArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setIntArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -128,8 +147,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => isNaN(y) && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-numeric value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-numeric value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : parseFloat(y)); | ||
let arr = x.map(y => y === null ? null : parseFloat(y)); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setFloatArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setFloatArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setFloatArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -141,8 +179,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => typeof y !== 'string' && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-string value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-string value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setStringArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setStringArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setStringArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -154,8 +211,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => typeof y !== 'boolean' && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-boolean value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-boolean value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : (y ? true : false)); | ||
let arr = x.map(y => y === null ? null : (y ? true : false)); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setBooleanArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setBooleanArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setBooleanArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -167,8 +243,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => typeof y !== 'function' && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-function value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-function value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setFunctionArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setFunctionArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setFunctionArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -180,8 +275,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => ( typeof y !== 'object' || y.constructor.name != 'Date' ) && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Date value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Date value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setDateArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setDateArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setDateArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -193,8 +307,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => ( typeof y !== 'object' || y.constructor.name != 'Buffer' ) && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Buffer value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Buffer value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setBufferArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setBufferArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setBufferArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -206,8 +339,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => ( typeof y !== 'object' || y.constructor.name != 'Set' ) && y !== null) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-string value passed to Array[${property.arrayOf.type}] setter.`); | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Set value passed as element of Array[${property.arrayOf.type}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${property.arrayOf.type}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setSetArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setSetArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setSetArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -219,8 +371,27 @@ | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed to 'Array' setter that doesn't allow nulls.`); | ||
else if ( !(x instanceof Array) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Non-Array value passed to 'Array' setter.`); | ||
else if ( x && x.some(y => y !== null && (typeof y !== 'object' || ( typeof property.arrayOf.type == 'string' && y.constructor.name != property.arrayOf.type ) || ( typeof property.arrayOf.instanceOf === 'string' && !module.exports.instanceOf(y, property.arrayOf.instanceOf) ))) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Invalid value passed to Array[${typeof property.arrayOf.type === 'string' ? property.arrayOf.type : property.arrayOf.instanceOf}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Invalid value passed as element of Array[${typeof property.arrayOf.type === 'string' ? property.arrayOf.type : property.arrayOf.instanceOf}] setter.`); | ||
else if ( x && x.some(y => y === null && !property.arrayOf.allowNull) ) | ||
throw new TypeError(`${property.className}.${property.name}(): Null value passed as element of 'Array[${typeof property.arrayOf.type === 'string' ? property.arrayOf.type : property.arrayOf.instanceOf}]' setter that doesn't allow null elements.`); | ||
return x === null ? null : x.map(y => y === null ? null : y); | ||
let arr = x.map(y => y === null ? null : y); | ||
Object.defineProperty(arr, 'push', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.push(x); this.splice(0, this.length); this.push(setOtherArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'unshift', { | ||
enumerable: false, | ||
value: function (x) { const newArr = Array.from(this); newArr.unshift(x); this.splice(0, this.length); this.push(setOtherArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
Object.defineProperty(arr, 'fill', { | ||
enumerable: false, | ||
value: function (x, y, z) { const newArr = Array.from(this); newArr.fill(x, y, z); this.splice(0, this.length); this.push(setOtherArrayTransform(newArr, property)); return this.length; } | ||
}); | ||
return x === null ? null : arr; | ||
}; | ||
@@ -227,0 +398,0 @@ |
{ | ||
"name": "ezobjects", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Easy Auto-Generated Strictly-Typed JavaScript Class Objects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# EZ Objects v5.0.1 | ||
# EZ Objects v5.1.0 | ||
@@ -3,0 +3,0 @@ EZ Objects is a Node.js module (that can also be usefully browserify'd) that aims to save you lots of time |
Sorry, the diff of this file is not supported yet
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
353056
1803