UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

21 lines (20 loc) 610 B
const require_keys = require("./keys.js"); //#region src/compat/object/values.ts /** * Creates an array of the own enumerable property values of `object`. * * @param object The object to query. * @returns Returns an array of property values. * @example * const obj = { a: 1, b: 2, c: 3 }; * values(obj); // => [1, 2, 3] */ function values(object) { if (object == null) return []; const objectKeys = require_keys.keys(object); const result = new Array(objectKeys.length); for (let i = 0; i < objectKeys.length; i++) result[i] = object[objectKeys[i]]; return result; } //#endregion exports.values = values;