Socket
Socket
Sign inDemoInstall

re-reselect

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

re-reselect - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 0.4.0
- Expose `removeMatchingSelector` method
- Expose `clearCache` method
# 0.3.0

@@ -2,0 +6,0 @@ - Add UMD dist

@@ -33,6 +33,8 @@ (function (global, factory) {

if (typeof cacheKey === 'string' || typeof cacheKey === 'number') {
if (cache.hasOwnProperty(cacheKey) === false) {
var _cache;
if (cache[cacheKey] === undefined) {
cache[cacheKey] = createSelectorInstance.apply(undefined, funcs);
}
return cache[cacheKey].apply(cache, arguments);
return (_cache = cache)[cacheKey].apply(_cache, arguments);
}

@@ -42,2 +44,3 @@ return undefined;

// Further selector methods
selector.getMatchingSelector = function () {

@@ -48,2 +51,13 @@ var cacheKey = resolver.apply(undefined, arguments);

selector.removeMatchingSelector = function () {
var cacheKey = resolver.apply(undefined, arguments);
if (cache[cacheKey] !== undefined) {
cache[cacheKey] = undefined;
}
};
selector.clearCache = function () {
cache = {};
};
return selector;

@@ -50,0 +64,0 @@ };

@@ -18,6 +18,8 @@ import { createSelector } from 'reselect';

if (typeof cacheKey === 'string' || typeof cacheKey === 'number') {
if (cache.hasOwnProperty(cacheKey) === false) {
var _cache;
if (cache[cacheKey] === undefined) {
cache[cacheKey] = createSelectorInstance.apply(undefined, funcs);
}
return cache[cacheKey].apply(cache, arguments);
return (_cache = cache)[cacheKey].apply(_cache, arguments);
}

@@ -27,2 +29,3 @@ return undefined;

// Further selector methods
selector.getMatchingSelector = function () {

@@ -33,4 +36,15 @@ var cacheKey = resolver.apply(undefined, arguments);

selector.removeMatchingSelector = function () {
var cacheKey = resolver.apply(undefined, arguments);
if (cache[cacheKey] !== undefined) {
cache[cacheKey] = undefined;
}
};
selector.clearCache = function () {
cache = {};
};
return selector;
};
}

@@ -23,6 +23,8 @@ 'use strict';

if (typeof cacheKey === 'string' || typeof cacheKey === 'number') {
if (cache.hasOwnProperty(cacheKey) === false) {
var _cache;
if (cache[cacheKey] === undefined) {
cache[cacheKey] = createSelectorInstance.apply(undefined, funcs);
}
return cache[cacheKey].apply(cache, arguments);
return (_cache = cache)[cacheKey].apply(_cache, arguments);
}

@@ -32,2 +34,3 @@ return undefined;

// Further selector methods
selector.getMatchingSelector = function () {

@@ -38,4 +41,15 @@ var cacheKey = resolver.apply(undefined, arguments);

selector.removeMatchingSelector = function () {
var cacheKey = resolver.apply(undefined, arguments);
if (cache[cacheKey] !== undefined) {
cache[cacheKey] = undefined;
}
};
selector.clearCache = function () {
cache = {};
};
return selector;
};
}

2

package.json
{
"name": "re-reselect",
"version": "0.3.0",
"version": "0.4.0",
"description": "Memoize selectors and avoid recalculation between calls with different inputs",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -46,2 +46,4 @@ # Re-reselect [![Build Status][ci-img]][ci]

Jump straight to the [API's](#api).
## Installation

@@ -210,7 +212,12 @@ ```console

### reReselectInstance.getMatchingSelector(selectorArguments)
Retrieve the selector object being called and cached for given arguments.
### reReselectInstance`.getMatchingSelector(selectorArguments)`
Retrieve the selector responding to the given arguments.
### reReselectInstance`.removeMatchingSelector(selectorArguments)`
Remove the selector responding to the given arguments from the cache.
### reReselectInstance`.clearCache()`
Clear the whole `reReselectInstance` cache.
## Todo's
- Consider to expose a cache clearing method
- Named exports?
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc