@orchidjs/sifter 0.8.1 → 0.9.1
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/README.md +25 -3
- package/dist/cjs/diacritics.js +19 -3
- package/dist/cjs/diacritics.js.map +1 -1
- package/dist/cjs/sifter.js +6 -1
- package/dist/cjs/sifter.js.map +1 -1
- package/dist/cjs/utils.js +1 -0
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/diacritics.js +19 -3
- package/dist/esm/diacritics.js.map +1 -1
- package/dist/esm/sifter.js +6 -1
- package/dist/esm/sifter.js.map +1 -1
- package/dist/esm/utils.js +1 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/diacritics.d.ts +1 -0
- package/dist/types/sifter.d.ts +3 -3
- package/dist/types/types.d.ts +10 -8
- package/dist/types/utils.d.ts +1 -1
- package/dist/umd/sifter.js +26 -4
- package/dist/umd/sifter.js.map +1 -1
- package/dist/umd/sifter.min.js +11 -4
- package/dist/umd/sifter.min.js.map +1 -1
- package/lib/diacritics.ts +22 -6
- package/lib/sifter.ts +6 -2
- package/lib/types.ts +12 -8
- package/lib/utils.ts +3 -0
- package/package.json +6 -2
- package/.config/babel.config.json +0 -17
- package/.config/rollup.config.js +0 -95
- package/.config/tsconfig.json +0 -16
- package/.travis.yml +0 -9
- package/Makefile +0 -27
- package/build/cjs/diacritics.js +0 -157
- package/build/cjs/diacritics.js.map +0 -1
- package/build/cjs/sifter.js +0 -372
- package/build/cjs/sifter.js.map +0 -1
- package/build/cjs/utils.js +0 -113
- package/build/cjs/utils.js.map +0 -1
- package/build/esm/diacritics.js +0 -148
- package/build/esm/diacritics.js.map +0 -1
- package/build/esm/sifter.js +0 -370
- package/build/esm/sifter.js.map +0 -1
- package/build/esm/utils.js +0 -103
- package/build/esm/utils.js.map +0 -1
- package/build/umd/sifter.js +0 -618
- package/build/umd/sifter.js.map +0 -1
- package/build/umd/sifter.min.js +0 -77
- package/build/umd/sifter.min.js.map +0 -1
- package/coverage/clover.xml +0 -251
- package/coverage/coverage-final.json +0 -4
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/diacritics.ts.html +0 -1085
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -141
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sifter.ts.html +0 -1157
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/utils.ts.html +0 -419
- package/coverage/lcov.info +0 -492
- package/release.sh +0 -119
- package/test/diacritics.js +0 -64
- package/test/getScoreFunction.js +0 -55
- package/test/prepareSearch.js +0 -40
- package/test/search.js +0 -335
- package/test/sorting.js +0 -193
- package/test/tokenize.js +0 -63
- package/test/utils.js +0 -28
- package/x-test.js +0 -129
package/x-test.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// node x-test.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var assert = require('assert');
|
|
5
|
-
var diacritics = require('./build/cjs/diacritics.js');
|
|
6
|
-
var utils = require('./build/cjs/utils.js');
|
|
7
|
-
var Sifter = require('./build/cjs/sifter.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var str, reg, sifter;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
str = '\u0041\u006d\u0065\u0301\u006c\u0069\u0065';
|
|
14
|
-
str = 'ae';
|
|
15
|
-
str = 'fi';
|
|
16
|
-
str = 'أهلا';
|
|
17
|
-
|
|
18
|
-
var str = 'ſ';
|
|
19
|
-
var regex = /(?:s|S|ſ)/i;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const asciifold = (str) => {
|
|
23
|
-
return str.normalize('NFKD');
|
|
24
|
-
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase();
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const compose = (str) => {
|
|
28
|
-
return str.normalize('NFC');
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
regex = '\-';
|
|
32
|
-
console.log('regex string',regex);
|
|
33
|
-
regex = new RegExp(regex,'iu');
|
|
34
|
-
console.log('fa-al search','fa-al'.search(regex));
|
|
35
|
-
|
|
36
|
-
const codePoints = (str) => {
|
|
37
|
-
var code_points = Array.from(str)
|
|
38
|
-
.map((v) =>{
|
|
39
|
-
var hex = v.codePointAt(0).toString(16);
|
|
40
|
-
return v + " = \\u{" + hex + "}";
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
console.log('codepoints for ',str,code_points);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var data = [
|
|
48
|
-
{fieldx: 'ff-al'},
|
|
49
|
-
{fieldx: 'ff-la'}
|
|
50
|
-
];
|
|
51
|
-
var sifter = new Sifter(data);
|
|
52
|
-
|
|
53
|
-
var result = sifter.search('-', {
|
|
54
|
-
fields: ['fieldx']
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
assert.equal(result.items.length,2);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
let str_composed = 'أهلا'; // '\u{623}\u{647}\u{644}\u{627}'
|
|
62
|
-
let str_decomposed = 'أهلا'; // '\u{627}\u{654}\u{647}\u{644}\u{627}'
|
|
63
|
-
|
|
64
|
-
//str_decomposed = 'ffl';
|
|
65
|
-
//str_decomposed = 'è';
|
|
66
|
-
str_composed = 'IJ';
|
|
67
|
-
str_decomposed = 'IJ'.normalize('NFKD');
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
sifter = new Sifter([]);
|
|
71
|
-
//const composed = 'a';
|
|
72
|
-
//const composed = 'ʼn';
|
|
73
|
-
const composed = 'ffl';
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
codePoints(composed.normalize('NFKD'));
|
|
77
|
-
|
|
78
|
-
tokens = sifter.tokenize(composed);
|
|
79
|
-
console.log(tokens);
|
|
80
|
-
|
|
81
|
-
assert.equal(tokens[0].regex.test('ffl'), true);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//console.log('\u{623}\u{647}\u{644}\u{627}');
|
|
85
|
-
//console.log('\u{627}\u{654}\u{647}\u{644}\u{627}');
|
|
86
|
-
/*
|
|
87
|
-
codePoints(str_composed);
|
|
88
|
-
codePoints(asciifold(str_composed));
|
|
89
|
-
codePoints(compose(str_composed));
|
|
90
|
-
|
|
91
|
-
codePoints(str_decomposed);
|
|
92
|
-
codePoints(asciifold(str_decomposed));
|
|
93
|
-
codePoints(compose(str_decomposed));
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//console.log(str.length);
|
|
98
|
-
//console.log(str,asciifold(str));
|
|
99
|
-
|
|
100
|
-
//console.log(diacritics.generateDiacritics());
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
//reg = diacritics.diacriticRegexPoints('1 ae \u0041\u006d\u0065\u0301\u006c\u0069\u0065 ffl ffl IJ أهلا');
|
|
104
|
-
|
|
105
|
-
//console.log('reg length',reg);
|
|
106
|
-
//console.log('reg length',reg.length);
|
|
107
|
-
|
|
108
|
-
/*
|
|
109
|
-
reg = new RegExp('(?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A)|(?:E|ɛ|Ⓔ))');
|
|
110
|
-
reg = new RegExp('(?:(?:ae|Æ|Ǽ|Ǣ)|[AⒶA]|[AⒶA])');
|
|
111
|
-
|
|
112
|
-
str = 'beaes'
|
|
113
|
-
|
|
114
|
-
pos = str.search(reg);
|
|
115
|
-
|
|
116
|
-
console.log('reg',reg);
|
|
117
|
-
console.log('pos',pos);
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//console.log('Ⱥ codepoints','Ⱥ'.codePointAt(0),'Ⱥ'.codePointAt(1));
|
|
123
|
-
|
|
124
|
-
//let latin = toLatin('Ⱥ');
|
|
125
|
-
//console.log('Ⱥ latin',latin);
|
|
126
|
-
|
|
127
|
-
let string = 'does this work? Ⱥ ?= \u023A \u023B \u023C A\u0335 A\u0338 A\u0337'
|
|
128
|
-
//console.log(string);
|
|
129
|
-
//console.log(toLatin(string));
|