No Description

pairs.js 395B

1234567891011121314151617
  1. define(['./keys'], function (keys) {
  2. // Convert an object into a list of `[key, value]` pairs.
  3. // The opposite of `_.object` with one argument.
  4. 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. }
  13. return pairs;
  14. });