Skip to main content

@rtorcato/js-common / objects

objects

Functions

isPlainObject()

isPlainObject(value): value is Record<string, any>

Defined in: objects/index.ts:7

Returns true if the value is a plain object (not null, not array, not function).

Parameters

value

any

The value to check.

Returns

value is Record<string, any>


deepMerge()

deepMerge<T, U>(target, source): T & U

Defined in: objects/index.ts:17

Deeply merges two objects. Does not mutate inputs.

Type Parameters

T

T extends object

U

U extends object

Parameters

target

T

The target object.

source

U

The source object.

Returns

T & U

The merged object.


omit()

omit<T, K>(obj, keys): Omit<T, K>

Defined in: objects/index.ts:35

Returns a shallow copy of an object with the given keys omitted.

Type Parameters

T

T extends object

K

K extends string | number | symbol

Parameters

obj

T

The source object.

keys

K[]

Keys to omit.

Returns

Omit<T, K>


pick()

pick<T, K>(obj, keys): Pick<T, K>

Defined in: objects/index.ts:49

Returns a shallow copy of an object with only the given keys.

Type Parameters

T

T extends object

K

K extends string | number | symbol

Parameters

obj

T

The source object.

keys

K[]

Keys to pick.

Returns

Pick<T, K>


deepClone()

deepClone<T>(obj): T

Defined in: objects/index.ts:65

Deep clones a value using the native structuredClone algorithm. Correctly handles Date, Map, Set, ArrayBuffer, and circular references.

Type Parameters

T

T

Parameters

obj

T

The value to clone.

Returns

T

A deep clone of the value.