Nodejs Utililty Methods Object Value Set

List of utility methods to do Object Value Set

Description

The list of methods to do Object Value Set are organized into topic(s).

Method

setDefault(key, value)
Object.prototype.setDefault = function(key, value) {
    if (!this.hasOwnProperty(key)) {
  this[key] = value;
    return this[key];
};
addSibling(k, v)
Object.prototype.addSibling = function(k, v) {
  if (typeof this[k] === 'undefined') this[k] = v;
  return this[k];