Ohm-Management - Projektarbeit B-ME
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.

isFunction.js 993B

12345678910111213141516171819202122232425262728293031323334353637
  1. var baseGetTag = require('./_baseGetTag'),
  2. isObject = require('./isObject');
  3. /** `Object#toString` result references. */
  4. var asyncTag = '[object AsyncFunction]',
  5. funcTag = '[object Function]',
  6. genTag = '[object GeneratorFunction]',
  7. proxyTag = '[object Proxy]';
  8. /**
  9. * Checks if `value` is classified as a `Function` object.
  10. *
  11. * @static
  12. * @memberOf _
  13. * @since 0.1.0
  14. * @category Lang
  15. * @param {*} value The value to check.
  16. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  17. * @example
  18. *
  19. * _.isFunction(_);
  20. * // => true
  21. *
  22. * _.isFunction(/abc/);
  23. * // => false
  24. */
  25. function isFunction(value) {
  26. if (!isObject(value)) {
  27. return false;
  28. }
  29. // The use of `Object#toString` avoids issues with the `typeof` operator
  30. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  31. var tag = baseGetTag(value);
  32. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  33. }
  34. module.exports = isFunction;