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

paunkie

v1.0.0

Published

Paunkie [![Build Status](https://travis-ci.org/tusharmath/paunkie.svg?branch=master)](https://travis-ci.org/tusharmath/paunkie) --- A [lodash](lodash.com/docs#initial) inspired [functional reactive programming](https://www.wikiwand.com/en/Functional_react

Downloads

4

Readme

Paunkie Build Status

A lodash inspired functional reactive programming library. Async programming in Javascript isn't a daunting task anymore when you use features like Arrow functions, Promises, es6 generators or es7 Async. EventStreams on the other hand add a bit more sugar to the whole process.

##Installation

npm i paunkie --save

#Examples ###Http request stream Http requests are actually streams but more often than not you end up first filling a buffer with the packets of data and once all the data is transferred and the buffer is full, the callback would be called with the err as first param and concated response as the second. This is how you could achieve the same via paunkie.

var httpRequestStream = HttpRequestStream('http://www.example.com'); //Custom implementation of an EventStream

//Append the packet of data into an empty string
var response = await httpRequestStream.reduce((memory, data) => memory += data, '');

//Log out the response
console.log(response);

###Download a file and save in parts Here the idea is to download a file of size 1024 bytes over http and be able to save it in two parts on the disk.


//File url to be downloaded 
var url = 'http://www.example.com/1024-bytes-file.txt',
  
  //Bytes of data downloaded till now
  downloadedBytes = 0,
  
  //a function that tells which file should the data go to
  part = (data) => {
    downloadedBytes += data.length;
    return Math.floor(downloadedBytes / 512);
  },
  
  //Create two writers for the two files
  writers = [
    new FileWrite('./512-bytes-file-part-1.txt'),
    new FileWrite('./512-bytes-file-part-2.txt')
  ],
  
  //Create an Http Request Stream
  httpRequestStream = HttpRequestStream(url)
    
    //Set the file number in a property with the data
    .map(data => {data, part: part(data)})
    
    //Split the out stream into two parts based on which file writer it needs to go to
    .split( x => x.part === 0, x => x.part === 1),
  
  //A list of total bytes written to disk [512, 512] 
  bytesWritten = await partialRequests.map((req, i) => {
    return req.reduce((bytesWritten, x) => bytesWritten + await writers[i].write(x.data), 0);
  });  
   

#API

###onClose(cb: Function) Attaches listeners for the close event. The Listner is called with the writeCount ie. number of times the stream was written.

###onValue(:Function) Attaches listeners for the value event. The listner is called with the value.

###write(:Object) Write any value to a stream, all the listeners would be triggered with that particular value automatically.

###close() Closes the stream for further writes and also triggers the close event.

###isClosed(): Boolean Returns true or false based on the status of the stream.

###filter(predicate: Function): EventStream Creates a new stream, with only the events that test for truthy via the predicate.

###map(iteratee: Function): EventStream Maps the current stream to a new stream via the iteratee.

###reduce(iteratee: Function, initialValue: Object): Promise Reduces a stream to a value.

#merge(...eventStream: EventStream): EventStream Merges multiple event streams into a single one.

###split(...filters: Function): [EventStream] Splits the current stream into multiple streams based on the filters.

###concat(...eventStream: EventStream): EventStream Like merge but maintains the order of the inputted stream.