Installation
@chip:registry=npm install @chip/cstd@0.0.5"@chip/cstd": "0.0.5"About this package
@chip/cstd
Chip's standard library.
This is a somewhat eclectic collection of functions, types, etc. that I find useful in different projects that I've pulled into a standard library.
Using @chip/cstd
First, add this registry in your project's .npmrc file:
@chip:registry=https://git.gg/api/packages/chip/npm/
Then just install @chip/cstd as normal, e.g.:
yarn add @chip/cstd
You can import the entire package to rely on your packer to do any code splitting, or you can perform more specific imports yourself:
import { safeConcat } from "@chip/cstd";
import { safePush } from "@chip/cstd/array";
Functional Implementation
If you'd prefer unary versions of functions import like so. See also ramda's curry though it may be what you're really looking for.
import { safeConcat } from "@chip/cstd/fp";
const concatToOriginal = safeConcat(sourceArray);
const batchOne = concatToOriginal([1, 2, undefined]);
const batchTwo = concatToOriginal(["billy", undefined, "bobertson"]);
Dependencies
Development dependencies
| ID | Version |
|---|---|
| @types/jest | ^30.0.0 |
| jest | ^30.2.0 |
| ts-jest | ^29.4.5 |
| typescript | ^5.3.0 |