added mixinFlat(..)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-07-05 20:34:19 +03:00
parent b00433a902
commit a20ea675ee
2 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,19 @@ function(root, ...objects){
return o }, root) }
// Like .mixin(..) but will mixin all the methods/props/attrs directly
// (flatly) into root...
var mixinFlat =
module.mixinFlat =
function(root, ...objects){
return objects
.reduce(function(root, cur){
Object.keys(cur)
.map(function(k){
Object.defineProperty(root, k,
Object.getOwnPropertyDescriptor(cur, k)) })
return root }, root) }
//---------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "1.3.0",
"version": "1.4.0",
"description": "",
"main": "object.js",
"scripts": {