TypeScript/Javascript Utilities
npm install @egjiri/node-kit
A collection of useful Node.js utility functions that can be used across projects. Written in TypeScript.
- 🚀 Node.js Only (not for DOM/browsers)
- 📦 Zero Dependencies - No runtime dependencies
The library is available as an npm package. To install the package using your favorite package manager run:
| Package Manager | Command |
|-----------------|---------|
| npm | npm install @egjiri/node-kit |
| pnpm | pnpm add @egjiri/node-kit |
| yarn | yarn add @egjiri/node-kit |
| bun | bun add @egjiri/node-kit |
js
import { formatNumber } from '@egjiri/node-kit/numbers'formatNumber(1234.56, 'currency');
// => $1,234.56
``js
import { removeKeysWithBlankValues } from '@egjiri/node-kit/objects'removeKeysWithBlankValues({
first: 'first',
second: null,
third: undefined,
fourth: 4
});
// => { first: 'first', fourth: 4 }
`Development
1. Install dependencies: pnpm install
1. Run tests: pnpm run test
1. Run tests in watch mode: pnpm run test:watch (tests automatically re-run when TypeScript src files change)
1. Run code coverage report and open it in the browser pnpm run coverage
1. Run all checks (lint, build, and coverage): pnpm run all - This is the comprehensive command to run before committing changes
1. Start Coding!$3
The CI GitHub Action requires a
BADGE_API_KEY GitHub secret. To fetch this secret from 1Password and set it on GitHub, run the following command locally once. Re-run this command whenever the secret changes.`bash
gh secret set BADGE_API_KEY --repo egjiri/node-kit --body "$(op read 'op://Infrastructure/Badge/BADGE_API_KEY' -n)"
`The coverage badge is automatically updated by the CI GitHub Action whenever tests run on the main branch. The badge is generated using the egjiri/badge project and hosted at badge.egjiri.com.
Release
This project uses automated publishing through GitHub Actions. Publishing happens automatically when you create and push a version tag.
$3
1. Update the version in
package.json:
`bash
# For a patch release (1.7.0 → 1.7.1)
pnpm version patch -m "Upgrade version to %s" # For a minor release (1.7.0 → 1.8.0)
pnpm version minor -m "Upgrade version to %s"
# For a major release (1.7.0 → 2.0.0)
pnpm version major -m "Upgrade version to %s"
`2. Push the tag to trigger the release workflow:
`bash
git push origin main --tags
``