UNPKG

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