moved Object.prototype.run(..) to its own package...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-07-03 00:26:43 +03:00
parent 595db957d3
commit cd08827c8c
4 changed files with 11 additions and 15 deletions

View File

@ -19,6 +19,7 @@ var requirejs_cfg = {
'lib/actions': 'node_modules/ig-actions/actions',
'lib/features': 'node_modules/ig-features/features',
//'lib/keyboard': './node_modules/ig-keyboard/keyboard',
'object-run': 'node_modules/object-run/run',
'lib/walk': 'node_modules/generic-walk/walk',
},

View File

@ -7,21 +7,12 @@
(function(require){ var module={} // make module AMD/node compatible...
/*********************************************************************/
require('object-run')
//---------------------------------------------------------------------
// Object...
// Run a function in the context of an object...
//
Object.defineProperty(Object.prototype, 'run', {
enumerable: false,
value: function(func){
var res = func ? func.call(this) : undefined
return res === undefined ? this : res
},
})
// Get all the accessible keys...
//
// This is different to Object.keys(..) in that this will return keys
@ -33,8 +24,7 @@ Object.deepKeys = function(obj){
res = res.concat(Object.keys(obj))
obj = obj.__proto__
}
return res.unique()
}
return res.unique() }
// Make a full key set copy of an object...
@ -45,8 +35,7 @@ Object.flatCopy = function(obj){
Object.deepKeys(obj).forEach(function(key){
res[key] = obj[key]
})
return res
}
return res}

View File

@ -1437,6 +1437,11 @@
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
"integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY="
},
"object-run": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/object-run/-/object-run-1.0.0.tgz",
"integrity": "sha512-Gfd2RZOPfItVfZnPxi5rnGGa1Kix2AKMNoZyLDbIZ/AqB2k6zcULxpwyg1o56QHFL9KTJPVIkgiEQH7ipcUXUA=="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",

View File

@ -31,6 +31,7 @@
"ig-features": "^3.4.2",
"ig-object": "^5.0.8",
"moment": "^2.26.0",
"object-run": "^1.0.0",
"requirejs": "^2.3.6",
"requirejs-plugins": "^1.0.2",
"sharp": "^0.25.3",