index.js 460 B

123456789101112131415161718
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getMatchFactory;
  6. function getMatchFactory(map) {
  7. return function getMatch(args) {
  8. const match = args.reduce((list, arg, i) => {
  9. return list.filter(keyword => keyword[1][i] === arg);
  10. }, map);
  11. if (match.length) {
  12. return match[0][0];
  13. }
  14. return false;
  15. };
  16. }
  17. module.exports = exports["default"];