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

agos

v0.11.1

Published

JavaScript utility for data flow composition

Downloads

16

Readme

Agos

JavaScript utility for data flow composition.

Overview

Agos (Filipino translation of Stream) is a utility library that helps the data flow to be composed in a functional manner. It is inspired by other reactive libraries like RxJS, xstream and mostjs but with one key difference, the data source is naturally interactive. The general idea of the library is base on the article Redefining Observarble, basically, it enables the data source to be reactive with an outside entity like an observer. It is also implements Fantasy Land Semigroup, Monoid, Functor, Apply, Applicative, Chain, Monad and has interoperability in Observable.

Installation

Install it using npm or yarn.

npm install agos

Example

import Stream, { pipe, create, filter, listen } from "agos";

// create main source
const interval = create((open, next, fail, done, talkback) => {
  let count = 0;
  // propagate data
  const id = setInterval(() => next(++count), 100);

  // talkback is another stream that comes
  // from the outside this enable the main
  // source to be reactive on cancellation
  // or anything depending on the implementaion,
  // see that this piped stream filters only data
  // that pertains to Stream cancellation stopping
  // the data propagation
  pipe(
    talkback,
    filter(data => data === Stream.CANCEL),
    listen(() => {
      clearInterval(id);
      done(true)
    })
  )
  open();
});

// create cancel source
const cancel = create((open, next, fail, done) => {
  open();
  setTimeout(() => {
    // propagates CANCEL
    next(Stream.CANCEL);
    done(false);
  }, 500);
});

// listen to main source and 
// passing the cancel source to
// listen function
pipe(
  interval,
  listen({
    open: () => console.log("open"),
    next: value => console.log(value),
    fail: error => console.log(error),
    done: cancelled => console.log("done", "cancelled", cancelled),
  }, cancel)
);

// logs
// open
// 1
// 2
// 3
// 4
// done cancelled true

License

This project is licensed under the MIT License - see the LICENSE file for details.

switch back to never as default talkback source

multicast bug where all listenerrs are cancelled even only one cancel signal has been propagated