Last active
November 11, 2019 21:31
-
-
Save evgenyfedorenko/8e2764dcbb38eeadbd6585d1f12d54be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createSelector(...args: any[]) { | |
const selectors = args.slice(0, args.length - 1); | |
const projector = args[args.length - 1]; | |
return function (state: any) { | |
const args = selectors.map(fn => fn(state)); | |
return projector.apply(null, args); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment