MCPcopy
hub / github.com/vercel/hyper / nullify

Function nullify

bin/yarn-standalone.js:5220–5250  ·  view source on GitHub ↗
(obj = {})

Source from the content-addressed store, hash-verified

5218});
5219exports.default = nullify;
5220function nullify(obj = {}) {
5221 if (Array.isArray(obj)) {
5222 for (var _iterator = obj, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
5223 var _ref;
5224
5225 if (_isArray) {
5226 if (_i >= _iterator.length) break;
5227 _ref = _iterator[_i++];
5228 } else {
5229 _i = _iterator.next();
5230 if (_i.done) break;
5231 _ref = _i.value;
5232 }
5233
5234 const item = _ref;
5235
5236 nullify(item);
5237 }
5238 } else if (obj !== null && typeof obj === 'object' || typeof obj === 'function') {
5239 Object.setPrototypeOf(obj, null);
5240
5241 // for..in can only be applied to 'object', not 'function'
5242 if (typeof obj === 'object') {
5243 for (const key in obj) {
5244 nullify(obj[key]);
5245 }
5246 }
5247 }
5248
5249 return obj;
5250}
5251
5252/***/ }),
5253/* 30 */

Callers

nothing calls this directly

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected