All files / src defined.ts

100% Statements 8/8
100% Branches 1/1
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16    22x 10x 10x 24x     1x     10x     22x  
/** @returns object without undefined values. */
const defined =
  (object: Record<string, unknown>): Record<string, unknown> => {
    const object_ = Object.assign({}, object)
    for (const key in object) {
      if (typeof object_[key] === 'undefined') {
 
        // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
        delete object_[key]
      }
    }
    return object_
  }
 
export default defined