Add Utils Function
Workflow
- •Identify the target package based on environment needs:
- •Environment-agnostic logic ->
packages/utils - •Browser-only APIs ->
packages/web-utils - •Node-only APIs ->
packages/node-utils
- •Environment-agnostic logic ->
- •Search existing modules to avoid duplication (
rg <keyword> packages). - •Choose the most appropriate module file (e.g.,
array.ts,validators.ts) or create a new focused file. - •Implement the function with explicit types and no
any. - •Add bilingual JSDoc (Chinese + English), parameter/return docs, and at least two examples. Use the
bilingual-jsdocskill if needed. - •Export the function from the package
src/index.ts. - •Add unit tests in the package
__tests__directory. Use theadd-testsskill if needed. - •Suggest verification commands:
- •
TEST_API=<package> npm run test - •
npm run build
- •