change(developer/compilers): parseWordlist can take a WordListSource instance

This commit is contained in:
Eddie Antonio Santos 2020-07-20 15:03:05 -06:00
parent 59a3af04e2
commit ca89784635
No known key found for this signature in database
GPG key ID: DD411EA4D9509D87

View file

@ -74,9 +74,11 @@ export function parseWordListFromFilename(wordlist: WordList, filename: string):
* @param contents contents of the file to import
*
*/
export function parseWordList(wordlist: WordList, contents: string): void {
export function parseWordList(wordlist: WordList, contents: string | WordListSource): void {
const TAB = "\t";
let source = new WordListFromMemory(contents);
let source = typeof contents == "string"
? new WordListFromMemory(contents)
: contents;
// @ts-ignore: unused
for (let [lineno, line] of source.lines()) {