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

@typedash/typedash

v3.7.14

Published

Domain agnostic utility functions

Downloads

650

Readme

@typedash/typedash

This package houses domain agnostic utility functions that can be used in any project/package. This is the centralized place where you can get util functions without needing to know which underlying package it's coming from.

Everything in this package should be curried/auto-curried, take data last, follow similar patterns as ramda, ramda-adjunct, fp-ts, fp-ts-std, and have thorough test coverage.

Installation

npm install @typedash/typedash
yard add --save @typedash/typedash

Organization

Utility functions are organized based on the type of data they work on. If they don't fit into a group (pipe, flow, ifElse, etc) then they will be exported as bare functions at the root. To encourage cohesiveness, modules have been collected and exported under a reserved abbreviation. See below for the mapping. In each module, you'll find a _external.ts file that houses all the external methods we're re-exporting. Any custom methods that aren't covered by the utils mentioned above are alongside that with tests and exported from the index.ts. The root of the src directory enforces common abbreviations that are loosely tied to how fp-ts organizes itself.

| Module Name | Abbreviation | Note | | ----------------------- | ------------ | ------------------------------- | | function | N/A | Bare word exports, no namespace | | Array | A | | | Apply | AP | | | Boolean | B | | | Date | DATE | | | Either | E | | | Json | J | | | Spectacles | L | L for "Lenses" | | Number | N | | | NonEmptyArray | NEA | | | Option | O | | | Ord | ORD | | | Promise | P | | | Predicate | PRED | | | Record | R | AKA Object/Struct methods | | ReadonlyArray | RA | | | ReadonlyNonEmptyArray | RNEA | | | String | S | | | Semigroup | Semi | | | Task | T | | | TaskEither | TE | | | TaskOption | TO | | | Undefined | U | |

Example

Below is an example of how you would/could use this package in your project.

import { A, R, pipe, double } from '@typedash/typedash'

A.join(', ')(['foo', 'bar']) // 'foo, bar'

R.map((x) => x * 2)({ foo: 5, bar: 6 }) // { foo: 10, bar: 12 }
A.map(double)([5, 6]) // [10, 12]

pipe(
  [5, 6, 5, 10],
  A.map(double),
  A.filter(equal(10)),
  A.map(toString),
  A.join(', '),
) // '10, 10'

Adding functions

Add functions as you see fit, but be careful of conflicting names. As a base, fp-ts functions should b preferred as they are generally safer than the other utility libraries. From there, you can grab methods from other externals and export them by name. Can't find something you need in any of the current externals (see External References)? Implement your own in a separate file inside the appropriate data module and export it in that module's index.ts. Be sure not to override an existing function name!

External References

| Package | Docs Url | | --------------- | ----------------------------------------------------- | | fp-ts | https://gcanti.github.io/fp-ts/modules/ | | fp-ts-std | https://github.com/samhh/fp-ts-std | | ramda | https://ramdajs.com/docs/ | | ramda-adjunct | https://char0n.github.io/ramda-adjunct/2.23.0/RA.html |