Home

valuesin

valuesIn is a utility function from the Lodash JavaScript library. It returns an array containing the enumerable property values of an object, including both its own properties and inherited properties from its prototype chain.

Syntax and parameters

The function is typically used as _.valuesIn(object). It takes a single argument:

- object: The value to query. If the value is null or undefined, the function returns an empty

Return value

The result is an array of the enumerable values found on the object, including inherited properties. Non-enumerable

Behavior and differences

valuesIn differs from _.values (which returns only the object's own enumerable values) by including inherited enumerable

Examples

- _.valuesIn({ a: 1, b: 2 }) yields [1, 2].

- If a object has inherited properties, e.g., const parent = { c: 3 }; const child = Object.create(parent); child.d = 4;

See also

Related lodash functions include _.values (own enumerable values only) and other object utilities that inspect or

array.
properties
are
not
included,
and
the
order
of
values
generally
follows
the
property
enumeration
order
defined
by
the
JavaScript
engine
(commonly
own
properties
before
inherited
ones,
but
the
exact
order
can
vary
by
environment).
properties
as
well.
Both
functions
ignore
non-enumerable
properties
and
do
not
throw
on
non-object
inputs
that
lodash
treats
as
nullish.
_.valuesIn(child)
might
yield
[4,
3],
depending
on
property
order,
including
the
own
property
and
the
inherited
one.
manipulate
property
values.