Welcome to NHB Toolbox π¦
Replace Boilerplate(s) with One-Liner(s)
nhb-toolbox
provides battle-tested utilities for professional TypeScript/JavaScript development. Carefully crafted to solve common challenges with elegant, production-ready solutions:
- Helper Functions & Classes: Reusable solutions for everyday tasks
- Type Guards & Predicates: Runtime safety with perfect type inference
- Validation Utilities: Robust data validation patterns
- Zero Dependencies: Framework-agnostic implementation using only native TS/JS with 0 external package
- Types: Includes types designed to enhance type safety and developer ergonomics
π§° Installation Guideβ
nhb-toolbox
is published to two package registries:
- NPM Registry (default public registry) - This is the simplest way to install and requires no additional setup.
- GitHub Packages (GitHubβs package registry, scoped package)
- Use NPM Registry (default) if you want the stable public version without extra config.
- GitHub Packages requires authentication and scoped package names.
π¦ Install as Main Dependencyβ
- π¦ npm
- π§Ά yarn
- π pnpm
- NPM Registry
npm i nhb-toolbox
- GitHub Packages
npm i @nazmul-nhb/nhb-toolbox
- NPM Registry
yarn add nhb-toolbox
- GitHub Packages
yarn add @nazmul-nhb/nhb-toolbox
- NPM Registry
pnpm add nhb-toolbox
- GitHub Packages
pnpm add @nazmul-nhb/nhb-toolbox
π οΈ Install as Dev Dependencyβ
- π¦ npm
- π§Ά yarn
- π pnpm
- NPM Registry
npm i -D nhb-toolbox
- GitHub Packages
npm i -D @nazmul-nhb/nhb-toolbox
- NPM Registry
yarn add -D nhb-toolbox
- GitHub Packages
yarn add -D @nazmul-nhb/nhb-toolbox
- NPM Registry
pnpm add -D nhb-toolbox
- GitHub Packages
pnpm add -D @nazmul-nhb/nhb-toolbox
π Install Globallyβ
- π¦ npm
- π§Ά yarn
- π pnpm
- NPM Registry
npm i -g nhb-toolbox
- GitHub Packages
npm i -g @nazmul-nhb/nhb-toolbox
- NPM Registry
yarn add -g nhb-toolbox
- GitHub Packages
yarn add -g @nazmul-nhb/nhb-toolbox
- NPM Registry
pnpm add -g nhb-toolbox
- GitHub Packages
pnpm add -g @nazmul-nhb/nhb-toolbox
π¦ Installation Guide from GitHub Packagesβ
GitHub Packages requires authentication and scoped package names.
Step 1: Authenticate with GitHub Packagesβ
Create or use a GitHub Personal Access Token (PAT) with read:packages
permission.
Add the following to your projectβs .npmrc
file (create if it doesnβt exist):
@nazmul-nhb:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN
Replace
YOUR_GITHUB_PERSONAL_ACCESS_TOKEN
with your actual token.
Step 2: Install the package with scoped nameβ
Choose your preferred package manager:
npm i @nazmul-nhb/nhb-toolbox
pnpm add @nazmul-nhb/nhb-toolbox
yarn add @nazmul-nhb/nhb-toolbox
Where do consumers get the GitHub token?β
-
The token is personal and private β each consumer must create own.
-
Your GitHub Personal Access Token (PAT) should never be shared publicly or with consumers.
How consumers create own tokenβ
-
Go to GitHub account settings β Developer settings β Personal access tokens β Tokens (classic).
-
Click Generate new token, then:
-
Give it a name (e.g.,
npm package read access
). -
Set expiration as prefer.
-
Enable only the
read:packages
permission (to allow reading packages).
-
-
Generate the token and copy it immediately β won't see it again.
What should consumers do with the token?β
- Add it to
.npmrc
file (or environment) to authenticate with GitHub Packages.
Example .npmrc
snippet:
@nazmul-nhb:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=PERSONAL_ACCESS_TOKEN_HERE
Summaryβ
Registry | Package Name | Registry URL | Requires Auth? |
---|---|---|---|
NPM Registry | nhb-toolbox | https://registry.npmjs.org | No |
GitHub Packages | @nazmul-nhb/nhb-toolbox | https://npm.pkg.github.com | Yes (PAT with read:packages ) |
If you want to use both, just configure .npmrc
accordingly and install the appropriate package name depending on your needs.
Notesβ
- The GitHub Packages version may include pre-release or private builds.
- NPM Registry version is the recommended default for most users.
- You can safely use either registry depending on your environment.
π Featuresβ
- Type-Safe Utilities: Fully typed for perfect TypeScript integration with strict type checking
- Types: Ready-to-use types designed to enhance type safety and developer efficiency
- Modular Design: Tree-shaking friendly β import only what you need with zero bloat
- Zero Dependencies: No external dependencies - works with any JS/TS framework
- IDE Support: Full type hints with JSDoc-powered API references in your editor
- Battle-Tested: Reliable utilities refined through real-world production use
- Optimized for Production: Focused on clean, efficient implementations