Getting Started
Get up and running with @indodev/toolkit in minutes.
Installation
npm
npm install @indodev/toolkitRequirements: Node.js 18+ or any modern browser. Works with TypeScript 5.0+ or JavaScript.
Usage Pattern
The library uses subpath imports for optimal tree-shaking. This ensures your final bundle only includes the code you actually use.
// âś… Recommended: Import from specific submodules
import { validateNIK } from '@indodev/toolkit/nik';
import { formatRupiah } from '@indodev/toolkit/currency';
// ⚠️ Supported but not recommended for large apps
import { validateNIK, formatRupiah } from '@indodev/toolkit';TypeScript Configuration
For the best developer experience, especially when using subpath imports, ensure your tsconfig.json is configured correctly:
{
"compilerOptions": {
"moduleResolution": "bundler", // or "node16" / "nodenext"
"resolvePackageJsonExports": true
}
}This enables proper resolution of subpaths like @indodev/toolkit/nik.
Framework Integration
@indodev/toolkit is framework-agnostic and works seamlessly with any modern UI library.
React / Next.js
import { parseNIK, validateNIK } from '@indodev/toolkit/nik';
import { useState } from 'react';
export function NIKCard() {
const [nik, setNik] = useState('');
const info = validateNIK(nik) ? parseNIK(nik) : null;
return (
<div className="card">
<input value={nik} onChange={(e) => setNik(e.target.value)} placeholder="Enter 16-digit NIK" />
{info && <div>Born in {info.province.name}</div>}
</div>
);
}Vue 3
<script setup icons>
import { ref, computed } from 'vue';
import { formatRupiah } from '@indodev/toolkit/currency';
const amount = ref(1000000);
const formatted = computed(() => formatRupiah(amount.value));
</script>
<template>
<p>{{ formatted }}</p>
</template>Environment Support
Works in all modern environments:
- âś… Browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- âś… Node.js: 18.x or newer
- âś… Runtimes: Deno, Bun, Cloudflare Workers
Next Steps
Explore the API
Dive into the specific documentation for each module:
Real-world Examples
Check out more complex patterns in our GitHub Examples .
Community
Found a bug or have a feature request? Let us know on GitHub Issues .
Last updated on