@orchidjs/sifter
Advanced tools
Comparing version 0.7.5 to 0.8.0
@@ -7,2 +7,13 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -13,3 +24,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -22,5 +33,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -30,39 +76,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -75,54 +126,37 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
exports.allSubstrings = allSubstrings; | ||
exports.arrayToPattern = arrayToPattern; | ||
exports.asciifold = asciifold; | ||
exports.code_points = code_points; | ||
exports.diacriticRegexPoints = diacriticRegexPoints; | ||
exports.generateDiacritics = generateDiacritics; | ||
//# sourceMappingURL=diacritics.js.map |
@@ -78,3 +78,3 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -311,6 +311,5 @@ }); | ||
query = diacritics.asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -317,0 +316,0 @@ total: 0, |
/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -8,3 +19,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -17,5 +28,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -25,39 +71,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -70,52 +121,32 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
export { asciifold, diacriticRegexPoints, generateDiacritics }; | ||
export { allSubstrings, arrayToPattern, asciifold, code_points, diacriticRegexPoints, generateDiacritics }; | ||
//# sourceMappingURL=diacritics.js.map |
/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
import { escape_regex, iterate, cmp, propToArray, getAttrNesting, getAttr, scoreValue } from './utils.js'; | ||
import { diacriticRegexPoints, asciifold } from './diacritics.js'; | ||
import { diacriticRegexPoints } from './diacritics.js'; | ||
@@ -76,3 +76,3 @@ /** | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -309,6 +309,5 @@ }); | ||
query = asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -315,0 +314,0 @@ total: 0, |
@@ -9,2 +9,13 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -15,3 +26,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -24,5 +35,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -32,39 +78,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -77,50 +128,30 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
@@ -291,3 +322,3 @@ // @ts-ignore TS2691 "An import path cannot end with a '.ts' extension" | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -524,6 +555,5 @@ }); | ||
query = asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -530,0 +560,0 @@ total: 0, |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).sifter=t()}(this,(function(){"use strict" | ||
var e=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]] | ||
const t=e=>e.normalize("NFD").replace(/[\u0300-\u036F]/g,"").normalize("NFKD").toLowerCase() | ||
var r=null | ||
const n=t=>{null===r&&(r=(()=>{var t={"l·":"l","ʼn":"n","æ":"ae","ø":"o","aʾ":"a","dž":"dz"},r={} | ||
return e.forEach((e=>{for(let n=e[0];n<=e[1];n++){let e=String.fromCharCode(n),i=e.normalize("NFD").replace(/[\u0300-\u036F]/g,"").normalize("NFKD") | ||
i!=e&&(i=i.toLowerCase(),i in t&&(i=t[i]),i in r||(r[i]=i+i.toUpperCase()),r[i]+=e)}})),r})()) | ||
for(let e in r)r.hasOwnProperty(e)&&(t=t.replace(new RegExp(e,"g"),"["+r[e]+"]")) | ||
return t},i=(e,t)=>{if(e)return e[t]},o=(e,t)=>{if(e){for(var r,n=t.split(".");(r=n.shift())&&(e=e[r]););return e}},s=(e,t,r)=>{var n,i | ||
return e?-1===(i=(e+="").search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n*r):0},c=e=>(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),u=(e,t)=>{var r=e[t] | ||
r&&!Array.isArray(r)&&(e[t]=[r])},f=(e,t)=>{if(Array.isArray(e))e.forEach(t) | ||
else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)},l=(e,r)=>"number"==typeof e&&"number"==typeof r?e>r?1:e<r?-1:0:(e=t(e+"").toLowerCase())>(r=t(r+"").toLowerCase())?1:r>e?-1:0 | ||
var e | ||
const t="[̀-ͯ·ʾ]",r=new RegExp(t,"g") | ||
var n | ||
const i={"æ":"ae","ⱥ":"a","ø":"o"},o=new RegExp(Object.keys(i).join("|"),"g"),s=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],c=e=>e.normalize("NFKD").replace(r,"").toLowerCase().replace(o,(function(e){return i[e]})),u=(e,t="|")=>e.length>1?"(?:"+e.join(t)+")":e[0],f=e=>{if(1===e.length)return[[e]] | ||
var t=[] | ||
return f(e.substring(1)).forEach((function(r){var n=r.slice(0) | ||
n[0]=e.charAt(0)+n[0],t.push(n),(n=r.slice(0)).unshift(e.charAt(0)),t.push(n)})),t},a=t=>{void 0===n&&(n=(()=>{var t={} | ||
s.forEach((e=>{for(let r=e[0];r<=e[1];r++){let e=String.fromCharCode(r),n=c(e) | ||
n!=e.toLowerCase()&&(n in t||(t[n]=[n]),t[n].push(e))}})) | ||
var r=Object.keys(t) | ||
r=r.sort(((e,t)=>t.length-e.length)),e=new RegExp("("+u(r)+"[̀-ͯ·ʾ]*)","g") | ||
var n={} | ||
return r.sort(((e,t)=>e.length-t.length)).forEach((e=>{var r=f(e).map((e=>(e=e.map((e=>t.hasOwnProperty(e)?u(t[e]):e)),u(e,"")))) | ||
n[e]=u(r)})),n})()) | ||
return t.normalize("NFKD").toLowerCase().split(e).map((e=>{if(""==e)return"" | ||
const t=c(e) | ||
if(n.hasOwnProperty(t))return n[t] | ||
const r=e.normalize("NFC") | ||
return r!=e?u([e,r]):e})).join("")},l=(e,t)=>{if(e)return e[t]},h=(e,t)=>{if(e){for(var r,n=t.split(".");(r=n.shift())&&(e=e[r]););return e}},g=(e,t,r)=>{var n,i | ||
return e?-1===(i=(e+="").search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n*r):0},p=e=>(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),d=(e,t)=>{var r=e[t] | ||
r&&!Array.isArray(r)&&(e[t]=[r])},m=(e,t)=>{if(Array.isArray(e))e.forEach(t) | ||
else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)},y=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=c(e+"").toLowerCase())>(t=c(t+"").toLowerCase())?1:t>e?-1:0 | ||
@@ -30,18 +41,18 @@ ;/** | ||
return class{constructor(e,t){this.items=void 0,this.settings=void 0,this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,r){if(!e||!e.length)return[] | ||
const i=[],o=e.split(/\s+/) | ||
var s | ||
return r&&(s=new RegExp("^("+Object.keys(r).map(c).join("|")+"):(.*)$")),o.forEach((e=>{let r,o=null,u=null | ||
s&&(r=e.match(s))&&(o=r[1],e=r[2]),e.length>0&&(u=c(e),this.settings.diacritics&&(u=n(u)),t&&(u="\\b"+u)),i.push({string:e,regex:u?new RegExp(u,"i"):null,field:o})})),i}getScoreFunction(e,t){var r=this.prepareSearch(e,t) | ||
const n=[],i=e.split(/\s+/) | ||
var o | ||
return r&&(o=new RegExp("^("+Object.keys(r).map(p).join("|")+"):(.*)$")),i.forEach((e=>{let r,i=null,s=null | ||
o&&(r=e.match(o))&&(i=r[1],e=r[2]),e.length>0&&(s=p(e),this.settings.diacritics&&(s=a(s)),t&&(s="\\b"+s)),n.push({string:e,regex:s?new RegExp(s,"iu"):null,field:i})})),n}getScoreFunction(e,t){var r=this.prepareSearch(e,t) | ||
return this._getScoreFunction(r)}_getScoreFunction(e){const t=e.tokens,r=t.length | ||
if(!r)return function(){return 0} | ||
const n=e.options.fields,i=e.weights,o=n.length,c=e.getAttrFn | ||
const n=e.options.fields,i=e.weights,o=n.length,s=e.getAttrFn | ||
if(!o)return function(){return 1} | ||
const u=1===o?function(e,t){const r=n[0].field | ||
return s(c(t,r),e,i[r])}:function(e,t){var r=0 | ||
if(e.field){const n=c(t,e.field) | ||
!e.regex&&n?r+=1/o:r+=s(n,e,1)}else f(i,((n,i)=>{r+=s(c(t,i),e,n)})) | ||
const c=1===o?function(e,t){const r=n[0].field | ||
return g(s(t,r),e,i[r])}:function(e,t){var r=0 | ||
if(e.field){const n=s(t,e.field) | ||
!e.regex&&n?r+=1/o:r+=g(n,e,1)}else m(i,((n,i)=>{r+=g(s(t,i),e,n)})) | ||
return r/o} | ||
return 1===r?function(e){return u(t[0],e)}:"and"===e.options.conjunction?function(e){for(var n,i=0,o=0;i<r;i++){if((n=u(t[i],e))<=0)return 0 | ||
return 1===r?function(e){return c(t[0],e)}:"and"===e.options.conjunction?function(e){for(var n,i=0,o=0;i<r;i++){if((n=c(t[i],e))<=0)return 0 | ||
o+=n}return o/r}:function(e){var n=0 | ||
return f(t,(t=>{n+=u(t,e)})),n/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t) | ||
return m(t,(t=>{n+=c(t,e)})),n/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t) | ||
return this._getSortFunction(r)}_getSortFunction(e){var t,r,n | ||
@@ -55,14 +66,14 @@ const i=this,o=e.options,s=!e.query&&o.sort_empty?o.sort_empty:o.sort,c=[],u=[],f=function(t,r){return"$score"===t?r.score:e.getAttrFn(i.items[r.id],t)} | ||
if(a){if(1===a){const e=c[0].field,t=u[0] | ||
return function(r,n){return t*l(f(e,r),f(e,n))}}return function(e,t){var r,n,i | ||
for(r=0;r<a;r++)if(i=c[r].field,n=u[r]*l(f(i,e),f(i,t)))return n | ||
return 0}}return null}prepareSearch(e,r){const n={} | ||
var s=Object.assign({},r) | ||
if(u(s,"sort"),u(s,"sort_empty"),s.fields){u(s,"fields") | ||
return function(r,n){return t*y(f(e,r),f(e,n))}}return function(e,t){var r,n,i | ||
for(r=0;r<a;r++)if(i=c[r].field,n=u[r]*y(f(i,e),f(i,t)))return n | ||
return 0}}return null}prepareSearch(e,t){const r={} | ||
var n=Object.assign({},t) | ||
if(d(n,"sort"),d(n,"sort_empty"),n.fields){d(n,"fields") | ||
const e=[] | ||
s.fields.forEach((t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),n[t.field]="weight"in t?t.weight:1})),s.fields=e}return{options:s,query:e=t(e+"").toLowerCase().trim(),tokens:this.tokenize(e,s.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:s.nesting?o:i}}search(e,t){var r,n,i=this | ||
n.fields.forEach((t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),r[t.field]="weight"in t?t.weight:1})),n.fields=e}return{options:n,query:e.toLowerCase().trim(),tokens:this.tokenize(e,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?h:l}}search(e,t){var r,n,i=this | ||
n=this.prepareSearch(e,t),t=n.options,e=n.query | ||
const o=t.score||i._getScoreFunction(n) | ||
e.length?f(i.items,((e,i)=>{r=o(e),(!1===t.filter||r>0)&&n.items.push({score:r,id:i})})):f(i.items,((e,t)=>{n.items.push({score:1,id:t})})) | ||
e.length?m(i.items,((e,i)=>{r=o(e),(!1===t.filter||r>0)&&n.items.push({score:r,id:i})})):m(i.items,((e,t)=>{n.items.push({score:1,id:t})})) | ||
const s=i._getSortFunction(n) | ||
return s&&n.items.sort(s),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n}}})) | ||
//# sourceMappingURL=sifter.min.js.map |
@@ -1,4 +0,4 @@ | ||
{"/var/www/html/github/sifter.js/lib/diacritics.ts": {"path":"/var/www/html/github/sifter.js/lib/diacritics.ts","statementMap":{"0":{"start":{"line":110,"column":18},"end":{"line":110,"column":null}},"1":{"start":{"line":141,"column":26},"end":{"line":143,"column":null}},"2":{"start":{"line":142,"column":1},"end":{"line":142,"column":8}},"3":{"start":{"line":191,"column":34},"end":{"line":231,"column":null}},"4":{"start":{"line":193,"column":43},"end":{"line":193,"column":null}},"5":{"start":{"line":202,"column":40},"end":{"line":202,"column":null}},"6":{"start":{"line":204,"column":1},"end":{"line":204,"column":12}},"7":{"start":{"line":206,"column":2},"end":{"line":225,"column":null}},"8":{"start":{"line":206,"column":14},"end":{"line":206,"column":25}},"9":{"start":{"line":207,"column":19},"end":{"line":207,"column":25}},"10":{"start":{"line":208,"column":16},"end":{"line":208,"column":25}},"11":{"start":{"line":210,"column":3},"end":{"line":213,"column":null}},"12":{"start":{"line":212,"column":4},"end":{"line":212,"column":null}},"13":{"start":{"line":215,"column":3},"end":{"line":215,"column":8}},"14":{"start":{"line":217,"column":3},"end":{"line":219,"column":null}},"15":{"start":{"line":218,"column":4},"end":{"line":218,"column":9}},"16":{"start":{"line":221,"column":3},"end":{"line":223,"column":null}},"17":{"start":{"line":222,"column":4},"end":{"line":222,"column":14}},"18":{"start":{"line":224,"column":3},"end":{"line":224,"column":13}},"19":{"start":{"line":230,"column":1},"end":{"line":230,"column":8}},"20":{"start":{"line":238,"column":37},"end":{"line":238,"column":null}},"21":{"start":{"line":239,"column":37},"end":{"line":251,"column":null}},"22":{"start":{"line":241,"column":1},"end":{"line":243,"column":null}},"23":{"start":{"line":242,"column":2},"end":{"line":242,"column":12}},"24":{"start":{"line":245,"column":1},"end":{"line":249,"column":null}},"25":{"start":{"line":246,"column":2},"end":{"line":248,"column":null}},"26":{"start":{"line":247,"column":3},"end":{"line":247,"column":8}},"27":{"start":{"line":250,"column":1},"end":{"line":250,"column":8}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":141,"column":26},"end":{"line":141,"column":48}},"loc":{"start":{"line":141,"column":48},"end":{"line":143,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":191,"column":34},"end":{"line":191,"column":55}},"loc":{"start":{"line":191,"column":55},"end":{"line":231,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":204,"column":22},"end":{"line":204,"column":35}},"loc":{"start":{"line":204,"column":35},"end":{"line":226,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":239,"column":37},"end":{"line":239,"column":61}},"loc":{"start":{"line":239,"column":61},"end":{"line":251,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":210,"column":3},"end":{"line":213,"column":null}},"type":"if","locations":[{"start":{"line":210,"column":3},"end":{"line":213,"column":null}},{"start":{"line":210,"column":3},"end":{"line":213,"column":null}}]},"1":{"loc":{"start":{"line":217,"column":3},"end":{"line":219,"column":null}},"type":"if","locations":[{"start":{"line":217,"column":3},"end":{"line":219,"column":null}},{"start":{"line":217,"column":3},"end":{"line":219,"column":null}}]},"2":{"loc":{"start":{"line":221,"column":3},"end":{"line":223,"column":null}},"type":"if","locations":[{"start":{"line":221,"column":3},"end":{"line":223,"column":null}},{"start":{"line":221,"column":3},"end":{"line":223,"column":null}}]},"3":{"loc":{"start":{"line":241,"column":1},"end":{"line":243,"column":null}},"type":"if","locations":[{"start":{"line":241,"column":1},"end":{"line":243,"column":null}},{"start":{"line":241,"column":1},"end":{"line":243,"column":null}}]},"4":{"loc":{"start":{"line":246,"column":2},"end":{"line":248,"column":null}},"type":"if","locations":[{"start":{"line":246,"column":2},"end":{"line":248,"column":null}},{"start":{"line":246,"column":2},"end":{"line":248,"column":null}}]}},"s":{"0":6,"1":6,"2":146,"3":6,"4":5,"5":5,"6":5,"7":115,"8":115,"9":4840,"10":4840,"11":4840,"12":1700,"13":3140,"14":3140,"15":65,"16":3140,"17":190,"18":3140,"19":5,"20":6,"21":6,"22":41,"23":5,"24":41,"25":1558,"26":1558,"27":41},"f":{"0":146,"1":5,"2":115,"3":41},"b":{"0":[1700,3140],"1":[65,3075],"2":[190,2950],"3":[5,36],"4":[1558,0]}} | ||
,"/var/www/html/github/sifter.js/lib/sifter.ts": {"path":"/var/www/html/github/sifter.js/lib/sifter.ts","statementMap":{"0":{"start":{"line":35,"column":45},"end":{"line":35,"column":null}},"1":{"start":{"line":36,"column":2},"end":{"line":36,"column":7}},"2":{"start":{"line":37,"column":2},"end":{"line":37,"column":7}},"3":{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},"4":{"start":{"line":46,"column":31},"end":{"line":46,"column":38}},"5":{"start":{"line":48,"column":27},"end":{"line":48,"column":null}},"6":{"start":{"line":49,"column":19},"end":{"line":49,"column":24}},"7":{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},"8":{"start":{"line":53,"column":3},"end":{"line":53,"column":14}},"9":{"start":{"line":56,"column":2},"end":{"line":56,"column":7}},"10":{"start":{"line":58,"column":27},"end":{"line":58,"column":null}},"11":{"start":{"line":59,"column":27},"end":{"line":59,"column":null}},"12":{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},"13":{"start":{"line":63,"column":4},"end":{"line":63,"column":9}},"14":{"start":{"line":64,"column":4},"end":{"line":64,"column":8}},"15":{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},"16":{"start":{"line":68,"column":4},"end":{"line":68,"column":9}},"17":{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},"18":{"start":{"line":70,"column":5},"end":{"line":70,"column":10}},"19":{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},"20":{"start":{"line":72,"column":34},"end":{"line":72,"column":39}},"21":{"start":{"line":75,"column":3},"end":{"line":75,"column":9}},"22":{"start":{"line":82,"column":2},"end":{"line":82,"column":9}},"23":{"start":{"line":95,"column":15},"end":{"line":95,"column":20}},"24":{"start":{"line":96,"column":2},"end":{"line":96,"column":9}},"25":{"start":{"line":100,"column":18},"end":{"line":100,"column":null}},"26":{"start":{"line":101,"column":18},"end":{"line":101,"column":null}},"27":{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},"28":{"start":{"line":104,"column":3},"end":{"line":104,"column":10}},"29":{"start":{"line":104,"column":23},"end":{"line":104,"column":30}},"30":{"start":{"line":107,"column":17},"end":{"line":107,"column":null}},"31":{"start":{"line":108,"column":14},"end":{"line":108,"column":null}},"32":{"start":{"line":109,"column":17},"end":{"line":109,"column":null}},"33":{"start":{"line":110,"column":15},"end":{"line":110,"column":null}},"34":{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},"35":{"start":{"line":113,"column":3},"end":{"line":113,"column":10}},"36":{"start":{"line":113,"column":23},"end":{"line":113,"column":30}},"37":{"start":{"line":122,"column":23},"end":{"line":122,"column":1}},"38":{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},"39":{"start":{"line":126,"column":4},"end":{"line":126,"column":11}},"40":{"start":{"line":127,"column":19},"end":{"line":127,"column":null}},"41":{"start":{"line":128,"column":5},"end":{"line":128,"column":12}},"42":{"start":{"line":132,"column":3},"end":{"line":132,"column":10}},"43":{"start":{"line":133,"column":14},"end":{"line":133,"column":null}},"44":{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},"45":{"start":{"line":138,"column":19},"end":{"line":138,"column":29}},"46":{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},"47":{"start":{"line":141,"column":6},"end":{"line":141,"column":9}},"48":{"start":{"line":143,"column":6},"end":{"line":143,"column":9}},"49":{"start":{"line":149,"column":5},"end":{"line":149,"column":12}},"50":{"start":{"line":150,"column":6},"end":{"line":150,"column":9}},"51":{"start":{"line":154,"column":4},"end":{"line":154,"column":11}},"52":{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},"53":{"start":{"line":159,"column":3},"end":{"line":159,"column":10}},"54":{"start":{"line":160,"column":4},"end":{"line":160,"column":11}},"55":{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},"56":{"start":{"line":165,"column":3},"end":{"line":165,"column":10}},"57":{"start":{"line":166,"column":12},"end":{"line":166,"column":15}},"58":{"start":{"line":166,"column":28},"end":{"line":166,"column":null}},"59":{"start":{"line":167,"column":4},"end":{"line":171,"column":null}},"60":{"start":{"line":168,"column":5},"end":{"line":168,"column":10}},"61":{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},"62":{"start":{"line":169,"column":21},"end":{"line":169,"column":28}},"63":{"start":{"line":170,"column":5},"end":{"line":170,"column":8}},"64":{"start":{"line":172,"column":4},"end":{"line":172,"column":11}},"65":{"start":{"line":175,"column":3},"end":{"line":175,"column":10}},"66":{"start":{"line":176,"column":14},"end":{"line":176,"column":null}},"67":{"start":{"line":177,"column":4},"end":{"line":177,"column":11}},"68":{"start":{"line":178,"column":5},"end":{"line":178,"column":8}},"69":{"start":{"line":180,"column":4},"end":{"line":180,"column":11}},"70":{"start":{"line":193,"column":16},"end":{"line":193,"column":21}},"71":{"start":{"line":194,"column":2},"end":{"line":194,"column":9}},"72":{"start":{"line":200,"column":15},"end":{"line":200,"column":null}},"73":{"start":{"line":201,"column":13},"end":{"line":201,"column":null}},"74":{"start":{"line":202,"column":11},"end":{"line":202,"column":null}},"75":{"start":{"line":203,"column":24},"end":{"line":203,"column":null}},"76":{"start":{"line":204,"column":25},"end":{"line":204,"column":null}},"77":{"start":{"line":212,"column":20},"end":{"line":215,"column":null}},"78":{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},"79":{"start":{"line":213,"column":26},"end":{"line":213,"column":33}},"80":{"start":{"line":214,"column":3},"end":{"line":214,"column":10}},"81":{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},"82":{"start":{"line":219,"column":3},"end":{"line":223,"column":null}},"83":{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},"84":{"start":{"line":221,"column":5},"end":{"line":221,"column":14}},"85":{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},"86":{"start":{"line":229,"column":3},"end":{"line":229,"column":17}},"87":{"start":{"line":230,"column":3},"end":{"line":235,"column":null}},"88":{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},"89":{"start":{"line":232,"column":5},"end":{"line":232,"column":19}},"90":{"start":{"line":233,"column":5},"end":{"line":233,"column":null}},"91":{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},"92":{"start":{"line":237,"column":4},"end":{"line":237,"column":13}},"93":{"start":{"line":240,"column":3},"end":{"line":245,"column":null}},"94":{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},"95":{"start":{"line":242,"column":5},"end":{"line":242,"column":14}},"96":{"start":{"line":243,"column":5},"end":{"line":243,"column":null}},"97":{"start":{"line":248,"column":2},"end":{"line":250,"column":null}},"98":{"start":{"line":249,"column":3},"end":{"line":249,"column":14}},"99":{"start":{"line":253,"column":26},"end":{"line":253,"column":null}},"100":{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},"101":{"start":{"line":255,"column":3},"end":{"line":255,"column":10}},"102":{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},"103":{"start":{"line":257,"column":20},"end":{"line":257,"column":null}},"104":{"start":{"line":258,"column":22},"end":{"line":258,"column":34}},"105":{"start":{"line":259,"column":3},"end":{"line":259,"column":10}},"106":{"start":{"line":260,"column":4},"end":{"line":260,"column":11}},"107":{"start":{"line":266,"column":3},"end":{"line":266,"column":10}},"108":{"start":{"line":268,"column":4},"end":{"line":275,"column":null}},"109":{"start":{"line":269,"column":5},"end":{"line":269,"column":10}},"110":{"start":{"line":270,"column":5},"end":{"line":270,"column":11}},"111":{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},"112":{"start":{"line":274,"column":17},"end":{"line":274,"column":24}},"113":{"start":{"line":276,"column":4},"end":{"line":276,"column":11}},"114":{"start":{"line":288,"column":28},"end":{"line":288,"column":null}},"115":{"start":{"line":289,"column":17},"end":{"line":289,"column":23}},"116":{"start":{"line":291,"column":2},"end":{"line":291,"column":13}},"117":{"start":{"line":292,"column":2},"end":{"line":292,"column":13}},"118":{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},"119":{"start":{"line":296,"column":3},"end":{"line":296,"column":14}},"120":{"start":{"line":297,"column":28},"end":{"line":297,"column":null}},"121":{"start":{"line":298,"column":3},"end":{"line":298,"column":10}},"122":{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},"123":{"start":{"line":300,"column":5},"end":{"line":300,"column":10}},"124":{"start":{"line":302,"column":4},"end":{"line":302,"column":10}},"125":{"start":{"line":303,"column":4},"end":{"line":303,"column":11}},"126":{"start":{"line":305,"column":3},"end":{"line":305,"column":10}},"127":{"start":{"line":308,"column":2},"end":{"line":308,"column":7}},"128":{"start":{"line":310,"column":2},"end":{"line":310,"column":9}},"129":{"start":{"line":326,"column":13},"end":{"line":326,"column":19}},"130":{"start":{"line":328,"column":2},"end":{"line":328,"column":8}},"131":{"start":{"line":329,"column":2},"end":{"line":329,"column":9}},"132":{"start":{"line":330,"column":2},"end":{"line":330,"column":7}},"133":{"start":{"line":333,"column":19},"end":{"line":333,"column":40}},"134":{"start":{"line":336,"column":2},"end":{"line":347,"column":null}},"135":{"start":{"line":337,"column":3},"end":{"line":337,"column":10}},"136":{"start":{"line":338,"column":4},"end":{"line":338,"column":9}},"137":{"start":{"line":339,"column":4},"end":{"line":341,"column":null}},"138":{"start":{"line":340,"column":5},"end":{"line":340,"column":11}},"139":{"start":{"line":344,"column":3},"end":{"line":344,"column":10}},"140":{"start":{"line":345,"column":4},"end":{"line":345,"column":10}},"141":{"start":{"line":349,"column":18},"end":{"line":349,"column":22}},"142":{"start":{"line":350,"column":2},"end":{"line":350,"column":21}},"143":{"start":{"line":350,"column":15},"end":{"line":350,"column":21}},"144":{"start":{"line":353,"column":2},"end":{"line":353,"column":8}},"145":{"start":{"line":354,"column":2},"end":{"line":356,"column":null}},"146":{"start":{"line":355,"column":3},"end":{"line":355,"column":9}},"147":{"start":{"line":358,"column":2},"end":{"line":358,"column":9}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":35,"column":1},"end":{"line":35,"column":12}},"loc":{"start":{"line":35,"column":45},"end":{"line":38,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":45,"column":1},"end":{"line":45,"column":9}},"loc":{"start":{"line":45,"column":89},"end":{"line":83,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":56,"column":17},"end":{"line":56,"column":33}},"loc":{"start":{"line":56,"column":33},"end":{"line":80,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":94,"column":1},"end":{"line":94,"column":17}},"loc":{"start":{"line":94,"column":51},"end":{"line":97,"column":null}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":99,"column":1},"end":{"line":99,"column":18}},"loc":{"start":{"line":99,"column":40},"end":{"line":183,"column":null}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":104,"column":10},"end":{"line":104,"column":21}},"loc":{"start":{"line":104,"column":21},"end":{"line":104,"column":null}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":113,"column":10},"end":{"line":113,"column":21}},"loc":{"start":{"line":113,"column":21},"end":{"line":113,"column":null}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":122,"column":23},"end":{"line":122,"column":34}},"loc":{"start":{"line":122,"column":34},"end":{"line":156,"column":null}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":126,"column":11},"end":{"line":126,"column":20}},"loc":{"start":{"line":126,"column":44},"end":{"line":129,"column":null}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":132,"column":10},"end":{"line":132,"column":19}},"loc":{"start":{"line":132,"column":43},"end":{"line":155,"column":null}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":149,"column":22},"end":{"line":149,"column":23}},"loc":{"start":{"line":149,"column":55},"end":{"line":151,"column":null}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":159,"column":10},"end":{"line":159,"column":19}},"loc":{"start":{"line":159,"column":28},"end":{"line":161,"column":null}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":165,"column":10},"end":{"line":165,"column":19}},"loc":{"start":{"line":165,"column":28},"end":{"line":173,"column":null}}},"13":{"name":"(anonymous_13)","decl":{"start":{"line":175,"column":10},"end":{"line":175,"column":19}},"loc":{"start":{"line":175,"column":28},"end":{"line":181,"column":null}}},"14":{"name":"(anonymous_14)","decl":{"start":{"line":177,"column":20},"end":{"line":177,"column":36}},"loc":{"start":{"line":177,"column":36},"end":{"line":179,"column":null}}},"15":{"name":"(anonymous_15)","decl":{"start":{"line":192,"column":1},"end":{"line":192,"column":16}},"loc":{"start":{"line":192,"column":50},"end":{"line":195,"column":null}}},"16":{"name":"(anonymous_16)","decl":{"start":{"line":197,"column":1},"end":{"line":197,"column":17}},"loc":{"start":{"line":197,"column":38},"end":{"line":279,"column":null}}},"17":{"name":"get_field","decl":{"start":{"line":212,"column":8},"end":{"line":212,"column":17}},"loc":{"start":{"line":212,"column":77},"end":{"line":215,"column":null}}},"18":{"name":"(anonymous_18)","decl":{"start":{"line":259,"column":10},"end":{"line":259,"column":19}},"loc":{"start":{"line":259,"column":51},"end":{"line":264,"column":null}}},"19":{"name":"(anonymous_19)","decl":{"start":{"line":266,"column":10},"end":{"line":266,"column":19}},"loc":{"start":{"line":266,"column":51},"end":{"line":277,"column":null}}},"20":{"name":"(anonymous_20)","decl":{"start":{"line":287,"column":1},"end":{"line":287,"column":14}},"loc":{"start":{"line":287,"column":62},"end":{"line":319,"column":null}}},"21":{"name":"(anonymous_21)","decl":{"start":{"line":298,"column":27},"end":{"line":298,"column":52}},"loc":{"start":{"line":298,"column":52},"end":{"line":304,"column":null}}},"22":{"name":"(anonymous_22)","decl":{"start":{"line":325,"column":1},"end":{"line":325,"column":7}},"loc":{"start":{"line":325,"column":56},"end":{"line":359,"column":null}}},"23":{"name":"(anonymous_23)","decl":{"start":{"line":337,"column":23},"end":{"line":337,"column":24}},"loc":{"start":{"line":337,"column":64},"end":{"line":342,"column":null}}},"24":{"name":"(anonymous_24)","decl":{"start":{"line":344,"column":23},"end":{"line":344,"column":24}},"loc":{"start":{"line":344,"column":64},"end":{"line":346,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":37,"column":18},"end":{"line":37,"column":26}},"type":"binary-expr","locations":[{"start":{"line":37,"column":18},"end":{"line":37,"column":26}},{"start":{"line":37,"column":30},"end":{"line":37,"column":31}}]},"1":{"loc":{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},"type":"if","locations":[{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},{"start":{"line":46,"column":2},"end":{"line":46,"column":38}}]},"2":{"loc":{"start":{"line":46,"column":6},"end":{"line":46,"column":16}},"type":"binary-expr","locations":[{"start":{"line":46,"column":6},"end":{"line":46,"column":16}},{"start":{"line":46,"column":16},"end":{"line":46,"column":31}}]},"3":{"loc":{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},"type":"if","locations":[{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},{"start":{"line":52,"column":2},"end":{"line":54,"column":null}}]},"4":{"loc":{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},"type":"if","locations":[{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},{"start":{"line":62,"column":3},"end":{"line":65,"column":null}}]},"5":{"loc":{"start":{"line":62,"column":7},"end":{"line":62,"column":18}},"type":"binary-expr","locations":[{"start":{"line":62,"column":7},"end":{"line":62,"column":18}},{"start":{"line":62,"column":23},"end":{"line":62,"column":41}}]},"6":{"loc":{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},"type":"if","locations":[{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},{"start":{"line":67,"column":3},"end":{"line":73,"column":null}}]},"7":{"loc":{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},{"start":{"line":69,"column":4},"end":{"line":71,"column":null}}]},"8":{"loc":{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},"type":"if","locations":[{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},{"start":{"line":72,"column":4},"end":{"line":72,"column":39}}]},"9":{"loc":{"start":{"line":77,"column":21},"end":{"line":77,"column":25}},"type":"cond-expr","locations":[{"start":{"line":77,"column":21},"end":{"line":77,"column":25}},{"start":{"line":77,"column":45},"end":{"line":77,"column":null}}]},"10":{"loc":{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},"type":"if","locations":[{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},{"start":{"line":103,"column":2},"end":{"line":105,"column":null}}]},"11":{"loc":{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},"type":"if","locations":[{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},{"start":{"line":112,"column":2},"end":{"line":114,"column":null}}]},"12":{"loc":{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},"type":"if","locations":[{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},{"start":{"line":125,"column":3},"end":{"line":130,"column":null}}]},"13":{"loc":{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},"type":"if","locations":[{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},{"start":{"line":136,"column":4},"end":{"line":152,"column":null}}]},"14":{"loc":{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},"type":"if","locations":[{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},{"start":{"line":140,"column":5},"end":{"line":144,"column":null}}]},"15":{"loc":{"start":{"line":140,"column":9},"end":{"line":140,"column":25}},"type":"binary-expr","locations":[{"start":{"line":140,"column":9},"end":{"line":140,"column":25}},{"start":{"line":140,"column":25},"end":{"line":140,"column":32}}]},"16":{"loc":{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},"type":"if","locations":[{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},{"start":{"line":158,"column":2},"end":{"line":162,"column":null}}]},"17":{"loc":{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},"type":"if","locations":[{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},{"start":{"line":164,"column":2},"end":{"line":182,"column":null}}]},"18":{"loc":{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},"type":"if","locations":[{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},{"start":{"line":169,"column":5},"end":{"line":169,"column":28}}]},"19":{"loc":{"start":{"line":202,"column":50},"end":{"line":202,"column":71}},"type":"cond-expr","locations":[{"start":{"line":202,"column":50},"end":{"line":202,"column":71}},{"start":{"line":202,"column":71},"end":{"line":202,"column":null}}]},"20":{"loc":{"start":{"line":202,"column":11},"end":{"line":202,"column":28}},"type":"binary-expr","locations":[{"start":{"line":202,"column":11},"end":{"line":202,"column":28}},{"start":{"line":202,"column":28},"end":{"line":202,"column":50}}]},"21":{"loc":{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},"type":"if","locations":[{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},{"start":{"line":213,"column":3},"end":{"line":213,"column":33}}]},"22":{"loc":{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},"type":"if","locations":[{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},{"start":{"line":218,"column":2},"end":{"line":224,"column":null}}]},"23":{"loc":{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},"type":"if","locations":[{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},{"start":{"line":220,"column":4},"end":{"line":222,"column":null}}]},"24":{"loc":{"start":{"line":220,"column":8},"end":{"line":220,"column":24}},"type":"binary-expr","locations":[{"start":{"line":220,"column":8},"end":{"line":220,"column":24}},{"start":{"line":220,"column":24},"end":{"line":220,"column":52}}]},"25":{"loc":{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},"type":"if","locations":[{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},{"start":{"line":228,"column":2},"end":{"line":246,"column":null}}]},"26":{"loc":{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},"type":"if","locations":[{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},{"start":{"line":231,"column":4},"end":{"line":234,"column":null}}]},"27":{"loc":{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},"type":"if","locations":[{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},{"start":{"line":236,"column":3},"end":{"line":238,"column":null}}]},"28":{"loc":{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},"type":"if","locations":[{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},{"start":{"line":241,"column":4},"end":{"line":244,"column":null}}]},"29":{"loc":{"start":{"line":249,"column":56},"end":{"line":249,"column":61}},"type":"cond-expr","locations":[{"start":{"line":249,"column":56},"end":{"line":249,"column":61}},{"start":{"line":249,"column":61},"end":{"line":249,"column":null}}]},"30":{"loc":{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},"type":"if","locations":[{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},{"start":{"line":254,"column":2},"end":{"line":278,"column":null}}]},"31":{"loc":{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},"type":"if","locations":[{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},{"start":{"line":256,"column":9},"end":{"line":278,"column":null}}]},"32":{"loc":{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},"type":"if","locations":[{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},{"start":{"line":274,"column":5},"end":{"line":274,"column":24}}]},"33":{"loc":{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},"type":"if","locations":[{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},{"start":{"line":295,"column":2},"end":{"line":306,"column":null}}]},"34":{"loc":{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},"type":"if","locations":[{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},{"start":{"line":299,"column":4},"end":{"line":301,"column":null}}]},"35":{"loc":{"start":{"line":303,"column":49},"end":{"line":303,"column":64}},"type":"cond-expr","locations":[{"start":{"line":303,"column":49},"end":{"line":303,"column":64}},{"start":{"line":303,"column":64},"end":{"line":303,"column":null}}]},"36":{"loc":{"start":{"line":317,"column":35},"end":{"line":317,"column":52}},"type":"cond-expr","locations":[{"start":{"line":317,"column":35},"end":{"line":317,"column":52}},{"start":{"line":317,"column":52},"end":{"line":317,"column":null}}]},"37":{"loc":{"start":{"line":333,"column":19},"end":{"line":333,"column":36}},"type":"binary-expr","locations":[{"start":{"line":333,"column":19},"end":{"line":333,"column":36}},{"start":{"line":333,"column":36},"end":{"line":333,"column":40}}]},"38":{"loc":{"start":{"line":336,"column":2},"end":{"line":347,"column":null}},"type":"if","locations":[{"start":{"line":336,"column":2},"end":{"line":347,"column":null}},{"start":{"line":336,"column":2},"end":{"line":347,"column":null}}]},"39":{"loc":{"start":{"line":339,"column":4},"end":{"line":341,"column":null}},"type":"if","locations":[{"start":{"line":339,"column":4},"end":{"line":341,"column":null}},{"start":{"line":339,"column":4},"end":{"line":341,"column":null}}]},"40":{"loc":{"start":{"line":339,"column":8},"end":{"line":339,"column":36}},"type":"binary-expr","locations":[{"start":{"line":339,"column":8},"end":{"line":339,"column":36}},{"start":{"line":339,"column":36},"end":{"line":339,"column":47}}]},"41":{"loc":{"start":{"line":350,"column":2},"end":{"line":350,"column":21}},"type":"if","locations":[{"start":{"line":350,"column":2},"end":{"line":350,"column":21}},{"start":{"line":350,"column":2},"end":{"line":350,"column":21}}]},"42":{"loc":{"start":{"line":354,"column":2},"end":{"line":356,"column":null}},"type":"if","locations":[{"start":{"line":354,"column":2},"end":{"line":356,"column":null}},{"start":{"line":354,"column":2},"end":{"line":356,"column":null}}]}},"s":{"0":64,"1":32,"2":32,"3":42,"4":10,"5":32,"6":32,"7":32,"8":29,"9":32,"10":42,"11":42,"12":42,"13":3,"14":3,"15":42,"16":41,"17":41,"18":41,"19":41,"20":6,"21":42,"22":32,"23":3,"24":3,"25":36,"26":36,"27":36,"28":9,"29":0,"30":27,"31":27,"32":27,"33":27,"34":27,"35":1,"36":2,"37":26,"38":26,"39":13,"40":38,"41":38,"42":13,"43":62,"44":62,"45":6,"46":6,"47":1,"48":5,"49":56,"50":137,"51":62,"52":26,"53":20,"54":55,"55":6,"56":2,"57":7,"58":7,"59":7,"60":11,"61":11,"62":6,"63":5,"64":1,"65":4,"66":17,"67":17,"68":34,"69":17,"70":0,"71":0,"72":32,"73":32,"74":32,"75":32,"76":32,"77":32,"78":152,"79":24,"80":128,"81":32,"82":13,"83":17,"84":17,"85":32,"86":23,"87":23,"88":6,"89":2,"90":2,"91":23,"92":21,"93":9,"94":11,"95":0,"96":0,"97":32,"98":38,"99":32,"100":32,"101":0,"102":32,"103":26,"104":26,"105":26,"106":38,"107":6,"108":27,"109":38,"110":38,"111":38,"112":22,"113":5,"114":38,"115":38,"116":38,"117":38,"118":38,"119":37,"120":37,"121":37,"122":57,"123":49,"124":57,"125":57,"126":37,"127":38,"128":38,"129":32,"130":32,"131":32,"132":32,"133":32,"134":32,"135":23,"136":65,"137":65,"138":38,"139":9,"140":31,"141":32,"142":32,"143":32,"144":32,"145":32,"146":3,"147":32},"f":{"0":32,"1":42,"2":42,"3":3,"4":36,"5":0,"6":2,"7":26,"8":38,"9":62,"10":137,"11":55,"12":7,"13":17,"14":34,"15":0,"16":32,"17":152,"18":38,"19":27,"20":38,"21":57,"22":32,"23":65,"24":31},"b":{"0":[32,32],"1":[10,32],"2":[42,32],"3":[29,3],"4":[3,39],"5":[42,36],"6":[41,1],"7":[41,0],"8":[6,35],"9":[41,1],"10":[9,27],"11":[1,26],"12":[13,13],"13":[6,56],"14":[1,5],"15":[6,2],"16":[20,6],"17":[2,4],"18":[6,5],"19":[1,31],"20":[32,9],"21":[24,128],"22":[13,19],"23":[17,0],"24":[17,11],"25":[23,9],"26":[2,4],"27":[21,2],"28":[0,11],"29":[23,15],"30":[0,32],"31":[26,6],"32":[22,16],"33":[37,1],"34":[49,8],"35":[55,2],"36":[2,36],"37":[32,32],"38":[23,9],"39":[38,27],"40":[65,62],"41":[32,0],"42":[3,29]}} | ||
,"/var/www/html/github/sifter.js/lib/utils.ts": {"path":"/var/www/html/github/sifter.js/lib/utils.ts","statementMap":{"0":{"start":{"line":15,"column":23},"end":{"line":18,"column":null}},"1":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"2":{"start":{"line":16,"column":15},"end":{"line":16,"column":null}},"3":{"start":{"line":17,"column":4},"end":{"line":17,"column":11}},"4":{"start":{"line":26,"column":30},"end":{"line":31,"column":null}},"5":{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},"6":{"start":{"line":27,"column":15},"end":{"line":27,"column":null}},"7":{"start":{"line":28,"column":22},"end":{"line":28,"column":26}},"8":{"start":{"line":29,"column":1},"end":{"line":29,"column":null}},"9":{"start":{"line":30,"column":4},"end":{"line":30,"column":11}},"10":{"start":{"line":38,"column":26},"end":{"line":51,"column":null}},"11":{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},"12":{"start":{"line":41,"column":13},"end":{"line":41,"column":20}},"13":{"start":{"line":43,"column":1},"end":{"line":43,"column":6}},"14":{"start":{"line":44,"column":1},"end":{"line":44,"column":4}},"15":{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},"16":{"start":{"line":45,"column":17},"end":{"line":45,"column":24}},"17":{"start":{"line":47,"column":1},"end":{"line":47,"column":6}},"18":{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},"19":{"start":{"line":48,"column":16},"end":{"line":48,"column":21}},"20":{"start":{"line":50,"column":1},"end":{"line":50,"column":8}},"21":{"start":{"line":53,"column":29},"end":{"line":55,"column":null}},"22":{"start":{"line":54,"column":1},"end":{"line":54,"column":8}},"23":{"start":{"line":62,"column":27},"end":{"line":67,"column":null}},"24":{"start":{"line":63,"column":13},"end":{"line":63,"column":17}},"25":{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},"26":{"start":{"line":65,"column":2},"end":{"line":65,"column":5}},"27":{"start":{"line":80,"column":23},"end":{"line":93,"column":null}},"28":{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},"29":{"start":{"line":83,"column":2},"end":{"line":83,"column":8}},"30":{"start":{"line":87,"column":2},"end":{"line":91,"column":null}},"31":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"32":{"start":{"line":89,"column":4},"end":{"line":89,"column":12}},"33":{"start":{"line":97,"column":19},"end":{"line":106,"column":null}},"34":{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},"35":{"start":{"line":99,"column":2},"end":{"line":99,"column":9}},"36":{"start":{"line":101,"column":1},"end":{"line":101,"column":2}},"37":{"start":{"line":102,"column":1},"end":{"line":102,"column":2}},"38":{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},"39":{"start":{"line":103,"column":12},"end":{"line":103,"column":19}},"40":{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},"41":{"start":{"line":104,"column":12},"end":{"line":104,"column":19}},"42":{"start":{"line":105,"column":1},"end":{"line":105,"column":8}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":15,"column":23},"end":{"line":15,"column":24}},"loc":{"start":{"line":15,"column":65},"end":{"line":18,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":26,"column":30},"end":{"line":26,"column":31}},"loc":{"start":{"line":26,"column":72},"end":{"line":31,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":38,"column":26},"end":{"line":38,"column":27}},"loc":{"start":{"line":38,"column":82},"end":{"line":51,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":53,"column":29},"end":{"line":53,"column":51}},"loc":{"start":{"line":53,"column":51},"end":{"line":55,"column":null}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":62,"column":27},"end":{"line":62,"column":28}},"loc":{"start":{"line":62,"column":67},"end":{"line":67,"column":null}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":80,"column":23},"end":{"line":80,"column":24}},"loc":{"start":{"line":80,"column":102},"end":{"line":93,"column":null}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":97,"column":19},"end":{"line":97,"column":20}},"loc":{"start":{"line":97,"column":57},"end":{"line":106,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},{"start":{"line":16,"column":4},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},{"start":{"line":27,"column":4},"end":{"line":27,"column":null}}]},"2":{"loc":{"start":{"line":29,"column":9},"end":{"line":29,"column":21}},"type":"binary-expr","locations":[{"start":{"line":29,"column":9},"end":{"line":29,"column":21}},{"start":{"line":29,"column":35},"end":{"line":29,"column":45}}]},"3":{"loc":{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},"type":"if","locations":[{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},{"start":{"line":41,"column":1},"end":{"line":41,"column":20}}]},"4":{"loc":{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},"type":"if","locations":[{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},{"start":{"line":45,"column":1},"end":{"line":45,"column":24}}]},"5":{"loc":{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},"type":"if","locations":[{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},{"start":{"line":48,"column":1},"end":{"line":48,"column":21}}]},"6":{"loc":{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},"type":"if","locations":[{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},{"start":{"line":64,"column":1},"end":{"line":66,"column":null}}]},"7":{"loc":{"start":{"line":64,"column":5},"end":{"line":64,"column":10}},"type":"binary-expr","locations":[{"start":{"line":64,"column":5},"end":{"line":64,"column":10}},{"start":{"line":64,"column":14},"end":{"line":64,"column":20}}]},"8":{"loc":{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},"type":"if","locations":[{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},{"start":{"line":82,"column":1},"end":{"line":92,"column":null}}]},"9":{"loc":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"type":"if","locations":[{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},{"start":{"line":88,"column":3},"end":{"line":90,"column":null}}]},"10":{"loc":{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},"type":"if","locations":[{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},{"start":{"line":98,"column":1},"end":{"line":100,"column":null}}]},"11":{"loc":{"start":{"line":98,"column":5},"end":{"line":98,"column":30}},"type":"binary-expr","locations":[{"start":{"line":98,"column":5},"end":{"line":98,"column":30}},{"start":{"line":98,"column":30},"end":{"line":98,"column":53}}]},"12":{"loc":{"start":{"line":99,"column":17},"end":{"line":99,"column":22}},"type":"cond-expr","locations":[{"start":{"line":99,"column":17},"end":{"line":99,"column":22}},{"start":{"line":99,"column":22},"end":{"line":99,"column":null}}]},"13":{"loc":{"start":{"line":99,"column":30},"end":{"line":99,"column":35}},"type":"cond-expr","locations":[{"start":{"line":99,"column":30},"end":{"line":99,"column":35}},{"start":{"line":99,"column":35},"end":{"line":99,"column":null}}]},"14":{"loc":{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},"type":"if","locations":[{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},{"start":{"line":103,"column":1},"end":{"line":103,"column":19}}]},"15":{"loc":{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},"type":"if","locations":[{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},{"start":{"line":104,"column":1},"end":{"line":104,"column":19}}]}},"s":{"0":6,"1":299,"2":1,"3":298,"4":6,"5":12,"6":1,"7":11,"8":11,"9":11,"10":6,"11":181,"12":16,"13":165,"14":165,"15":165,"16":109,"17":56,"18":56,"19":42,"20":56,"21":6,"22":87,"23":6,"24":113,"25":113,"26":23,"27":6,"28":105,"29":48,"30":57,"31":139,"32":139,"33":6,"34":77,"35":23,"36":54,"37":54,"38":54,"39":16,"40":38,"41":27,"42":11},"f":{"0":299,"1":12,"2":181,"3":87,"4":113,"5":105,"6":77},"b":{"0":[1,298],"1":[1,11],"2":[33,22],"3":[16,165],"4":[109,56],"5":[42,14],"6":[23,90],"7":[113,53],"8":[48,57],"9":[139,0],"10":[23,54],"11":[77,23],"12":[8,15],"13":[6,9],"14":[16,38],"15":[27,11]}} | ||
{"/var/www/html/github/sifter.js/lib/diacritics.ts": {"path":"/var/www/html/github/sifter.js/lib/diacritics.ts","statementMap":{"0":{"start":{"line":7,"column":19},"end":{"line":7,"column":null}},"1":{"start":{"line":8,"column":19},"end":{"line":8,"column":23}},"2":{"start":{"line":11,"column":37},"end":{"line":11,"column":null}},"3":{"start":{"line":17,"column":20},"end":{"line":17,"column":24}},"4":{"start":{"line":125,"column":27},"end":{"line":125,"column":null}},"5":{"start":{"line":156,"column":26},"end":{"line":164,"column":null}},"6":{"start":{"line":157,"column":1},"end":{"line":157,"column":8}},"7":{"start":{"line":162,"column":3},"end":{"line":162,"column":10}},"8":{"start":{"line":212,"column":30},"end":{"line":217,"column":null}},"9":{"start":{"line":213,"column":1},"end":{"line":215,"column":null}},"10":{"start":{"line":214,"column":2},"end":{"line":214,"column":9}},"11":{"start":{"line":216,"column":1},"end":{"line":216,"column":8}},"12":{"start":{"line":224,"column":30},"end":{"line":240,"column":null}},"13":{"start":{"line":226,"column":4},"end":{"line":226,"column":35}},"14":{"start":{"line":226,"column":28},"end":{"line":226,"column":35}},"15":{"start":{"line":228,"column":28},"end":{"line":228,"column":null}},"16":{"start":{"line":229,"column":4},"end":{"line":229,"column":17}},"17":{"start":{"line":230,"column":18},"end":{"line":230,"column":27}},"18":{"start":{"line":231,"column":8},"end":{"line":231,"column":11}},"19":{"start":{"line":232,"column":8},"end":{"line":232,"column":14}},"20":{"start":{"line":234,"column":8},"end":{"line":234,"column":11}},"21":{"start":{"line":235,"column":8},"end":{"line":235,"column":11}},"22":{"start":{"line":236,"column":8},"end":{"line":236,"column":14}},"23":{"start":{"line":239,"column":4},"end":{"line":239,"column":11}},"24":{"start":{"line":246,"column":34},"end":{"line":299,"column":null}},"25":{"start":{"line":248,"column":42},"end":{"line":248,"column":null}},"26":{"start":{"line":249,"column":1},"end":{"line":249,"column":12}},"27":{"start":{"line":251,"column":2},"end":{"line":264,"column":null}},"28":{"start":{"line":251,"column":14},"end":{"line":251,"column":25}},"29":{"start":{"line":253,"column":19},"end":{"line":253,"column":25}},"30":{"start":{"line":254,"column":16},"end":{"line":254,"column":26}},"31":{"start":{"line":256,"column":3},"end":{"line":258,"column":null}},"32":{"start":{"line":257,"column":4},"end":{"line":257,"column":null}},"33":{"start":{"line":260,"column":3},"end":{"line":262,"column":null}},"34":{"start":{"line":261,"column":4},"end":{"line":261,"column":14}},"35":{"start":{"line":263,"column":3},"end":{"line":263,"column":13}},"36":{"start":{"line":267,"column":19},"end":{"line":267,"column":25}},"37":{"start":{"line":272,"column":1},"end":{"line":272,"column":12}},"38":{"start":{"line":272,"column":43},"end":{"line":272,"column":null}},"39":{"start":{"line":273,"column":1},"end":{"line":273,"column":10}},"40":{"start":{"line":279,"column":41},"end":{"line":279,"column":null}},"41":{"start":{"line":280,"column":1},"end":{"line":280,"column":12}},"42":{"start":{"line":280,"column":27},"end":{"line":280,"column":47}},"43":{"start":{"line":282,"column":19},"end":{"line":282,"column":33}},"44":{"start":{"line":283,"column":16},"end":{"line":283,"column":26}},"45":{"start":{"line":285,"column":3},"end":{"line":285,"column":10}},"46":{"start":{"line":286,"column":4},"end":{"line":288,"column":null}},"47":{"start":{"line":287,"column":5},"end":{"line":287,"column":12}},"48":{"start":{"line":289,"column":4},"end":{"line":289,"column":11}},"49":{"start":{"line":292,"column":3},"end":{"line":292,"column":10}},"50":{"start":{"line":295,"column":2},"end":{"line":295,"column":20}},"51":{"start":{"line":298,"column":1},"end":{"line":298,"column":8}},"52":{"start":{"line":306,"column":37},"end":{"line":335,"column":null}},"53":{"start":{"line":308,"column":1},"end":{"line":310,"column":null}},"54":{"start":{"line":309,"column":2},"end":{"line":309,"column":20}},"55":{"start":{"line":312,"column":21},"end":{"line":312,"column":26}},"56":{"start":{"line":314,"column":1},"end":{"line":314,"column":8}},"57":{"start":{"line":316,"column":2},"end":{"line":318,"column":null}},"58":{"start":{"line":317,"column":3},"end":{"line":317,"column":10}},"59":{"start":{"line":321,"column":20},"end":{"line":321,"column":30}},"60":{"start":{"line":322,"column":2},"end":{"line":324,"column":null}},"61":{"start":{"line":323,"column":3},"end":{"line":323,"column":10}},"62":{"start":{"line":327,"column":24},"end":{"line":327,"column":28}},"63":{"start":{"line":328,"column":2},"end":{"line":330,"column":null}},"64":{"start":{"line":329,"column":3},"end":{"line":329,"column":10}},"65":{"start":{"line":332,"column":2},"end":{"line":332,"column":9}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":156,"column":26},"end":{"line":156,"column":48}},"loc":{"start":{"line":156,"column":48},"end":{"line":164,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":161,"column":23},"end":{"line":161,"column":32}},"loc":{"start":{"line":161,"column":47},"end":{"line":163,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":212,"column":30},"end":{"line":212,"column":31}},"loc":{"start":{"line":212,"column":72},"end":{"line":217,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":224,"column":30},"end":{"line":224,"column":58}},"loc":{"start":{"line":224,"column":58},"end":{"line":240,"column":null}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":229,"column":46},"end":{"line":229,"column":55}},"loc":{"start":{"line":229,"column":66},"end":{"line":237,"column":null}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":246,"column":34},"end":{"line":246,"column":55}},"loc":{"start":{"line":246,"column":55},"end":{"line":299,"column":null}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":249,"column":22},"end":{"line":249,"column":35}},"loc":{"start":{"line":249,"column":35},"end":{"line":265,"column":null}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":272,"column":33},"end":{"line":272,"column":34}},"loc":{"start":{"line":272,"column":43},"end":{"line":272,"column":null}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":280,"column":18},"end":{"line":280,"column":19}},"loc":{"start":{"line":280,"column":27},"end":{"line":280,"column":47}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":280,"column":56},"end":{"line":280,"column":64}},"loc":{"start":{"line":280,"column":64},"end":{"line":296,"column":null}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":283,"column":32},"end":{"line":283,"column":42}},"loc":{"start":{"line":283,"column":42},"end":{"line":293,"column":null}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":285,"column":26},"end":{"line":285,"column":30}},"loc":{"start":{"line":285,"column":30},"end":{"line":290,"column":null}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":306,"column":37},"end":{"line":306,"column":61}},"loc":{"start":{"line":306,"column":61},"end":{"line":335,"column":null}}},"13":{"name":"(anonymous_13)","decl":{"start":{"line":314,"column":41},"end":{"line":314,"column":55}},"loc":{"start":{"line":314,"column":55},"end":{"line":333,"column":4}}}},"branchMap":{"0":{"loc":{"start":{"line":212,"column":58},"end":{"line":212,"column":72}},"type":"default-arg","locations":[{"start":{"line":212,"column":58},"end":{"line":212,"column":72}}]},"1":{"loc":{"start":{"line":213,"column":1},"end":{"line":215,"column":null}},"type":"if","locations":[{"start":{"line":213,"column":1},"end":{"line":215,"column":null}},{"start":{"line":213,"column":1},"end":{"line":215,"column":null}}]},"2":{"loc":{"start":{"line":226,"column":4},"end":{"line":226,"column":35}},"type":"if","locations":[{"start":{"line":226,"column":4},"end":{"line":226,"column":35}},{"start":{"line":226,"column":4},"end":{"line":226,"column":35}}]},"3":{"loc":{"start":{"line":256,"column":3},"end":{"line":258,"column":null}},"type":"if","locations":[{"start":{"line":256,"column":3},"end":{"line":258,"column":null}},{"start":{"line":256,"column":3},"end":{"line":258,"column":null}}]},"4":{"loc":{"start":{"line":260,"column":3},"end":{"line":262,"column":null}},"type":"if","locations":[{"start":{"line":260,"column":3},"end":{"line":262,"column":null}},{"start":{"line":260,"column":3},"end":{"line":262,"column":null}}]},"5":{"loc":{"start":{"line":286,"column":4},"end":{"line":288,"column":null}},"type":"if","locations":[{"start":{"line":286,"column":4},"end":{"line":288,"column":null}},{"start":{"line":286,"column":4},"end":{"line":288,"column":null}}]},"6":{"loc":{"start":{"line":308,"column":1},"end":{"line":310,"column":null}},"type":"if","locations":[{"start":{"line":308,"column":1},"end":{"line":310,"column":null}},{"start":{"line":308,"column":1},"end":{"line":310,"column":null}}]},"7":{"loc":{"start":{"line":316,"column":2},"end":{"line":318,"column":null}},"type":"if","locations":[{"start":{"line":316,"column":2},"end":{"line":318,"column":null}},{"start":{"line":316,"column":2},"end":{"line":318,"column":null}}]},"8":{"loc":{"start":{"line":322,"column":2},"end":{"line":324,"column":null}},"type":"if","locations":[{"start":{"line":322,"column":2},"end":{"line":324,"column":null}},{"start":{"line":322,"column":2},"end":{"line":324,"column":null}}]},"9":{"loc":{"start":{"line":328,"column":2},"end":{"line":330,"column":null}},"type":"if","locations":[{"start":{"line":328,"column":2},"end":{"line":330,"column":null}},{"start":{"line":328,"column":2},"end":{"line":330,"column":null}}]}},"s":{"0":7,"1":7,"2":7,"3":7,"4":7,"5":7,"6":9942,"7":122,"8":7,"9":988,"10":586,"11":402,"12":7,"13":312,"14":234,"15":78,"16":78,"17":90,"18":90,"19":90,"20":90,"21":90,"22":90,"23":78,"24":7,"25":6,"26":6,"27":138,"28":138,"29":5808,"30":5808,"31":5808,"32":2004,"33":3804,"34":234,"35":3804,"36":6,"37":6,"38":876,"39":6,"40":6,"41":6,"42":924,"43":234,"44":234,"45":324,"46":426,"47":420,"48":6,"49":324,"50":234,"51":6,"52":7,"53":3914,"54":6,"55":3914,"56":3914,"57":9198,"58":5172,"59":4026,"60":4026,"61":2690,"62":1336,"63":1336,"64":4,"65":1332},"f":{"0":9942,"1":122,"2":988,"3":312,"4":90,"5":6,"6":138,"7":876,"8":924,"9":234,"10":324,"11":426,"12":3914,"13":9198},"b":{"0":[664],"1":[586,402],"2":[234,78],"3":[2004,3804],"4":[234,3570],"5":[420,6],"6":[6,3908],"7":[5172,4026],"8":[2690,1336],"9":[4,1332]}} | ||
,"/var/www/html/github/sifter.js/lib/sifter.ts": {"path":"/var/www/html/github/sifter.js/lib/sifter.ts","statementMap":{"0":{"start":{"line":35,"column":45},"end":{"line":35,"column":null}},"1":{"start":{"line":36,"column":2},"end":{"line":36,"column":7}},"2":{"start":{"line":37,"column":2},"end":{"line":37,"column":7}},"3":{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},"4":{"start":{"line":46,"column":31},"end":{"line":46,"column":38}},"5":{"start":{"line":48,"column":27},"end":{"line":48,"column":null}},"6":{"start":{"line":49,"column":19},"end":{"line":49,"column":24}},"7":{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},"8":{"start":{"line":53,"column":3},"end":{"line":53,"column":14}},"9":{"start":{"line":56,"column":2},"end":{"line":56,"column":7}},"10":{"start":{"line":58,"column":27},"end":{"line":58,"column":null}},"11":{"start":{"line":59,"column":27},"end":{"line":59,"column":null}},"12":{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},"13":{"start":{"line":63,"column":4},"end":{"line":63,"column":9}},"14":{"start":{"line":64,"column":4},"end":{"line":64,"column":8}},"15":{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},"16":{"start":{"line":68,"column":4},"end":{"line":68,"column":9}},"17":{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},"18":{"start":{"line":70,"column":5},"end":{"line":70,"column":10}},"19":{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},"20":{"start":{"line":72,"column":34},"end":{"line":72,"column":39}},"21":{"start":{"line":75,"column":3},"end":{"line":75,"column":9}},"22":{"start":{"line":82,"column":2},"end":{"line":82,"column":9}},"23":{"start":{"line":95,"column":15},"end":{"line":95,"column":20}},"24":{"start":{"line":96,"column":2},"end":{"line":96,"column":9}},"25":{"start":{"line":100,"column":18},"end":{"line":100,"column":null}},"26":{"start":{"line":101,"column":18},"end":{"line":101,"column":null}},"27":{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},"28":{"start":{"line":104,"column":3},"end":{"line":104,"column":10}},"29":{"start":{"line":104,"column":23},"end":{"line":104,"column":30}},"30":{"start":{"line":107,"column":17},"end":{"line":107,"column":null}},"31":{"start":{"line":108,"column":14},"end":{"line":108,"column":null}},"32":{"start":{"line":109,"column":17},"end":{"line":109,"column":null}},"33":{"start":{"line":110,"column":15},"end":{"line":110,"column":null}},"34":{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},"35":{"start":{"line":113,"column":3},"end":{"line":113,"column":10}},"36":{"start":{"line":113,"column":23},"end":{"line":113,"column":30}},"37":{"start":{"line":122,"column":23},"end":{"line":122,"column":1}},"38":{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},"39":{"start":{"line":126,"column":4},"end":{"line":126,"column":11}},"40":{"start":{"line":127,"column":19},"end":{"line":127,"column":null}},"41":{"start":{"line":128,"column":5},"end":{"line":128,"column":12}},"42":{"start":{"line":132,"column":3},"end":{"line":132,"column":10}},"43":{"start":{"line":133,"column":14},"end":{"line":133,"column":null}},"44":{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},"45":{"start":{"line":138,"column":19},"end":{"line":138,"column":29}},"46":{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},"47":{"start":{"line":141,"column":6},"end":{"line":141,"column":9}},"48":{"start":{"line":143,"column":6},"end":{"line":143,"column":9}},"49":{"start":{"line":149,"column":5},"end":{"line":149,"column":12}},"50":{"start":{"line":150,"column":6},"end":{"line":150,"column":9}},"51":{"start":{"line":154,"column":4},"end":{"line":154,"column":11}},"52":{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},"53":{"start":{"line":159,"column":3},"end":{"line":159,"column":10}},"54":{"start":{"line":160,"column":4},"end":{"line":160,"column":11}},"55":{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},"56":{"start":{"line":165,"column":3},"end":{"line":165,"column":10}},"57":{"start":{"line":166,"column":12},"end":{"line":166,"column":15}},"58":{"start":{"line":166,"column":28},"end":{"line":166,"column":null}},"59":{"start":{"line":167,"column":4},"end":{"line":171,"column":null}},"60":{"start":{"line":168,"column":5},"end":{"line":168,"column":10}},"61":{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},"62":{"start":{"line":169,"column":21},"end":{"line":169,"column":28}},"63":{"start":{"line":170,"column":5},"end":{"line":170,"column":8}},"64":{"start":{"line":172,"column":4},"end":{"line":172,"column":11}},"65":{"start":{"line":175,"column":3},"end":{"line":175,"column":10}},"66":{"start":{"line":176,"column":14},"end":{"line":176,"column":null}},"67":{"start":{"line":177,"column":4},"end":{"line":177,"column":11}},"68":{"start":{"line":178,"column":5},"end":{"line":178,"column":8}},"69":{"start":{"line":180,"column":4},"end":{"line":180,"column":11}},"70":{"start":{"line":193,"column":16},"end":{"line":193,"column":21}},"71":{"start":{"line":194,"column":2},"end":{"line":194,"column":9}},"72":{"start":{"line":200,"column":15},"end":{"line":200,"column":null}},"73":{"start":{"line":201,"column":13},"end":{"line":201,"column":null}},"74":{"start":{"line":202,"column":11},"end":{"line":202,"column":null}},"75":{"start":{"line":203,"column":24},"end":{"line":203,"column":null}},"76":{"start":{"line":204,"column":25},"end":{"line":204,"column":null}},"77":{"start":{"line":212,"column":20},"end":{"line":215,"column":null}},"78":{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},"79":{"start":{"line":213,"column":26},"end":{"line":213,"column":33}},"80":{"start":{"line":214,"column":3},"end":{"line":214,"column":10}},"81":{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},"82":{"start":{"line":219,"column":3},"end":{"line":223,"column":null}},"83":{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},"84":{"start":{"line":221,"column":5},"end":{"line":221,"column":14}},"85":{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},"86":{"start":{"line":229,"column":3},"end":{"line":229,"column":17}},"87":{"start":{"line":230,"column":3},"end":{"line":235,"column":null}},"88":{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},"89":{"start":{"line":232,"column":5},"end":{"line":232,"column":19}},"90":{"start":{"line":233,"column":5},"end":{"line":233,"column":null}},"91":{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},"92":{"start":{"line":237,"column":4},"end":{"line":237,"column":13}},"93":{"start":{"line":240,"column":3},"end":{"line":245,"column":null}},"94":{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},"95":{"start":{"line":242,"column":5},"end":{"line":242,"column":14}},"96":{"start":{"line":243,"column":5},"end":{"line":243,"column":null}},"97":{"start":{"line":248,"column":2},"end":{"line":250,"column":null}},"98":{"start":{"line":249,"column":3},"end":{"line":249,"column":14}},"99":{"start":{"line":253,"column":26},"end":{"line":253,"column":null}},"100":{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},"101":{"start":{"line":255,"column":3},"end":{"line":255,"column":10}},"102":{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},"103":{"start":{"line":257,"column":20},"end":{"line":257,"column":null}},"104":{"start":{"line":258,"column":22},"end":{"line":258,"column":34}},"105":{"start":{"line":259,"column":3},"end":{"line":259,"column":10}},"106":{"start":{"line":260,"column":4},"end":{"line":260,"column":11}},"107":{"start":{"line":266,"column":3},"end":{"line":266,"column":10}},"108":{"start":{"line":268,"column":4},"end":{"line":275,"column":null}},"109":{"start":{"line":269,"column":5},"end":{"line":269,"column":10}},"110":{"start":{"line":270,"column":5},"end":{"line":270,"column":11}},"111":{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},"112":{"start":{"line":274,"column":17},"end":{"line":274,"column":24}},"113":{"start":{"line":276,"column":4},"end":{"line":276,"column":11}},"114":{"start":{"line":288,"column":28},"end":{"line":288,"column":null}},"115":{"start":{"line":289,"column":17},"end":{"line":289,"column":23}},"116":{"start":{"line":291,"column":2},"end":{"line":291,"column":13}},"117":{"start":{"line":292,"column":2},"end":{"line":292,"column":13}},"118":{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},"119":{"start":{"line":296,"column":3},"end":{"line":296,"column":14}},"120":{"start":{"line":297,"column":28},"end":{"line":297,"column":null}},"121":{"start":{"line":298,"column":3},"end":{"line":298,"column":10}},"122":{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},"123":{"start":{"line":300,"column":5},"end":{"line":300,"column":10}},"124":{"start":{"line":302,"column":4},"end":{"line":302,"column":10}},"125":{"start":{"line":303,"column":4},"end":{"line":303,"column":11}},"126":{"start":{"line":305,"column":3},"end":{"line":305,"column":10}},"127":{"start":{"line":309,"column":2},"end":{"line":309,"column":9}},"128":{"start":{"line":325,"column":13},"end":{"line":325,"column":19}},"129":{"start":{"line":327,"column":2},"end":{"line":327,"column":8}},"130":{"start":{"line":328,"column":2},"end":{"line":328,"column":9}},"131":{"start":{"line":329,"column":2},"end":{"line":329,"column":7}},"132":{"start":{"line":332,"column":19},"end":{"line":332,"column":40}},"133":{"start":{"line":335,"column":2},"end":{"line":346,"column":null}},"134":{"start":{"line":336,"column":3},"end":{"line":336,"column":10}},"135":{"start":{"line":337,"column":4},"end":{"line":337,"column":9}},"136":{"start":{"line":338,"column":4},"end":{"line":340,"column":null}},"137":{"start":{"line":339,"column":5},"end":{"line":339,"column":11}},"138":{"start":{"line":343,"column":3},"end":{"line":343,"column":10}},"139":{"start":{"line":344,"column":4},"end":{"line":344,"column":10}},"140":{"start":{"line":348,"column":18},"end":{"line":348,"column":22}},"141":{"start":{"line":349,"column":2},"end":{"line":349,"column":21}},"142":{"start":{"line":349,"column":15},"end":{"line":349,"column":21}},"143":{"start":{"line":352,"column":2},"end":{"line":352,"column":8}},"144":{"start":{"line":353,"column":2},"end":{"line":355,"column":null}},"145":{"start":{"line":354,"column":3},"end":{"line":354,"column":9}},"146":{"start":{"line":357,"column":2},"end":{"line":357,"column":9}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":35,"column":1},"end":{"line":35,"column":12}},"loc":{"start":{"line":35,"column":45},"end":{"line":38,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":45,"column":1},"end":{"line":45,"column":9}},"loc":{"start":{"line":45,"column":89},"end":{"line":83,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":56,"column":17},"end":{"line":56,"column":33}},"loc":{"start":{"line":56,"column":33},"end":{"line":80,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":94,"column":1},"end":{"line":94,"column":17}},"loc":{"start":{"line":94,"column":51},"end":{"line":97,"column":null}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":99,"column":1},"end":{"line":99,"column":18}},"loc":{"start":{"line":99,"column":40},"end":{"line":183,"column":null}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":104,"column":10},"end":{"line":104,"column":21}},"loc":{"start":{"line":104,"column":21},"end":{"line":104,"column":null}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":113,"column":10},"end":{"line":113,"column":21}},"loc":{"start":{"line":113,"column":21},"end":{"line":113,"column":null}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":122,"column":23},"end":{"line":122,"column":34}},"loc":{"start":{"line":122,"column":34},"end":{"line":156,"column":null}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":126,"column":11},"end":{"line":126,"column":20}},"loc":{"start":{"line":126,"column":44},"end":{"line":129,"column":null}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":132,"column":10},"end":{"line":132,"column":19}},"loc":{"start":{"line":132,"column":43},"end":{"line":155,"column":null}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":149,"column":22},"end":{"line":149,"column":23}},"loc":{"start":{"line":149,"column":55},"end":{"line":151,"column":null}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":159,"column":10},"end":{"line":159,"column":19}},"loc":{"start":{"line":159,"column":28},"end":{"line":161,"column":null}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":165,"column":10},"end":{"line":165,"column":19}},"loc":{"start":{"line":165,"column":28},"end":{"line":173,"column":null}}},"13":{"name":"(anonymous_13)","decl":{"start":{"line":175,"column":10},"end":{"line":175,"column":19}},"loc":{"start":{"line":175,"column":28},"end":{"line":181,"column":null}}},"14":{"name":"(anonymous_14)","decl":{"start":{"line":177,"column":20},"end":{"line":177,"column":36}},"loc":{"start":{"line":177,"column":36},"end":{"line":179,"column":null}}},"15":{"name":"(anonymous_15)","decl":{"start":{"line":192,"column":1},"end":{"line":192,"column":16}},"loc":{"start":{"line":192,"column":50},"end":{"line":195,"column":null}}},"16":{"name":"(anonymous_16)","decl":{"start":{"line":197,"column":1},"end":{"line":197,"column":17}},"loc":{"start":{"line":197,"column":38},"end":{"line":279,"column":null}}},"17":{"name":"get_field","decl":{"start":{"line":212,"column":8},"end":{"line":212,"column":17}},"loc":{"start":{"line":212,"column":77},"end":{"line":215,"column":null}}},"18":{"name":"(anonymous_18)","decl":{"start":{"line":259,"column":10},"end":{"line":259,"column":19}},"loc":{"start":{"line":259,"column":51},"end":{"line":264,"column":null}}},"19":{"name":"(anonymous_19)","decl":{"start":{"line":266,"column":10},"end":{"line":266,"column":19}},"loc":{"start":{"line":266,"column":51},"end":{"line":277,"column":null}}},"20":{"name":"(anonymous_20)","decl":{"start":{"line":287,"column":1},"end":{"line":287,"column":14}},"loc":{"start":{"line":287,"column":62},"end":{"line":318,"column":null}}},"21":{"name":"(anonymous_21)","decl":{"start":{"line":298,"column":27},"end":{"line":298,"column":52}},"loc":{"start":{"line":298,"column":52},"end":{"line":304,"column":null}}},"22":{"name":"(anonymous_22)","decl":{"start":{"line":324,"column":1},"end":{"line":324,"column":7}},"loc":{"start":{"line":324,"column":56},"end":{"line":358,"column":null}}},"23":{"name":"(anonymous_23)","decl":{"start":{"line":336,"column":23},"end":{"line":336,"column":24}},"loc":{"start":{"line":336,"column":64},"end":{"line":341,"column":null}}},"24":{"name":"(anonymous_24)","decl":{"start":{"line":343,"column":23},"end":{"line":343,"column":24}},"loc":{"start":{"line":343,"column":64},"end":{"line":345,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":37,"column":18},"end":{"line":37,"column":26}},"type":"binary-expr","locations":[{"start":{"line":37,"column":18},"end":{"line":37,"column":26}},{"start":{"line":37,"column":30},"end":{"line":37,"column":31}}]},"1":{"loc":{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},"type":"if","locations":[{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},{"start":{"line":46,"column":2},"end":{"line":46,"column":38}}]},"2":{"loc":{"start":{"line":46,"column":6},"end":{"line":46,"column":16}},"type":"binary-expr","locations":[{"start":{"line":46,"column":6},"end":{"line":46,"column":16}},{"start":{"line":46,"column":16},"end":{"line":46,"column":31}}]},"3":{"loc":{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},"type":"if","locations":[{"start":{"line":52,"column":2},"end":{"line":54,"column":null}},{"start":{"line":52,"column":2},"end":{"line":54,"column":null}}]},"4":{"loc":{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},"type":"if","locations":[{"start":{"line":62,"column":3},"end":{"line":65,"column":null}},{"start":{"line":62,"column":3},"end":{"line":65,"column":null}}]},"5":{"loc":{"start":{"line":62,"column":7},"end":{"line":62,"column":18}},"type":"binary-expr","locations":[{"start":{"line":62,"column":7},"end":{"line":62,"column":18}},{"start":{"line":62,"column":23},"end":{"line":62,"column":41}}]},"6":{"loc":{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},"type":"if","locations":[{"start":{"line":67,"column":3},"end":{"line":73,"column":null}},{"start":{"line":67,"column":3},"end":{"line":73,"column":null}}]},"7":{"loc":{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":71,"column":null}},{"start":{"line":69,"column":4},"end":{"line":71,"column":null}}]},"8":{"loc":{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},"type":"if","locations":[{"start":{"line":72,"column":4},"end":{"line":72,"column":39}},{"start":{"line":72,"column":4},"end":{"line":72,"column":39}}]},"9":{"loc":{"start":{"line":77,"column":21},"end":{"line":77,"column":25}},"type":"cond-expr","locations":[{"start":{"line":77,"column":21},"end":{"line":77,"column":25}},{"start":{"line":77,"column":46},"end":{"line":77,"column":null}}]},"10":{"loc":{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},"type":"if","locations":[{"start":{"line":103,"column":2},"end":{"line":105,"column":null}},{"start":{"line":103,"column":2},"end":{"line":105,"column":null}}]},"11":{"loc":{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},"type":"if","locations":[{"start":{"line":112,"column":2},"end":{"line":114,"column":null}},{"start":{"line":112,"column":2},"end":{"line":114,"column":null}}]},"12":{"loc":{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},"type":"if","locations":[{"start":{"line":125,"column":3},"end":{"line":130,"column":null}},{"start":{"line":125,"column":3},"end":{"line":130,"column":null}}]},"13":{"loc":{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},"type":"if","locations":[{"start":{"line":136,"column":4},"end":{"line":152,"column":null}},{"start":{"line":136,"column":4},"end":{"line":152,"column":null}}]},"14":{"loc":{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},"type":"if","locations":[{"start":{"line":140,"column":5},"end":{"line":144,"column":null}},{"start":{"line":140,"column":5},"end":{"line":144,"column":null}}]},"15":{"loc":{"start":{"line":140,"column":9},"end":{"line":140,"column":25}},"type":"binary-expr","locations":[{"start":{"line":140,"column":9},"end":{"line":140,"column":25}},{"start":{"line":140,"column":25},"end":{"line":140,"column":32}}]},"16":{"loc":{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},"type":"if","locations":[{"start":{"line":158,"column":2},"end":{"line":162,"column":null}},{"start":{"line":158,"column":2},"end":{"line":162,"column":null}}]},"17":{"loc":{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},"type":"if","locations":[{"start":{"line":164,"column":2},"end":{"line":182,"column":null}},{"start":{"line":164,"column":2},"end":{"line":182,"column":null}}]},"18":{"loc":{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},"type":"if","locations":[{"start":{"line":169,"column":5},"end":{"line":169,"column":28}},{"start":{"line":169,"column":5},"end":{"line":169,"column":28}}]},"19":{"loc":{"start":{"line":202,"column":50},"end":{"line":202,"column":71}},"type":"cond-expr","locations":[{"start":{"line":202,"column":50},"end":{"line":202,"column":71}},{"start":{"line":202,"column":71},"end":{"line":202,"column":null}}]},"20":{"loc":{"start":{"line":202,"column":11},"end":{"line":202,"column":28}},"type":"binary-expr","locations":[{"start":{"line":202,"column":11},"end":{"line":202,"column":28}},{"start":{"line":202,"column":28},"end":{"line":202,"column":50}}]},"21":{"loc":{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},"type":"if","locations":[{"start":{"line":213,"column":3},"end":{"line":213,"column":33}},{"start":{"line":213,"column":3},"end":{"line":213,"column":33}}]},"22":{"loc":{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},"type":"if","locations":[{"start":{"line":218,"column":2},"end":{"line":224,"column":null}},{"start":{"line":218,"column":2},"end":{"line":224,"column":null}}]},"23":{"loc":{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},"type":"if","locations":[{"start":{"line":220,"column":4},"end":{"line":222,"column":null}},{"start":{"line":220,"column":4},"end":{"line":222,"column":null}}]},"24":{"loc":{"start":{"line":220,"column":8},"end":{"line":220,"column":24}},"type":"binary-expr","locations":[{"start":{"line":220,"column":8},"end":{"line":220,"column":24}},{"start":{"line":220,"column":24},"end":{"line":220,"column":52}}]},"25":{"loc":{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},"type":"if","locations":[{"start":{"line":228,"column":2},"end":{"line":246,"column":null}},{"start":{"line":228,"column":2},"end":{"line":246,"column":null}}]},"26":{"loc":{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},"type":"if","locations":[{"start":{"line":231,"column":4},"end":{"line":234,"column":null}},{"start":{"line":231,"column":4},"end":{"line":234,"column":null}}]},"27":{"loc":{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},"type":"if","locations":[{"start":{"line":236,"column":3},"end":{"line":238,"column":null}},{"start":{"line":236,"column":3},"end":{"line":238,"column":null}}]},"28":{"loc":{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},"type":"if","locations":[{"start":{"line":241,"column":4},"end":{"line":244,"column":null}},{"start":{"line":241,"column":4},"end":{"line":244,"column":null}}]},"29":{"loc":{"start":{"line":249,"column":56},"end":{"line":249,"column":61}},"type":"cond-expr","locations":[{"start":{"line":249,"column":56},"end":{"line":249,"column":61}},{"start":{"line":249,"column":61},"end":{"line":249,"column":null}}]},"30":{"loc":{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},"type":"if","locations":[{"start":{"line":254,"column":2},"end":{"line":278,"column":null}},{"start":{"line":254,"column":2},"end":{"line":278,"column":null}}]},"31":{"loc":{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},"type":"if","locations":[{"start":{"line":256,"column":9},"end":{"line":278,"column":null}},{"start":{"line":256,"column":9},"end":{"line":278,"column":null}}]},"32":{"loc":{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},"type":"if","locations":[{"start":{"line":274,"column":5},"end":{"line":274,"column":24}},{"start":{"line":274,"column":5},"end":{"line":274,"column":24}}]},"33":{"loc":{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},"type":"if","locations":[{"start":{"line":295,"column":2},"end":{"line":306,"column":null}},{"start":{"line":295,"column":2},"end":{"line":306,"column":null}}]},"34":{"loc":{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},"type":"if","locations":[{"start":{"line":299,"column":4},"end":{"line":301,"column":null}},{"start":{"line":299,"column":4},"end":{"line":301,"column":null}}]},"35":{"loc":{"start":{"line":303,"column":49},"end":{"line":303,"column":64}},"type":"cond-expr","locations":[{"start":{"line":303,"column":49},"end":{"line":303,"column":64}},{"start":{"line":303,"column":64},"end":{"line":303,"column":null}}]},"36":{"loc":{"start":{"line":316,"column":35},"end":{"line":316,"column":52}},"type":"cond-expr","locations":[{"start":{"line":316,"column":35},"end":{"line":316,"column":52}},{"start":{"line":316,"column":52},"end":{"line":316,"column":null}}]},"37":{"loc":{"start":{"line":332,"column":19},"end":{"line":332,"column":36}},"type":"binary-expr","locations":[{"start":{"line":332,"column":19},"end":{"line":332,"column":36}},{"start":{"line":332,"column":36},"end":{"line":332,"column":40}}]},"38":{"loc":{"start":{"line":335,"column":2},"end":{"line":346,"column":null}},"type":"if","locations":[{"start":{"line":335,"column":2},"end":{"line":346,"column":null}},{"start":{"line":335,"column":2},"end":{"line":346,"column":null}}]},"39":{"loc":{"start":{"line":338,"column":4},"end":{"line":340,"column":null}},"type":"if","locations":[{"start":{"line":338,"column":4},"end":{"line":340,"column":null}},{"start":{"line":338,"column":4},"end":{"line":340,"column":null}}]},"40":{"loc":{"start":{"line":338,"column":8},"end":{"line":338,"column":36}},"type":"binary-expr","locations":[{"start":{"line":338,"column":8},"end":{"line":338,"column":36}},{"start":{"line":338,"column":36},"end":{"line":338,"column":47}}]},"41":{"loc":{"start":{"line":349,"column":2},"end":{"line":349,"column":21}},"type":"if","locations":[{"start":{"line":349,"column":2},"end":{"line":349,"column":21}},{"start":{"line":349,"column":2},"end":{"line":349,"column":21}}]},"42":{"loc":{"start":{"line":353,"column":2},"end":{"line":355,"column":null}},"type":"if","locations":[{"start":{"line":353,"column":2},"end":{"line":355,"column":null}},{"start":{"line":353,"column":2},"end":{"line":355,"column":null}}]}},"s":{"0":70,"1":35,"2":35,"3":3915,"4":10,"5":3905,"6":3905,"7":3905,"8":30,"9":3905,"10":3915,"11":3915,"12":3915,"13":3,"14":3,"15":3915,"16":3914,"17":3914,"18":3914,"19":3914,"20":6,"21":3915,"22":3905,"23":3,"24":3,"25":37,"26":37,"27":37,"28":9,"29":0,"30":28,"31":28,"32":28,"33":28,"34":28,"35":1,"36":2,"37":27,"38":27,"39":14,"40":40,"41":40,"42":13,"43":62,"44":62,"45":6,"46":6,"47":1,"48":5,"49":56,"50":137,"51":62,"52":27,"53":21,"54":57,"55":6,"56":2,"57":7,"58":7,"59":7,"60":11,"61":11,"62":6,"63":5,"64":1,"65":4,"66":17,"67":17,"68":34,"69":17,"70":0,"71":0,"72":33,"73":33,"74":33,"75":33,"76":33,"77":33,"78":152,"79":24,"80":128,"81":33,"82":13,"83":17,"84":17,"85":33,"86":24,"87":24,"88":6,"89":2,"90":2,"91":24,"92":22,"93":9,"94":11,"95":0,"96":0,"97":33,"98":39,"99":33,"100":33,"101":0,"102":33,"103":27,"104":27,"105":27,"106":38,"107":6,"108":27,"109":38,"110":38,"111":38,"112":22,"113":5,"114":39,"115":39,"116":39,"117":39,"118":39,"119":38,"120":38,"121":38,"122":58,"123":50,"124":58,"125":58,"126":38,"127":39,"128":33,"129":33,"130":33,"131":33,"132":33,"133":33,"134":24,"135":67,"136":67,"137":39,"138":9,"139":31,"140":33,"141":33,"142":33,"143":33,"144":33,"145":3,"146":33},"f":{"0":35,"1":3915,"2":3915,"3":3,"4":37,"5":0,"6":2,"7":27,"8":40,"9":62,"10":137,"11":57,"12":7,"13":17,"14":34,"15":0,"16":33,"17":152,"18":38,"19":27,"20":39,"21":58,"22":33,"23":67,"24":31},"b":{"0":[35,35],"1":[10,3905],"2":[3915,3905],"3":[30,3875],"4":[3,3912],"5":[3915,37],"6":[3914,1],"7":[3914,0],"8":[6,3908],"9":[3914,1],"10":[9,28],"11":[1,27],"12":[14,13],"13":[6,56],"14":[1,5],"15":[6,2],"16":[21,6],"17":[2,4],"18":[6,5],"19":[1,32],"20":[33,9],"21":[24,128],"22":[13,20],"23":[17,0],"24":[17,11],"25":[24,9],"26":[2,4],"27":[22,2],"28":[0,11],"29":[24,15],"30":[0,33],"31":[27,6],"32":[22,16],"33":[38,1],"34":[50,8],"35":[56,2],"36":[2,37],"37":[33,33],"38":[24,9],"39":[39,28],"40":[67,64],"41":[33,0],"42":[3,30]}} | ||
,"/var/www/html/github/sifter.js/lib/utils.ts": {"path":"/var/www/html/github/sifter.js/lib/utils.ts","statementMap":{"0":{"start":{"line":15,"column":23},"end":{"line":18,"column":null}},"1":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"2":{"start":{"line":16,"column":15},"end":{"line":16,"column":null}},"3":{"start":{"line":17,"column":4},"end":{"line":17,"column":11}},"4":{"start":{"line":26,"column":30},"end":{"line":31,"column":null}},"5":{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},"6":{"start":{"line":27,"column":15},"end":{"line":27,"column":null}},"7":{"start":{"line":28,"column":22},"end":{"line":28,"column":26}},"8":{"start":{"line":29,"column":1},"end":{"line":29,"column":null}},"9":{"start":{"line":30,"column":4},"end":{"line":30,"column":11}},"10":{"start":{"line":38,"column":26},"end":{"line":51,"column":null}},"11":{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},"12":{"start":{"line":41,"column":13},"end":{"line":41,"column":20}},"13":{"start":{"line":43,"column":1},"end":{"line":43,"column":6}},"14":{"start":{"line":44,"column":1},"end":{"line":44,"column":4}},"15":{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},"16":{"start":{"line":45,"column":17},"end":{"line":45,"column":24}},"17":{"start":{"line":47,"column":1},"end":{"line":47,"column":6}},"18":{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},"19":{"start":{"line":48,"column":16},"end":{"line":48,"column":21}},"20":{"start":{"line":50,"column":1},"end":{"line":50,"column":8}},"21":{"start":{"line":53,"column":29},"end":{"line":55,"column":null}},"22":{"start":{"line":54,"column":1},"end":{"line":54,"column":8}},"23":{"start":{"line":62,"column":27},"end":{"line":67,"column":null}},"24":{"start":{"line":63,"column":13},"end":{"line":63,"column":17}},"25":{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},"26":{"start":{"line":65,"column":2},"end":{"line":65,"column":5}},"27":{"start":{"line":80,"column":23},"end":{"line":93,"column":null}},"28":{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},"29":{"start":{"line":83,"column":2},"end":{"line":83,"column":8}},"30":{"start":{"line":87,"column":2},"end":{"line":91,"column":null}},"31":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"32":{"start":{"line":89,"column":4},"end":{"line":89,"column":12}},"33":{"start":{"line":97,"column":19},"end":{"line":106,"column":null}},"34":{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},"35":{"start":{"line":99,"column":2},"end":{"line":99,"column":9}},"36":{"start":{"line":101,"column":1},"end":{"line":101,"column":2}},"37":{"start":{"line":102,"column":1},"end":{"line":102,"column":2}},"38":{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},"39":{"start":{"line":103,"column":12},"end":{"line":103,"column":19}},"40":{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},"41":{"start":{"line":104,"column":12},"end":{"line":104,"column":19}},"42":{"start":{"line":105,"column":1},"end":{"line":105,"column":8}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":15,"column":23},"end":{"line":15,"column":24}},"loc":{"start":{"line":15,"column":65},"end":{"line":18,"column":null}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":26,"column":30},"end":{"line":26,"column":31}},"loc":{"start":{"line":26,"column":72},"end":{"line":31,"column":null}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":38,"column":26},"end":{"line":38,"column":27}},"loc":{"start":{"line":38,"column":82},"end":{"line":51,"column":null}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":53,"column":29},"end":{"line":53,"column":51}},"loc":{"start":{"line":53,"column":51},"end":{"line":55,"column":null}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":62,"column":27},"end":{"line":62,"column":28}},"loc":{"start":{"line":62,"column":67},"end":{"line":67,"column":null}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":80,"column":23},"end":{"line":80,"column":24}},"loc":{"start":{"line":80,"column":102},"end":{"line":93,"column":null}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":97,"column":19},"end":{"line":97,"column":20}},"loc":{"start":{"line":97,"column":57},"end":{"line":106,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},{"start":{"line":16,"column":4},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":null}},{"start":{"line":27,"column":4},"end":{"line":27,"column":null}}]},"2":{"loc":{"start":{"line":29,"column":9},"end":{"line":29,"column":21}},"type":"binary-expr","locations":[{"start":{"line":29,"column":9},"end":{"line":29,"column":21}},{"start":{"line":29,"column":35},"end":{"line":29,"column":45}}]},"3":{"loc":{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},"type":"if","locations":[{"start":{"line":41,"column":1},"end":{"line":41,"column":20}},{"start":{"line":41,"column":1},"end":{"line":41,"column":20}}]},"4":{"loc":{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},"type":"if","locations":[{"start":{"line":45,"column":1},"end":{"line":45,"column":24}},{"start":{"line":45,"column":1},"end":{"line":45,"column":24}}]},"5":{"loc":{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},"type":"if","locations":[{"start":{"line":48,"column":1},"end":{"line":48,"column":21}},{"start":{"line":48,"column":1},"end":{"line":48,"column":21}}]},"6":{"loc":{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},"type":"if","locations":[{"start":{"line":64,"column":1},"end":{"line":66,"column":null}},{"start":{"line":64,"column":1},"end":{"line":66,"column":null}}]},"7":{"loc":{"start":{"line":64,"column":5},"end":{"line":64,"column":10}},"type":"binary-expr","locations":[{"start":{"line":64,"column":5},"end":{"line":64,"column":10}},{"start":{"line":64,"column":14},"end":{"line":64,"column":20}}]},"8":{"loc":{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},"type":"if","locations":[{"start":{"line":82,"column":1},"end":{"line":92,"column":null}},{"start":{"line":82,"column":1},"end":{"line":92,"column":null}}]},"9":{"loc":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"type":"if","locations":[{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},{"start":{"line":88,"column":3},"end":{"line":90,"column":null}}]},"10":{"loc":{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},"type":"if","locations":[{"start":{"line":98,"column":1},"end":{"line":100,"column":null}},{"start":{"line":98,"column":1},"end":{"line":100,"column":null}}]},"11":{"loc":{"start":{"line":98,"column":5},"end":{"line":98,"column":30}},"type":"binary-expr","locations":[{"start":{"line":98,"column":5},"end":{"line":98,"column":30}},{"start":{"line":98,"column":30},"end":{"line":98,"column":53}}]},"12":{"loc":{"start":{"line":99,"column":17},"end":{"line":99,"column":22}},"type":"cond-expr","locations":[{"start":{"line":99,"column":17},"end":{"line":99,"column":22}},{"start":{"line":99,"column":22},"end":{"line":99,"column":null}}]},"13":{"loc":{"start":{"line":99,"column":30},"end":{"line":99,"column":35}},"type":"cond-expr","locations":[{"start":{"line":99,"column":30},"end":{"line":99,"column":35}},{"start":{"line":99,"column":35},"end":{"line":99,"column":null}}]},"14":{"loc":{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},"type":"if","locations":[{"start":{"line":103,"column":1},"end":{"line":103,"column":19}},{"start":{"line":103,"column":1},"end":{"line":103,"column":19}}]},"15":{"loc":{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},"type":"if","locations":[{"start":{"line":104,"column":1},"end":{"line":104,"column":19}},{"start":{"line":104,"column":1},"end":{"line":104,"column":19}}]}},"s":{"0":7,"1":301,"2":1,"3":300,"4":7,"5":12,"6":1,"7":11,"8":11,"9":11,"10":7,"11":183,"12":16,"13":167,"14":167,"15":167,"16":110,"17":57,"18":57,"19":43,"20":57,"21":7,"22":3961,"23":7,"24":116,"25":116,"26":23,"27":7,"28":106,"29":49,"30":57,"31":139,"32":139,"33":7,"34":77,"35":23,"36":54,"37":54,"38":54,"39":15,"40":39,"41":27,"42":12},"f":{"0":301,"1":12,"2":183,"3":3961,"4":116,"5":106,"6":77},"b":{"0":[1,300],"1":[1,11],"2":[33,22],"3":[16,167],"4":[110,57],"5":[43,14],"6":[23,93],"7":[116,54],"8":[49,57],"9":[139,0],"10":[23,54],"11":[77,23],"12":[8,15],"13":[6,9],"14":[15,39],"15":[27,12]}} | ||
} |
@@ -7,2 +7,13 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -13,3 +24,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -22,5 +33,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -30,39 +76,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -75,54 +126,37 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
exports.allSubstrings = allSubstrings; | ||
exports.arrayToPattern = arrayToPattern; | ||
exports.asciifold = asciifold; | ||
exports.code_points = code_points; | ||
exports.diacriticRegexPoints = diacriticRegexPoints; | ||
exports.generateDiacritics = generateDiacritics; | ||
//# sourceMappingURL=diacritics.js.map |
@@ -78,3 +78,3 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -311,6 +311,5 @@ }); | ||
query = diacritics.asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -317,0 +316,0 @@ total: 0, |
/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -8,3 +19,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -17,5 +28,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -25,39 +71,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -70,52 +121,32 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
export { asciifold, diacriticRegexPoints, generateDiacritics }; | ||
export { allSubstrings, arrayToPattern, asciifold, code_points, diacriticRegexPoints, generateDiacritics }; | ||
//# sourceMappingURL=diacritics.js.map |
/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
import { escape_regex, iterate, cmp, propToArray, getAttrNesting, getAttr, scoreValue } from './utils.js'; | ||
import { diacriticRegexPoints, asciifold } from './diacritics.js'; | ||
import { diacriticRegexPoints } from './diacritics.js'; | ||
@@ -76,3 +76,3 @@ /** | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -309,6 +309,5 @@ }); | ||
query = asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -315,0 +314,0 @@ total: 0, |
@@ -6,2 +6,7 @@ declare type TDiacraticList = { | ||
/** | ||
* code points generated from toCodePoints(); | ||
* removed 65339 to 65345 | ||
*/ | ||
export declare const code_points: number[][]; | ||
/** | ||
* Remove accents | ||
@@ -13,2 +18,14 @@ * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703 | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
export declare const arrayToPattern: (chars: string[], glue?: string) => string; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
export declare const allSubstrings: (input: string) => string[][]; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -18,4 +35,2 @@ * | ||
export declare const generateDiacritics: () => TDiacraticList; | ||
export declare const diacriticRegexPoints: (regex: string) => string; | ||
export {}; | ||
/** | ||
@@ -25,31 +40,4 @@ * Expand a regular expression pattern to include diacritics | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
*/ | ||
export declare const diacriticRegexPoints: (regex: string) => string; | ||
export {}; |
@@ -9,2 +9,13 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat, 'g'); | ||
var diacritic_patterns; | ||
const latin_convert = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o' | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'), 'g'); | ||
/** | ||
@@ -15,3 +26,3 @@ * code points generated from toCodePoints(); | ||
var code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
const code_points = [[67, 67], [160, 160], [192, 438], [452, 652], [961, 961], [1019, 1019], [1083, 1083], [1281, 1289], [1984, 1984], [5095, 5095], [7429, 7441], [7545, 7549], [7680, 7935], [8580, 8580], [9398, 9449], [11360, 11391], [42792, 42793], [42802, 42851], [42873, 42897], [42912, 42922], [64256, 64260], [65313, 65338], [65345, 65370]]; | ||
/** | ||
@@ -24,5 +35,40 @@ * Remove accents | ||
const asciifold = str => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str.normalize('NFKD').replace(accent_reg, '').toLowerCase().replace(convert_pat, function (foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
const arrayToPattern = (chars, glue = '|') => { | ||
if (chars.length > 1) { | ||
return '(?:' + chars.join(glue) + ')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
const allSubstrings = input => { | ||
if (input.length === 1) return [[input]]; | ||
var result = []; | ||
allSubstrings(input.substring(1)).forEach(function (subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
}; | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
@@ -32,39 +78,44 @@ * | ||
const generateDiacritics = () => { | ||
var latin_convert = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz' | ||
}; | ||
var diacritics = {}; //var no_latin = []; | ||
var diacritics = {}; | ||
code_points.forEach(code_range => { | ||
for (let i = code_range[0]; i <= code_range[1]; i++) { | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
let latin = asciifold(diacritic); | ||
if (latin == diacritic) { | ||
//no_latin.push(diacritic); | ||
if (latin == diacritic.toLowerCase()) { | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if (latin in latin_convert) { | ||
latin = latin_convert[latin]; | ||
} | ||
if (!(latin in diacritics)) { | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); //console.log('no_latin',JSON.stringify(no_latin)); | ||
}); | ||
var latin_chars = Object.keys(diacritics); // latin character pattern | ||
// match longer substrings first | ||
return diacritics; | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length); | ||
latin_pat = new RegExp('(' + arrayToPattern(latin_chars) + accent_pat + '*)', 'g'); // build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns = {}; | ||
latin_chars.sort((a, b) => a.length - b.length).forEach(latin => { | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map(sub_pat => { | ||
sub_pat = sub_pat.map(l => { | ||
if (diacritics.hasOwnProperty(l)) { | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat, ''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
}; | ||
@@ -77,50 +128,30 @@ /** | ||
var diacritics = null; | ||
const diacriticRegexPoints = regex => { | ||
if (diacritics === null) { | ||
diacritics = generateDiacritics(); | ||
if (diacritic_patterns === undefined) { | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for (let latin in diacritics) { | ||
if (diacritics.hasOwnProperty(latin)) { | ||
regex = regex.replace(new RegExp(latin, 'g'), '[' + diacritics[latin] + ']'); | ||
} | ||
} | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map(part => { | ||
if (part == '') { | ||
return ''; | ||
} // "ffl" or "ffl" | ||
return regex; | ||
}; | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
const no_accent = asciifold(part); | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
} | ||
if (diacritic_patterns.hasOwnProperty(no_accent)) { | ||
return diacritic_patterns[no_accent]; | ||
} // 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
const composed_part = part.normalize('NFC'); | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
} | ||
} | ||
if (composed_part != part) { | ||
return arrayToPattern([part, composed_part]); | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
}; | ||
@@ -291,3 +322,3 @@ // @ts-ignore TS2691 "An import path cannot end with a '.ts' extension" | ||
string: word, | ||
regex: regex ? new RegExp(regex, 'i') : null, | ||
regex: regex ? new RegExp(regex, 'iu') : null, | ||
field: field | ||
@@ -524,6 +555,5 @@ }); | ||
query = asciifold(query + '').toLowerCase().trim(); | ||
return { | ||
options: options, | ||
query: query, | ||
query: query.toLowerCase().trim(), | ||
tokens: this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -530,0 +560,0 @@ total: 0, |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).sifter=t()}(this,(function(){"use strict" | ||
var e=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]] | ||
const t=e=>e.normalize("NFD").replace(/[\u0300-\u036F]/g,"").normalize("NFKD").toLowerCase() | ||
var r=null | ||
const n=t=>{null===r&&(r=(()=>{var t={"l·":"l","ʼn":"n","æ":"ae","ø":"o","aʾ":"a","dž":"dz"},r={} | ||
return e.forEach((e=>{for(let n=e[0];n<=e[1];n++){let e=String.fromCharCode(n),i=e.normalize("NFD").replace(/[\u0300-\u036F]/g,"").normalize("NFKD") | ||
i!=e&&(i=i.toLowerCase(),i in t&&(i=t[i]),i in r||(r[i]=i+i.toUpperCase()),r[i]+=e)}})),r})()) | ||
for(let e in r)r.hasOwnProperty(e)&&(t=t.replace(new RegExp(e,"g"),"["+r[e]+"]")) | ||
return t},i=(e,t)=>{if(e)return e[t]},o=(e,t)=>{if(e){for(var r,n=t.split(".");(r=n.shift())&&(e=e[r]););return e}},s=(e,t,r)=>{var n,i | ||
return e?-1===(i=(e+="").search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n*r):0},c=e=>(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),u=(e,t)=>{var r=e[t] | ||
r&&!Array.isArray(r)&&(e[t]=[r])},f=(e,t)=>{if(Array.isArray(e))e.forEach(t) | ||
else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)},l=(e,r)=>"number"==typeof e&&"number"==typeof r?e>r?1:e<r?-1:0:(e=t(e+"").toLowerCase())>(r=t(r+"").toLowerCase())?1:r>e?-1:0 | ||
var e | ||
const t="[̀-ͯ·ʾ]",r=new RegExp(t,"g") | ||
var n | ||
const i={"æ":"ae","ⱥ":"a","ø":"o"},o=new RegExp(Object.keys(i).join("|"),"g"),s=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],c=e=>e.normalize("NFKD").replace(r,"").toLowerCase().replace(o,(function(e){return i[e]})),u=(e,t="|")=>e.length>1?"(?:"+e.join(t)+")":e[0],f=e=>{if(1===e.length)return[[e]] | ||
var t=[] | ||
return f(e.substring(1)).forEach((function(r){var n=r.slice(0) | ||
n[0]=e.charAt(0)+n[0],t.push(n),(n=r.slice(0)).unshift(e.charAt(0)),t.push(n)})),t},a=t=>{void 0===n&&(n=(()=>{var t={} | ||
s.forEach((e=>{for(let r=e[0];r<=e[1];r++){let e=String.fromCharCode(r),n=c(e) | ||
n!=e.toLowerCase()&&(n in t||(t[n]=[n]),t[n].push(e))}})) | ||
var r=Object.keys(t) | ||
r=r.sort(((e,t)=>t.length-e.length)),e=new RegExp("("+u(r)+"[̀-ͯ·ʾ]*)","g") | ||
var n={} | ||
return r.sort(((e,t)=>e.length-t.length)).forEach((e=>{var r=f(e).map((e=>(e=e.map((e=>t.hasOwnProperty(e)?u(t[e]):e)),u(e,"")))) | ||
n[e]=u(r)})),n})()) | ||
return t.normalize("NFKD").toLowerCase().split(e).map((e=>{if(""==e)return"" | ||
const t=c(e) | ||
if(n.hasOwnProperty(t))return n[t] | ||
const r=e.normalize("NFC") | ||
return r!=e?u([e,r]):e})).join("")},l=(e,t)=>{if(e)return e[t]},h=(e,t)=>{if(e){for(var r,n=t.split(".");(r=n.shift())&&(e=e[r]););return e}},g=(e,t,r)=>{var n,i | ||
return e?-1===(i=(e+="").search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n*r):0},p=e=>(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),d=(e,t)=>{var r=e[t] | ||
r&&!Array.isArray(r)&&(e[t]=[r])},m=(e,t)=>{if(Array.isArray(e))e.forEach(t) | ||
else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)},y=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=c(e+"").toLowerCase())>(t=c(t+"").toLowerCase())?1:t>e?-1:0 | ||
@@ -30,18 +41,18 @@ ;/** | ||
return class{constructor(e,t){this.items=void 0,this.settings=void 0,this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,r){if(!e||!e.length)return[] | ||
const i=[],o=e.split(/\s+/) | ||
var s | ||
return r&&(s=new RegExp("^("+Object.keys(r).map(c).join("|")+"):(.*)$")),o.forEach((e=>{let r,o=null,u=null | ||
s&&(r=e.match(s))&&(o=r[1],e=r[2]),e.length>0&&(u=c(e),this.settings.diacritics&&(u=n(u)),t&&(u="\\b"+u)),i.push({string:e,regex:u?new RegExp(u,"i"):null,field:o})})),i}getScoreFunction(e,t){var r=this.prepareSearch(e,t) | ||
const n=[],i=e.split(/\s+/) | ||
var o | ||
return r&&(o=new RegExp("^("+Object.keys(r).map(p).join("|")+"):(.*)$")),i.forEach((e=>{let r,i=null,s=null | ||
o&&(r=e.match(o))&&(i=r[1],e=r[2]),e.length>0&&(s=p(e),this.settings.diacritics&&(s=a(s)),t&&(s="\\b"+s)),n.push({string:e,regex:s?new RegExp(s,"iu"):null,field:i})})),n}getScoreFunction(e,t){var r=this.prepareSearch(e,t) | ||
return this._getScoreFunction(r)}_getScoreFunction(e){const t=e.tokens,r=t.length | ||
if(!r)return function(){return 0} | ||
const n=e.options.fields,i=e.weights,o=n.length,c=e.getAttrFn | ||
const n=e.options.fields,i=e.weights,o=n.length,s=e.getAttrFn | ||
if(!o)return function(){return 1} | ||
const u=1===o?function(e,t){const r=n[0].field | ||
return s(c(t,r),e,i[r])}:function(e,t){var r=0 | ||
if(e.field){const n=c(t,e.field) | ||
!e.regex&&n?r+=1/o:r+=s(n,e,1)}else f(i,((n,i)=>{r+=s(c(t,i),e,n)})) | ||
const c=1===o?function(e,t){const r=n[0].field | ||
return g(s(t,r),e,i[r])}:function(e,t){var r=0 | ||
if(e.field){const n=s(t,e.field) | ||
!e.regex&&n?r+=1/o:r+=g(n,e,1)}else m(i,((n,i)=>{r+=g(s(t,i),e,n)})) | ||
return r/o} | ||
return 1===r?function(e){return u(t[0],e)}:"and"===e.options.conjunction?function(e){for(var n,i=0,o=0;i<r;i++){if((n=u(t[i],e))<=0)return 0 | ||
return 1===r?function(e){return c(t[0],e)}:"and"===e.options.conjunction?function(e){for(var n,i=0,o=0;i<r;i++){if((n=c(t[i],e))<=0)return 0 | ||
o+=n}return o/r}:function(e){var n=0 | ||
return f(t,(t=>{n+=u(t,e)})),n/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t) | ||
return m(t,(t=>{n+=c(t,e)})),n/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t) | ||
return this._getSortFunction(r)}_getSortFunction(e){var t,r,n | ||
@@ -55,14 +66,14 @@ const i=this,o=e.options,s=!e.query&&o.sort_empty?o.sort_empty:o.sort,c=[],u=[],f=function(t,r){return"$score"===t?r.score:e.getAttrFn(i.items[r.id],t)} | ||
if(a){if(1===a){const e=c[0].field,t=u[0] | ||
return function(r,n){return t*l(f(e,r),f(e,n))}}return function(e,t){var r,n,i | ||
for(r=0;r<a;r++)if(i=c[r].field,n=u[r]*l(f(i,e),f(i,t)))return n | ||
return 0}}return null}prepareSearch(e,r){const n={} | ||
var s=Object.assign({},r) | ||
if(u(s,"sort"),u(s,"sort_empty"),s.fields){u(s,"fields") | ||
return function(r,n){return t*y(f(e,r),f(e,n))}}return function(e,t){var r,n,i | ||
for(r=0;r<a;r++)if(i=c[r].field,n=u[r]*y(f(i,e),f(i,t)))return n | ||
return 0}}return null}prepareSearch(e,t){const r={} | ||
var n=Object.assign({},t) | ||
if(d(n,"sort"),d(n,"sort_empty"),n.fields){d(n,"fields") | ||
const e=[] | ||
s.fields.forEach((t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),n[t.field]="weight"in t?t.weight:1})),s.fields=e}return{options:s,query:e=t(e+"").toLowerCase().trim(),tokens:this.tokenize(e,s.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:s.nesting?o:i}}search(e,t){var r,n,i=this | ||
n.fields.forEach((t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),r[t.field]="weight"in t?t.weight:1})),n.fields=e}return{options:n,query:e.toLowerCase().trim(),tokens:this.tokenize(e,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?h:l}}search(e,t){var r,n,i=this | ||
n=this.prepareSearch(e,t),t=n.options,e=n.query | ||
const o=t.score||i._getScoreFunction(n) | ||
e.length?f(i.items,((e,i)=>{r=o(e),(!1===t.filter||r>0)&&n.items.push({score:r,id:i})})):f(i.items,((e,t)=>{n.items.push({score:1,id:t})})) | ||
e.length?m(i.items,((e,i)=>{r=o(e),(!1===t.filter||r>0)&&n.items.push({score:r,id:i})})):m(i.items,((e,t)=>{n.items.push({score:1,id:t})})) | ||
const s=i._getSortFunction(n) | ||
return s&&n.items.sort(s),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n}}})) | ||
//# sourceMappingURL=sifter.min.js.map |
@@ -5,2 +5,17 @@ | ||
// https://github.com/andrewrk/node-diacritics/blob/master/index.js | ||
var latin_pat:RegExp; | ||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc} | ||
const accent_reg = new RegExp(accent_pat,'g'); | ||
var diacritic_patterns:TDiacraticList; | ||
const latin_convert:TDiacraticList = { | ||
'æ': 'ae', | ||
'ⱥ': 'a', | ||
'ø': 'o', | ||
}; | ||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|'),'g'); | ||
export const DIACRITICS:TDiacraticList = { | ||
@@ -111,3 +126,3 @@ " ":" ", | ||
*/ | ||
var code_points = [ | ||
export const code_points = [ | ||
[ 67, 67 ], | ||
@@ -144,3 +159,9 @@ [ 160, 160 ], | ||
export const asciifold = (str:string):string => { | ||
return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD').toLowerCase(); | ||
return str | ||
.normalize('NFKD') | ||
.replace(accent_reg, '') | ||
.toLowerCase() | ||
.replace(convert_pat,function(foreignletter) { | ||
return latin_convert[foreignletter]; | ||
}); | ||
}; | ||
@@ -168,3 +189,3 @@ | ||
var accumulator: number[][] = []; | ||
var result = char_codes.reduce(function (accumulator, currentValue, index, source) { | ||
char_codes.reduce(function (accumulator, currentValue, index, source) { | ||
@@ -185,52 +206,99 @@ if( !index ){ | ||
return accumulator; | ||
}, accumulator); | ||
return accumulator; | ||
}, accumulator); | ||
console.log(`char_codes (${result.length})`,result); | ||
} | ||
/** | ||
* Convert array of strings to a regular expression | ||
* ex ['ab','a'] => (?:ab|a) | ||
* | ||
*/ | ||
export const arrayToPattern = (chars:string[],glue:string='|'):string =>{ | ||
if( chars.length > 1 ){ | ||
return '(?:'+chars.join(glue)+')'; | ||
} | ||
return chars[0]; | ||
}; | ||
/** | ||
* Get all possible combinations of substrings that add up to the given string | ||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string | ||
* | ||
*/ | ||
export const allSubstrings = (input:string):string[][] => { | ||
if( input.length === 1) return [[input]]; | ||
var result:string[][] = []; | ||
allSubstrings(input.substring(1)).forEach(function(subresult) { | ||
var tmp = subresult.slice(0); | ||
tmp[0] = input.charAt(0) + tmp[0]; | ||
result.push(tmp); | ||
tmp = subresult.slice(0); | ||
tmp.unshift(input.charAt(0)); | ||
result.push(tmp); | ||
}); | ||
return result; | ||
} | ||
/** | ||
* Generate a list of diacritics from the list of code points | ||
* | ||
*/ | ||
export const generateDiacritics = ():TDiacraticList => { | ||
export const generateDiacritics = ():TDiacraticList => { | ||
var latin_convert:{[key:string]:string} = { | ||
'l·': 'l', | ||
'ʼn': 'n', | ||
'æ': 'ae', | ||
'ø': 'o', | ||
'aʾ': 'a', | ||
'dž': 'dz', | ||
}; | ||
var diacritics:{[key:string]:string} = {}; | ||
//var no_latin = []; | ||
var diacritics:{[key:string]:string[]} = {}; | ||
code_points.forEach((code_range)=>{ | ||
for(let i = code_range[0]; i <= code_range[1]; i++){ | ||
let diacritic = String.fromCharCode(i); | ||
let latin = diacritic.normalize('NFD').replace(/[\u0300-\u036F]/g, '').normalize('NFKD'); | ||
if( latin == diacritic ){ | ||
//no_latin.push(diacritic); | ||
let diacritic = String.fromCharCode(i); | ||
let latin = asciifold(diacritic); | ||
if( latin == diacritic.toLowerCase() ){ | ||
continue; | ||
} | ||
latin = latin.toLowerCase(); | ||
if( latin in latin_convert ){ | ||
latin = latin_convert[latin]; | ||
} | ||
if( !(latin in diacritics) ){ | ||
diacritics[latin] = latin + latin.toUpperCase(); | ||
diacritics[latin] = [latin]; | ||
} | ||
diacritics[latin] += diacritic; | ||
diacritics[latin].push(diacritic); | ||
} | ||
}); | ||
//console.log('no_latin',JSON.stringify(no_latin)); | ||
return diacritics; | ||
var latin_chars = Object.keys(diacritics); | ||
// latin character pattern | ||
// match longer substrings first | ||
latin_chars = latin_chars.sort((a, b) => b.length - a.length ); | ||
latin_pat = new RegExp('('+ arrayToPattern(latin_chars) + accent_pat + '*)','g'); | ||
// build diacritic patterns | ||
// ae needs: | ||
// (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...)) | ||
var diacritic_patterns:TDiacraticList = {}; | ||
latin_chars.sort((a,b) => a.length -b.length).forEach((latin)=>{ | ||
var substrings = allSubstrings(latin); | ||
var pattern = substrings.map((sub_pat)=>{ | ||
sub_pat = sub_pat.map((l)=>{ | ||
if( diacritics.hasOwnProperty(l) ){ | ||
return arrayToPattern(diacritics[l]); | ||
} | ||
return l; | ||
}); | ||
return arrayToPattern(sub_pat,''); | ||
}); | ||
diacritic_patterns[latin] = arrayToPattern(pattern); | ||
}); | ||
return diacritic_patterns; | ||
} | ||
@@ -243,51 +311,31 @@ | ||
*/ | ||
var diacritics:null|TDiacraticList = null | ||
export const diacriticRegexPoints = (regex:string):string => { | ||
if( diacritics === null ){ | ||
diacritics = generateDiacritics(); | ||
if( diacritic_patterns === undefined ){ | ||
diacritic_patterns = generateDiacritics(); | ||
} | ||
for( let latin in diacritics ){ | ||
if( diacritics.hasOwnProperty(latin) ){ | ||
regex = regex.replace( new RegExp(latin,'g'), '['+diacritics[latin]+']'); | ||
const decomposed = regex.normalize('NFKD').toLowerCase(); | ||
return decomposed.split(latin_pat).map((part:string)=>{ | ||
if( part == '' ){ | ||
return ''; | ||
} | ||
} | ||
return regex; | ||
} | ||
/** | ||
* Expand a regular expression pattern to include diacritics | ||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/ | ||
* | ||
* rollup will bundle this function (and the DIACRITICS constant) unless commented out | ||
* | ||
var diacriticRegex = (function() { | ||
var list = []; | ||
for( let letter in DIACRITICS ){ | ||
if( letter.toLowerCase() != letter && letter.toLowerCase() in DIACRITICS ){ | ||
continue; | ||
// "ffl" or "ffl" | ||
const no_accent = asciifold(part); | ||
if( diacritic_patterns.hasOwnProperty(no_accent) ){ | ||
return diacritic_patterns[no_accent]; | ||
} | ||
if( DIACRITICS.hasOwnProperty(letter) ){ | ||
var replace = letter + DIACRITICS[letter]; | ||
if( letter.toUpperCase() in DIACRITICS ){ | ||
replace += letter.toUpperCase() + DIACRITICS[letter.toUpperCase()]; | ||
} | ||
list.push({let:letter,pat:'['+replace+']'}); | ||
// 'أهلا' (\u{623}\u{647}\u{644}\u{627}) or 'أهلا' (\u{627}\u{654}\u{647}\u{644}\u{627}) | ||
const composed_part = part.normalize('NFC'); | ||
if( composed_part != part ){ | ||
return arrayToPattern([part,composed_part]); | ||
} | ||
} | ||
return function(regex:string):string{ | ||
list.forEach((item)=>{ | ||
regex = regex.replace( new RegExp(item.let,'g'),item.pat); | ||
}); | ||
return regex; | ||
} | ||
})(); | ||
*/ | ||
return part; | ||
}).join(''); | ||
} |
@@ -20,3 +20,3 @@ /** | ||
// @ts-ignore TS2691 "An import path cannot end with a '.ts' extension" | ||
import { diacriticRegexPoints, asciifold } from './diacritics.ts'; | ||
import { diacriticRegexPoints } from './diacritics.ts'; | ||
// @ts-ignore TS2691 "An import path cannot end with a '.ts' extension" | ||
@@ -78,3 +78,3 @@ import * as T from 'types.ts'; | ||
string : word, | ||
regex : regex ? new RegExp(regex,'i') : null, | ||
regex : regex ? new RegExp(regex,'iu') : null, | ||
field : field, | ||
@@ -310,7 +310,6 @@ }); | ||
query = asciifold( query + '' ).toLowerCase().trim(); | ||
return { | ||
options : options, | ||
query : query, | ||
query : query.toLowerCase().trim(), | ||
tokens : this.tokenize(query, options.respect_word_boundaries, weights), | ||
@@ -317,0 +316,0 @@ total : 0, |
@@ -14,3 +14,3 @@ { | ||
"description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.", | ||
"version": "0.7.5", | ||
"version": "0.8.0", | ||
"license": "Apache-2.0", | ||
@@ -32,3 +32,3 @@ "author": "Brian Reavis <brian@thirdroute.com>", | ||
"build": "npx rollup -c .config/rollup.config.js", | ||
"build:types": "tsc -p .config --emitDeclarationOnly", | ||
"build:types": "tsc -p .config --emitDeclarationOnly", | ||
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls" | ||
@@ -35,0 +35,0 @@ }, |
@@ -306,3 +306,17 @@ var assert = require('assert'); | ||
it('should match one item', function() { | ||
var data = [ | ||
{fieldx: 'ffal'}, | ||
{fieldx: 'ffla'} | ||
]; | ||
var sifter = new Sifter(data); | ||
var result = sifter.search('ffl', { | ||
fields: ['fieldx'] | ||
}); | ||
assert.equal(result.items.length,1); | ||
}); | ||
}); |
@@ -11,3 +11,3 @@ var assert = require('assert'); | ||
assert.equal( utils.cmp(from,to), true); | ||
assert.strictEqual( utils.cmp(from,to), 0 ); | ||
}); | ||
@@ -14,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
689521
70
5775