baseFunctions.js 695 B

123456789101112131415161718192021222324252627
  1. var isFunction = require('../lang/isFunction');
  2. /**
  3. * The base implementation of `_.functions` which creates an array of
  4. * `object` function property names filtered from those provided.
  5. *
  6. * @private
  7. * @param {Object} object The object to inspect.
  8. * @param {Array} props The property names to filter.
  9. * @returns {Array} Returns the new array of filtered property names.
  10. */
  11. function baseFunctions(object, props) {
  12. var index = -1,
  13. length = props.length,
  14. resIndex = -1,
  15. result = [];
  16. while (++index < length) {
  17. var key = props[index];
  18. if (isFunction(object[key])) {
  19. result[++resIndex] = key;
  20. }
  21. }
  22. return result;
  23. }
  24. module.exports = baseFunctions;