-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
values.js
33 lines (31 loc) · 824 Bytes
/
values.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import _curry1 from './internal/_curry1.js';
import keys from './keys.js';
/**
* Returns a list of all the enumerable own properties of the supplied object.
* Note that the order of the output array is not guaranteed across different
* JS platforms.
*
* @func
* @memberOf R
* @since v0.1.0
* @category Object
* @sig {k: v} -> [v]
* @param {Object} obj The object to extract values from
* @return {Array} An array of the values of the object's own properties.
* @see R.valuesIn, R.keys, R.toPairs
* @example
*
* R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]
*/
var values = _curry1(function values(obj) {
var props = keys(obj);
var len = props.length;
var vals = [];
var idx = 0;
while (idx < len) {
vals[idx] = obj[props[idx]];
idx += 1;
}
return vals;
});
export default values;