Socket
Socket
Sign inDemoInstall

memoize-one

Package Overview
Dependencies
0
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

10

lib/index.js

@@ -15,3 +15,7 @@ "use strict";

// breaking cache when arguments or context changes
var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
return isEqual(newArg, lastArgs[index]);
};
// breaking cache when context (this) or arguments change
return function () {

@@ -22,5 +26,3 @@ for (var _len = arguments.length, newArgs = Array(_len), _key = 0; _key < _len; _key++) {

if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && lastArgs.every(function (lastArg, i) {
return isEqual(lastArg, newArgs[i]);
})) {
if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
return lastResult;

@@ -27,0 +29,0 @@ }

2

package.json
{
"name": "memoize-one",
"version": "1.0.1",
"version": "1.0.2",
"description": "A memoization library which only remembers the latest invocation",

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

@@ -12,3 +12,5 @@ // @flow

// breaking cache when arguments or context changes
const isNewArgEqualToLast = (newArg, index) => isEqual(newArg, lastArgs[index]);
// breaking cache when context (this) or arguments change
return function (...newArgs: Array<any>) {

@@ -18,3 +20,3 @@ if (calledOnce &&

newArgs.length === lastArgs.length &&
lastArgs.every((lastArg, i) => isEqual(lastArg, newArgs[i]))) {
newArgs.every(isNewArgEqualToLast)) {
return lastResult;

@@ -21,0 +23,0 @@ }

@@ -444,3 +444,3 @@ // @flow

expect(equalityStub.calledWith(1, 1)).to.be.true;
expect(equalityStub.calledWith(2, 4)).to.be.true;
expect(equalityStub.calledWith(4, 2)).to.be.true;
});

@@ -447,0 +447,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc