(queries, opts)
| 230 | } |
| 231 | |
| 232 | query (queries, opts) { |
| 233 | // this ugly interface here is meant to be a compatibility layer with the legacy API lib/view.js is consuming |
| 234 | // if at some point we refactor that command then we can revisit making this nicer |
| 235 | if (queries === Queryable.ALL) { |
| 236 | return { [Queryable.ALL]: this.#data } |
| 237 | } |
| 238 | |
| 239 | const q = query => |
| 240 | getter({ |
| 241 | data: this.#data, |
| 242 | key: query, |
| 243 | }, opts) |
| 244 | |
| 245 | if (Array.isArray(queries)) { |
| 246 | let res = {} |
| 247 | for (const query of queries) { |
| 248 | res = { ...res, ...q(query) } |
| 249 | } |
| 250 | return res |
| 251 | } else { |
| 252 | return q(queries) |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | // return the value for a single query if found; otherwise, returns undefined |
| 257 | get (query) { |
no outgoing calls
no test coverage detected