@cargo-ai/utils
v1.0.28
Published
Shared TypeScript utilities for Cargo.
Readme
@cargo-ai/utils
Shared TypeScript utilities for Cargo.
A collection of helpers used across Cargo packages and applications: arrays, dates, strings, numbers, JSON, validation, cron, storage helpers, and more.
Documentation: docs.getcargo.ai
Installation
npm install @cargo-ai/utilsUsage
Most helpers are available from the root entry point:
import {
formatDate,
parseDate,
formatBytes,
debounce,
pluralize,
parseCronExpression,
// ... and more
} from "@cargo-ai/utils";Workflow layout is isolated in its own subpath so consumers do not load ELK unless they use it:
import { layoutWorkflowNodes } from "@cargo-ai/utils/workflow-layout";
const layoutedNodes = await layoutWorkflowNodes(nodes, {
nested: "recursive",
});Areas covered
- Array – array helpers
- Date – date/time formatting, parsing, timezone handling
- String – string formatting and parsing
- Number – number formatting and rounding
- JSON – JSON parsing and schema helpers
- Validation – validation utilities
- Zod – Zod-related helpers
- Cron – cron expression parsing
- Storage – key/value and storage helpers
- Expression – expression-related utilities
- Other – base64, bytes, colors, delay, poll, random, schema, etc.
Check the built TypeScript definitions (build/src/) or your IDE for the full list of exports.
Requirements
- Node.js 22.x
- TypeScript (for types)
License
See the root of the repository for license information.
