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 🙏

© 2024 – Pkg Stats / Ryan Hefner

h-ts

v1.0.91

Published

Typescript Helpers

Downloads

142

Readme

Helpers for typescript

(documentation, wip)

export {AnyHelp} from "./AnyHelp";

helpers that work on any type e.g.
isNotNull

export {ArrayHelp} from "./ArrayHelp"

helpers for array, better typesafety for higher order function array helpers

export {ObjectHelp} from "./ObjectHelp"

helper for object

export {EQ, EQ_NS} from "./Equality"

export {KeySet} from "./KeySet"

export {MapHelp} from "./MapHelp"

export {WebHelp} from "./WebHelp"

export {Global} from "./Global"

export {ChunkedIterate} from "./ChunkedIterate"

export {Decorators} from "./Decorators"

export {TypeHelp} from "./TypeHelp"

export {StringHelp} from "./StringHelp"

export {FunctionHelp} from "./FunctionHelp"

export {ProxyHelp} from "./ProxyHelp"

export {Ided, Idify} from "./Ided"

a way to DRYly write an object whose properties use the key they are assigned to in their own initialization

type Color<T extends string> = {name: T}
const colors = {
  ...Ided.byName({name: "red"}),
  ...Ided.byName({name: "green"}),
}
//Colors will have the type:
{red: {name: "red"}, {green: {name: "green"}}

export {Heap} from "./Heap"

a simple heap implementation

export {YoconHelp} from "./yocon/YoconHelp"

a work in progress port of the

export {StringEnum, Enum} from "./Enum"

better versions of enums

export * from "./TopLevelExports"

export function createRecord

function createRecord<T extends object>(obj: T,): T extends object ? Record<keyof T, TypeHelp.ValueType<T>> : never {
  return obj as any
}

export const unreachable = LangHelp.unreachable

export const isNotNull = AnyHelp.isNotNull

export const augment = AnyHelp.augment

export const createKeySet = KeySet.create

export const createPrefixedKeySet = KeySet.createPrefixed

export const iife = (f : () => T) : T => f()

//iife = immediately invoked function expression, useful to avoid having to add extra parens
iife(() => x + 1) // invokes immediately

(() => x + 1)()//Lines starting with a `(` are Problematic without explicit semicolons
//Consider
const y = 1
const x = y
(() => x + 1)()
//This will be interpreted as
const y = 1
const x = y(() => x + 1)()

export const ensure = TypeHelp.ensure

export const ensureValue = TypeHelp.ensureValue

export const literal = TypeHelp.literal

export const infer = TypeHelp.infer

export const cast = TypeHelp.cast

export const cast_any = TypeHelp.cast_any

export const tuple = TypeHelp.tuple

export const memo = Decorators.memo

export const cache = Decorators.cache

export * from "./TopLevelTypes"

export type Id = TypeHelp.Id

export type PropsOf = TypeHelp.PropsOf

export type UnionToIntersection = TypeHelp.UnionToIntersection

export type UnionFromArray<T extends any[]> = TypeHelp.UnionFromArray

export type IntersectionFromArray<T extends any[]> = TypeHelp.IntersectionFromArray

export type StringMap = TypeHelp.StringMap

export type Readyonly = TypeHelp.Readyonly

export type Diff<T extends keyof any, U extends keyof any> = TypeHelp.Diff<T, U>

export type Omit<T, K extends keyof T> = TypeHelp.Omit<T, K>

export type Replace<T, K extends keyof T, V> = TypeHelp.Replace<T, K, V>

export type DeepPartial = TypeHelp.DeepPartial

export type KeyType = keyof T

export type ValueType = T[keyof T]