Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reselect-tools

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reselect-tools - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

42

dist/reselect-tools.js

@@ -81,4 +81,7 @@ (function (global, factory) {

function checkSelector(selector) {
var isRegistered = false;
if (typeof selector === 'string' && _isFunction(_registered[selector])) {
selector = _registered[selector];
isRegistered = true;
}

@@ -90,6 +93,14 @@

if (!isRegistered) {
Object.keys(_registered).forEach(function (key) {
if (_registered[key] === selector) {
isRegistered = true;
}
});
}
var dependencies = selector.dependencies || [];
var recomputations = selector.recomputations ? selector.recomputations() : 'N/A/';
var recomputations = selector.recomputations ? selector.recomputations() : null;
var ret = { dependencies: dependencies, recomputations: recomputations };
var ret = { dependencies: dependencies, recomputations: recomputations, isRegistered: isRegistered };
if (_getState) {

@@ -152,3 +163,3 @@ var state = _getState();

return base + _sumString(dep);
}, selector.resultFunc.toString());
}, (selector.resultFunc ? selector.resultFunc : selector).toString());
};

@@ -160,8 +171,13 @@

var graph = { nodes: {}, edges: [] };
var traversedDependencies = new Set();
var addToGraph = function addToGraph(selector) {
var name = selectorKey(selector, _registered);
if (graph.nodes[name]) return;
var _checkSelector = checkSelector(selector),
recomputations = _checkSelector.recomputations,
isRegistered = _checkSelector.isRegistered;
graph.nodes[name] = {
recomputations: selector.recomputations ? selector.recomputations() : 'N/A',
recomputations: recomputations,
isRegistered: isRegistered,
name: name

@@ -171,6 +187,2 @@ };

var dependencies = selector.dependencies || [];
if (traversedDependencies.has(name)) {
// Don't re-add.
dependencies = [];
}
dependencies.forEach(function (dependency) {

@@ -180,3 +192,2 @@ addToGraph(dependency);

});
traversedDependencies.add(name);
};

@@ -211,2 +222,11 @@

}
// hack for devtools
/* istanbul ignore if */
if (typeof window !== 'undefined') {
window.__RESELECT_TOOLS__ = {
selectorGraph: selectorGraph,
checkSelector: checkSelector
};
}
});

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

