Simplify kwfilter

This commit is contained in:
SukkaW
2024-01-28 00:55:23 +08:00
parent 7458d6ff86
commit b7a11b55ed
2 changed files with 62 additions and 62 deletions

View File

@@ -0,0 +1,12 @@
// eslint-disable-next-line import/no-unresolved -- bun
import { describe, expect, it } from 'bun:test';
import createKeywordFilter from './aho-corasick';
describe('AhoCorasick', () => {
it('basic', () => {
const kwfilter = createKeywordFilter(['ap', 'an']);
expect(kwfilter('bananan')).toBeTrue();
expect(kwfilter('apple')).toBeTrue();
expect(kwfilter('melon')).toBeFalse();
});
});