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

tiny-frp

v1.0.0

Published

A tiny state management library built for ProgrammersWeek 2021

Downloads

1

Readme

TinyFRP (TFRP)

A tiny transparent function reactive library built for didactic purposes.

Originally meant to illustrate the points about transparent reactive programming during ProgrammersWeek 2021 event, so it's definitely not production ready.

API

The library exports 3 functions: observable, effect and computed , the building blocks of any reactive library. It does not offer wrappers around various used land frameworks since their implementation it's pretty simple and can be easily achieved using used land code.

observable(data)

Wraps any data, either primitive or objects and turns it into an observable entity.

Wrapping a primitive returns an object with a single property: value.

effect(fn)

Executes a function a tracks the observables used inside it. It re-runs the fn function whenever any read observable property changes.

        const o = observable({firstName: 'a', lastName: 'b'});
        const effectFn = () => { console.log(`${o.firstName}-${o.lastName}`); };
        const unsubscribe = effect(effectFn);
        unsubscribe();

Returns a function that, when called, it removes the watches on any tracked observable properties.

computed(fn)

A variation of the effect function that is meant to compute derived values. Just as effect it auto-magically tracks any read observables inside the fn function but it also memoizes the return value of fn() until any tracked observables change.

As such fn is deemed to be a PURE function and return a value.

        const o = observable({firstName: 'a', lastName: 'b'});
        const computedFn = () => `${o.firstName}-${o.lastName}`;
        const fullName = computed(computedFn);
        console.log(fullName.value);

It returns an observable instance wrapping whatever value fn() returned.