_/Chapter17/hobnob-client/api/docs/src/core/utils.js
// by preserving the key's place in the object based on its value.
by preserving the key's place in the object based on its value.
by preserving the key ' s place in the object based on its value .
function deeplyStripKey(input, keyToStrip, predicate = () => true) {
  if(typeof input !== "object" || Array.isArray(input) || !keyToStrip) {
    return input
  }
  const obj = Object.assign({}, input)
  Object.keys(obj).forEach(k => {
    if(k === keyToStrip && predicate(obj[k], k)) {
      delete obj[k]
      return
    }
    obj[k] = deeplyStripKey(obj[k], keyToStrip, predicate)
  })
  return obj
}
function deeplyStripKey ( input , keyToStrip , predicate = ( ) => true ) { if ( typeof input !== "object" || Array . isArray ( input ) || ! keyToStrip ) { return input } const obj = Object . assign ( { } , input ) Object . keys ( obj ) . forEach ( k => { if ( k === keyToStrip && predicate ( obj [ k ] , k ) ) { delete obj [ k ] return } obj [ k ] = deeplyStripKey ( obj [ k ] , keyToStrip , predicate ) } ) return obj }
by preserving the key's place in the object based on its value.
by preserving the key ' s place in the object based on its value .