open-index/open-npm huggingface dataset:
npm package: @segment/create-selector
Description: [![Circle CI](https://circleci.com/gh/segmentio/create-selector.svg?style=svg&circle-token=44d8c416a1100b6ad5ce54061d559f7a9bd73621)](https://circleci.com/gh/segmentio/create-selector)
Latest version: 0.0.4

[![Circle CI](https://circleci.com/gh/segmentio/create-selector.svg?style=svg&circle-token=44d8c416a1100b6ad5ce54061d559f7a9bd73621)](https://circleci.com/gh/segmentio/create-selector)

# create-selector

A simple wrapper over [reselect](https://github.com/reactjs/reselect) to allow creating selectors with a cache size more than 1. See [here](https://github.com/reactjs/reselect#motivation-for-memoized-selectors) for more information on this.

## Example

```js
import createSelector from '@segment/create-selector'

const getVisibilityFilter = (state) => state.visibilityFilter
const getTodos = (state) => state.todos

export const getVisibleTodos = createSelector(
  [ getVisibilityFilter, getTodos ],
  (visibilityFilter, todos) => {
    switch (visibilityFilter) {
      case 'SHOW_ALL':
        return todos
      case 'SHOW_COMPLETED':
        return todos.filter(t => t.completed)
      case 'SHOW_ACTIVE':
        return todos.filter(t => !t.completed)
    }
  }
)
```

## Developing

```
$ goto create-selector
$ make test
```

## Releasing / Publishing

CircleCI will handle publishing to npm. To cut a new release, just do:

```
$ git changelog --tag <version>
$ vim package.json # enter <version>
$ git release <version>
```

Where `<version>` follows the [semver](http://semver.org/) spec.