This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
@naverpay/hidash is a zero-dependency, performance-focused drop-in replacement for Lodash. Each utility is exported via subpath imports (e.g., import has from '@naverpay/hidash/has'). Namespace imports are not supported.
pnpm test # run all tests
pnpm test -- src/has.test.ts # run a single test file
pnpm bench # run all benchmarks
pnpm build # clean + vite build (dual CJS/ESM output)
pnpm lint # eslint check
pnpm lint:fix # eslint fix
pnpm prettier # prettier check
pnpm prettier:fix # prettier fix
pnpm run generate # regenerate index.ts + package.json exports from src/*.tsEvery utility lives as a single file in src/ with a strict pattern enforced by eslint-plugin-hidash:
src/<name>.ts— implementation (must have both a named export and a default export)src/<name>.test.ts— tests (compare against lodash to verify compatibility)src/<name>.bench.ts— benchmarks (measure performance vs lodash)- Shared types live in
src/internal/types.ts
pnpm run generate (scripts/generate-utils.mjs) scans src/*.ts (excluding test/bench files) and auto-generates:
index.ts— moduleMap used by the Vite build configpackage.jsonexportsfield — subpath export entries for every utility
Run pnpm run generate after adding or removing any utility file.
Vite (via @naverpay/pite) produces per-function output: <name>.js, <name>.mjs, <name>.d.ts, <name>.d.mts. These are copied to the package root at publish time (scripts/pre-build.mjs) and cleaned up post-publish.
Uses Changesets. Create a changeset file, merge to main, and the GitHub Actions publish workflow handles versioning and npm publish automatically.
- Lodash behavioral compatibility is mandatory. Tests assert
has(x, y) === _has(x, y)against real lodash. Every edge case must match lodash's output exactly. - Performance must be equal to or better than lodash. Benchmarks verify this.
- Zero runtime dependencies. lodash is a devDependency used only in tests/benchmarks.
- Dual export required. Each
src/<name>.tsmust export bothexport function <name>andexport default <name>. This is enforced by theenforce-single-function-dual-exportESLint rule. - JSDoc header comments are required on exported functions:
@description,@param,@returns. - Comments in English only.
- pre-commit: eslint, prettier, markdownlint (parallel, on staged files)
- commit-msg:
@naverpay/commit-helpervalidates commit message format