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

@geordi7/fint

v0.1.7

Published

Strongly typed tools for typescript

Downloads

16

Readme

fint

A library of strongly typed tools for typescript

npm install -s '@Geordi7/fint';

Property Proxies

Create proxies for functions over the properties of a virtual object.

import {readProxy} from '@Geordi7/fint';

const prefixy = readProxy((s1: string) => (s2: string) => s1 + s2);
const postfixy = readProxy((s1: string) => (s2: string) => s2 + s1);

const example1 = prefixy.abc('xyz')     // 'abcxyz'
const example2 = postfixy.abc('xyz')    // 'xyzabc'
const example3 = prefixy.hello(postfixy.world(' ')) // 'hello world'

or an example with html tags

const tag = readProxy((tagname: string) => (props: Record<string, string>, ...content: string[]): string =>
    content.length ?
        `<${tagname} ${formatProps(props)}>${content.join('\n')}</${tagname}>` :
        `<${tagname} />`);

const formatProps = (props: Record<string,string>) =>
    rec.e(props).map(([k,v]) => ` ${k}="${v}"`).join('');

const {html, head, body, title, div, p} = tag;

const doc = html({},
    head({}, title({}, 'A clever example of using a readProxy to create html tag functions')),
    body({},
        div({class: 'centered-x centered-y'},
            p({}, 'paragraph 1'),
            p({}, 'paragraph 2')
        )
    )
);

Data Transformation tools

easily create data transform pipelines for sync (pipe/into) or async (bridge/over) code.

point-free wrappers for common HOFs in:

  • arr for arrays
  • rec for records
  • iter for iterators
  • maybe for unions with null or undefined

and some helpers in

  • str for strings
  • set for sets
  • obj for general objects
import {rec, arr, flow} from '@Geordi7/fint';

data = [1,2,3,4,5];
labels = ['a', 'b', 'c', 'd', 'e'];

const x = flow([labels, data],      // [string[], number[]]
    arr.zip,                        // [string, number][]
    rec.from,                       // Record<string, number>
    rec.map(n => n > 2),            // Record<string, boolean>
    rec.entries,                    // [string, boolean][]
    arr.order(([k]) => k)           // [string, boolean][] (sorted on the strings)
);
import {over} from '@Geordi7/fint';

async function delay<T>(miliseconds: number,v: T): Promise<T> {
    await new Promise(r => setTimeout(r, miliseconds));
    return v;
}

(async () => {
    await over([1,2,3,4,5],
        n => delay(1000, n)),

})()

Other

a study on numerics