var withKeepStartCount = function (json, property, count) { traverse(json).forEach(function (node) { if (this.key === property) { node = "" + node; // make sure it's a string var l = node.length; var end = node.substring(l - count); this.update(_.padEnd(end, l, REPLACECHAR)); } }); return json; }
bench([ function JSONStrinfify (done) { const obj = { a: 1, b: 2, c: 4224, d: 'eeeeeeeew' } const stringified = JSON.stringify(obj) regex.test(stringified) done() }, function propertyIteration (done) { const obj = { a: 1, b: 2, c: 4224, d: 'eeeeeeeew' } traverse(obj).forEach((x) => { if (typeof x === 'string') { regex.test(x) } }) done() } ], 1000)
function hasUndefinedValues (obj) { let has traverse(obj).forEach(function (val) { if (val === undefined) { has = true /* eslint no-invalid-this: "off" */ this.update(undefined, true) // stop traversing } }) return has }
var items = traverse(data.items).forEach(function(item) { if (this.key === "type" && this.notLeaf) { index++;
traverse(auth).forEach(function (val) { if ('string' === typeof val) { const match = ENV_VAR_REGEX.exec(val);
traverse(mdata).forEach(function(item) { if (this.key === 'type' && this.notLeaf) { index ++; this.node.push(index); //console.log(this.node); } })
var withFixedLength = function (json, property, count) { traverse(json).forEach(function (node) { if (this.key === property) { this.update(_.padEnd('', count, REPLACECHAR)); } }); return json; }
var withAll = function (json, property) { traverse(json).forEach(function (node) { if (this.key === property) { node = "" + node; // make sure it's a string var l = node.length; this.update(_.padStart('', l, REPLACECHAR)); } }); return json; }
var withKeepEndCount = function (json, property, count) { traverse(json).forEach(function (node) { if (this.key === property) { node = "" + node; // make sure it's a string var l = node.length; var end = node.substring(l - count); this.update(_.padStart(end, l, REPLACECHAR)); } }); return json; }
bench([ function JSONStrinfify(done) { const obj = { a: 1, b: 2, c: 4224, d: 'eeeeeeeew' } const stringified = JSON.stringify(obj) regex.test(stringified) done() }, function propertyIteration(done) { const obj = { a: 1, b: 2, c: 4224, d: 'eeeeeeeew' } traverse(obj).forEach((x) => { if (typeof x === 'string') { regex.test(x) } }) done() } ], 1000)