memoize-one
Advanced tools
Comparing version 5.0.4 to 5.0.5
@@ -17,3 +17,3 @@ 'use strict'; | ||
function index (resultFn, isEqual) { | ||
function memoizeOne(resultFn, isEqual) { | ||
if (isEqual === void 0) { | ||
@@ -28,3 +28,3 @@ isEqual = areInputsEqual; | ||
var result = function result() { | ||
var result = function memoized() { | ||
for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -48,2 +48,2 @@ newArgs[_key] = arguments[_key]; | ||
module.exports = index; | ||
module.exports = memoizeOne; |
@@ -15,3 +15,3 @@ function areInputsEqual(newInputs, lastInputs) { | ||
function index (resultFn, isEqual) { | ||
function memoizeOne(resultFn, isEqual) { | ||
if (isEqual === void 0) { | ||
@@ -26,3 +26,3 @@ isEqual = areInputsEqual; | ||
var result = function result() { | ||
var result = function memoized() { | ||
for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -46,2 +46,2 @@ newArgs[_key] = arguments[_key]; | ||
export default index; | ||
export default memoizeOne; |
@@ -21,3 +21,3 @@ (function (global, factory) { | ||
function index (resultFn, isEqual) { | ||
function memoizeOne(resultFn, isEqual) { | ||
if (isEqual === void 0) { | ||
@@ -32,3 +32,3 @@ isEqual = areInputsEqual; | ||
var result = function result() { | ||
var result = function memoized() { | ||
for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -52,4 +52,4 @@ newArgs[_key] = arguments[_key]; | ||
return index; | ||
return memoizeOne; | ||
})); |
{ | ||
"name": "memoize-one", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"description": "A memoization library which only remembers the latest invocation", | ||
@@ -26,24 +26,24 @@ "main": "dist/memoize-one.cjs.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"@babel/core": "^7.5.0", | ||
"@babel/preset-env": "^7.5.2", | ||
"@babel/preset-flow": "^7.0.0", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "10.0.1", | ||
"babel-jest": "^24.7.1", | ||
"babel-eslint": "10.0.2", | ||
"babel-jest": "^24.8.0", | ||
"benchmark": "^2.1.4", | ||
"cross-env": "^5.2.0", | ||
"eslint": "5.16.0", | ||
"eslint-config-prettier": "^4.1.0", | ||
"eslint-plugin-flowtype": "^3.5.1", | ||
"eslint-plugin-jest": "^22.4.1", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"flow-bin": "0.96.0", | ||
"jest": "^24.7.1", | ||
"eslint": "6.0.1", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-flowtype": "^3.11.1", | ||
"eslint-plugin-jest": "^22.7.2", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"flow-bin": "0.102.0", | ||
"jest": "^24.8.0", | ||
"lodash.isequal": "^4.5.0", | ||
"prettier": "1.16.4", | ||
"prettier": "1.18.2", | ||
"rimraf": "2.6.3", | ||
"rollup": "^1.9.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-replace": "^2.1.1", | ||
"rollup": "^1.16.6", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-uglify": "^6.0.2" | ||
@@ -50,0 +50,0 @@ }, |
@@ -88,5 +88,4 @@ # memoize-one | ||
newArgs.length === lastArgs.length && | ||
newArgs.every( | ||
(newArg: mixed, index: number): boolean => | ||
shallowEqual(newArg, lastArgs[index]), | ||
newArgs.every((newArg: mixed, index: number): boolean => | ||
shallowEqual(newArg, lastArgs[index]), | ||
); | ||
@@ -93,0 +92,0 @@ ``` |
@@ -12,3 +12,3 @@ // @flow | ||
// mixed: The result can be anything but needs to be checked before usage | ||
export default function<ResultFn: (...any[]) => mixed>( | ||
export default function memoizeOne<ResultFn: (...any[]) => mixed>( | ||
resultFn: ResultFn, | ||
@@ -23,3 +23,3 @@ isEqual?: EqualityFn = areInputsEqual, | ||
// breaking cache when context (this) or arguments change | ||
const result = function(...newArgs: mixed[]) { | ||
const result = function memoized(...newArgs: mixed[]) { | ||
if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) { | ||
@@ -26,0 +26,0 @@ return lastResult; |
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
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
17622
232