UNPKG

@ecomplus/search-engine

Version:

JS lib to handle products search with E-Com Plus stores

9 lines (8 loc) 267 B
export default ({ aggregations }, field) => { // abstraction to get buckets array from result aggregations let buckets if (aggregations && aggregations[field]) { buckets = aggregations[field].buckets } return (Array.isArray(buckets) && buckets) || [] }