functions.js 685B

1234567891011121314151617181920212223242526272829303132
  1. var baseFunctions = require('./_baseFunctions'),
  2. keys = require('./keys');
  3. /**
  4. * Creates an array of function property names from own enumerable properties
  5. * of `object`.
  6. *
  7. * @static
  8. * @since 0.1.0
  9. * @memberOf _
  10. * @category Object
  11. * @param {Object} object The object to inspect.
  12. * @returns {Array} Returns the function names.
  13. * @see _.functionsIn
  14. * @example
  15. *
  16. * function Foo() {
  17. * this.a = _.constant('a');
  18. * this.b = _.constant('b');
  19. * }
  20. *
  21. * Foo.prototype.c = _.constant('c');
  22. *
  23. * _.functions(new Foo);
  24. * // => ['a', 'b']
  25. */
  26. function functions(object) {
  27. return object == null ? [] : baseFunctions(object, keys(object));
  28. }
  29. module.exports = functions;