augment-vir - v31.13.0
    Preparing search index...

    Function copyThroughJson

    • Deeply copy an object through JSON. This is the fastest deep copy, but the input must already be JSON serializable otherwise the copy will not match the original.

      Type Parameters

      • const T

      Parameters

      • input: T

      Returns Writable<Jsonify<T>>

      import {copyThroughJson} from '@augment-vir/common';

      // `copy1` will be `{a: 'a', b: 'b'}`
      const copy1 = copyThroughJson({a: 'a', b: 'b'});
      // `copy2` will be `{map: {}, b: 'b'}`
      const copy2 = copyThroughJson({
      map: new Map([
      [
      'q',
      'r',
      ],
      [
      's',
      't',
      ],
      ]),
      b: 'b',
      });