|
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
|
| Rev | Line | |
|---|
| [a762898] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const identity = require('../../function/identity.js');
|
|---|
| 6 | const property = require('../object/property.js');
|
|---|
| 7 | const matches = require('../predicate/matches.js');
|
|---|
| 8 | const matchesProperty = require('../predicate/matchesProperty.js');
|
|---|
| 9 |
|
|---|
| 10 | function 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 |
|
|---|
| 32 | exports.iteratee = iteratee;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.