您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

_baseIteratee.js 895B

12345678910111213141516171819202122232425262728293031
  1. var baseMatches = require('./_baseMatches'),
  2. baseMatchesProperty = require('./_baseMatchesProperty'),
  3. identity = require('./identity'),
  4. isArray = require('./isArray'),
  5. property = require('./property');
  6. /**
  7. * The base implementation of `_.iteratee`.
  8. *
  9. * @private
  10. * @param {*} [value=_.identity] The value to convert to an iteratee.
  11. * @returns {Function} Returns the iteratee.
  12. */
  13. function baseIteratee(value) {
  14. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  15. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  16. if (typeof value == 'function') {
  17. return value;
  18. }
  19. if (value == null) {
  20. return identity;
  21. }
  22. if (typeof value == 'object') {
  23. return isArray(value)
  24. ? baseMatchesProperty(value[0], value[1])
  25. : baseMatches(value);
  26. }
  27. return property(value);
  28. }
  29. module.exports = baseIteratee;