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

nano-memoize

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nano-memoize - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

test/es5_ie11.html

3

package.json
{
"name": "nano-memoize",
"version": "v1.1.5",
"version": "v1.1.6",
"description": "Faster than fast, smaller than micro ... a nano speed and nano size memoizer.",
"engines": {},
"sideEffects": false,
"license": "MIT",

@@ -7,0 +8,0 @@ "scripts": {

@@ -200,2 +200,5 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/30ce201484754fa5b0a6c6046abb842d)](https://www.codacy.com/app/syblackwell/nano-memoize?utm_source=github.com&utm_medium=referral&utm_content=anywhichway/nano-memoize&utm_campaign=Badge_Grade)

2019-09-17 v1.1.6 Added a manually transpiled es5_ie11.html file with an Object.assign polyfill to the test directory to verify
compatibility with IE11. Modified unit tests so they are ES5 compatible. All tests pass. Addes `sideEffects=false` to package.json.
2019-06-28 v1.1.5 Improved documentation. Updated version of `micro-memoize` used for benchmark testing. No code changes.

@@ -202,0 +205,0 @@

@@ -15,3 +15,3 @@ var chai,

function multipleArg(arg1,arg2) {
return {arg1,arg2};
return {arg1:arg1,arg2:arg2};
}

@@ -23,3 +23,3 @@

varArg = nanomemoize((...args) => args);
varArg = nanomemoize(function() { return [].slice.call(arguments); });

@@ -29,4 +29,8 @@

it("memoize functions with function arg", function() {
const memoized = nanomemoize(fn => o => fn(o)),
myFunc = memoized(o => o),
const memoized = nanomemoize(function (fn) {
return function (o) {
return fn(o);
};
}),
myFunc = memoized(function(o) { return o; }),
result = myFunc(0);

@@ -80,6 +84,6 @@ expect(typeof(memoized)).equal("function");

it("expires content single primitive",function(done) {
const expiring = nanomemoize((a) => a,{maxAge:5});
const expiring = nanomemoize(function(a) { return a; },{maxAge:5});
expect(expiring(1)).to.equal(1);
expect(expiring.keyValues().primitives[1]).to.equal(1);
setTimeout(() => {
setTimeout(function() {
expect(expiring.keyValues().primitives[1]).to.equal(undefined);

@@ -90,7 +94,7 @@ done();

it("expires content single object",function(done) {
const expiring = nanomemoize((a) => a,{maxAge:5}),
const expiring = nanomemoize(function(a) { return a; },{maxAge:5}),
o = {}
expect(expiring(o)).to.equal(o);
expect(expiring.keyValues().objects.get(o)).to.equal(o);
setTimeout(() => {
setTimeout(function() {
expect(expiring.keyValues().objects.get(o)).to.equal(undefined);

@@ -101,3 +105,3 @@ done();

it("expires content multiple",function(done) {
const expiring = nanomemoize((a,b) => { return {a,b}; },{maxAge:5}),
const expiring = nanomemoize(function(a,b) { return {a:a,b:b}; },{maxAge:5}),
result = expiring(1,2);

@@ -108,3 +112,3 @@ expect(result.a).to.equal(1);

expect(expiring.values()[0].b).to.equal(2);
setTimeout(() => {
setTimeout(function() {
expect(expiring.values()[0]).to.equal(undefined);

@@ -111,0 +115,0 @@ done();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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