toPairs.js 699B

12345678910111213141516171819202122232425262728293031
  1. var createToPairs = require('./_createToPairs'),
  2. keys = require('./keys');
  3. /**
  4. * Creates an array of own enumerable string keyed-value pairs for `object`
  5. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  6. * entries are returned.
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 4.0.0
  11. * @alias entries
  12. * @category Object
  13. * @param {Object} object The object to query.
  14. * @returns {Array} Returns the key-value pairs.
  15. * @example
  16. *
  17. * function Foo() {
  18. * this.a = 1;
  19. * this.b = 2;
  20. * }
  21. *
  22. * Foo.prototype.c = 3;
  23. *
  24. * _.toPairs(new Foo);
  25. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26. */
  27. var toPairs = createToPairs(keys);
  28. module.exports = toPairs;