main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
924 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _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 |
|
---|
| 24 | var 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 |
|
---|
| 36 | export default toPairsIn; |
---|
Note:
See
TracBrowser
for help on using the repository browser.