UNPKG

941 BJavaScriptView Raw
1var _curry1 =
2/*#__PURE__*/
3require("./internal/_curry1");
4/**
5 * Converts an object into an array of key, value arrays. The object's own
6 * properties and prototype properties are used. Note that the order of the
7 * output array is not guaranteed to be consistent across different JS
8 * platforms.
9 *
10 * @func
11 * @memberOf R
12 * @since v0.4.0
13 * @category Object
14 * @sig {String: *} -> [[String,*]]
15 * @param {Object} obj The object to extract from
16 * @return {Array} An array of key, value arrays from the object's own
17 * and prototype properties.
18 * @example
19 *
20 * const F = function() { this.x = 'X'; };
21 * F.prototype.y = 'Y';
22 * const f = new F();
23 * R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
24 */
25
26
27var toPairsIn =
28/*#__PURE__*/
29_curry1(function toPairsIn(obj) {
30 var pairs = [];
31
32 for (var prop in obj) {
33 pairs[pairs.length] = [prop, obj[prop]];
34 }
35
36 return pairs;
37});
38
39module.exports = toPairsIn;
\No newline at end of file