Node.js examples for Object:Object Operation
Merge two object
export function merge(m1, m2) { var m = {};//ww w.j a v a 2 s. c o m for (var attr in m1) { if (m1.hasOwnProperty(attr)) { m[attr] = m1[attr]; } } for (var attr in m2) { if (m2.hasOwnProperty(attr)) { m[attr] = m2[attr]; } } return m; } export function forEach(map, callback) { for (var prop in map) { if (map.hasOwnProperty(prop)) { callback(map[prop], prop); } } }