v1
- by lmyers 4/23/202100
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const innerObj = {
	foo: 'xcvb',
	bar: 'vbnm',
	baz: 'qwer',
	qux: 'wert'
};

const obj = {
  foo: 'abcd',
  bar: {
    foo: 'abcd',
    bar: {
      foo: 'abcd',
      baz: 'efgh',
      qux: 'ijkl',
      quux: [
      	innerObj,
      	innerObj,
      	innerObj,
      	innerObj,
      	innerObj,
      	innerObj,
      	innerObj,
      	innerObj
      ]
    },
    baz: 'efgh',
    qux: 'ijkl'
  },
  baz: 'efgh',
  qux: 'ijkl'
};

function traverse(obj1, predicate) {
  for (const [key, value] of Object.entries(obj1)) {
    if (typeof(value) === 'string') {
    	if (predicate(key)) {
          obj[key] = '***';    		
    	}
    } else {
      traverse(value, predicate);
    }
  }
}

const keysToRedactArray = ['foo', 'qux'];
for (let i = 0; i < 30; i++) {
	const dummyKey = Math.random().toString(36).substr(2, 5);
	keysToRedactArray.push(dummyKey);
}
const keysToRedactSet = new Set(keysToRedactArray);
delete caserun single casemove downdrag and drop case


ready



traverse(obj, (key) => keysToRedactArray.includes(key));
delete caserun single casemove updrag and drop case


ready



traverse(obj, (key) => keysToRedactSet.has(key));
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN