This commit is contained in:
David Marshall 2023-04-19 22:28:42 -04:00
parent a6eb62deec
commit e7df21f0fa

View file

@ -5,7 +5,7 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import what from 'jswhat'; import what from "jswhat";
/** /**
* WhatIsIt operation * WhatIsIt operation
@ -51,14 +51,14 @@ class WhatIsIt extends Operation {
*/ */
run(input, args) { run(input, args) {
const [search, filter, exclude] = args; const [search, filter, exclude] = args;
let fOptions = { search }; const fOptions = { search };
if (filter.length) { if (filter.length) {
fOptions.filter = filter.split(/,\s?/); fOptions.filter = filter.split(/,\s?/);
} }
if (exclude.length) { if (exclude.length) {
fOptions.exclude = exclude.split(/,\s?/); fOptions.exclude = exclude.split(/,\s?/);
} }
console.log(fOptions)
return what.is(input, fOptions); return what.is(input, fOptions);
} }
/** /**
@ -81,7 +81,7 @@ class WhatIsIt extends Operation {
output += `<tr> output += `<tr>
<td>${option.name}</td> <td>${option.name}</td>
<td>${option.matched}</td> <td>${option.matched}</td>
<td>${option.description}(${option.tags.join(', ')})</td> <td>${option.description}(${option.tags.join(", ")})</td>
</tr>`; </tr>`;
}); });