Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
feat(core): filter out falsy sources
Browse files Browse the repository at this point in the history
This allows patterns like:

```js
autocomplete({
  // ...
  getSources({ query }) {
    return [
      query && { /* ... */ },
    ];
  }
});
```
  • Loading branch information
francoischalifour committed Feb 24, 2020
1 parent 53c2ef7 commit f771522
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/autocomplete-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function normalizeGetSources<TItem>(
return options => {
return Promise.resolve(getSources(options)).then(sources =>
Promise.all(
sources.map(source => {
sources.filter(Boolean).map(source => {
return Promise.resolve(normalizeSource<TItem>(source));
})
)
Expand Down

0 comments on commit f771522

Please sign in to comment.