memoize-one
Advanced tools
Comparing version 3.1.1 to 4.0.0
{ | ||
"name": "memoize-one", | ||
"version": "3.1.1", | ||
"version": "4.0.0", | ||
"description": "A memoization library which only remembers the latest invocation", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"main": "dist/memoize-one.cjs.js", | ||
"module": "dist/memoize-one.esm.js", | ||
"sideEffects": false, | ||
@@ -15,4 +15,3 @@ "author": "Alex Reardon <alexreardon@gmail.com>", | ||
"files": [ | ||
"/lib", | ||
"/esm", | ||
"/dist", | ||
"/src" | ||
@@ -29,17 +28,21 @@ ], | ||
"babel-cli": "6.26.0", | ||
"babel-core": "6.26.0", | ||
"babel-eslint": "8.2.2", | ||
"babel-core": "6.26.3", | ||
"babel-eslint": "8.2.5", | ||
"babel-plugin-transform-flow-strip-types": "6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-flow": "^6.23.0", | ||
"chai": "4.1.2", | ||
"cross-env": "^5.1.4", | ||
"eslint": "4.19.0", | ||
"eslint-plugin-flowtype": "^2.46.1", | ||
"eslint-plugin-jest": "^21.15.0", | ||
"flow-bin": "0.68.0", | ||
"flow-copy-source": "1.3.0", | ||
"jest": "^22.4.2", | ||
"rimraf": "2.6.2" | ||
"cross-env": "^5.2.0", | ||
"eslint": "5.0.1", | ||
"eslint-plugin-flowtype": "^2.49.3", | ||
"eslint-plugin-jest": "^21.17.0", | ||
"flow-bin": "0.75.0", | ||
"jest": "^23.2.0", | ||
"rimraf": "2.6.2", | ||
"rollup": "^0.62.0", | ||
"rollup-plugin-babel": "^3.0.5", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-uglify": "^4.0.0" | ||
}, | ||
@@ -50,11 +53,9 @@ "scripts": { | ||
"typecheck": "flow check", | ||
"lint": "eslint src test -", | ||
"lint:fix": "yarn run lint --fix", | ||
"build": "yarn run build:clean && yarn run build:lib && yarn run build:esm && yarn run build:flow", | ||
"build:clean": "rimraf lib esm", | ||
"build:lib": "cross-env NODE_ENV=cjs babel src -d lib", | ||
"build:esm": "babel src --out-dir esm", | ||
"build:flow": "flow-copy-source --verbose src lib && flow-copy-source --verbose src esm", | ||
"lint": "eslint src test", | ||
"build": "yarn run build:clean && yarn run build:dist && yarn run build:flow", | ||
"build:clean": "rimraf dist", | ||
"build:dist": "rollup -c", | ||
"build:flow": "echo \"// @flow\n\nexport * from '../src';\" > dist/memoize-one.cjs.js.flow", | ||
"prepublish": "yarn run build" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# memoizeOne | ||
# memoize-one | ||
@@ -17,3 +17,3 @@ A memoization library which only remembers the latest invocation | ||
Unlike other memoization libraries, `memoizeOne` only remembers the latest arguments and result. No need to worry about cache busting mechanisms such as `maxAge`, `maxSize`, `exclusions` and so on which can be prone to memory leaks. `memoizeOne` simply remembers the last arguments, and if the function is next called with the same arguments then it returns the previous result. | ||
Unlike other memoization libraries, `memoize-one` only remembers the latest arguments and result. No need to worry about cache busting mechanisms such as `maxAge`, `maxSize`, `exclusions` and so on which can be prone to memory leaks. `memoize-one` simply remembers the last arguments, and if the function is next called with the same arguments then it returns the previous result. | ||
@@ -110,3 +110,3 @@ ## Usage | ||
### memoizeOne correctly respects `this` control | ||
### `memoize-one` correctly respects `this` control | ||
@@ -142,5 +142,5 @@ This library takes special care to maintain, and allow control over the the `this` context for **both** the original function being memoized as well as the returned memoized function. Both the original function and the memoized function's `this` context respect [all the `this` controlling techniques](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md): | ||
Therefore, in order to prevent against unexpected results, `memoizeOne` takes into account the current execution context (`this`) of the memoized function. If `this` is different to the previous invocation then it is considered a change in argument. [further discussion](https://github.com/alexreardon/memoize-one/issues/3). | ||
Therefore, in order to prevent against unexpected results, `memoize-one` takes into account the current execution context (`this`) of the memoized function. If `this` is different to the previous invocation then it is considered a change in argument. [further discussion](https://github.com/alexreardon/memoize-one/issues/3). | ||
Generally this will be of no impact if you are not explicity controlling the `this` context of functions you want to memoize with [explicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#explicit-binding) or [implicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#implicit-binding). `memoizeOne` will detect when you are manipulating `this` and will then consider the `this` context as an argument. If `this` changes, it will re-execute the original function even if the arguments have not changed. | ||
Generally this will be of no impact if you are not explicity controlling the `this` context of functions you want to memoize with [explicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#explicit-binding) or [implicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#implicit-binding). `memoize-One` will detect when you are manipulating `this` and will then consider the `this` context as an argument. If `this` changes, it will re-execute the original function even if the arguments have not changed. | ||
@@ -151,7 +151,7 @@ ## Performance :rocket: | ||
`memoizeOne` is super lightweight at `457 bytes` minified and `299 bytes` gzipped. (`1kb` = `1000 bytes`) | ||
`memoize-one` is super lightweight at `457 bytes` minified and `299 bytes` gzipped. (`1kb` = `1000 bytes`) | ||
### Extremely fast | ||
`memoizeOne` performs better or on par with than other popular memoization libraries for the purpose of remembering the latest invocation. | ||
`memoize-one` performs better or on par with than other popular memoization libraries for the purpose of remembering the latest invocation. | ||
@@ -163,3 +163,3 @@ **Results** | ||
The comparisions are not exhaustive and are primiarly to show that `memoizeOne` accomplishes remembering the latest invocation really fast. The benchmarks do not take into account the differences in feature sets, library sizes, parse time, and so on. | ||
The comparisions are not exhaustive and are primiarly to show that `memoize-one` accomplishes remembering the latest invocation really fast. The benchmarks do not take into account the differences in feature sets, library sizes, parse time, and so on. | ||
@@ -166,0 +166,0 @@ ## Code health :thumbsup: |
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
9
125
14197
20