@digigov/text-search 1.2.0-rc.32 → 2.0.0-16fbe090
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/hook.d.ts +1 -1
- package/hook.js +34 -0
- package/index.d.ts +2 -2
- package/index.js +5 -8
- package/package.json +4 -4
- package/search/index.d.ts +1 -1
- package/search/index.js +3 -6
- package/search/lang/gr/encoder.js +8 -0
- package/search/lang/gr/normalization-map.js +101 -0
- package/search/search-index.d.ts +1 -1
- package/search/search-index.js +46 -0
- package/search/utils.js +26 -0
- package/types.js +0 -0
- package/cjs/hook/index.js +0 -58
- package/cjs/hook.js.map +0 -7
- package/cjs/index.js +0 -42
- package/cjs/index.js.map +0 -7
- package/cjs/search/index.js +0 -26
- package/cjs/search/index.js.map +0 -7
- package/cjs/search/lang/gr/encoder/index.js +0 -41
- package/cjs/search/lang/gr/encoder.js.map +0 -7
- package/cjs/search/lang/gr/normalization-map/index.js +0 -128
- package/cjs/search/lang/gr/normalization-map.js.map +0 -7
- package/cjs/search/search-index/index.js +0 -106
- package/cjs/search/search-index.js.map +0 -7
- package/cjs/search/utils/index.js +0 -68
- package/cjs/search/utils.js.map +0 -7
- package/cjs/types/index.js +0 -17
- package/cjs/types.js.map +0 -7
- package/hook/index.js +0 -28
- package/hook/package.json +0 -6
- package/hook.js.map +0 -7
- package/hook.spec.d.ts +0 -1
- package/index.js.map +0 -7
- package/search/__tests__/utils.spec.d.ts +0 -1
- package/search/index.js.map +0 -7
- package/search/lang/gr/encoder/index.js +0 -17
- package/search/lang/gr/encoder/package.json +0 -6
- package/search/lang/gr/encoder.js.map +0 -7
- package/search/lang/gr/normalization-map/index.js +0 -104
- package/search/lang/gr/normalization-map/package.json +0 -6
- package/search/lang/gr/normalization-map.js.map +0 -7
- package/search/package.json +0 -6
- package/search/search-index/index.js +0 -86
- package/search/search-index/package.json +0 -6
- package/search/search-index.js.map +0 -7
- package/search/utils/index.js +0 -42
- package/search/utils/package.json +0 -6
- package/search/utils.js.map +0 -7
- package/types/index.js +0 -1
- package/types/package.json +0 -6
- package/types.js.map +0 -7
package/search/utils.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/search/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleDocumentSearchResultSetUnit } from 'flexsearch';\n\n/**\n * Extracts the unique item IDs from the result set\n *\n * @param result - The result set to extract the IDs from\n */\nexport function getResultIds(result: SimpleDocumentSearchResultSetUnit[]) {\n const set = new Set<number | string>();\n result.forEach((item) => {\n item.result.forEach((id) => set.add(id));\n });\n return Array.from(set);\n}\n\n/**\n * Get the items from the list that match the given IDs\n *\n * @param items - The list of items to search through\n * @param ids - The list of IDs to search for\n * @param idKey - The key to use to find the IDs in the items\n */\nexport function findItemsByIds<T extends Record<string, any>>(\n items: T[],\n ids: (string | number)[],\n idKey: Extract<keyof T, string>\n) {\n return items.filter(\n (item) => item && ids.includes(getValueFromNestedKey(item, idKey))\n );\n}\n\nfunction getValueFromNestedKey(object: Record<string, any>, nestedKey: string) {\n const keys = nestedKey.split(':');\n\n let result = object;\n for (const keySegment of keys) {\n if (Object.prototype.hasOwnProperty.call(result, keySegment)) {\n result = result[keySegment];\n }\n }\n return result as unknown as string;\n}\n\n/**\n * Recursively get all the keys from an object\n *\n * The keys are returned in the format `parentKey.childKey` for nested objects\n * and `key` for top level objects (objects that are not nested inside another object).\n *\n * @param object - The item to get the keys from\n * @param parentKey - The parent key to which the current key should be appended\n */\nexport function getAllItemKeys(\n object: Record<string, any>,\n parentKey = ''\n): string[] {\n let keys: string[] = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n const currentKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (typeof object[key] === 'object' && object[key] !== null) {\n keys = keys.concat(getAllItemKeys(object[key], currentKey));\n } else {\n keys.push(currentKey);\n }\n }\n }\n\n return keys;\n}\n"],
|
|
5
|
-
"mappings": "AAOO,SAAS,aAAa,QAA6C;AACxE,QAAM,MAAM,oBAAI,IAAqB;AACrC,SAAO,QAAQ,CAAC,SAAS;AACvB,SAAK,OAAO,QAAQ,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;AAAA,EACzC,CAAC;AACD,SAAO,MAAM,KAAK,GAAG;AACvB;AASO,SAAS,eACd,OACA,KACA,OACA;AACA,SAAO,MAAM;AAAA,IACX,CAAC,SAAS,QAAQ,IAAI,SAAS,sBAAsB,MAAM,KAAK,CAAC;AAAA,EACnE;AACF;AAEA,SAAS,sBAAsB,QAA6B,WAAmB;AAC7E,QAAM,OAAO,UAAU,MAAM,GAAG;AAEhC,MAAI,SAAS;AACb,aAAW,cAAc,MAAM;AAC7B,QAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,UAAU,GAAG;AAC5D,eAAS,OAAO,UAAU;AAAA,IAC5B;AAAA,EACF;AACA,SAAO;AACT;AAWO,SAAS,eACd,QACA,YAAY,IACF;AACV,MAAI,OAAiB,CAAC;AACtB,aAAW,OAAO,QAAQ;AACxB,QAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,GAAG;AACrD,YAAM,aAAa,YAAY,GAAG,SAAS,IAAI,GAAG,KAAK;AAEvD,UAAI,OAAO,OAAO,GAAG,MAAM,YAAY,OAAO,GAAG,MAAM,MAAM;AAC3D,eAAO,KAAK,OAAO,eAAe,OAAO,GAAG,GAAG,UAAU,CAAC;AAAA,MAC5D,OAAO;AACL,aAAK,KAAK,UAAU;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/types/package.json
DELETED