Skip to content

Commit

Permalink
add support for hebrew search
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Jul 3, 2024
1 parent 4c670b4 commit f1fcb81
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions babel.config.js → babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Jest runs Babel synchronously so we need to use the CommonJS module system.
*/
module.exports = function (api) {
api.cache(true);
return {
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const TEST_REGEX = '(/__tests__/.*|(\\.|/)(test|spec))\\.(tsx?|ts?)$';

module.exports = {
export default {
roots: ['<rootDir>/tests'],
displayName: '@wcpos/query',
preset: 'ts-jest',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "@wcpos/query",
"version": "1.6.7",
"version": "1.6.8",
"description": "Query and Replication for WooCommerce POS",
"author": "kilbot <[email protected]>",
"license": "MIT",
"main": "src/index.ts",
"type": "module",
"files": [
"src/*"
],
Expand Down
2 changes: 2 additions & 0 deletions src/search-dbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const localeToLangMap: { [key: string]: string } = {
th: 'thai',
vi: 'vietnamese',
zh: 'chinese',
he: 'hebrew',
// Default to English for any other locale
};

Expand All @@ -59,6 +60,7 @@ const SPLITTERS: Record<string, RegExp> = {
thai: /[^a-zA-Z0-9ก-๙]+/gim,
vietnamese: /[^a-zA-Z0-9àáâãèéêìíòóôõùúýăđĩũơưạảấầẩẫậắằẳẵặẹẻẽếềễểệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹ]+/gim,
chinese: /[^a-zA-Z0-9\u4e00-\u9fff]+/gim,
hebrew: /[^a-zA-Z0-9\u0590-\u05FF]+/gim,
};

function getTokenizer(locale = '') {
Expand Down
2 changes: 1 addition & 1 deletion tests/manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Manager', () => {
beforeEach(async () => {
storeDatabase = await createStoreDatabase();
syncDatabase = await createSyncDatabase();
manager = new Manager(storeDatabase, httpClientMock);
manager = new Manager(storeDatabase, syncDatabase, httpClientMock);
});

afterEach(() => {
Expand Down

0 comments on commit f1fcb81

Please sign in to comment.