source: node_modules/es-toolkit/dist/compat/util/iteratee.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 894 bytes
RevLine 
[a762898]1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const identity = require('../../function/identity.js');
6const property = require('../object/property.js');
7const matches = require('../predicate/matches.js');
8const matchesProperty = require('../predicate/matchesProperty.js');
9
10function iteratee(value) {
11 if (value == null) {
12 return identity.identity;
13 }
14 switch (typeof value) {
15 case 'function': {
16 return value;
17 }
18 case 'object': {
19 if (Array.isArray(value) && value.length === 2) {
20 return matchesProperty.matchesProperty(value[0], value[1]);
21 }
22 return matches.matches(value);
23 }
24 case 'string':
25 case 'symbol':
26 case 'number': {
27 return property.property(value);
28 }
29 }
30}
31
32exports.iteratee = iteratee;
Note: See TracBrowser for help on using the repository browser.