@raincheck/glyph
v0.1.2
Published
Framework-independent TypeScript utilities and types.
Readme
@raincheck/glyph
Small, framework-independent, tree-shakeable TypeScript utilities.
npm install @raincheck/glyphimport { pick } from "@raincheck/glyph/object";
import { resolveNumberProp } from "@raincheck/glyph/math";
import { insertAt } from "@raincheck/glyph/array";Only explicit module subpath imports are supported. The package ships ESM JavaScript and TypeScript declarations and requires Node.js 18 or newer.
Utilities
| Subpath | Utilities | | -------- | ------------------------------------------------------------------- | | array | Insertion, grouping, partitioning, selection, and neighboring items | | object | Cloning, picking, omitting, shallow differences, and selectors | | string | Truncation and hashing | | math | Clamping and numeric property resolution | | date | UTC date formatting | | time | Duration conversion, timestamps, and time parsing | | enum | Numeric enum extraction | | parse | Value parsing, property defaults, and allowed values | | schema | Schema validation, enums, defaults, and numeric constraints | | persist | Browser storage | | platform | Platform detection | | promises | Settled promise values |
- Array helpers include random and hash selection, neighboring items, and partitioning.
- The parser accepts numeric strings through numeric; number accepts only finite numbers; numericPlus returns undefined for nonpositive results.
- Date helpers use native Date and format UTC values.
- Browser storage reads return an empty object when unavailable or invalid.
- groupBy preserves key types and insertion order; cloneDeep uses structuredClone; dateFromTime validates input; ellipses honors the supplied length.
Development
npm install
npm run verifyPublishing
Run in Git Bash from this repository:
npm run releaseThe script verifies the package, prompts for an npm token without displaying it, and publishes the current version publicly to npm. The token is passed through the script's environment and cleared when the script exits; it is never written to a file. The committed .npmrc contains only the NPM_TOKEN placeholder.
The token must have publishing access to the package scope. npm may require a 2FA challenge unless the token permits bypassing 2FA.
To verify and preview publishing without uploading or prompting for a token:
npm run release -- --dry-runUse a new package version for each release.
