Interface IObjDeepCopyHandlerDetails

Context details passed to the deep copy handler to allow it parse the current value based on the original source and path to reach the current value. The provided value should be updated with the value to by copied into the new deep copy and will be used when the handler returns true.

0.4.4

interface IObjDeepCopyHandlerDetails {
    copy<T>(source: T, key?: string | number | symbol): T;
    copyTo<T>(target: T, source: T): T;
    isPlain: boolean;
    isPrim: boolean;
    origin?: any;
    path: (string | number | symbol)[];
    result: any;
    type: string;
    value: any;
}

Properties

isPlain: boolean

Identifies whether the type is a plain object or not, this also saves each handler from checking the type, currently the type will also be "object" if this is true.

0.9.6

isPrim: boolean

Identifies whether the type of the value is considered to be a primitive value

origin?: any

The original source object passed into the objDeepCopy() or objCopyProps() functions.

path: (string | number | symbol)[]

A array of keys from the orginal source (origin) object which lead to the current value

result: any

Replace this value with the new deep copied value (defaults to the same as the value property) this value will be used when returning true from the handler. Ignored when the handler returns false.

type: string

Identifies the type of the value as per typeof value, saves each check having to process this value.

value: any

The current value to be processed, replace this value with the new deep copied value to use when returning true from the handler. Ignored when the handler returns false.

Methods

  • Continue the deep copy with the current context and recursive checks, effectively calls objDeepCopy but keeps the current context and recursive references.

    Type Parameters

    • T

    Parameters

    • source: T

      The source object to be copied

    • Optionalkey: string | number | symbol

    Returns T

  • Continue the deep copy with the current context and recursive checks by copying all of the properties from the source to the target instance, effectively calls objCopyProps but keeps the current context and recursive references.

    Type Parameters

    • T

    Parameters

    • target: T

      The target object to populated

    • source: T

      The source object to copy the properties from

    Returns T