values
object
Creates an array of the own enumerable string keyed property values of object.
Installation
Import
import { values } from '@tulx/utils';Source Code
Implementation
/**
* Creates an array of the own enumerable string keyed property values of object.
*
* @param object - The object to query.
* @returns Returns the array of property values.
*
* @example
* ```ts
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
* Foo.prototype.c = 3;
* values(new Foo()); // [1, 2]
* ```
*/
export function values<T>(object: Record<string, T>): T[] {
return Object.values(object);
}
Example
import { values } from '@tulx/utils';
function Foo() {
this.a = 1;
this.b = 2;
}
Foo.prototype.c = 3;
values(new Foo()); // [1, 2]Related Functions
assign
Assigns own enumerable string keyed properties of source objects to the destination object.
assignIn
This method is like assign except that it iterates over own and inherited source properties.
assignInWith
This method is like assignIn except that it accepts customizer which is invoked to produce the assigned values.
assignWith
This method is like assign except that it accepts customizer which is invoked to produce the assigned values.
at
Creates an array of values corresponding to paths of object.
create
Creates an object that inherits from the prototype object.