Variable: values()
constvalues: <Value>(object) =>Iterable<Value>
Defined in: generators.d.ts:120
Returns an iterable containing the values of object.
This differs from Map.prototype.values and Set.prototype.values in that
the returned iterable can be iterated multiple times and differs from
Object.values in that the returned iterable is opaque.
Type Parameters
Value
Value
Parameters
object
ReadonlyMap<unknown, Value> | ReadonlySet<Value> | Readonly<Record<PropertyKey, Value>>
Returns
Iterable<Value>
Example
import { pipe, reduce, toArray, values } from 'lfi'
console.log(
pipe(
values([`sloth`, `lazy`, `sleep`]),
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy, 'sleep' ]
console.log(
pipe(
values({
sloth: 1,
lazy: 2,
sleep: 3,
}),
reduce(toArray()),
),
)
//=> [ 1, 2, 3 ]
console.log(
pipe(
values(new Set([`sloth`, `lazy`, `sleep`])),
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy, 'sleep' ]
console.log(
pipe(
values(
new Map([
[`sloth`, 1],
[`lazy`, 2],
[`sleep`, 3],
]),
),
reduce(toArray()),
),
)
//=> [ 1, 2, 3 ]
Since
v0.1.0