JSPM

@prishelets/utils

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q41468F
  • License ISC

A modern utility library for strings, numbers, and general data types β€” fully typed, tested, and built for Node.js and TypeScript.

Package Exports

  • @prishelets/utils
  • @prishelets/utils/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@prishelets/utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@prishelets/utils

npm version Build Status License


πŸ“¦ Description

@prishelets/utils is a modern, type-safe utility library for working with strings, numbers, and general data types. It’s fully typed, tested, and optimized for Node.js and TypeScript projects.


✨ Features

  • 🧠 Fully typed with TypeScript
  • πŸ§ͺ Tested with Jest
  • ⚑ Lightweight and modular
  • πŸ“š Useful for everyday string and number manipulation
  • πŸ”§ Tree-shakable and ESM/CommonJS compatible

πŸ“₯ Installation

npm install @prishelets/utils
# or
pnpm add @prishelets/utils
# or
yarn add @prishelets/utils

πŸš€ Usage

import { clamp, isEven, roundTo, randomInRange } from "@prishelets/utils";
clamp(5, 0, 10); // 5
isEven(4); // true
roundTo(3.14159, 2); // 3.14
randomInRange(1, 5); // e.g., 3

πŸ”’ Number Utilities

clamp(value, min, max)

Clamp a number between a min and max range.

clamp(5, 0, 10); // 5
clamp(-1, 0, 10); // 0
clamp(15, 0, 10); // 10

isEven(value)

Check if a number is even.

isEven(4); // true
isEven(3); // false

roundTo(value, decimals)

Round a number to a specific number of decimal places.

roundTo(3.14159, 2); // 3.14
roundTo(1.005, 2); // 1.01

randomInRange(min, max)

Generate a random integer between min and max (inclusive).

randomInRange(1, 3); // e.g., 2

πŸ›  Roadmap

  • String utilities
  • Array helpers
  • Object type guards
  • Functional programming tools
  • Performance benchmarks
  • TypeScript documentation generator

πŸ“‚ Project Structure

β”œβ”€β”€ src/
β”‚   └── numbers/
β”‚       β”œβ”€β”€ clamp.ts
β”‚       β”œβ”€β”€ isEven.ts
β”‚       β”œβ”€β”€ randomInRange.ts
β”‚       └── roundTo.ts
β”œβ”€β”€ dist/ (compiled output)
β”œβ”€β”€ .github/workflows/ (CI)
└── package.json

πŸ§ͺ Testing

npm run test

This runs all tests via Jest. Test files are colocated with source files or kept in a __tests__ directory.


🧾 License

ISC Β© Curslo


πŸ’¬ Feedback & Contributions

Feel free to open issues or pull requests. Ideas, bug reports, and feature requests are welcome!

πŸ”— GitHub: github.com/Curslo/prishelets