Skip to content

Commit

Permalink
Merge pull request #158 from bsideup/patch-1
Browse files Browse the repository at this point in the history
Pass argument's index to equalityCheck function
  • Loading branch information
ellbee authored Sep 7, 2016
2 parents ba48833 + 31c5f64 commit f63e49c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Matthew Hetherington (https://github.com/matthetherington)
Mike Wilcox <mwilcox56@gmail.com> (https://github.com/mjw56)
David Edmondson (https://github.com/threehams)
Andrey Zaytsev <za@zalab.net> (https://github.com/zandroid)
1ven (https://github.com/1ven)
Alexey Yurchenko <alexes.dev@gmail.com> (https://github.com/alexesdev)
3 changes: 2 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
chungchiehlun, Dave Hendler, Leon Aves, Ian Ker-Seymer, Josh Kelley,
Daniel Bugl, Courtland Allen, Henrik Joreteg, Kyle Davis, Nick Ball,
Salvador Hernandez, mctep, Jacob Rask, Luqmaan Dawoodjee, Walter Breakell,
Matthew Hetherington, Mike Wilcox, David Edmondson, Andrey Zaytsev
Matthew Hetherington, Mike Wilcox, David Edmondson, Andrey Zaytsev, 1ven,
Alexey Yurchenko

* Inspired by getters in Nuclear.js and subscriptions in re-frame.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,12 @@ export default function todos(state = initialState, action) {
The following selector is going to recompute every time REMOVE_OLD is invoked because Array.filter always returns a new object. However, in the majority of cases the REMOVE_OLD action will not change the list of todos so the recomputation is unnecessary.

```js
import { createselector } from 'reselect'
import { createSelector } from 'reselect'

const todosSelector = state => state.todos

export const visibletodosselector = createselector(
todosselector,
export const visibleTodosSelector = createSelector(
todosSelector,
(todos) => {
...
}
Expand Down
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function defaultMemoize(func, equalityCheck = defaultEqualityCheck) {
if (
lastArgs !== null &&
lastArgs.length === args.length &&
args.every((value, index) => equalityCheck(value, lastArgs[index]))
args.every((value, index) => equalityCheck(value, lastArgs[index], index))
) {
return lastResult
}
Expand Down Expand Up @@ -63,9 +63,7 @@ export function createSelectorCreator(memoize, ...memoizeOptions) {
}
}

export function createSelector(...args) {
return createSelectorCreator(defaultMemoize)(...args)
}
export const createSelector = createSelectorCreator(defaultMemoize)

export function createStructuredSelector(selectors, selectorCreator = createSelector) {
if (typeof selectors !== 'object') {
Expand Down

0 comments on commit f63e49c

Please sign in to comment.