source: imaps-frontend/node_modules/lodash-es/_createToPairs.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 787 bytes
Line 
1import baseToPairs from './_baseToPairs.js';
2import getTag from './_getTag.js';
3import mapToArray from './_mapToArray.js';
4import setToPairs from './_setToPairs.js';
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
30export default createToPairs;
Note: See TracBrowser for help on using the repository browser.