(function(e,r){if(typeof define==="function"&&define.amd){define("ReselectTools",["exports","reselect"],r)}else if(typeof exports!=="undefined"){r(exports,require("reselect"))}else{var t={exports:{}};r(t.exports,e.Reselect);e.ReselectTools=t.exports}})(this,function(e,r){"use strict";e.__esModule=true;e.createSelectorWithDependencies=u;e.registerSelectors=c;e.reset=s;e.checkSelector=l;e.getStateWith=d;e.selectorGraph=y;function t(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++){t[r]=e[r]}return t}else{return Array.from(e)}}var n={};var o=null;var a=new Set;var i=function e(r){return typeof r==="function"};function u(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++){n[o]=arguments[o]}var i=n.pop();var u=Array.isArray(n[0])?n[0]:n;var c=r.createSelector.apply(undefined,t(u).concat([i]));c.dependencies=u;a.add(c);return c}function c(e){var r={};Object.keys(e).forEach(function(t){var n=e[t];if(n.resultFunc||i(n)){r[t]=n}});return Object.assign(n,r)}function f(){Object.keys(n).forEach(function(e){delete n[e]})}function s(){f();o=null;a=new Set}function l(e){if(typeof e==="string"&&i(n[e])){e=n[e]}if(!i(e)){throw new Error("Selector "+e+" is not a function...has it been registered?")}var r=e.dependencies||[];var t=e.recomputations?e.recomputations():"N/A/";var a={dependencies:r,recomputations:t};if(o){var u=o();var c=r.map(function(e){return e(u)});var f=e(u);Object.assign(a,{inputs:c,output:f})}return a}function d(e){o=e}function v(e){return Array.from(e.toString()).reduce(function(e,r){return r.charCodeAt(0)+e},0)}var p=function e(r,t){if(r.name){return r.name}var n=true;var o=false;var a=undefined;try{for(var i=Object.keys(t)[Symbol.iterator](),u;!(n=(u=i.next()).done);n=true){var c=u.value;if(t[c]===r){return c}}}catch(e){o=true;a=e}finally{try{if(!n&&i.return){i.return()}}finally{if(o){throw a}}}return(r.dependencies||[]).reduce(function(e,r){return e+v(r)},r.resultFunc.toString())};function y(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:p;var r={nodes:{},edges:[]};var t=new Set;var o=function o(a){var i=e(a,n);r.nodes[i]={recomputations:a.recomputations?a.recomputations():"N/A",name:i};var u=a.dependencies||[];if(t.has(i)){u=[]}u.forEach(function(t){o(t);r.edges.push({from:i,to:e(t,n)})});t.add(i)};var i=true;var u=false;var c=undefined;try{for(var f=a[Symbol.iterator](),s;!(i=(s=f.next()).done);i=true){var l=s.value;o(l)}}catch(e){u=true;c=e}finally{try{if(!i&&f.return){f.return()}}finally{if(u){throw c}}}return r}});
(function(e,r){if(typeof define==="function"&&define.amd){define("ReselectTools",["exports","reselect"],r)}else if(typeof exports!=="undefined"){r(exports,require("reselect"))}else{var t={exports:{}};r(t.exports,e.Reselect);e.ReselectTools=t.exports}})(this,function(e,r){"use strict";e.__esModule=true;e.createSelectorWithDependencies=u;e.registerSelectors=c;e.reset=s;e.checkSelector=l;e.getStateWith=d;e.selectorGraph=y;function t(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++){t[r]=e[r]}return t}else{return Array.from(e)}}var n={};var i=null;var o=new Set;var a=function e(r){return typeof r==="function"};function u(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++){n[i]=arguments[i]}var a=n.pop();var u=Array.isArray(n[0])?n[0]:n;var c=r.createSelector.apply(undefined,t(u).concat([a]));c.dependencies=u;o.add(c);return c}function c(e){var r={};Object.keys(e).forEach(function(t){var n=e[t];if(n.resultFunc||a(n)){r[t]=n}});return Object.assign(n,r)}function f(){Object.keys(n).forEach(function(e){delete n[e]})}function s(){f();i=null;o=new Set}function l(e){var r=false;if(typeof e==="string"&&a(n[e])){e=n[e];r=true}if(!a(e)){throw new Error("Selector "+e+" is not a function...has it been registered?")}if(!r){Object.keys(n).forEach(function(t){if(n[t]===e){r=true}})}var t=e.dependencies||[];var o=e.recomputations?e.recomputations():null;var u={dependencies:t,recomputations:o,isRegistered:r};if(i){var c=i();var f=t.map(function(e){return e(c)});var s=e(c);Object.assign(u,{inputs:f,output:s})}return u}function d(e){i=e}function v(e){return Array.from(e.toString()).reduce(function(e,r){return r.charCodeAt(0)+e},0)}var p=function e(r,t){if(r.name){return r.name}var n=true;var i=false;var o=undefined;try{for(var a=Object.keys(t)[Symbol.iterator](),u;!(n=(u=a.next()).done);n=true){var c=u.value;if(t[c]===r){return c}}}catch(e){i=true;o=e}finally{try{if(!n&&a.return){a.return()}}finally{if(i){throw o}}}return(r.dependencies||[]).reduce(function(e,r){return e+v(r)},(r.resultFunc?r.resultFunc:r).toString())};function y(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:p;var r={nodes:{},edges:[]};var t=function t(i){var o=e(i,n);if(r.nodes[o])return;var a=l(i),u=a.recomputations,c=a.isRegistered;r.nodes[o]={recomputations:u,isRegistered:c,name:o};var f=i.dependencies||[];f.forEach(function(i){t(i);r.edges.push({from:o,to:e(i,n)})})};var i=true;var a=false;var u=undefined;try{for(var c=o[Symbol.iterator](),f;!(i=(f=c.next()).done);i=true){var s=f.value;t(s)}}catch(e){a=true;u=e}finally{try{if(!i&&c.return){c.return()}}finally{if(a){throw u}}}return r}if(typeof window!=="undefined"){window.__RESELECT_TOOLS__={selectorGraph:y,checkSelector:l}}});

@@ -62,4 +62,7 @@ 'use strict';

function checkSelector(selector) {
var isRegistered = false;
if (typeof selector === 'string' && _isFunction(_registered[selector])) {
selector = _registered[selector];
isRegistered = true;
}

@@ -71,6 +74,14 @@

if (!isRegistered) {
Object.keys(_registered).forEach(function (key) {
if (_registered[key] === selector) {
isRegistered = true;
}
});
}
var dependencies = selector.dependencies || [];
var recomputations = selector.recomputations ? selector.recomputations() : 'N/A/';
var recomputations = selector.recomputations ? selector.recomputations() : null;
var ret = { dependencies: dependencies, recomputations: recomputations };
var ret = { dependencies: dependencies, recomputations: recomputations, isRegistered: isRegistered };
if (_getState) {

@@ -133,3 +144,3 @@ var state = _getState();

return base + _sumString(dep);
}, selector.resultFunc.toString());
}, (selector.resultFunc ? selector.resultFunc : selector).toString());
};

@@ -141,8 +152,13 @@

var graph = { nodes: {}, edges: [] };
var traversedDependencies = new Set();
var addToGraph = function addToGraph(selector) {
var name = selectorKey(selector, _registered);
if (graph.nodes[name]) return;
var _checkSelector = checkSelector(selector),
recomputations = _checkSelector.recomputations,
isRegistered = _checkSelector.isRegistered;
graph.nodes[name] = {
recomputations: selector.recomputations ? selector.recomputations() : 'N/A',
recomputations: recomputations,
isRegistered: isRegistered,
name: name

@@ -152,6 +168,2 @@ };

var dependencies = selector.dependencies || [];
if (traversedDependencies.has(name)) {
// Don't re-add.
dependencies = [];
}
dependencies.forEach(function (dependency) {

@@ -161,3 +173,2 @@ addToGraph(dependency);

});
traversedDependencies.add(name);
};

