Comparing version 1.9.8 to 2.0.0
@@ -161,28 +161,7 @@ /** | ||
} | ||
/** | ||
* @param {Object} [prototype] | ||
* @param {Object[]} fields | ||
* @returns {Object} | ||
**/ | ||
function ObjectGenerate(prototype, ...fields) { | ||
let object; | ||
if ( fields.length >= 2 ) { | ||
object = Object.create(fields[0]); | ||
fields = fields.slice(1); | ||
function ObjectGenerate(field, prototype=null) { | ||
const object = Object.create(prototype); | ||
if ( Object(field) === field ) { | ||
Object.assign(object, field); | ||
} | ||
else { | ||
object = Object.create(null); | ||
fields.push(prototype); | ||
} | ||
for ( const carrier of fields ) { | ||
if ( carrier === null || carrier === undefined ) | ||
continue; | ||
if ( Object(carrier) === carrier ) { | ||
Object.assign(object, carrier); | ||
} | ||
} | ||
return object; | ||
@@ -189,0 +168,0 @@ } |
{ | ||
"name": "extes", | ||
"version": "1.9.8", | ||
"version": "2.0.0", | ||
"description": "A tiny library that extends native js with some handy tools", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
33307
1134