_functionsWith.js 408 B

1234567891011121314
  1. import _filter from "./_filter.js";
  2. /**
  3. * @private
  4. * @param {Function} fn The strategy for extracting function names from an object
  5. * @return {Function} A function that takes an object and returns an array of function names.
  6. */
  7. export default function _functionsWith(fn) {
  8. return function (obj) {
  9. return _filter(function (key) {
  10. return typeof obj[key] === 'function';
  11. }, fn(obj));
  12. };
  13. }