@orchidjs/sifter 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/sifter.ts CHANGED
@@ -65,9 +65,10 @@ export default class Sifter{
65
65
  }
66
66
 
67
67
  if( word.length > 0 ){
68
- regex = escape_regex(word);
69
68
  if( this.settings.diacritics ){
70
- regex = diacriticRegexPoints(regex);
69
+ regex = diacriticRegexPoints(word);
70
+ }else{
71
+ regex = escape_regex(word);
71
72
  }
72
73
  if( respect_word_boundaries ) regex = "\\b"+regex;
73
74
  }
@@ -206,7 +207,7 @@ export default class Sifter{
206
207
 
207
208
  if( typeof sort == 'function' ){
208
209
  return sort.bind(this);
209
- }
210
+ }
210
211
 
211
212
  /**
212
213
  * Fetches the specified sort field value
package/lib/utils.ts CHANGED
@@ -54,7 +54,7 @@ export const scoreValue = (value:string, token:T.Token, weight:number ):number =
54
54
  *
55
55
  * https://stackoverflow.com/questions/63006601/why-does-u-throw-an-invalid-escape-error
56
56
  */
57
- export const escape_regex = (str:string):string => {
57
+ export const escape_regex = (str:string):string => {
58
58
  return (str + '').replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu, '\\$1');
59
59
  };
60
60
 
@@ -65,9 +65,9 @@ export const escape_regex = (str:string):string => {
65
65
  */
66
66
  export const propToArray = (obj:{[key:string]:any}, key:string) => {
67
67
  var value = obj[key];
68
-
68
+
69
69
  if( typeof value == 'function' ) return value;
70
-
70
+
71
71
  if( value && !Array.isArray(value) ){
72
72
  obj[key] = [value];
73
73
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "autocomplete"
12
12
  ],
13
13
  "description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.",
14
- "version": "0.9.1",
14
+ "version": "0.9.2",
15
15
  "license": "Apache-2.0",
16
16
  "author": "Brian Reavis <brian@thirdroute.com>",
17
17
  "main": "dist/umd/sifter.js",
@@ -25,11 +25,11 @@
25
25
  "scripts": {
26
26
  "test": "jest --coverage",
27
27
  "test:typescript": "tsc -p .config --noemit",
28
+ "test:coveralls": "npm run build && jest --coverage && cat ./coverage/lcov.info | coveralls",
28
29
  "pretest": "npm run build",
29
- "benchmark": "node --expose-gc benchmark/index.js",
30
+ "benchmark": "npm run build && node --expose-gc benchmark/index.js",
30
31
  "build": "npx rollup -c .config/rollup.config.js",
31
- "build:types": "tsc -p .config --emitDeclarationOnly",
32
- "coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls"
32
+ "build:types": "tsc -p .config --emitDeclarationOnly"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/core": "^7.13.16",
@@ -39,7 +39,7 @@
39
39
  "@rollup/plugin-babel": "^5.3.0",
40
40
  "coveralls": "^3.1.0",
41
41
  "humanize": "0.0.9",
42
- "jest": "^27.0.5",
42
+ "jest": "^28.1.2",
43
43
  "rollup": "^2.45.2",
44
44
  "rollup-plugin-terser": "^7.0.2",
45
45
  "typescript": "^4.2.4"
@@ -63,5 +63,6 @@
63
63
  "files": [
64
64
  "/dist",
65
65
  "/lib"
66
- ]
66
+ ],
67
+ "dependencies": {}
67
68
  }