@ethnolib/find-language 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -302926,13 +302926,14 @@ function eb(r) {
302926
302926
  }
302927
302927
  return _;
302928
302928
  }
302929
- function tb(r) {
302930
- var y;
302931
- return (y = new Sn(ts, {
302929
+ function tb(r, m) {
302930
+ var h;
302931
+ const y = new Sn(ts, {
302932
302932
  keys: ["languageSubtag", "iso639_3_code"],
302933
302933
  threshold: 0
302934
302934
  // exact matches only
302935
- }).search(r)[0]) == null ? void 0 : y.item;
302935
+ }).search(r);
302936
+ return m ? m(y, r)[0] : (h = y[0]) == null ? void 0 : h.item;
302936
302937
  }
302937
302938
  const Rh = /* @__PURE__ */ new Set([
302938
302939
  "ang",
@@ -306534,15 +306535,25 @@ function lb(r) {
306534
306535
  };
306535
306536
  }
306536
306537
  const rb = {
306538
+ // Scripts which frequently show up as options for languages with multiple scripts
306537
306539
  latn: "A B C D",
306538
306540
  arab: "ا ب ت ث",
306539
- deva: " ",
306541
+ deva: " ",
306540
306542
  cyrl: "А Б В Г",
306541
306543
  tibt: "ཀ ཁ ག གྷ",
306542
306544
  ethi: "ሀ ሁ ሂ ሃ",
306543
306545
  thai: "ก ข ค ฆ",
306544
- beng: " ",
306545
- mymr: "က ခ ဂ ဃ"
306546
+ beng: " ",
306547
+ mymr: "က ခ ဂ ဃ",
306548
+ // Some additional Indian scripts
306549
+ guru: "ਕ ਖ ਗ ਘ",
306550
+ gujr: "ક ખ ગ ઘ",
306551
+ taml: "க ங ச ஞ",
306552
+ telu: "క ఖ గ ఘ",
306553
+ knda: "ಕ ಖ ಗ ಘ",
306554
+ mlym: "ക ഖ ഗ ഘ",
306555
+ orya: "କ ଖ ଗ ଘ",
306556
+ mtei: "ꯀ ꯈ ꯒ ꯔ"
306546
306557
  };
306547
306558
  export {
306548
306559
  Yo as END_OF_MATCH_MARKER,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A library for fuzzy-searching for languages and other utils for language choosers",
4
4
  "author": "SIL Global",
5
5
  "license": "MIT",
6
- "version": "0.0.20",
6
+ "version": "0.0.22",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "scripts": {
@@ -2,4 +2,4 @@ import { FuseResult } from 'fuse.js';
2
2
  import { ILanguage } from './findLanguageInterfaces';
3
3
  export declare const fieldsToSearch: string[];
4
4
  export declare function searchForLanguage(queryString: string): FuseResult<ILanguage>[];
5
- export declare function getLanguageBySubtag(code: string): ILanguage | undefined;
5
+ export declare function getLanguageBySubtag(code: string, searchResultModifier?: (results: FuseResult<ILanguage>[], searchString: string) => ILanguage[]): ILanguage | undefined;