@@ -191,2 +202,11 @@

return graph;
}
// hack for devtools
/* istanbul ignore if */
if (typeof window !== 'undefined') {
window.__RESELECT_TOOLS__ = {
selectorGraph: selectorGraph,
checkSelector: checkSelector
};
}

@@ -60,4 +60,7 @@ 'use strict';

function checkSelector(selector) {
var isRegistered = false;
if (typeof selector === 'string' && _isFunction(_registered[selector])) {
selector = _registered[selector];
isRegistered = true;
}

@@ -69,6 +72,14 @@

if (!isRegistered) {
Object.keys(_registered).forEach(function (key) {
if (_registered[key] === selector) {
isRegistered = true;
}
});
}
var dependencies = selector.dependencies || [];
var recomputations = selector.recomputations ? selector.recomputations() : 'N/A/';
var recomputations = selector.recomputations ? selector.recomputations() : null;
var ret = { dependencies: dependencies, recomputations: recomputations };
var ret = { dependencies: dependencies, recomputations: recomputations, isRegistered: isRegistered };
if (_getState) {

@@ -131,3 +142,3 @@ var state = _getState();

return base + _sumString(dep);
}, selector.resultFunc.toString());
}, (selector.resultFunc ? selector.resultFunc : selector).toString());
};

@@ -139,8 +150,13 @@

var graph = { nodes: {}, edges: [] };
var traversedDependencies = new Set();
var addToGraph = function addToGraph(selector) {
var name = selectorKey(selector, _registered);
if (graph.nodes[name]) return;
var _checkSelector = checkSelector(selector),
recomputations = _checkSelector.recomputations,
isRegistered = _checkSelector.isRegistered;
graph.nodes[name] = {
recomputations: selector.recomputations ? selector.recomputations() : 'N/A',
recomputations: recomputations,
isRegistered: isRegistered,
name: name

@@ -150,6 +166,2 @@ };

var dependencies = selector.dependencies || [];
if (traversedDependencies.has(name)) {
// Don't re-add.
dependencies = [];
}
dependencies.forEach(function (dependency) {

@@ -159,3 +171,2 @@ addToGraph(dependency);

});
traversedDependencies.add(name);
};

@@ -189,2 +200,11 @@

return graph;
}
// hack for devtools
/* istanbul ignore if */
if (typeof window !== 'undefined') {
window.__RESELECT_TOOLS__ = {
selectorGraph: selectorGraph,
checkSelector: checkSelector
};
}
{
"name": "reselect-tools",
"version": "0.0.3",
"version": "0.0.4",
"description": "Selector Debugging Tools for Reselect.",

@@ -22,3 +22,4 @@ "main": "lib/index.js",

"compile": "npm run compile:commonjs && npm run compile:umd && npm run compile:umdmin && npm run compile:es",
"lint": "eslint --fix src test",
"lint": "eslint src test",
"lint-fix": "eslint --fix src test",
"prepublish": "npm run compile",

@@ -25,0 +26,0 @@ "test": "better-npm-run test",

@@ -45,4 +45,7 @@ import { createSelector } from 'reselect'

export function checkSelector(selector) {
let isRegistered = false
if (typeof selector === 'string' && _isFunction(_registered[selector])) {
selector = _registered[selector];
selector = _registered[selector]
isRegistered = true
}

@@ -54,6 +57,14 @@

if (!isRegistered) {
Object.keys(_registered).forEach((key) => {
if (_registered[key] === selector) {
isRegistered = true
}
})
}
const dependencies = selector.dependencies || []
const recomputations = selector.recomputations ? selector.recomputations() : 'N/A/'
const recomputations = selector.recomputations ? selector.recomputations() : null
const ret = { dependencies, recomputations }
const ret = { dependencies, recomputations, isRegistered }
if (_getState) {

@@ -92,3 +103,3 @@ const state = _getState()

return base + _sumString(dep)
}, selector.resultFunc.toString())
}, (selector.resultFunc ? selector.resultFunc : selector).toString())
}

@@ -98,8 +109,9 @@

const graph = { nodes: {}, edges: [] }
const traversedDependencies = new Set()
const addToGraph = (selector) => {
const name = selectorKey(selector, _registered)
if (graph.nodes[name]) return
const { recomputations, isRegistered } = checkSelector(selector)
graph.nodes[name] = {
recomputations: selector.recomputations ? selector.recomputations() : 'N/A',
recomputations,
isRegistered,
name

@@ -109,5 +121,2 @@ }

let dependencies = selector.dependencies || []
if (traversedDependencies.has(name)) { // Don't re-add.
dependencies = []
}
dependencies.forEach((dependency) => {

@@ -117,3 +126,2 @@ addToGraph(dependency)

})
traversedDependencies.add(name)
}

@@ -126,1 +134,10 @@

}
// hack for devtools
/* istanbul ignore if */
if (typeof window !== 'undefined') {
window.__RESELECT_TOOLS__ = {
selectorGraph,
checkSelector
}
}
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