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

barely

v0.0.3

Published

A functional programming library written in TypeScript.

Readme

Barely Functional

status

A "functional programming library written in TypeScript.

npm install barely --save

This library favors accurate typing over functionality. Where possible, it limits methods to four parameters. It fiddles with method signatures to more accurately reflect the types. Generally, it makes concessions to favor common scenarios.

Current

Monads

Maybe

The maybe monad is incredibly useful. It helps you deal with a common problem—optional values.


interface Person {
    first:string;
    last: string;
    passport: string;
    company: Company
}

interface Comapny {
    name: string;
}

let me: Person = {
    first: "Mason",
    last: "Meyer",
    passport: null, 
    company: null
};

// Let's try and format it or return an empty string
let passportNumber:string = Maybe.just(me)
     .map(x => `$#{x.passport}`)
     .else(() => "");

// Maybes :heart: to be chained. 
let companyNameMaybe:Maybe<string> = Maybe.just(me)
            .map(x => x.company)
            .map(x => x.name);
            
let bigCompanyName:Maybe<string> = companyNameMaybe.map(x => x.name.toUpperCase());
let companyName = companyNameMaybe.orError('You need to have a company name');

Pipe and Compose

Pipe

Pipe helps you combine functions (from left to right) into a new function. Conceptually, it is equal to:

pipe(fn1, fn2, fn3)(arguments) == fn3(fn2(fn1(arguments)));

Examples,

// Adds an exlaimation point to the end of a string
let exclaim = (x: string) => x + "!";
// func to upper case a string
let toUpper = (x: string) => x.toUpperCase();

let yell = pipe(toUpper, exclaim);

// HELLO WORLD!
yell('hello world');

// We can also combine this new function in to new functions
let twice = (x: string) => x + ' ' + x;
let yellTwice = pipe(yell, twice);

// HI! Hi!
yellTwice('hi');

Compose

Compose is similar to pipe except it processes right to left. It is equal to

pipe(fn1, fn2, fn3)(arguments) == fn1(fn2(fn3(arguments)));
  let plusOne = (x:number) => x + 1;
  let timesTwo = (x: number) => x * 2;
  let plusTwo = (x: number) => x + 2;

  // Compose goes right to left
  // 9  = ((2 + 2) * 2) + 1
  compose(plusOne, timesTwo, plusTwo)(2);

  // Pipe goes left to right
  // 8 = ((2 + 1) * 2) + 2
  pipe(plusOne, timesTwo, pluseTwo)(2);  

Curry

Makes a function of multiple parameters into a sequence of single param functions. You can think of it like this:

curry(fn(x, y)) === (x) => (y) => result

For example,

let multiply = (x: number, y: number) => x * y;

let double = curry(multiply, 2);

// Typescript will automatically type this as (x:number) => number
// Result is 12
double(6);

Future

  • [] Identity Monad
  • and more...