Functions

Browse all available utility functions by category

object

assign

Assigns own enumerable string keyed properties of source objects to the destination object.

Example:

function Foo() {
object

assignIn

This method is like assign except that it iterates over own and inherited source properties.

Example:

function Foo() {
object

assignInWith

This method is like assignIn except that it accepts customizer which is invoked to produce the assigned values.

Example:

function customizer(objValue: unknown, srcValue: unknown) {
object

assignWith

This method is like assign except that it accepts customizer which is invoked to produce the assigned values.

Example:

function customizer(objValue: unknown, srcValue: unknown) {
object

at

Creates an array of values corresponding to paths of object.

Example:

const object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
object

create

Creates an object that inherits from the prototype object.

Example:

function Shape() {
object

defaults

Assigns own enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined.

Example:

defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); // { 'a': 1, 'b': 2 }
object

defaultsDeep

This method is like defaults except that it recursively assigns default properties.

Example:

defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); // { 'a': { 'b': 2, 'c': 3 } }
object

entries

Creates an array of own enumerable string keyed-value pairs for object.

Example:

function Foo() {
object

entriesIn

Creates an array of own and inherited enumerable string keyed-value pairs for object.

Example:

function Foo() {
object

extend

Assigns own enumerable string keyed properties of source objects to the destination object. This is an alias for assignIn.

Example:

extend({ 'a': 1 }, { 'b': 2 }); // { 'a': 1, 'b': 2 }
object

extendWith

This method is like extend except that it accepts customizer which is invoked to produce the assigned values.

Example:

function customizer(objValue: unknown, srcValue: unknown) {
object

findKey

This method is like find except that it returns the key of the first element predicate returns truthy for instead of the element itself.

Example:

const users = {
object

findLastKey

This method is like findKey except that it iterates over elements of a collection in the opposite order.

Example:

const users = {
object

forIn

Iterates over own and inherited enumerable string keyed properties of an object and invokes iteratee for each property.

Example:

function Foo() {
object

forInRight

This method is like forIn except that it iterates over properties of object in the opposite order.

Example:

function Foo() {
object

forOwn

Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.

Example:

function Foo() {
object

forOwnRight

This method is like forOwn except that it iterates over properties of object in the opposite order.

Example:

function Foo() {
object

functions

Creates an array of function property names from own enumerable properties of object.

Example:

function Foo() {
object

functionsIn

Creates an array of function property names from own and inherited enumerable properties of object.

Example:

function Foo() {
object

get

Gets the value at path of object.

Example:

const object = { 'a': [{ 'b': { 'c': 3 } }] };
object

has

Checks if path is a direct property of object.

Example:

const object = { 'a': { 'b': 2 } };
object

hasIn

Checks if path is a direct or inherited property of object.

Example:

const object = Object.create({ 'a': Object.create({ 'b': 2 }) });
object

invert

Creates an object composed of the inverted keys and values of object.

Example:

const object = { 'a': 1, 'b': 2, 'c': 1 };
object

invertBy

This method is like invert except that the inverted object is generated from the results of running each element of object thru iteratee.

Example:

const object = { 'a': 1, 'b': 2, 'c': 1 };
object

invoke

Invokes the method at path of object.

Example:

const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
object

keys

Creates an array of the own enumerable property names of object.

Example:

function Foo() {
object

keysIn

Creates an array of the own and inherited enumerable property names of object.

Example:

function Foo() {
object

mapKeys

Creates an object with the same values as object and keys generated by running each own enumerable string keyed property of object thru iteratee.

Example:

mapKeys({ 'a': 1, 'b': 2 }, (value, key) => key + value); // { 'a1': 1, 'b2': 2 }
object

mapValues

Creates an object with the same keys as object and values generated by running each own enumerable string keyed property of object thru iteratee.

Example:

const users = {
object

merge

Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object.

Example:

const object = {
object

mergeWith

This method is like merge except that it accepts customizer which is invoked to produce the merged values of the destination and source properties.

Example:

function customizer(objValue: unknown, srcValue: unknown) {
object

omit

Creates an object composed of the own and inherited enumerable property paths of object that are not omitted.

Example:

const object = { 'a': 1, 'b': '2', 'c': 3 };
object

omitBy

Creates an object composed of the own and inherited enumerable string keyed properties of object that predicate doesn't return truthy for.

Example:

const object = { 'a': 1, 'b': '2', 'c': 3 };
object

pick

Creates an object composed of the picked object properties.

Example:

const object = { 'a': 1, 'b': '2', 'c': 3 };
object

pickBy

Creates an object composed of the object properties predicate returns truthy for.

Example:

const object = { 'a': 1, 'b': '2', 'c': 3 };
object

result

This method is like get except that if the resolved value is a function it's invoked with the this binding of its parent object and its result is returned.

Example:

const object = { 'a': [{ 'b': { 'c1': 3, 'c2': () => 4 } }] };
object

set

Sets the value at path of object.

Example:

const object = { 'a': [{ 'b': { 'c': 3 } }] };
object

setWith

This method is like set except that it accepts customizer which is invoked to produce the objects of path.

Example:

const object = {};
object

toPairs

Creates an array of own enumerable string keyed-value pairs for object. This is an alias for entries.

Example:

function Foo() {
object

toPairsIn

Creates an array of own and inherited enumerable string keyed-value pairs for object. This is an alias for entriesIn.

Example:

function Foo() {
object

transform

An alternative to reduce; this method transforms object to a new accumulator object which is the result of running each of its own enumerable string keyed properties thru iteratee.

Example:

transform([2, 3, 4], (result, n) => {
object

unset

Removes the property at path of object.

Example:

const object = { 'a': [{ 'b': { 'c': 7 } }] };
object

update

This method is like set except that it accepts updater to produce the value to set.

Example:

const object = { 'a': [{ 'b': { 'c': 3 } }] };
object

updateWith

This method is like update except that it accepts customizer which is invoked to produce the objects of path.

Example:

const object = {};
object

values

Creates an array of the own enumerable string keyed property values of object.

Example:

function Foo() {
object

valuesIn

Creates an array of the own and inherited enumerable string keyed property values of object.

Example:

function Foo() {