Socket
Socket
Sign inDemoInstall

re-reselect

Package Overview
Dependencies
1
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.0 to 4.0.0

24

CHANGELOG.md
# Change log
## 4.0.0
### Breaking Changes
- Drop support for `createCachedSelector` calls with multiple arguments
- Drop legacy `FifoCacheObject`, `FlatCacheObject`, `LruCacheObject` exports
- TypeScript typings of `createStructuredSelector` have been changed. Explicitly setting `State` and `Parameter` types is no longer required (nor possible), please update the typings as follows if necessary:
```typescript
// Before:
const selector = createStructuredCachedSelector<State, string>({
x: (state, id) => state.a[id],
})((state, id) => id);
// After:
const selector = createStructuredCachedSelector({
x: (state: State, id: string) => state.a[id],
})((state, id) => id);
```
### New Features
- Provide auto inferring to `createStructuredSelector` typings
- Expose `createCachedSelector` as both default and named export
## 3.4.0

@@ -4,0 +28,0 @@

50

dist/index.js

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = global || self, factory(global['Re-reselect'] = {}, global.Reselect));
}(this, function (exports, reselect) { 'use strict';
}(this, (function (exports, reselect) { 'use strict';

@@ -12,5 +12,3 @@ function isStringOrNumber(value) {

var FlatObjectCache =
/*#__PURE__*/
function () {
var FlatObjectCache = /*#__PURE__*/function () {
function FlatObjectCache() {

@@ -57,18 +55,10 @@ this._cache = {};

return function (polymorphicOptions, legacyOptions) {
// @NOTE Versions 0.x/1.x accepted "options" as a function
if (typeof legacyOptions === 'function') {
throw new Error('[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.');
if (legacyOptions) {
throw new Error('[re-reselect] "options" as second argument is not supported anymore. Please provide an option object as single argument.');
}
var options = {};
var options = typeof polymorphicOptions === 'function' ? {
keySelector: polymorphicOptions
} : Object.assign({}, polymorphicOptions); // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
if (typeof polymorphicOptions === 'function') {
Object.assign(options, legacyOptions, {
keySelector: polymorphicOptions
}); // @TODO add legacyOptions deprecation notice in next major release
} else {
Object.assign(options, polymorphicOptions);
} // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
var recomputations = 0;

@@ -162,5 +152,3 @@ var resultFunc = funcs.pop();

var FifoObjectCache =
/*#__PURE__*/
function () {
var FifoObjectCache = /*#__PURE__*/function () {
function FifoObjectCache(_temp) {

@@ -215,5 +203,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruObjectCache =
/*#__PURE__*/
function () {
var LruObjectCache = /*#__PURE__*/function () {
function LruObjectCache(_temp) {

@@ -280,5 +266,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var FlatMapCache =
/*#__PURE__*/
function () {
var FlatMapCache = /*#__PURE__*/function () {
function FlatMapCache() {

@@ -309,5 +293,3 @@ this._cache = new Map();

var FifoMapCache =
/*#__PURE__*/
function () {
var FifoMapCache = /*#__PURE__*/function () {
function FifoMapCache(_temp) {

@@ -349,5 +331,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruMapCache =
/*#__PURE__*/
function () {
var LruMapCache = /*#__PURE__*/function () {
function LruMapCache(_temp) {

@@ -398,11 +378,9 @@ var _ref = _temp === void 0 ? {} : _temp,

exports.FifoCacheObject = FifoObjectCache;
exports.FifoMapCache = FifoMapCache;
exports.FifoObjectCache = FifoObjectCache;
exports.FlatCacheObject = FlatObjectCache;
exports.FlatMapCache = FlatMapCache;
exports.FlatObjectCache = FlatObjectCache;
exports.LruCacheObject = LruMapCache;
exports.LruMapCache = LruMapCache;
exports.LruObjectCache = LruObjectCache;
exports.createCachedSelector = createCachedSelector;
exports.createStructuredCachedSelector = createStructuredCachedSelector;

@@ -413,3 +391,3 @@ exports.default = createCachedSelector;

}));
})));
//# sourceMappingURL=index.js.map

@@ -7,5 +7,3 @@ import { createSelector, createStructuredSelector } from 'reselect';

var FlatObjectCache =
/*#__PURE__*/
function () {
var FlatObjectCache = /*#__PURE__*/function () {
function FlatObjectCache() {

@@ -52,18 +50,10 @@ this._cache = {};

return function (polymorphicOptions, legacyOptions) {
// @NOTE Versions 0.x/1.x accepted "options" as a function
if (typeof legacyOptions === 'function') {
throw new Error('[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.');
if (legacyOptions) {
throw new Error('[re-reselect] "options" as second argument is not supported anymore. Please provide an option object as single argument.');
}
var options = {};
var options = typeof polymorphicOptions === 'function' ? {
keySelector: polymorphicOptions
} : Object.assign({}, polymorphicOptions); // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
if (typeof polymorphicOptions === 'function') {
Object.assign(options, legacyOptions, {
keySelector: polymorphicOptions
}); // @TODO add legacyOptions deprecation notice in next major release
} else {
Object.assign(options, polymorphicOptions);
} // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
var recomputations = 0;

@@ -157,5 +147,3 @@ var resultFunc = funcs.pop();

var FifoObjectCache =
/*#__PURE__*/
function () {
var FifoObjectCache = /*#__PURE__*/function () {
function FifoObjectCache(_temp) {

@@ -210,5 +198,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruObjectCache =
/*#__PURE__*/
function () {
var LruObjectCache = /*#__PURE__*/function () {
function LruObjectCache(_temp) {

@@ -275,5 +261,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var FlatMapCache =
/*#__PURE__*/
function () {
var FlatMapCache = /*#__PURE__*/function () {
function FlatMapCache() {

@@ -304,5 +288,3 @@ this._cache = new Map();

var FifoMapCache =
/*#__PURE__*/
function () {
var FifoMapCache = /*#__PURE__*/function () {
function FifoMapCache(_temp) {

@@ -344,5 +326,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruMapCache =
/*#__PURE__*/
function () {
var LruMapCache = /*#__PURE__*/function () {
function LruMapCache(_temp) {

@@ -394,3 +374,3 @@ var _ref = _temp === void 0 ? {} : _temp,

export default createCachedSelector;
export { FifoObjectCache as FifoCacheObject, FifoMapCache, FifoObjectCache, FlatObjectCache as FlatCacheObject, FlatMapCache, FlatObjectCache, LruMapCache as LruCacheObject, LruMapCache, LruObjectCache, createStructuredCachedSelector };
export { FifoMapCache, FifoObjectCache, FlatMapCache, FlatObjectCache, LruMapCache, LruObjectCache, createCachedSelector, createStructuredCachedSelector };
//# sourceMappingURL=index.js.map

@@ -11,5 +11,3 @@ 'use strict';

var FlatObjectCache =
/*#__PURE__*/
function () {
var FlatObjectCache = /*#__PURE__*/function () {
function FlatObjectCache() {

@@ -56,18 +54,10 @@ this._cache = {};

return function (polymorphicOptions, legacyOptions) {
// @NOTE Versions 0.x/1.x accepted "options" as a function
if (typeof legacyOptions === 'function') {
throw new Error('[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.');
if (legacyOptions) {
throw new Error('[re-reselect] "options" as second argument is not supported anymore. Please provide an option object as single argument.');
}
var options = {};
var options = typeof polymorphicOptions === 'function' ? {
keySelector: polymorphicOptions
} : Object.assign({}, polymorphicOptions); // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
if (typeof polymorphicOptions === 'function') {
Object.assign(options, legacyOptions, {
keySelector: polymorphicOptions
}); // @TODO add legacyOptions deprecation notice in next major release
} else {
Object.assign(options, polymorphicOptions);
} // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54
var recomputations = 0;

@@ -161,5 +151,3 @@ var resultFunc = funcs.pop();

var FifoObjectCache =
/*#__PURE__*/
function () {
var FifoObjectCache = /*#__PURE__*/function () {
function FifoObjectCache(_temp) {

@@ -214,5 +202,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruObjectCache =
/*#__PURE__*/
function () {
var LruObjectCache = /*#__PURE__*/function () {
function LruObjectCache(_temp) {

@@ -279,5 +265,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var FlatMapCache =
/*#__PURE__*/
function () {
var FlatMapCache = /*#__PURE__*/function () {
function FlatMapCache() {

@@ -308,5 +292,3 @@ this._cache = new Map();

var FifoMapCache =
/*#__PURE__*/
function () {
var FifoMapCache = /*#__PURE__*/function () {
function FifoMapCache(_temp) {

@@ -348,5 +330,3 @@ var _ref = _temp === void 0 ? {} : _temp,

var LruMapCache =
/*#__PURE__*/
function () {
var LruMapCache = /*#__PURE__*/function () {
function LruMapCache(_temp) {

@@ -397,13 +377,11 @@ var _ref = _temp === void 0 ? {} : _temp,

exports.FifoCacheObject = FifoObjectCache;
exports.FifoMapCache = FifoMapCache;
exports.FifoObjectCache = FifoObjectCache;
exports.FlatCacheObject = FlatObjectCache;
exports.FlatMapCache = FlatMapCache;
exports.FlatObjectCache = FlatObjectCache;
exports.LruCacheObject = LruMapCache;
exports.LruMapCache = LruMapCache;
exports.LruObjectCache = LruObjectCache;
exports.createCachedSelector = createCachedSelector;
exports.createStructuredCachedSelector = createStructuredCachedSelector;
exports.default = createCachedSelector;
//# sourceMappingURL=index.js.map
{
"name": "re-reselect",
"version": "3.4.0",
"version": "4.0.0",
"description": "Enhance Reselect selectors with deeper memoization and cache management",

@@ -20,6 +20,7 @@ "main": "lib/index.js",

"test": "npm run test:typescript && jest ./src",
"test:typescript": "typings-tester --config typescript_test/tsconfig.json --dir typescript_test",
"test:typescript": "typings-tester --dir typescript_test",
"test:bundles": "npm run test:bundles:snapshot && npm run test:bundles:unit",
"test:bundles:unit": "jest ./src --config ./jest/es.config.js && jest ./src --config ./jest/lib.config.js && jest ./src --config ./jest/dist.config.js",
"test:bundles:snapshot": "jest ./jest/bundles-snapshot.test.js",
"test:update": "npm run compile && npm run test:bundles:snapshot -- -u",
"clean": "rimraf dist es lib",

@@ -57,16 +58,16 @@ "compile": "npm run clean && rollup -c",

"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"all-contributors-cli": "^6.6.1",
"babel-jest": "^24.8.0",
"coveralls": "^3.0.4",
"husky": "^3.0.0",
"jest": "^24.8.0",
"lint-staged": "^9.0.0",
"prettier": "^1.16.2",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"all-contributors-cli": "^6.14.2",
"babel-jest": "^25.1.0",
"coveralls": "^3.0.9",
"husky": "^3.1.0",
"jest": "^25.1.0",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1",
"reselect": "^4.0.0",
"rimraf": "^2.6.1",
"rollup": "^1.16.4",
"rollup-plugin-babel": "^4.0.3",
"typescript": "^3.2.2",
"rimraf": "^3.0.1",
"rollup": "^1.27.14",
"rollup-plugin-babel": "^4.4.0",
"typescript": "^3.7.5",
"typings-tester": "^0.3.2"

@@ -73,0 +74,0 @@ },

@@ -28,7 +28,7 @@ # Re-reselect

```js
import createCachedSelector from 're-reselect';
import {createCachedSelector} from 're-reselect';
// Normal reselect routine: declare "inputSelectors" and "resultFunc"
const getUsers = state => state.users;
const getLibraryId = (state, libName) => state.libraries[libName].id;
const getLibraryId = (state, libraryName) => state.libraries[libraryName].id;

@@ -43,8 +43,8 @@ const getUsersByLibrary = createCachedSelector(

)(
// re-reselect keySelector
// Use "libraryId" as cacheKey
(_, libraryId) => libraryId
// re-reselect keySelector (receives selectors' arguments)
// Use "libraryName" as cacheKey
(_state_, libraryName) => libraryName
);
// Cached selector behave like normal selectors:
// Cached selectors behave like normal selectors:
// 2 reselect selectors are created, called and cached

@@ -92,3 +92,3 @@ const reactUsers = getUsersByLibrary(state, 'react');

getData(state, itemId, 'dataB');
getData(state, itemId, 'dataC');
getData(state, itemId, 'dataA');
```

@@ -108,3 +108,3 @@

- takes the same arguments as the final selector (in the example: `state`, `itemId`, `'dataX'`)
- takes the same arguments as the selector itself (in the example: `state`, `itemId`, `dataType`)
- returns a `cacheKey`

@@ -114,3 +114,3 @@

Back to the example, `re-reselect` retrieves data by **querying one of the cached selectors** using the 3rd argument as `cacheKey`, allowing cache invalidation only when `state` or `itemId` change (but not `dataType`):
Back to the example, we might setup `re-reselect` to retrieve data by **querying one of the cached selectors** using the 3rd argument as `cacheKey`, allowing cache invalidation only when `state` or `itemId` change (but not `dataType`):

@@ -121,3 +121,3 @@ <!-- prettier-ignore -->

state => state,
(_state_, itemId) => itemId,
(state, itemId) => itemId,
(state, itemId, dataType) => dataType,

@@ -134,3 +134,3 @@ (state, itemId, dataType) => expensiveComputation(state, itemId, dataType)

1. **Evaluate the `cacheKey`** for current call by executing `keySelector`
1. **Evaluate the `cacheKey`** for the current call by executing `keySelector`
2. **Retrieve** from cache the **`reselect` selector** stored under the given `cacheKey`

@@ -151,4 +151,4 @@ 3. **Return found selector or create a new one** if no selector was found

- Bloats your code by exposing both `get` selectors and `makeGet` selector factories
- Needs to import/call selector factory instead of directly using selector
- Two different instances given the same arguments, will individually store and recompute the same result (read [this](https://github.com/reactjs/reselect/pull/213))
- Needs to import/call the selector factory instead of directly using the selector
- Two different instances, given the same arguments, will individually store and recompute the same result (read [this](https://github.com/reactjs/reselect/pull/213))

@@ -165,2 +165,3 @@ #### 3- Wrap your `makeGetPieceOfData` selector factory into a memoizer function and call the returning memoized selector

- [Programmatic keySelector composition][example-4]
- [Usage with Selectorator][example-5]

@@ -195,3 +196,3 @@ ## FAQ

```js
import createCachedSelector from 're-reselect';
import {createCachedSelector} from 're-reselect';

@@ -256,3 +257,3 @@ export const getMyData = createCachedSelector(

Use a [`cacheObject`][cache-objects-docs] which provides that feature by supplying a [`cacheObject` option](#options).
Use a [`cacheObject`][cache-objects-docs] which provides that feature by supplying a [`cacheObject` option](#cacheobject).

@@ -270,3 +271,2 @@ You can also write **your own cache strategy**!

[This example][example-2] shows how `re-reselect` would solve the scenario described in [reselect docs][reselect-sharing-selectors].
Read more about testing selectors on [`reselect` docs][reselect-test-selectors].

@@ -302,3 +302,3 @@ </details>

```js
import createCachedSelector from 're-reselect';
import {createCachedSelector} from 're-reselect';

@@ -333,3 +333,3 @@ export const getMyData = createCachedSelector(selectorA, selectorB, (A, B) =>

```js
import createCachedSelector from 're-reselect';
import {createCachedSelector} from 're-reselect';

@@ -351,3 +351,3 @@ createCachedSelector(

```js
import { createStructuredCachedSelector } from 're-reselect';
import {createStructuredCachedSelector} from 're-reselect';

@@ -404,3 +404,3 @@ createStructuredCachedSelector(

This allows to dynamically **generate `keySelectors` on runtime** based on provided `inputSelectors`/`resultFunc` supporting [**key selectors composition**](https://github.com/toomuchdesign/re-reselect/pull/73). It overrides any provided `keySelector`.
This allows the ability to dynamically **generate `keySelectors` on runtime** based on provided `inputSelectors`/`resultFunc` supporting [**key selectors composition**](https://github.com/toomuchdesign/re-reselect/pull/73). It overrides any provided `keySelector`.

@@ -432,3 +432,3 @@ See [programmatic keySelector composition][example-4] example.

Get cacheObject instance being used by the selector (for advanced caching operations like [this](https://github.com/toomuchdesign/re-reselect/issues/40)).
Get the cacheObject instance being used by the selector (for advanced caching operations like [this](https://github.com/toomuchdesign/re-reselect/issues/40)).

@@ -480,5 +480,44 @@ #### selector`.clearCache()`

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="http://www.andreacarraro.it"><img src="https://avatars3.githubusercontent.com/u/4573549?v=4" width="100px;" alt="Andrea Carraro"/><br /><sub><b>Andrea Carraro</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Documentation">📖</a> <a href="#infra-toomuchdesign" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Tests">⚠️</a> <a href="#review-toomuchdesign" title="Reviewed Pull Requests">👀</a></td><td align="center"><a href="https://github.com/xsburg"><img src="https://avatars2.githubusercontent.com/u/830824?v=4" width="100px;" alt="Stepan Burguchev"/><br /><sub><b>Stepan Burguchev</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=xsburg" title="Code">💻</a> <a href="#ideas-xsburg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#question-xsburg" title="Answering Questions">💬</a> <a href="#review-xsburg" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=xsburg" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/sgrishchenko"><img src="https://avatars3.githubusercontent.com/u/15995890?v=4" width="100px;" alt="Sergei Grishchenko"/><br /><sub><b>Sergei Grishchenko</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=sgrishchenko" title="Code">💻</a> <a href="#ideas-sgrishchenko" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=sgrishchenko" title="Tests">⚠️</a> <a href="#tool-sgrishchenko" title="Tools">🔧</a></td><td align="center"><a href="https://github.com/Andarist"><img src="https://avatars2.githubusercontent.com/u/9800850?v=4" width="100px;" alt="Mateusz Burzyński"/><br /><sub><b>Mateusz Burzyński</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=Andarist" title="Code">💻</a> <a href="#infra-Andarist" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td><td align="center"><a href="https://olslash.github.io/"><img src="https://avatars3.githubusercontent.com/u/693493?v=4" width="100px;" alt="Mitch Robb"/><br /><sub><b>Mitch Robb</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=olslash" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=olslash" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/rufman"><img src="https://avatars3.githubusercontent.com/u/1128559?v=4" width="100px;" alt="Stephane Rufer"/><br /><sub><b>Stephane Rufer</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=rufman" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=rufman" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/spiffysparrow"><img src="https://avatars0.githubusercontent.com/u/2788860?v=4" width="100px;" alt="Tracy Mullen"/><br /><sub><b>Tracy Mullen</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=spiffysparrow" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=spiffysparrow" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="https://www.skc.name"><img src="https://avatars1.githubusercontent.com/u/4211838?v=4" width="100px;" alt="Sushain Cherivirala"/><br /><sub><b>Sushain Cherivirala</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=sushain97" title="Code">💻</a></td><td align="center"><a href="https://twitter.com/MaoStevemao"><img src="https://avatars0.githubusercontent.com/u/6316590?v=4" width="100px;" alt="Steve Mao"/><br /><sub><b>Steve Mao</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=stevemao" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/Dante-101"><img src="https://avatars2.githubusercontent.com/u/1428826?v=4" width="100px;" alt="Gaurav Lahoti"/><br /><sub><b>Gaurav Lahoti</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3ADante-101" title="Bug reports">🐛</a></td><td align="center"><a href="http://lon.im"><img src="https://avatars3.githubusercontent.com/u/13602053?v=4" width="100px;" alt="Lon"/><br /><sub><b>Lon</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Acnlon" title="Bug reports">🐛</a></td><td align="center"><a href="https://github.com/bratushka"><img src="https://avatars2.githubusercontent.com/u/5492495?v=4" width="100px;" alt="bratushka"/><br /><sub><b>bratushka</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=bratushka" title="Code">💻</a></td><td align="center"><a href="https://andrz.me"><img src="https://avatars3.githubusercontent.com/u/615381?v=4" width="100px;" alt="Anders D. Johnson"/><br /><sub><b>Anders D. Johnson</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=AndersDJohnson" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/wormyy"><img src="https://avatars3.githubusercontent.com/u/8556724?v=4" width="100px;" alt="Július Retzer"/><br /><sub><b>Július Retzer</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=wormyy" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/maartenschumacher"><img src="https://avatars3.githubusercontent.com/u/10407025?v=4" width="100px;" alt="Maarten Schumacher"/><br /><sub><b>Maarten Schumacher</b></sub></a><br /><a href="#ideas-maartenschumacher" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/alexanderjarvis"><img src="https://avatars2.githubusercontent.com/u/664238?v=4" width="100px;" alt="Alexander Jarvis"/><br /><sub><b>Alexander Jarvis</b></sub></a><br /><a href="#ideas-alexanderjarvis" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/greggb"><img src="https://avatars1.githubusercontent.com/u/514026?v=4" width="100px;" alt="Gregg B"/><br /><sub><b>Gregg B</b></sub></a><br /><a href="#example-greggb" title="Examples">💡</a></td><td align="center"><a href="http://ianobermiller.com"><img src="https://avatars0.githubusercontent.com/u/897931?v=4" width="100px;" alt="Ian Obermiller"/><br /><sub><b>Ian Obermiller</b></sub></a><br /><a href="#review-ianobermiller" title="Reviewed Pull Requests">👀</a></td><td align="center"><a href="https://github.com/lukyth"><img src="https://avatars3.githubusercontent.com/u/7040242?v=4" width="100px;" alt="Kanitkorn Sujautra"/><br /><sub><b>Kanitkorn Sujautra</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=lukyth" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/suark"><img src="https://avatars2.githubusercontent.com/u/6233440?v=4" width="100px;" alt="Brian Kraus"/><br /><sub><b>Brian Kraus</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=suark" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/el-dav"><img src="https://avatars1.githubusercontent.com/u/7252227?v=4" width="100px;" alt="el-dav"/><br /><sub><b>el-dav</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Ael-dav" title="Bug reports">🐛</a></td></tr><tr><td align="center"><a href="https://augustin-riedinger.fr"><img src="https://avatars3.githubusercontent.com/u/1970156?v=4" width="100px;" alt="Augustin Riedinger"/><br /><sub><b>Augustin Riedinger</b></sub></a><br /><a href="#ideas-augnustin" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/RichardForrester"><img src="https://avatars0.githubusercontent.com/u/12902182?v=4" width="100px;" alt="RichardForrester"/><br /><sub><b>RichardForrester</b></sub></a><br /><a href="#ideas-RichardForrester" title="Ideas, Planning, & Feedback">🤔</a></td></tr></table>
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://www.andreacarraro.it"><img src="https://avatars3.githubusercontent.com/u/4573549?v=4" width="100px;" alt=""/><br /><sub><b>Andrea Carraro</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Documentation">📖</a> <a href="#infra-toomuchdesign" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=toomuchdesign" title="Tests">⚠️</a> <a href="https://github.com/toomuchdesign/re-reselect/pulls?q=is%3Apr+reviewed-by%3Atoomuchdesign" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/xsburg"><img src="https://avatars2.githubusercontent.com/u/830824?v=4" width="100px;" alt=""/><br /><sub><b>Stepan Burguchev</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=xsburg" title="Code">💻</a> <a href="#ideas-xsburg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#question-xsburg" title="Answering Questions">💬</a> <a href="https://github.com/toomuchdesign/re-reselect/pulls?q=is%3Apr+reviewed-by%3Axsburg" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=xsburg" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/sgrishchenko"><img src="https://avatars3.githubusercontent.com/u/15995890?v=4" width="100px;" alt=""/><br /><sub><b>Sergei Grishchenko</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=sgrishchenko" title="Code">💻</a> <a href="#ideas-sgrishchenko" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=sgrishchenko" title="Tests">⚠️</a> <a href="#tool-sgrishchenko" title="Tools">🔧</a></td>
<td align="center"><a href="https://github.com/Andarist"><img src="https://avatars2.githubusercontent.com/u/9800850?v=4" width="100px;" alt=""/><br /><sub><b>Mateusz Burzyński</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=Andarist" title="Code">💻</a> <a href="#infra-Andarist" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center"><a href="https://olslash.github.io/"><img src="https://avatars3.githubusercontent.com/u/693493?v=4" width="100px;" alt=""/><br /><sub><b>Mitch Robb</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=olslash" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=olslash" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/rufman"><img src="https://avatars3.githubusercontent.com/u/1128559?v=4" width="100px;" alt=""/><br /><sub><b>Stephane Rufer</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=rufman" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=rufman" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/spiffysparrow"><img src="https://avatars0.githubusercontent.com/u/2788860?v=4" width="100px;" alt=""/><br /><sub><b>Tracy Mullen</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=spiffysparrow" title="Code">💻</a> <a href="https://github.com/toomuchdesign/re-reselect/commits?author=spiffysparrow" title="Tests">⚠️</a></td>
</tr>
<tr>
<td align="center"><a href="https://www.skc.name"><img src="https://avatars1.githubusercontent.com/u/4211838?v=4" width="100px;" alt=""/><br /><sub><b>Sushain Cherivirala</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=sushain97" title="Code">💻</a></td>
<td align="center"><a href="https://twitter.com/MaoStevemao"><img src="https://avatars0.githubusercontent.com/u/6316590?v=4" width="100px;" alt=""/><br /><sub><b>Steve Mao</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=stevemao" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/Dante-101"><img src="https://avatars2.githubusercontent.com/u/1428826?v=4" width="100px;" alt=""/><br /><sub><b>Gaurav Lahoti</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3ADante-101" title="Bug reports">🐛</a></td>
<td align="center"><a href="http://lon.im"><img src="https://avatars3.githubusercontent.com/u/13602053?v=4" width="100px;" alt=""/><br /><sub><b>Lon</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Acnlon" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/bratushka"><img src="https://avatars2.githubusercontent.com/u/5492495?v=4" width="100px;" alt=""/><br /><sub><b>bratushka</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=bratushka" title="Code">💻</a></td>
<td align="center"><a href="https://andrz.me"><img src="https://avatars3.githubusercontent.com/u/615381?v=4" width="100px;" alt=""/><br /><sub><b>Anders D. Johnson</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=AndersDJohnson" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/wormyy"><img src="https://avatars3.githubusercontent.com/u/8556724?v=4" width="100px;" alt=""/><br /><sub><b>Július Retzer</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=wormyy" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/maartenschumacher"><img src="https://avatars3.githubusercontent.com/u/10407025?v=4" width="100px;" alt=""/><br /><sub><b>Maarten Schumacher</b></sub></a><br /><a href="#ideas-maartenschumacher" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/alexanderjarvis"><img src="https://avatars2.githubusercontent.com/u/664238?v=4" width="100px;" alt=""/><br /><sub><b>Alexander Jarvis</b></sub></a><br /><a href="#ideas-alexanderjarvis" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/greggb"><img src="https://avatars1.githubusercontent.com/u/514026?v=4" width="100px;" alt=""/><br /><sub><b>Gregg B</b></sub></a><br /><a href="#example-greggb" title="Examples">💡</a></td>
<td align="center"><a href="http://ianobermiller.com"><img src="https://avatars0.githubusercontent.com/u/897931?v=4" width="100px;" alt=""/><br /><sub><b>Ian Obermiller</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/pulls?q=is%3Apr+reviewed-by%3Aianobermiller" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/lukyth"><img src="https://avatars3.githubusercontent.com/u/7040242?v=4" width="100px;" alt=""/><br /><sub><b>Kanitkorn Sujautra</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=lukyth" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/suark"><img src="https://avatars2.githubusercontent.com/u/6233440?v=4" width="100px;" alt=""/><br /><sub><b>Brian Kraus</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=suark" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/el-dav"><img src="https://avatars1.githubusercontent.com/u/7252227?v=4" width="100px;" alt=""/><br /><sub><b>el-dav</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Ael-dav" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="https://augustin-riedinger.fr"><img src="https://avatars3.githubusercontent.com/u/1970156?v=4" width="100px;" alt=""/><br /><sub><b>Augustin Riedinger</b></sub></a><br /><a href="#ideas-augnustin" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/RichardForrester"><img src="https://avatars0.githubusercontent.com/u/12902182?v=4" width="100px;" alt=""/><br /><sub><b>RichardForrester</b></sub></a><br /><a href="#ideas-RichardForrester" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://alfonsomillan.com/"><img src="https://avatars3.githubusercontent.com/u/25711137?v=4" width="100px;" alt=""/><br /><sub><b>Alfonso Millan</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/commits?author=mechmillan" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/parkerault"><img src="https://avatars2.githubusercontent.com/u/78856?v=4" width="100px;" alt=""/><br /><sub><b>parkerault</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Aparkerault" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/dahannes"><img src="https://avatars0.githubusercontent.com/u/2493211?v=4" width="100px;" alt=""/><br /><sub><b>johannes</b></sub></a><br /><a href="https://github.com/toomuchdesign/re-reselect/issues?q=author%3Adahannes" title="Bug reports">🐛</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

@@ -507,4 +546,5 @@

[example-4]: examples/4-programmatic-keyselector-composition.md
[example-5]: examples/5-selectorator.md
[selector-instance-docs]: #re-reselect-selector-instance
[cache-objects-docs]: src/cache#readme
[docs-all-contributors]: https://allcontributors.org/docs/en/emoji-key

@@ -20,3 +20,3 @@ # Re-reselect cache objects

```js
import createCachedSelector, {LruObjectCache, LruMapCache} from 're-reselect';
import {createCachedSelector, LruObjectCache, LruMapCache} from 're-reselect';

@@ -35,3 +35,3 @@ createCachedSelector(

**[*]MapCache** strategy objects needs a **Map objects polyfill** in order to use them on non-supporting browsers.
**[*]MapCache** strategy objects need a **Map objects polyfill** in order to use them on non-supporting browsers.

@@ -56,4 +56,4 @@ ## Write your custom cache object

[wiki-strategy-pattern]: https://en.wikipedia.org/wiki/Strategy_pattern
[docs-fifo-cache]: https://en.wikipedia.org/wiki/Cache_replacement_policies#First_In_First_Out_.28FIFO.29
[docs-lru-cache]: https://en.wikipedia.org/wiki/
[docs-fifo-cache]: https://en.wikipedia.org/wiki/Cache_replacement_policies#First_in_first_out_(FIFO)
[docs-lru-cache]: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
[docs-mozilla-map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

@@ -9,16 +9,12 @@ import {createSelector} from 'reselect';

return (polymorphicOptions, legacyOptions) => {
// @NOTE Versions 0.x/1.x accepted "options" as a function
if (typeof legacyOptions === 'function') {
if (legacyOptions) {
throw new Error(
'[re-reselect] Second argument "options" must be an object. Please use "options.selectorCreator" to provide a custom selectorCreator.'
'[re-reselect] "options" as second argument is not supported anymore. Please provide an option object as single argument.'
);
}
const options = {};
if (typeof polymorphicOptions === 'function') {
Object.assign(options, legacyOptions, {keySelector: polymorphicOptions});
// @TODO add legacyOptions deprecation notice in next major release
} else {
Object.assign(options, polymorphicOptions);
}
const options =
typeof polymorphicOptions === 'function'
? {keySelector: polymorphicOptions}
: Object.assign({}, polymorphicOptions);

@@ -25,0 +21,0 @@ // https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.js#L54

import createCachedSelector from './createCachedSelector';
export default createCachedSelector;
export {createCachedSelector};
export {
default as createStructuredCachedSelector,
} from './createStructuredCachedSelector';
export {default as createStructuredCachedSelector} from './createStructuredCachedSelector';

@@ -15,7 +14,1 @@ // Cache objects

export {default as LruMapCache} from './cache/LruMapCache';
// Deprecated cache objects exports
// @TODO remove in next major release
export {default as FlatCacheObject} from './cache/FlatObjectCache';
export {default as FifoCacheObject} from './cache/FifoObjectCache';
export {default as LruCacheObject} from './cache/LruMapCache';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc