Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orchidjs/sifter

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orchidjs/sifter - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

64

dist/cjs/sifter.js

@@ -154,4 +154,3 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */

const code_points = [[0, 65535]];
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc}
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
/** @type {TUnicodeMap} */

@@ -166,9 +165,58 @@

const latin_convert = {
'æ': 'ae',
'ⱥ': 'a',
'ø': 'o',
'⁄': '/',
'∕': '/'
const latin_convert = {};
/** @type {TUnicodeMap} */
const latin_condensed = {
'/': '⁄∕',
'0': '߀',
"a": "ⱥɐɑ",
"aa": "ꜳ",
"ae": "æǽǣ",
"ao": "ꜵ",
"au": "ꜷ",
"av": "ꜹꜻ",
"ay": "ꜽ",
"b": "ƀɓƃ",
"c": "ꜿƈȼↄ",
"d": "đɗɖᴅƌꮷԁɦ",
"e": "ɛǝᴇɇ",
"f": "ꝼƒ",
"g": "ǥɠꞡᵹꝿɢ",
"h": "ħⱨⱶɥ",
"i": "i̇ɨı",
"j": "ɉȷ",
"k": "ƙⱪꝁꝃꝅꞣ",
"l": "łƚɫⱡꝉꝇꞁɭ",
"m": "ɱɯϻ",
"n": "ꞥƞɲꞑᴎлԉ",
"o": "øǿɔɵꝋꝍᴑ",
"oe": "œ",
"oi": "ƣ",
"oo": "ꝏ",
"ou": "ȣ",
"p": "ƥᵽꝑꝓꝕρ",
"q": "ꝗꝙɋ",
"r": "ɍɽꝛꞧꞃ",
"s": "ßȿꞩꞅʂṧṩ",
"t": "ŧƭʈⱦꞇ",
"th": "þ",
"tz": "ꜩ",
"u": "ʉ",
"v": "ʋꝟʌ",
"vy": "ꝡ",
"w": "ⱳ",
"y": "ƴɏỿ",
"z": "ƶȥɀⱬꝣ",
"hv": "ƕ"
};
for (let latin in latin_condensed) {
let unicode = latin_condensed[latin] || '';
for (let i = 0; i < unicode.length; i++) {
let char = unicode.substring(i, i + 1);
latin_convert[char] = latin;
}
}
const convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');

@@ -175,0 +223,0 @@ /**

@@ -18,4 +18,3 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */

const code_points = [[0, 65535]];
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc}
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
/** @type {TUnicodeMap} */

@@ -30,9 +29,58 @@

const latin_convert = {
'æ': 'ae',
'ⱥ': 'a',
'ø': 'o',
'⁄': '/',
'∕': '/'
const latin_convert = {};
/** @type {TUnicodeMap} */
const latin_condensed = {
'/': '⁄∕',
'0': '߀',
"a": "ⱥɐɑ",
"aa": "ꜳ",
"ae": "æǽǣ",
"ao": "ꜵ",
"au": "ꜷ",
"av": "ꜹꜻ",
"ay": "ꜽ",
"b": "ƀɓƃ",
"c": "ꜿƈȼↄ",
"d": "đɗɖᴅƌꮷԁɦ",
"e": "ɛǝᴇɇ",
"f": "ꝼƒ",
"g": "ǥɠꞡᵹꝿɢ",
"h": "ħⱨⱶɥ",
"i": "i̇ɨı",
"j": "ɉȷ",
"k": "ƙⱪꝁꝃꝅꞣ",
"l": "łƚɫⱡꝉꝇꞁɭ",
"m": "ɱɯϻ",
"n": "ꞥƞɲꞑᴎлԉ",
"o": "øǿɔɵꝋꝍᴑ",
"oe": "œ",
"oi": "ƣ",
"oo": "ꝏ",
"ou": "ȣ",
"p": "ƥᵽꝑꝓꝕρ",
"q": "ꝗꝙɋ",
"r": "ɍɽꝛꞧꞃ",
"s": "ßȿꞩꞅʂṧṩ",
"t": "ŧƭʈⱦꞇ",
"th": "þ",
"tz": "ꜩ",
"u": "ʉ",
"v": "ʋꝟʌ",
"vy": "ꝡ",
"w": "ⱳ",
"y": "ƴɏỿ",
"z": "ƶȥɀⱬꝣ",
"hv": "ƕ"
};
for (let latin in latin_condensed) {
let unicode = latin_condensed[latin] || '';
for (let i = 0; i < unicode.length; i++) {
let char = unicode.substring(i, i + 1);
latin_convert[char] = latin;
}
}
const convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');

@@ -39,0 +87,0 @@ /**

@@ -156,4 +156,3 @@ /*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */

const code_points = [[0, 65535]];
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc}
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
/** @type {TUnicodeMap} */

