@toolpouch/sdk
v1.0.0
Published
ToolPouch utility functions for Node.js and browser
Downloads
358
Maintainers
Readme
@toolpouch/sdk
Free utility functions for Node.js and browser. Dates, text, data formatting, generators, calculators, and color conversion — all in one lightweight package.
No dependencies. TypeScript included. Tree-shakeable.
Install
npm install @toolpouch/sdkQuick Start
import { businessDaysBetween } from '@toolpouch/sdk/dates';
import { formatJSON } from '@toolpouch/sdk/data';
import { toCamelCase } from '@toolpouch/sdk/text';
// Date calculations
const days = businessDaysBetween('2026-01-01', '2026-12-31');
// { businessDays: 261, calendarDays: 364, weekendDays: 104 }
// JSON formatting
const formatted = formatJSON('{"name":"test","value":42}', 2);
// Text transformation
const camel = toCamelCase('hello world test'); // 'helloWorldTest'Modules
Dates (@toolpouch/sdk/dates)
| Function | Description |
|----------|-------------|
| businessDaysBetween(from, to) | Count business days between dates |
| daysBetween(from, to) | Count calendar days |
| weeksBetween(from, to) | Count weeks |
| monthsBetween(from, to) | Count months |
| dateAdd(date, amount, unit) | Add days/weeks/months/years |
| dateFormat(date, format) | Format as ISO, US, EU, or long |
| isLeapYear(year) | Check if year is a leap year |
| weekNumber(date) | Get ISO week number |
| age(birthDate) | Calculate exact age |
| daysUntil(targetDate) | Days from today to target |
Text (@toolpouch/sdk/text)
| Function | Description |
|----------|-------------|
| toCamelCase(text) | Convert to camelCase |
| toSnakeCase(text) | Convert to snake_case |
| toKebabCase(text) | Convert to kebab-case |
| toPascalCase(text) | Convert to PascalCase |
| toSlug(text) | Generate URL-friendly slug |
| removeExtraSpaces(text) | Collapse whitespace |
| extractUrls(text) | Extract all URLs |
| extractEmails(text) | Extract all email addresses |
| extractNumbers(text) | Extract all numbers |
| sortLines(text, mode?) | Sort lines alphabetically |
| removeDuplicateLines(text) | Remove duplicate lines |
| reverseText(text) | Reverse a string |
| wordCount(text) | Count words, characters, lines |
| morseEncode(text) | Text to Morse code |
| morseDecode(morse) | Morse code to text |
Data (@toolpouch/sdk/data)
| Function | Description |
|----------|-------------|
| formatJSON(json, indent?) | Pretty-print JSON |
| minifyJSON(json) | Minify JSON |
| validateJSON(json) | Check if JSON is valid |
| jsonToYaml(json) | Convert JSON to YAML |
| csvToJson(csv) | Parse CSV to JSON array |
| jsonToCsv(json) | Convert JSON array to CSV |
| formatXml(xml, indent?) | Pretty-print XML |
| formatSql(sql) | Format SQL queries |
| parseQueryString(qs) | Parse URL query string |
| buildQueryString(params) | Build query string from object |
Generators (@toolpouch/sdk/generators)
| Function | Description |
|----------|-------------|
| uuid() | Generate a UUID v4 |
| randomNumber(min, max) | Random number in range |
| randomString(length, charset?) | Random string |
| randomPick(items, count?) | Pick random items from array |
| hash(text, algorithm?) | SHA-256 or MD5 hash |
| passwordStrength(password) | Check password strength |
Calculators (@toolpouch/sdk/calculators)
| Function | Description |
|----------|-------------|
| tipCalculator(bill, pct, people?) | Calculate tip and split |
| discountCalculator(price, pct) | Calculate discount |
| compoundInterest(p, r, t, n?) | Compound interest |
| loanPayment(p, r, years) | Monthly loan payment |
| percentageChange(old, new) | Percentage change |
| unitConvert(value, from, to) | Convert units |
Colors (@toolpouch/sdk/colors)
| Function | Description |
|----------|-------------|
| hexToRgb(hex) | HEX to RGB |
| rgbToHex(r, g, b) | RGB to HEX |
| hexToHsl(hex) | HEX to HSL |
| colorConvert(input) | Convert between all formats |
License
MIT - Buukmark OU
