Skip to content

bengry/typedash

Repository files navigation

typedash

npm link downloads playground

A modern collection of utility functions for all occasions, all written in TypeScript and type-safe.

Similar to lodash but with a focus on simplicity and type-safety (no excessive checks are made, trust the compiler), tree-shaking, and leveraging the platform whenever possible.

Features

  • 📦 Modern and tree-shakeable
  • 🔥 Written in and designed to work with TypeScript (plain JavaScript also supported)
  • 🚫 No runtime dependencies
  • 🌱 Growing collection of 55+ type-safe utility functions

Installation

npm install typedash
# or using yarn
yarn add typedash

Usage

typedash provides utility functions that can be imported and used in your TypeScript projects. Here’s an example of how to import and use the pick function:

import { objectKeys } from 'typedash';
import { pick } from 'typedash/pick'; // either syntax works

const obj = {
  a: 1,
  b: 2,
  c: 3,
};

const result = objectKeys(obj); // ["a", "b", "c"]
//     ^? ("a" | "b" | "c")[]

const result2 = pick(obj, ['a', 'b']); // { a: 1, b: 2 }
//     ^? { a: number, b: number }

License

typedash is MIT licensed.