fast-memoize
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "fast-memoize", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Fastest memoization lib that supports N arguments", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "standard && tap test/*.js --cov --reporter=spec", | ||
"benchmark": "node benchmark" | ||
"test": "tape test/*.js --cov --reporter=spec", | ||
"test:lint": "standard src/* test/*", | ||
"test:coverage": "covert test/*.js", | ||
"test:cov": "npm run test:coverage", | ||
"test:karma": "karma start --singleRun", | ||
"test:all": "npm run test:lint && npm test && npm run test:karma", | ||
"test:saucelabs": "karma start saucelabs.karma.conf.js --singleRun", | ||
"build": "webpack", | ||
"benchmark": "node benchmark", | ||
"preversion": "npm run test:all", | ||
"version": "npm run build && git add ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/caiogondim/cheap-memoize.git" | ||
"url": "git+https://github.com/caiogondim/fast-memoize.git" | ||
}, | ||
@@ -17,14 +26,24 @@ "author": "Caio Gondim <me@caiogondim.com> (http://caiogondim.com)", | ||
"bugs": { | ||
"url": "https://github.com/caiogondim/cheap-memoize/issues" | ||
"url": "https://github.com/caiogondim/fast-memoize/issues" | ||
}, | ||
"homepage": "https://github.com/caiogondim/cheap-memoize#readme", | ||
"homepage": "https://github.com/caiogondim/fast-memoize#readme", | ||
"devDependencies": { | ||
"benchmark": "^2.0.0", | ||
"covert": "^1.1.0", | ||
"karma": "^0.13.22", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^1.0.0", | ||
"karma-tap": "^1.0.4", | ||
"karma-webpack": "^1.7.0", | ||
"lodash": "^4.0.0", | ||
"logdown": "^1.2.4", | ||
"logdown": "^1.2.5", | ||
"lru-cache": "^4.0.0", | ||
"memoizee": "^0.3.9", | ||
"mocha": "^2.5.3", | ||
"standard": "^6.0.7", | ||
"tap": "^5.7.0", | ||
"underscore": "^1.8.3" | ||
"tape": "^4.5.1", | ||
"underscore": "^1.8.3", | ||
"webpack": "^1.13.1" | ||
}, | ||
@@ -31,0 +50,0 @@ "standard": { |
@@ -5,4 +5,5 @@ <img src="http://rawgit.com/caiogondim/fast-memoize/master/img/icon.svg" width="100%" /> | ||
<img src="https://travis-ci.org/caiogondim/fast-memoize.svg?branch=master" alt="Travis CI"> <img src="https://david-dm.org/caiogondim/fast-memoize/dev-status.svg" alt="David DM"> | ||
<img src="http://travis-ci.org/caiogondim/fast-memoize.js.svg?branch=master" alt="Travis CI"> <img src="http://david-dm.org/caiogondim/fast-memoize.js/dev-status.svg" alt="David DM"> [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
> In computing, memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. | ||
@@ -35,8 +36,8 @@ > — Wikipedia | ||
const fn = function (one, two, three) { /* ... */ }; | ||
const fn = function (one, two, three) { /* ... */ } | ||
memoized = memoize(fn); | ||
const memoized = memoize(fn) | ||
memoized('foo', 3, 'bar'); | ||
memoized('foo', 3, 'bar'); // Cache hit | ||
memoized('foo', 3, 'bar') | ||
memoized('foo', 3, 'bar') // Cache hit | ||
``` | ||
@@ -72,2 +73,6 @@ | ||
## Support | ||
![SauceLabs support matrix](http://soysauce.berabou.me/u/caiogondim.svg) | ||
## Reference | ||
@@ -74,0 +79,0 @@ - https://talideon.com/weblog/2005/07/javascript-memoization.cfm |
'use strict' | ||
const CacheDefault = require('./cache') | ||
const serializerDefault = require('./serializer') | ||
var cacheDefault = require('./cache') | ||
var serializerDefault = require('./serializer') | ||
function memoize (fn, Cache, serializer) { | ||
if (!Cache) { | ||
Cache = CacheDefault | ||
function memoize (fn, cache, serializer) { | ||
if (!cache) { | ||
cache = cacheDefault | ||
} | ||
@@ -15,3 +15,3 @@ if (!serializer) { | ||
function memoized () { | ||
let cacheKey | ||
var cacheKey | ||
@@ -31,3 +31,3 @@ if (arguments.length === 1) { | ||
memoized._cache = new Cache() | ||
memoized._cache = cache.create() | ||
@@ -34,0 +34,0 @@ return memoized |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19917
16
425
82
18
4
1