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) 660 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,keywords:n=[],roomId:i=""}=a,c=t.path(["dynamicData","grab","tags"],a)||[],s=n.filter(t.prop("isUserSearchable")).map(t.prop("name")),p=`${o} ${e.split(".").join(" ")} ${i} ${s.join(" ")} ${c.join(" ")}`;return[Number(r),p]})}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};