-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement memoize * prettier fix * update readme with better example * addressing pr comments - change copyright to 2023 - adjust read me description - add run tests back into ci workflows - import memoize from index.ts for test file * change npm run ci:test to npm test in publish.yml * change node engine to >=18 * remove Check Digit specific comments and fix example in read me + update workflows
- Loading branch information
Showing
20 changed files
with
2,978 additions
and
1,550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Check Pull Request Reviews | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
jobs: | ||
checkPrReviews: | ||
runs-on: ubuntu-latest | ||
name: Check PR Reviews | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Perform Check of PR Reviews | ||
uses: checkdigit/github-actions/check-pr-reviews@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: 'CodeQL' | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
branches: ['main'] | ||
schedule: | ||
- cron: '56 08 * * 1' | ||
|
||
jobs: | ||
analyze: | ||
name: CodeQL analysis | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: ['javascript'] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
name: Publish to NPM | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
- name: Audit Signatures | ||
run: npm audit signatures | ||
- name: Run Test | ||
run: npm run ci:test | ||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License | ||
|
||
Copyright (c) 2023 Check Digit, LLC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,28 @@ | ||
# Check Digit < Insert name > Library | ||
# Memoize | ||
|
||
The Check Digit < Insert Name > library is a library for Check Digit services to deal with [ short description about what the library does] | ||
Copyright (c) 2023 [Check Digit, LLC](https://checkdigit.com) | ||
|
||
Features: | ||
Memoize is a small async function for memoizing promises with cache eviction on reject. | ||
The promise being cached guarantees the underlying function is called at most once for a given set of arguments, unless | ||
the promise is rejected. If the promise is rejected, it will be removed from the memoize cache. | ||
This allows the function to be retried. | ||
|
||
- Feature 1 | ||
- Feature 2 | ||
- Feature3 | ||
- (...) | ||
|
||
### Installing | ||
|
||
`npm install @checkdigit/< Insert name >` | ||
|
||
### Use | ||
|
||
It could be. i.e. | ||
### Install | ||
|
||
``` | ||
import * as insertName from '@checkdigit/< Insert name >'; | ||
$ npm install @checkdigit/memoize | ||
``` | ||
|
||
const someVariable = insertName(); | ||
### Use | ||
|
||
``` | ||
import memoize from '@checkdigit/memoize'; | ||
Or if it can be called as a script. i.e. | ||
const promise = memoize((_param: _paramType) => _asyncFunction(_param)); | ||
``` | ||
insert-name -b src/package.json | ||
const value = await promise(_paramValue); | ||
``` | ||
|
||
### Links | ||
## License | ||
|
||
- Company website: [your.website.url] | ||
- Npm: [npm.url] | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Security Policy | ||
|
||
## Supported Versions | ||
|
||
These versions of @checkdigit/memoize are currently being supported with security updates. | ||
|
||
| Version | Supported | | ||
| ------- | ------------------ | | ||
| > 1.x | :white_check_mark: | | ||
|
||
## Reporting a Vulnerability | ||
|
||
Please create an issue at https://github.com/checkdigit/memoize/issues |
Oops, something went wrong.