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) • 421 B
JavaScript
import{FlightType as t}from"./flightDetailsMapper.js";const r=(e,a,l)=>{const{index:i,flights:p,apiError:o}=l,s=a===t.ALL?[t.DEPARTURE,t.ARRIVAL]:[a];let f;return f=e?s.flatMap(t=>i[t].search({query:e}).map(r=>p[t][String(r)]).filter(t=>Boolean(t))):s.flatMap(t=>Object.values(p[t])),0===f.length&&e&&/^\w\w\d{2,4}$/.test(e)?r(e.replace(/(\w\w)(\d{2,4})/,"$1_$2"),a,l):{flights:f,apiError:o}};export{r as searchFlights};