Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
object-helper-js
node v8.17.0
version:
1.0.6
endpoint
share
tweet
MergeObjects
let ObjectHelper = require('object-helper-js').ObjectHelper; var defaultConfig = { flipped: false, isFixedToCamera: false, healthBar: { x: 0, y: 0 } }; var customConfig = { isFixedToCamera: true, healthBar: { y: 10 } }; let config = ObjectHelper.mergeObjects(defaultConfig, customConfig);
FilterObjectsByKey
let data = { CURSOR_1_UP : { id: 'up', key: '1' }, CURSOR_1_DOWN : { id: 'down', key: '2' }, CURSOR_1_LEFT : { id: 'left', key: '3' }, CURSOR_1_RIGHT : { id: 'right', key: '4' }, TECH_2_BLOCK : { id: 'block', key: 'b' }, }; let objects = ObjectHelper.filterObjectsByKey(data, 'CURSOR', ['UP', 'LEFT']);
SearchTree
var tree = [{ title: 'topNode', children: [{ title: 'node1', children: [{ title: 'randomValue1' }, { title: 'node2', children: [{ title: 'randomValue2', children: [{ title: 'node2', children: [{ title: 'randomValue3', }] }] }] }] }] }]; let nodes = ObjectHelper.searchTree(tree, 'children', 'title', 'randomValue1');
Created from: https://npm.runkit.com/object-helper-js
Loading…
no comments
sign in
to comment