UNPKG

atriusmaps-node-sdk

Version:

This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information

2 lines (1 loc) 690 B
import*as t from"ramda";import{getFlexSearchInstance as a}from"./utils.js";function r(r,e){const o=a({lang:e});function n(a){return Object.values(a).map(a=>{const{poiId:r,category:e="",name:o,staticName:n,keywords:i=[],roomId:c=""}=a,s=t.path(["dynamicData","grab","tags"],a)||[],p=i.filter(t.prop("isUserSearchable")).map(t.prop("name")),u=`${o} ${n&&n!==o?n:""} ${e.split(".").join(" ")} ${c} ${p.join(" ")} ${s.join(" ")}`;return[Number(r),u]})}return n(r).forEach(([t,a])=>o.add(t,a)),{search:function(a){const e={...a};e.limit||(e.limit=5e3);const n=o.search(e);return Object.values(t.pick(n,r))},updateMultiple:function(t){n(t).forEach(([t,a])=>o.update(t,a))}}}export{r as default};