Comparing version 1.0.5 to 1.0.6
@@ -12,8 +12,13 @@ /** | ||
Object.defineProperties = ObjectDefineProperties; | ||
Object.assignProperties = ObjectAssignProperties; | ||
Object.merge = ObjectMerge; | ||
Object.generate = ObjectGenerate; | ||
Object.typeof = TypeOf; | ||
Object.assignConstant = function(dst, src){ | ||
return ObjectAssignProperties(dst, src); | ||
}; | ||
function ObjectDefineProperty(object, prop_name, prop_attr) { | ||
@@ -27,2 +32,18 @@ _ObjectDefineProperty(object, prop_name, prop_attr); | ||
} | ||
function ObjectAssignProperties(object, props, attr={configurable:false, enumerable:false, writable:false}) { | ||
for( const prop in props ) { | ||
if ( (props.hasOwnProperty && !props.hasOwnProperty(prop)) || | ||
(props[prop] === undefined) | ||
) { continue; } | ||
_ObjectDefineProperty(object, prop, { | ||
value:props[prop], | ||
configurable:!!attr.configurable, | ||
enumerable:!!attr.enumerable, | ||
writable:!!attr.writable | ||
}); | ||
} | ||
return object; | ||
} | ||
function ObjectMerge(target, source) { | ||
@@ -29,0 +50,0 @@ if ( Object(target) !== target ) { |
{ | ||
"name": "extes", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A tiny library that extends native js with some handy tools", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
9823
290