@thi.ng/memoize
Advanced tools
Comparing version 0.2.6 to 1.0.0
@@ -6,2 +6,24 @@ # Change Log | ||
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@0.2.6...@thi.ng/memoize@1.0.0) (2019-01-21) | ||
### Build System | ||
* update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703)) | ||
### BREAKING CHANGES | ||
* enabled multi-outputs (ES6 modules, CJS, UMD) | ||
- build scripts now first build ES6 modules in package root, then call | ||
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib` | ||
- all imports MUST be updated to only refer to package level | ||
(not individual files anymore). tree shaking in user land will get rid of | ||
all unused imported symbols. | ||
## [0.2.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@0.2.5...@thi.ng/memoize@0.2.6) (2018-12-15) | ||
@@ -8,0 +30,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Fn0 } from "@thi.ng/memoize/src/api"; | ||
import { Fn0 } from "./api"; | ||
/** | ||
@@ -16,2 +16,2 @@ * Lightweight named singleton factory, intended for hot-module | ||
*/ | ||
export declare function defonce<T>(id: string, factory: Fn0<T>): T; | ||
export declare const defonce: <T>(id: string, factory: Fn0<T>) => T; |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const cache = {}; | ||
@@ -18,7 +16,4 @@ /** | ||
*/ | ||
function defonce(id, factory) { | ||
return cache.hasOwnProperty(id) ? | ||
cache[id] : | ||
(cache[id] = factory()); | ||
} | ||
exports.defonce = defonce; | ||
export const defonce = (id, factory) => cache.hasOwnProperty(id) ? | ||
cache[id] : | ||
(cache[id] = factory()); |
13
index.js
@@ -1,9 +0,4 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./defonce")); | ||
__export(require("./memoize")); | ||
__export(require("./memoize1")); | ||
__export(require("./memoizej")); | ||
export * from "./defonce"; | ||
export * from "./memoize"; | ||
export * from "./memoize1"; | ||
export * from "./memoizej"; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function memoize(fn, cache) { | ||
export function memoize(fn, cache) { | ||
return (...args) => { | ||
@@ -11,2 +9,1 @@ let res; | ||
} | ||
exports.memoize = memoize; |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -14,3 +12,3 @@ * Optimized memoization for single arg functions. If the function | ||
*/ | ||
function memoize1(fn, cache) { | ||
export function memoize1(fn, cache) { | ||
!cache && (cache = new Map()); | ||
@@ -24,2 +22,1 @@ return (x) => { | ||
} | ||
exports.memoize1 = memoize1; |
@@ -1,2 +0,2 @@ | ||
import { IObjectOf } from "@thi.ng/api/api"; | ||
import { IObjectOf } from "@thi.ng/api"; | ||
import { Fn1, Fn2, Fn3, Fn4 } from "./api"; | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function memoizeJ(fn, cache) { | ||
export function memoizeJ(fn, cache) { | ||
!cache && (cache = {}); | ||
@@ -15,2 +13,1 @@ return (...args) => { | ||
} | ||
exports.memoizeJ = memoizeJ; |
{ | ||
"name": "@thi.ng/memoize", | ||
"version": "0.2.6", | ||
"version": "1.0.0", | ||
"description": "Function memoization with configurable caches", | ||
"main": "./index.js", | ||
"module": "./index.js", | ||
"main": "./lib/index.js", | ||
"umd:main": "./lib/index.umd.js", | ||
"typings": "./index.d.ts", | ||
@@ -15,8 +17,10 @@ "repository": { | ||
"scripts": { | ||
"build": "yarn run clean && tsc --declaration", | ||
"clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", | ||
"build": "yarn clean && yarn build:es6 && yarn build:bundle", | ||
"build:es6": "tsc --declaration", | ||
"build:bundle": "../../scripts/bundle-module memoize api", | ||
"test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", | ||
"clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", | ||
"cover": "yarn test && nyc report --reporter=lcov", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc src", | ||
"pub": "yarn run build && yarn publish --access public", | ||
"test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" | ||
"pub": "yarn build && yarn publish --access public" | ||
}, | ||
@@ -28,7 +32,7 @@ "devDependencies": { | ||
"nyc": "^13.1.0", | ||
"typedoc": "^0.13.0", | ||
"typedoc": "^0.14.0", | ||
"typescript": "^3.2.2" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/api": "^4.2.4" | ||
"@thi.ng/api": "^5.0.0" | ||
}, | ||
@@ -45,3 +49,4 @@ "keywords": [ | ||
}, | ||
"gitHead": "159ce8f6b1d2dad1e12f2ba3f4f7b60d1623acee" | ||
"sideEffects": false, | ||
"gitHead": "348e7303b8b4d2749a02dd43e3f78d711242e4fe" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
29869
20
227
0
+ Added@thi.ng/api@5.1.0(transitive)
+ Added@thi.ng/errors@1.3.4(transitive)
- Removed@thi.ng/api@4.2.4(transitive)
- Removed@thi.ng/errors@0.1.12(transitive)
Updated@thi.ng/api@^5.0.0