Chip's standard TypeScript library
| src | ||
| .gitignore | ||
| .npmrc | ||
| jest.config.js | ||
| Makefile | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| typedoc.json | ||
| yarn.lock | ||
@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";
Documentation
You can view the Typedocs for @chip/cstd here.
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"]);