source: trip-planner-front/node_modules/lodash/_createToPairs.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 789 bytes
RevLine 
[6a3a178]1var baseToPairs = require('./_baseToPairs'),
2 getTag = require('./_getTag'),
3 mapToArray = require('./_mapToArray'),
4 setToPairs = require('./_setToPairs');
5
6/** `Object#toString` result references. */
7var mapTag = '[object Map]',
8 setTag = '[object Set]';
9
10/**
11 * Creates a `_.toPairs` or `_.toPairsIn` function.
12 *
13 * @private
14 * @param {Function} keysFunc The function to get the keys of a given object.
15 * @returns {Function} Returns the new pairs function.
16 */
17function createToPairs(keysFunc) {
18 return function(object) {
19 var tag = getTag(object);
20 if (tag == mapTag) {
21 return mapToArray(object);
22 }
23 if (tag == setTag) {
24 return setToPairs(object);
25 }
26 return baseToPairs(object, keysFunc(object));
27 };
28}
29
30module.exports = createToPairs;
Note: See TracBrowser for help on using the repository browser.