UNPKG

grup

Version:
2 lines (1 loc) 470 B
const grup=(...c)=>{let d=c[0]||[],e=c[1]||(d.length?d.map(g=>g.split(" ")).reduce((g,h)=>g.concat(h)).filter(g=>g.length):[]),f={};for(let g of d)for(let h of e)h=h instanceof RegExp?h:h.trim(),g.match(h instanceof RegExp?h:new RegExp(h.replace(/(\(|\)|\[|\]|\.|\*|\{|\}|\+|\?|\||\$|\\)/g,"\\$1"),"igm"))&&(f[h]=f[h]||[],-1===f[h].indexOf(g)&&f[h].push(g));return f};"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=grup:window.tahta=grup;