You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
395 B
18 lines
395 B
3 years ago
|
define(['./keys'], function (keys) {
|
||
|
|
||
|
// Convert an object into a list of `[key, value]` pairs.
|
||
|
// The opposite of `_.object` with one argument.
|
||
|
function pairs(obj) {
|
||
|
var _keys = keys(obj);
|
||
|
var length = _keys.length;
|
||
|
var pairs = Array(length);
|
||
|
for (var i = 0; i < length; i++) {
|
||
|
pairs[i] = [_keys[i], obj[_keys[i]]];
|
||
|
}
|
||
|
return pairs;
|
||
|
}
|
||
|
|
||
|
return pairs;
|
||
|
|
||
|
});
|