main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
893 bytes
|
Line | |
---|
1 | import baseMatches from './_baseMatches.js';
|
---|
2 | import baseMatchesProperty from './_baseMatchesProperty.js';
|
---|
3 | import identity from './identity.js';
|
---|
4 | import isArray from './isArray.js';
|
---|
5 | import property from './property.js';
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * The base implementation of `_.iteratee`.
|
---|
9 | *
|
---|
10 | * @private
|
---|
11 | * @param {*} [value=_.identity] The value to convert to an iteratee.
|
---|
12 | * @returns {Function} Returns the iteratee.
|
---|
13 | */
|
---|
14 | function baseIteratee(value) {
|
---|
15 | // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
---|
16 | // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
---|
17 | if (typeof value == 'function') {
|
---|
18 | return value;
|
---|
19 | }
|
---|
20 | if (value == null) {
|
---|
21 | return identity;
|
---|
22 | }
|
---|
23 | if (typeof value == 'object') {
|
---|
24 | return isArray(value)
|
---|
25 | ? baseMatchesProperty(value[0], value[1])
|
---|
26 | : baseMatches(value);
|
---|
27 | }
|
---|
28 | return property(value);
|
---|
29 | }
|
---|
30 |
|
---|
31 | export default baseIteratee;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.