Objects

The Objects module provides a number of convenience functions to compare and manipulate JavaScript objects.

Many of these functions also serve as type guards for TypeScript users.

clone()

Clones any object or value.

compare()

Performs a shallow or deep comparison of two objects.

equal()

Compares two or more objects for equality and returns true if all are “equal”.

equatable()

Attempts to inject a default equals() function into the specified object that iterates through all its keys and compares it with the target object.

filter()

Creates a new object from an existing one with only the keys and values that match a condition.

getConstructor()

Gets the constructor of an object.

getPropertyDescriptor()

Returns a property descriptor for the given property on the object.

hasFunction()

Checks if an object contains a function by the specified name and number of arguments.

hasProperty()

Checks if an object contains a property by the specified name and optionally type.

is()

Checks if an object is of the given type.

isObject()

Checks if a value is an object (that is, not a primitive).

isObjectLiteral()

Checks if a value was created using object literal syntax (curly brackets), that is if it has a prototype other than Object.

isWritable()

Gets a value indicating whether a property can be written to.

map()

Creates a new object from an existing one by mapping all keys with a transform function.

omit()

Creates a new object from an existing one with a set of keys excluded.

pick()

Creates a new object from an existing one with only a set of keys included.

stringify()

Converts an arbitrary value to a string.

structure()

Type guard that checks if an object conforms to the given shape.

swap()

Swaps the values of two properties on an object and returns the original object.