You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
712 B

пре 3 година
  1. var LazyWrapper = require('./_LazyWrapper'),
  2. getData = require('./_getData'),
  3. getFuncName = require('./_getFuncName'),
  4. lodash = require('./wrapperLodash');
  5. /**
  6. * Checks if `func` has a lazy counterpart.
  7. *
  8. * @private
  9. * @param {Function} func The function to check.
  10. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  11. * else `false`.
  12. */
  13. function isLaziable(func) {
  14. var funcName = getFuncName(func),
  15. other = lodash[funcName];
  16. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  17. return false;
  18. }
  19. if (func === other) {
  20. return true;
  21. }
  22. var data = getData(other);
  23. return !!data && func === data[0];
  24. }
  25. module.exports = isLaziable;