UNPKG

668 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 * @typechecks
9 */
10
11'use strict';
12
13/**
14 * Retrieve an object's values as an array.
15 *
16 * If you are looking for a function that creates an Array instance based
17 * on an "Array-like" object, use createArrayFrom instead.
18 *
19 * @param {object} obj An object.
20 * @return {array} The object's values.
21 */
22function getObjectValues(obj) {
23 const values = [];
24 for (const key in obj) {
25 values.push(obj[key]);
26 }
27 return values;
28}
29
30module.exports = getObjectValues;