blob: a57c4f2dc72b57d812eea22bba7fe7d1cd08d28e [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001var LazyWrapper = require('./_LazyWrapper'),
2 getData = require('./_getData'),
3 getFuncName = require('./_getFuncName'),
4 lodash = require('./wrapperLodash');
5
6/**
7 * Checks if `func` has a lazy counterpart.
8 *
9 * @private
10 * @param {Function} func The function to check.
11 * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
12 * else `false`.
13 */
14function isLaziable(func) {
15 var funcName = getFuncName(func),
16 other = lodash[funcName];
17
18 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
19 return false;
20 }
21 if (func === other) {
22 return true;
23 }
24 var data = getData(other);
25 return !!data && func === data[0];
26}
27
28module.exports = isLaziable;