main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
710 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import LazyWrapper from './_LazyWrapper.js';
|
---|
| 2 | import getData from './_getData.js';
|
---|
| 3 | import getFuncName from './_getFuncName.js';
|
---|
| 4 | import lodash from './wrapperLodash.js';
|
---|
| 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 | */
|
---|
| 14 | function 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 |
|
---|
| 28 | export default isLaziable;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.