mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 00:52:29 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
36 lines
980 B
TypeScript
36 lines
980 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/toPairsIn.js
|
|
|
|
|
|
import _curry1 from './internal/_curry1.js';
|
|
|
|
|
|
/**
|
|
* Converts an object into an array of key, value arrays. The object's own
|
|
* properties and prototype properties are used. Note that the order of the
|
|
* output array is not guaranteed to be consistent across different JS
|
|
* platforms.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.4.0
|
|
* @category Object
|
|
* @sig {String: *} -> [[String,*]]
|
|
* @param {Object} obj The object to extract from
|
|
* @return {Array} An array of key, value arrays from the object's own
|
|
* and prototype properties.
|
|
* @example
|
|
*
|
|
* const F = function() { this.x = 'X'; };
|
|
* F.prototype.y = 'Y';
|
|
* const f = new F();
|
|
* R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
|
|
*/
|
|
var toPairsIn = _curry1(function toPairsIn(obj) {
|
|
var pairs = [];
|
|
for (var prop in obj) {
|
|
pairs[pairs.length] = [prop, obj[prop]];
|
|
}
|
|
return pairs;
|
|
});
|
|
export default toPairsIn;
|