Naysayers Promote Misery

    @appsweet-co/ts-utils

    0.37.1 • Public • Published

    Logo

    @appsweet-co/ts-utils

    A strongly-typed utility library for TypeScript


    Quick Start

    Node

    Install the package using npm.

    npm i @appsweet-co/ts-utils

    Import utilities directly into your files as needed.

    import { clamp, map, sub } from '@appsweet-co/ts-utils';

    Deno

    📝 NOTE: Support for Deno is a work in progress.

    Export the package from your deps.ts file directly from GitHub.

    export * from "https://raw.githubusercontent.com/Appsweet-co/ts-utils/index.ts";

    Import utilities in your files as needed.

    import { clamp, map, sub } from "../deps.ts";

    API Docs

    We use TypeDoc to generate API docs. Visit the docs website for details.

    Design Goals

    Immutable Data

    Mutated data is hard to work with. Use immutable data instead.

    Pure Functions

    Pure Functions are easy to test and work well with immutable data. They're also referentially transparent and easy for JavaScript engines to optimize.

    Single Input

    We write functions that take exactly one argument. We curry all functions as needed.

    Graceful Fallbacks

    Return fallbacks instead of undefined or throwing errors.

    Fallback First, Data Last

    Passing data as the last argument of a function is great for piping and currying, but TypeScript's typing system works best when we pass in data as the first argument.

    We pass fallback values as the first argument and actual data as the last. This helps TypeScript understand the code while still allowing for piping and currying.

    Code Examples

    Please see the API docs for example code.

    More Info

    Keywords

    none

    Install

    npm i @appsweet-co/ts-utils

    DownloadsWeekly Downloads

    34

    Version

    0.37.1

    License

    MIT

    Unpacked Size

    43 kB

    Total Files

    40

    Last publish

    Collaborators

    • dperuo