npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

boost-ts.utils

v0.0.2

Published

TypeScript utilities to boost typed programming

Downloads

9

Readme

boost-ts.utils

TypeScript Library to boost typed programming

partial

This library offers a partial function call with flexible argument binding. Of course, it's type safe.

import { partial, _1, _2 } from "boost-ts"

function sub (a:number, b:number):number {
    return a - b
}

// bind 2nd argument
const sub10 = partial(sub, _1, 10)        // type :: (a:number)=>number
console.log(sub10(100))                   // output is 90

// swap 1st and 2nd argument
const reverse_sub = partial(sub, _2, _1)  // type :: (a:number, b:number)=>number
console.log(reverse_sub(10, 100))         // output is 90

mkobjmap

Type-safe map for object.

By using Object.entries() and reduce(), we can implement a map-like fnction for Typescript objects.

////////////////////////////////////////////////////////////////
/// Unexpected Case
////////////////////////////////////////////////////////////////

type Box<T> = { value: T }

function boxify<T>(t: T):Box<T> {
    return { value: t }
}

const data = {
    name: "John",
    age: 26
}

const unexpected = Object.entries(data).reduce((acc, [key, value])=>{
    return {
        ...acc,
        [key]: boxify(value)
    }
}, {})

// unexpected.name is ERROR!!
//
// Even with more typing, type will be like ...
// {
//     name: Box<number> | Box<string>
//     age: Box<number> | Box<string>
// }

We want the type { name: Box<string>, age: Box<number> } in this case.

import { mkmapobj } from "boost-ts"

////////////////////////////////////////////////////////////////
// Expected Case
////////////////////////////////////////////////////////////////

type BoxMapType<T> = { [P in keyof T]: [T[P], Box<T[P]>] }

// To reuse 'mapobj', we can list all possible types as tuple
type BoxKeyType = [string, number, boolean, string[], number[]]

// Make 'map' type with Mapped Tuple Type, and apply
const mapobj = mkmapobj<BoxMapType<BoxKeyType>>()

// The dataBox type is `{ name: Box<string>, age: Box<number> }`
const dataBox = mapobj(data, boxify)

chai.assert.equal(dataBox.name.value, data.name)
chai.assert.equal(dataBox.age.value, data.age)

bundle

Supposed we have an interface for set of file operations,

// What we have

interface FileOper {
    dirname: (config:Config) => string,
    read: (config:Config, name:string) => string
    write: (config:Config, name:string, content:string) => number
}

and Config is a singleton, then we expect such interface with curried functions.

// What we expect

interface CurriedFileOper {
    dirname: () => string,
    read: (name:string) => string
    write: (name:string, content:string) => number
}

In such cases, bundle is convenient.

import { bundle } from "boost-ts"

// 'bundle' curries bunch of functions
const curriedFileOper:CurriedFileOper = bundle(config, fileOper)

mergeobj

Type-safe merge of key-value objects

const recordA = {
    personal: {
        name: "John",
        age: "26"
    }
}

const recordB = {
    personal: {
        age: 26,
        nationality: "American"
    }
}

const merged = mergeobj(recordA, recordB)
/*
  The type of 'merged' is

  {
      personal: {
          name: string,
          age: number,
          nationality: string
      }
  }

*/