Small Node.js utility library with Jest tests, coverage reporting, and GitHub Actions CI.
npm installnpm startruns the app entrypoint.npm run devruns the app in watch mode.npm testruns the Jest suite.npm run coverageruns Jest with coverage output.
const { sum, isPalindrome } = require("./src/utils");
const { multiply, divide } = require("./src/math");
const { unique, flatten } = require("./src/array");
const { getEnv } = require("./src/config");
console.log(sum([1, 2, 3]));
console.log(isPalindrome("Racecar"));
console.log(multiply(4, 5));
console.log(divide(12, 3));
console.log(unique([1, 1, 2, 3]));
console.log(flatten([[1, 2], [3, 4]]));
console.log(getEnv("PORT", 3000));The package supports subpath imports, so consumers can import only the module they need:
const { sum } = require("newnich-my-app/utils");
const { multiply } = require("newnich-my-app/math");
const { unique } = require("newnich-my-app/array");
const { fetchJson } = require("newnich-my-app/api");This avoids importing internal file paths directly.
src/utils.js: date formatting, summation, palindrome checkssrc/math.js: multiply and divide helperssrc/string.js: string capitalization and reversalsrc/array.js: unique values and one-level flatteningsrc/date.js: day-distance calculationsrc/config.js: environment lookup helpersrc/api.js: JSON and text fetch helperssrc/errors.js: safe JSON parsing and retry logicsrc/logger.js: formatted console logging helperssrc/fs.js: JSON file read and write helperssrc/async.js: delay and timeout helpers
GitHub Actions runs the test and coverage workflow on every push and pull request through .github/workflows/test.yml.
- Replace placeholder GitHub URLs in
package.jsonwith the live repository path. - The coverage badge is currently a static placeholder based on the latest local run.