No Description

pairs.js 359B

12345678910111213
  1. import keys from './keys.js';
  2. // Convert an object into a list of `[key, value]` pairs.
  3. // The opposite of `_.object` with one argument.
  4. export default function pairs(obj) {
  5. var _keys = keys(obj);
  6. var length = _keys.length;
  7. var pairs = Array(length);
  8. for (var i = 0; i < length; i++) {
  9. pairs[i] = [_keys[i], obj[_keys[i]]];
  10. }
  11. return pairs;
  12. }