Observed since 20 Oct, 18:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
1n-broadutils
A library providing utilities covering a wide range of use cases.
A comprehensive utility library covering a wide range of use cases for both browser and Node.js environments.
browser and node.1n-broadutils/node/filesystem or 1n-broadutils/browser/math).math, timing, validate, data, misc) share a common API across environments.You can install 1n-broadutils using npm, yarn, pnpm, bun, or jsr:
# npm
npm install 1n-broadutils
# yarn
yarn add 1n-broadutils
# pnpm
pnpm add 1n-broadutils
# bun
bun add 1n-broadutils
# jsr
npx jsr add @1natsie/broadutils
The library is split into two primary environments: ./browser and ./node. Each environment has its own set of utilities, and some utilities are shared between both environments.
1n-broadutils/browser - Main entry point for browser utilities.1n-broadutils/browser/canvas - Canvas utilities (resize, getImage, getImageData, cloneImageData, getDimensions, mirrorImageToCanvas, createContextSnapshot, applyContextSnapshot)1n-broadutils/browser/data - Data utilities (array, base64, object, string, clone, convertToDataUrl, textEncoder, textDecoder)1n-broadutils/browser/math - Math utilities (min, max, clamp, constrain, average, hcf, lcm, convert)1n-broadutils/browser/misc - Miscellaneous utilities (noop, createDeferred, allowGC, preventGC)1n-broadutils/browser/network - Network utilities (fetch)1n-broadutils/browser/timing - Timing utilities (time, sleep, setImmediate, clearImmediate)1n-broadutils/browser/validate - Validation utilities (assert, check, isNonNullable, nonNullable)1n-broadutils/browser/types - Type definitions1n-broadutils/node - Main entry point for Node utilities.1n-broadutils/node/data - Data utilities1n-broadutils/node/environment - Environment utilities (which, parseArgs)1n-broadutils/node/filesystem - File system utilities (betterReadStream)1n-broadutils/node/math - Math utilities1n-broadutils/node/misc - Miscellaneous utilities1n-broadutils/node/timing - Timing utilities (time, sleep)1n-broadutils/node/validate - Validation utilities1n-broadutils/node/types - Type definitionsimport { which } from "1n-broadutils/node/environment";
// Locate an executable in the system PATH
const nodePath = which("node");
console.log(nodePath); // e.g. /usr/bin/node
const multipleExes = which.many(["node", "npm"]);
import { betterReadStream } from "1n-broadutils/node/filesystem";
// Read a file using an async generator
for await (const chunk of betterReadStream("./large-file.txt", { chunkSize: 8192 })) {
console.log(chunk.byteLength);
}
// Import works from both browser or node entries
import { clamp, average, convert } from "1n-broadutils/browser/math";
const clamped = clamp(150, 0, 100); // 100
const avg = average([1, 2, 3, 4, 5]); // 3
import { resize, createContextSnapshot, applyContextSnapshot } from "1n-broadutils/browser/canvas";
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d")!;
// Resize canvas to [width, height]
resize(canvas, [800, 600]);
// Save and restore context state easily
const snapshot = createContextSnapshot(ctx);
// ... draw things ...
applyContextSnapshot(ctx, snapshot);
import { array, clone, string } from "1n-broadutils/node/data";
// Deep clone objects
const original = { a: 1, b: { c: 2 } };
const copied = clone(original);
import { time } from "1n-broadutils/node/timing";
// Measure execution time
const [duration, result] = time(() => {
// expensive operation
return 42;
});
console.log(`Execution took ${duration}ms`);
Clone the repository.
Install dependencies using Bun:
bun install --dev
Add awesome features or bug fixes.
Format the code:
bun run format
Run the test suites:
bun run test:node
bun run test:browser
Build the project for distribution:
bun run build
This project is licensed under the MIT License - see the LICENSE file for details.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@tsconfig/node-tsEnvironment{
"local_name": "@tsconfig/node-ts",
"alias": false,
"peer_metadata": null
} | ^23.6.4 | development |
@tsconfig/node20Environment{
"local_name": "@tsconfig/node20",
"alias": false,
"peer_metadata": null
} | ^20.1.9 | development |
@types/bunEnvironment{
"local_name": "@types/bun",
"alias": false,
"peer_metadata": null
} | ^1.3.14 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^25.9.1 | development |
prettierEnvironment{
"local_name": "prettier",
"alias": false,
"peer_metadata": null
} | ^3.8.1 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^6.0.2 | development |
vitestEnvironment{
"local_name": "vitest",
"alias": false,
"peer_metadata": null
} | ^4.1.8 | development |
Source distribution
{
"integrity": "sha512-843YcrHXtKmJV8xIn8qUK/Lx5jHlvDEZzGsl26wLMer9JILNiJuoKHRmncHELaCi3taoh4bpTjGNflc7oC7pzA==",
"shasum": "3ae4d111f59ef0cb234355e2067cd0afb4db7ca9",
"tarball": "https://registry.npmjs.org/1n-broadutils/-/1n-broadutils-0.0.2-patch.0.tgz",
"fileCount": 113,
"unpackedSize": 354923,
"signatures": [
{
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
"sig": "MEYCIQCWrRlhB7st9yA7jGnQFM3EYbpNcAweixHvcAYybIsELwIhANTDwaj2kk2eeq5FtqJaL9ZxTAMoAJ6EQnHck9mfo1gJ"
}
]
}Shared repository data · GitHub
Public sponsor counts have not been collected. These signals belong to the repository owner.
github · 1 observations shown. Missing days are unknown.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-21 | 0 | 2026-10-21T20:27:34.5562553Z |
Observed since 20 Oct, 18:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:74f0cba9dd5b202bbb4d312ec105eb4e5f3af927ea7a7e99dd896c94b6a172dc