@checkdigit/memoize 1.0.0-PR.2-665a → 1.0.0-PR.2-2998

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  The MIT License
3
3
 
4
- Copyright (c) 2021-2023 Check Digit, LLC
4
+ Copyright (c) 2023 Check Digit, LLC
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # Memoize
2
2
 
3
- Copyright (c) 2021-2023 [Check Digit, LLC](https://checkdigit.com)
3
+ Copyright (c) 2023 [Check Digit, LLC](https://checkdigit.com)
4
4
 
5
- Memoize is a light-weight utility library used by Check Digit services for memoization purposes.
5
+ Memoize is a small async function used by Check Digit services for memoizing promises with cache eviction on reject.
6
+ The promise being cached guarantees the underlying function is called at most once for a given set of arguments, unless
7
+ the promise is rejected. If the promise is rejected, it will be removed from the memoize cache.
8
+ This allows the function to be retried.
6
9
 
7
10
  ### Install
8
11
 
@@ -15,7 +18,9 @@ $ npm install @checkdigit/memoize
15
18
  ```
16
19
  import { memoize } from '@checkdigit/memoize';
17
20
 
18
- const value = memoize((_param: _paramType) => _asyncFunction(_paramValue));
21
+ const promise = memoize((_param: _paramType) => _asyncFunction(_param));
22
+
23
+ const value = await promise(_paramValue);
19
24
  ```
20
25
 
21
26
  ## License
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@checkdigit/memoize","version":"1.0.0-PR.2-665a","description":"Memoize is a light-weight utility library used by Check Digit services for memoization purposes","exports":{".":{"types":"./dist-types/index.d.ts","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"prettier":"@checkdigit/prettier-config","engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/memoize.git"},"author":"Check Digit, LLC","license":"MIT","bugs":{"url":"https://github.com/checkdigit/memoize/issues"},"homepage":"https://github.com/checkdigit/memoize#readme","devDependencies":{"@checkdigit/eslint-config":"^7.8.0","@checkdigit/jest-config":"^2.3.0","@checkdigit/prettier-config":"^3.4.0","@checkdigit/typescript-config":"^3.5.0","@types/uuid":"^9.0.2","rimraf":"^5.0.1","uuid":"^9.0.0"},"eslintConfig":{"extends":["@checkdigit/eslint-config"]},"jest":{"preset":"@checkdigit/jest-config"},"scripts":{"prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && npm run build:dist-esm","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --outDir=dist-cjs","build:dist-esm":"rimraf dist-esm && npx builder --type=module --sourceMap --outDir=dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","lint:fix":"eslint -f unix --ext .ts,.mts src --fix","lint":"eslint -f unix --ext .ts,.mts src","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","ci:compile":"tsc --noEmit","ci:test":"jest --coverage=false","ci:coverage":"jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier"}}
1
+ {"name":"@checkdigit/memoize","version":"1.0.0-PR.2-2998","description":"Memoize is a small async function used by Check Digit services for memoizing promises with cache eviction on reject","exports":{".":{"types":"./dist-types/index.d.ts","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"prettier":"@checkdigit/prettier-config","engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/memoize.git"},"author":"Check Digit, LLC","license":"MIT","bugs":{"url":"https://github.com/checkdigit/memoize/issues"},"homepage":"https://github.com/checkdigit/memoize#readme","devDependencies":{"@checkdigit/eslint-config":"^7.8.0","@checkdigit/jest-config":"^2.3.0","@checkdigit/prettier-config":"^3.4.0","@checkdigit/typescript-config":"^3.5.0","@types/uuid":"^9.0.2","rimraf":"^5.0.1","uuid":"^9.0.0"},"eslintConfig":{"extends":["@checkdigit/eslint-config"]},"jest":{"preset":"@checkdigit/jest-config"},"scripts":{"prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && npm run build:dist-esm","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --outDir=dist-cjs","build:dist-esm":"rimraf dist-esm && npx builder --type=module --sourceMap --outDir=dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","lint:fix":"eslint -f unix --ext .ts,.mts src --fix","lint":"eslint -f unix --ext .ts,.mts src","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","ci:compile":"tsc --noEmit","ci:test":"jest --coverage=false","ci:coverage":"jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier"}}
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // index.ts
2
2
 
3
3
  /*
4
- * Copyright (c) 2021-2023 Check Digit, LLC
4
+ * Copyright (c) 2023 Check Digit, LLC
5
5
  *
6
6
  * This code is licensed under the MIT license (see LICENSE.txt for details).
7
7
  */
package/src/memoize.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // memoize.ts
2
2
 
3
3
  /*
4
- * Copyright (c) 2021-2023 Check Digit, LLC
4
+ * Copyright (c) 2023 Check Digit, LLC
5
5
  *
6
6
  * This code is licensed under the MIT license (see LICENSE.txt for details).
7
7
  */