@@ -168,9 +167,58 @@

const latin_convert = {
'æ': 'ae',
'ⱥ': 'a',
'ø': 'o',
'⁄': '/',
'∕': '/'
const latin_convert = {};
/** @type {TUnicodeMap} */
const latin_condensed = {
'/': '⁄∕',
'0': '߀',
"a": "ⱥɐɑ",
"aa": "ꜳ",
"ae": "æǽǣ",
"ao": "ꜵ",
"au": "ꜷ",
"av": "ꜹꜻ",
"ay": "ꜽ",
"b": "ƀɓƃ",
"c": "ꜿƈȼↄ",
"d": "đɗɖᴅƌꮷԁɦ",
"e": "ɛǝᴇɇ",
"f": "ꝼƒ",
"g": "ǥɠꞡᵹꝿɢ",
"h": "ħⱨⱶɥ",
"i": "i̇ɨı",
"j": "ɉȷ",
"k": "ƙⱪꝁꝃꝅꞣ",
"l": "łƚɫⱡꝉꝇꞁɭ",
"m": "ɱɯϻ",
"n": "ꞥƞɲꞑᴎлԉ",
"o": "øǿɔɵꝋꝍᴑ",
"oe": "œ",
"oi": "ƣ",
"oo": "ꝏ",
"ou": "ȣ",
"p": "ƥᵽꝑꝓꝕρ",
"q": "ꝗꝙɋ",
"r": "ɍɽꝛꞧꞃ",
"s": "ßȿꞩꞅʂṧṩ",
"t": "ŧƭʈⱦꞇ",
"th": "þ",
"tz": "ꜩ",
"u": "ʉ",
"v": "ʋꝟʌ",
"vy": "ꝡ",
"w": "ⱳ",
"y": "ƴɏỿ",
"z": "ƶȥɀⱬꝣ",
"hv": "ƕ"
};
for (let latin in latin_condensed) {
let unicode = latin_condensed[latin] || '';
for (let i = 0; i < unicode.length; i++) {
let char = unicode.substring(i, i + 1);
latin_convert[char] = latin;
}
}
const convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');

@@ -177,0 +225,0 @@ /**

59

dist/umd/sifter.min.js

@@ -10,14 +10,17 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).sifter={})}(this,(function(t){"use strict"

return f(r).forEach((function(r){let n=r.slice(0)
n[0]=t.charAt(0)+n[0],e.push(n),n=r.slice(0),n.unshift(t.charAt(0)),e.push(n)})),e},c=[[0,65535]]
let a,h
const d={"æ":"ae","ⱥ":"a","ø":"o","⁄":"/","∕":"/"},g=new RegExp(Object.keys(d).join("|")+"|[̀-ͯ·ʾ]","gu"),p=(t,e="NFKD")=>t.normalize(e),m=t=>(t=>t.match(/[\u0f71-\u0f81]/)?u(t).reduce(((t,e)=>t+p(e)),""):p(t))(t).toLowerCase().replace(g,(t=>d[t]||""))
const b=t=>{const e={},r=(t,r)=>{const s=e[t]||new Set,o=new RegExp("^"+n(s)+"$","iu")
n[0]=t.charAt(0)+n[0],e.push(n),n=r.slice(0),n.unshift(t.charAt(0)),e.push(n)})),e},a=[[0,65535]]
let c,h
const d={},g={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"i̇ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂṧṩ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"}
for(let t in g){let e=g[t]||""
for(let r=0;r<e.length;r++){let n=e.substring(r,r+1)
d[n]=t}}const p=new RegExp(Object.keys(d).join("|")+"|[̀-ͯ·ʾʼ]","gu"),m=(t,e="NFKD")=>t.normalize(e),b=t=>(t=>t.match(/[\u0f71-\u0f81]/)?u(t).reduce(((t,e)=>t+m(e)),""):m(t))(t).toLowerCase().replace(p,(t=>d[t]||""))
const y=t=>{const e={},r=(t,r)=>{const s=e[t]||new Set,o=new RegExp("^"+n(s)+"$","iu")
r.match(o)||(s.add(i(r)),e[t]=s)}
for(let e of function*(t){for(const[e,r]of t)for(let t=e;t<=r;t++){let e=String.fromCharCode(t),r=m(e)
for(let e of function*(t){for(const[e,r]of t)for(let t=e;t<=r;t++){let e=String.fromCharCode(t),r=b(e)
if(r==e.toLowerCase())continue
if(r.length>3)continue
if(0==r.length)continue
let n=p(e)
p(n,"NFC")===e&&r===n||(yield{folded:r,composed:e,code_point:t})}}(t))r(e.folded,e.folded),r(e.folded,e.composed)
return e},y=t=>{const r=b(t),s={}
let n=m(e)
m(n,"NFC")===e&&r===n||(yield{folded:r,composed:e,code_point:t})}}(t))r(e.folded,e.folded),r(e.folded,e.composed)
return e},w=t=>{const r=y(t),s={}
let o=[]

@@ -27,8 +30,8 @@ for(let t in r){let e=r[t]

const l=e(o)
return h=new RegExp("^"+l,"u"),s},w=(t,n=1)=>(n=Math.max(n,t.length-1),e(f(t).map((t=>((t,e=1)=>{let n=0
return t=t.map((t=>(a[t]&&(n+=t.length),a[t]||t))),n>=e?r(t):""})(t,n))))),v=(t,n=!0)=>{let s=t.length>1?1:0
return h=new RegExp("^"+l,"u"),s},v=(t,n=1)=>(n=Math.max(n,t.length-1),e(f(t).map((t=>((t,e=1)=>{let n=0
return t=t.map((t=>(c[t]&&(n+=t.length),c[t]||t))),n>=e?r(t):""})(t,n))))),S=(t,n=!0)=>{let s=t.length>1?1:0
return e(t.map((t=>{let e=[]
const i=n?t.length():t.length()-1
for(let r=0;r<i;r++)e.push(w(t.substrs[r]||"",s))
return r(e)})))},S=(t,e)=>{for(const r of e){if(r.start!=t.start||r.end!=t.end)continue
for(let r=0;r<i;r++)e.push(v(t.substrs[r]||"",s))
return r(e)})))},x=(t,e)=>{for(const r of e){if(r.start!=t.start||r.end!=t.end)continue
if(r.substrs.join("")!==t.substrs.join(""))continue

@@ -40,8 +43,8 @@ let e=t.parts

if(!(r.parts.filter(n).length>0))return!0}return!1}
class x{constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let r=new x,n=JSON.parse(JSON.stringify(this.parts)),s=n.pop()
class j{constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let r=new j,n=JSON.parse(JSON.stringify(this.parts)),s=n.pop()
for(const t of n)r.add(t)
let i=e.substr.substring(0,t-s.start),o=i.length
return r.add({start:s.start,end:s.start+o,length:o,substr:i}),r}}const _=t=>{var e
void 0===a&&(a=y(e||c)),t=m(t)
let r="",n=[new x]
void 0===c&&(c=w(e||a)),t=b(t)
let r="",n=[new j]
for(let e=0;e<t.length;e++){let s=t.substring(e).match(h)

@@ -56,10 +59,10 @@ const i=t.substring(e,e+1),o=s?s[0]:null

n.add({start:e,end:e+s,length:s,substr:o}),l.push(n)}else u.add("3")}if(l.length>0){l=l.sort(((t,e)=>t.length()-e.length()))
for(let t of l)S(t,n)||n.push(t)}else if(e>0&&1==u.size&&!u.has("3")){r+=v(n,!1)
let t=new x
for(let t of l)x(t,n)||n.push(t)}else if(e>0&&1==u.size&&!u.has("3")){r+=S(n,!1)
let t=new j
const e=n[0]
e&&t.add(e.last()),n=[t]}}return r+=v(n,!0),r},j=(t,e)=>{if(t)return t[e]},A=(t,e)=>{if(t){for(var r,n=e.split(".");(r=n.shift())&&(t=t[r]););return t}},F=(t,e,r)=>{var n,s
return t?(t+="",null==e.regex||-1===(s=t.search(e.regex))?0:(n=e.string.length/t.length,0===s&&(n+=.5),n*r)):0},E=(t,e)=>{var r=t[e]
e&&t.add(e.last()),n=[t]}}return r+=S(n,!0),r},A=(t,e)=>{if(t)return t[e]},F=(t,e)=>{if(t){for(var r,n=e.split(".");(r=n.shift())&&(t=t[r]););return t}},E=(t,e,r)=>{var n,s
return t?(t+="",null==e.regex||-1===(s=t.search(e.regex))?0:(n=e.string.length/t.length,0===s&&(n+=.5),n*r)):0},$=(t,e)=>{var r=t[e]
if("function"==typeof r)return r
r&&!Array.isArray(r)&&(t[e]=[r])},$=(t,e)=>{if(Array.isArray(t))t.forEach(e)
else for(var r in t)t.hasOwnProperty(r)&&e(t[r],r)},C=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=m(t+"").toLowerCase())>(e=m(e+"").toLowerCase())?1:e>t?-1:0
r&&!Array.isArray(r)&&(t[e]=[r])},k=(t,e)=>{if(Array.isArray(t))t.forEach(e)
else for(var r in t)t.hasOwnProperty(r)&&e(t[r],r)},C=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=b(t+"").toLowerCase())>(e=b(e+"").toLowerCase())?1:e>t?-1:0
t.Sifter=

@@ -91,5 +94,5 @@ /**

const l=1===i?function(t,e){const r=n[0].field
return F(o(e,r),t,s[r]||1)}:function(t,e){var r=0
return E(o(e,r),t,s[r]||1)}:function(t,e){var r=0
if(t.field){const n=o(e,t.field)
!t.regex&&n?r+=1/i:r+=F(n,t,1)}else $(s,((n,s)=>{r+=F(o(e,s),t,n)}))
!t.regex&&n?r+=1/i:r+=E(n,t,1)}else k(s,((n,s)=>{r+=E(o(e,s),t,n)}))
return r/i}

@@ -99,3 +102,3 @@ return 1===r?function(t){return l(e[0],t)}:"and"===t.options.conjunction?function(t){var n,s=0

s+=n}return s/r}:function(t){var n=0
return $(e,(e=>{n+=l(e,t)})),n/r}}getSortFunction(t,e){var r=this.prepareSearch(t,e)
return k(e,(e=>{n+=l(e,t)})),n/r}}getSortFunction(t,e){var r=this.prepareSearch(t,e)
return this._getSortFunction(r)}_getSortFunction(t){var e,r=[]

@@ -112,10 +115,10 @@ const n=this,s=t.options,i=!t.query&&s.sort_empty?s.sort_empty:s.sort

var n=Object.assign({},e)
if(E(n,"sort"),E(n,"sort_empty"),n.fields){E(n,"fields")
if($(n,"sort"),$(n,"sort_empty"),n.fields){$(n,"fields")
const t=[]
n.fields.forEach((e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),r[e.field]="weight"in e?e.weight:1})),n.fields=t}return{options:n,query:t.toLowerCase().trim(),tokens:this.tokenize(t,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?A:j}}search(t,e){var r,n,s=this
n.fields.forEach((e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),r[e.field]="weight"in e?e.weight:1})),n.fields=t}return{options:n,query:t.toLowerCase().trim(),tokens:this.tokenize(t,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?F:A}}search(t,e){var r,n,s=this
n=this.prepareSearch(t,e),e=n.options,t=n.query
const i=e.score||s._getScoreFunction(n)
t.length?$(s.items,((t,s)=>{r=i(t),(!1===e.filter||r>0)&&n.items.push({score:r,id:s})})):$(s.items,((t,e)=>{n.items.push({score:1,id:e})}))
t.length?k(s.items,((t,s)=>{r=i(t),(!1===e.filter||r>0)&&n.items.push({score:r,id:s})})):k(s.items,((t,e)=>{n.items.push({score:1,id:e})}))
const o=s._getSortFunction(n)
return o&&n.items.sort(o),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n}},t.cmp=C,t.getAttr=j,t.getAttrNesting=A,t.getPattern=_,t.iterate=$,t.propToArray=E,t.scoreValue=F,Object.defineProperty(t,"__esModule",{value:!0})}))
return o&&n.items.sort(o),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n}},t.cmp=C,t.getAttr=A,t.getAttrNesting=F,t.getPattern=_,t.iterate=k,t.propToArray=$,t.scoreValue=E,Object.defineProperty(t,"__esModule",{value:!0})}))
//# sourceMappingURL=sifter.min.js.map

@@ -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": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",

@@ -70,4 +70,4 @@ "author": "Brian Reavis <brian@thirdroute.com>",

"dependencies": {
"@orchidjs/unicode-variants": "^1.0.2"
"@orchidjs/unicode-variants": "^1.0.3"
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc