Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
877 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var eq = require('./eq'),
|
---|
| 2 | isArrayLike = require('./isArrayLike'),
|
---|
| 3 | isIndex = require('./_isIndex'),
|
---|
| 4 | isObject = require('./isObject');
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Checks if the given arguments are from an iteratee call.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @param {*} value The potential iteratee value argument.
|
---|
| 11 | * @param {*} index The potential iteratee index or key argument.
|
---|
| 12 | * @param {*} object The potential iteratee object argument.
|
---|
| 13 | * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
---|
| 14 | * else `false`.
|
---|
| 15 | */
|
---|
| 16 | function isIterateeCall(value, index, object) {
|
---|
| 17 | if (!isObject(object)) {
|
---|
| 18 | return false;
|
---|
| 19 | }
|
---|
| 20 | var type = typeof index;
|
---|
| 21 | if (type == 'number'
|
---|
| 22 | ? (isArrayLike(object) && isIndex(index, object.length))
|
---|
| 23 | : (type == 'string' && index in object)
|
---|
| 24 | ) {
|
---|
| 25 | return eq(object[index], value);
|
---|
| 26 | }
|
---|
| 27 | return false;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | module.exports = isIterateeCall;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.