MCPcopy Create free account
hub / github.com/node-config/node-config / makeHidden

Method makeHidden

lib/util.js:121–138  ·  view source on GitHub ↗

* Make a configuration property hidden so it doesn't appear when enumerating * elements of the object. * * * The property still exists and can be read from and written to, but it won't * show up in for ... in loops, Object.keys(), or JSON.stringify() type methods. *

(object, property, value)

Source from the content-addressed store, hash-verified

119 * @return {object} - The original object is returned - for chaining.
120 */
121 static makeHidden(object, property, value) {
122 // If the new value isn't specified, just mark the property as hidden
123 if (typeof value === 'undefined') {
124 Object.defineProperty(object, property, {
125 enumerable: false,
126 configurable: true
127 });
128 } else {
129 // Otherwise set the value and mark it as hidden
130 Object.defineProperty(object, property, {
131 value: value,
132 enumerable: false,
133 configurable: true
134 });
135 }
136
137 return object;
138 }
139
140 /**
141 * Make a javascript object immutable (assuring it cannot be changed from the current value)

Callers 4

constructorMethod · 0.80
attachProtoDeepMethod · 0.80
0-util.jsFile · 0.80
util.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected