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

promisie

v3.0.1

Published

Some module

Downloads

140

Readme

Promisie

Coverage Status Build Status NPM version Downloads Per Month npm Join the chat at https://gitter.im/typesettin/promisie

Download Stats

Promisie is an extension of the ES6 native Promise class that provides helpful static methods that are seen in many other Promise libraries

Version

2.0.0-alpha.0

Installation

Because Promisie uses native ES6 Promises, classes and spread operators you must be running Node v6.0.0 or above

$ npm i promisie

Usage

/*
Because Promisie is an extension of the Promise class it also acts as a Promise constructor and shares all prototype methods, but adds promisify and promisifyAll static methods
*/
const Promisie = require('promisie'),
    fs = require('fs');
var readFileAsync = Promisie.promisify(fs.readFile);
readFileAsync('/some/file/path').then(fileData => { ... });
var asyncFs = Promisie.promisifyAll(fs);
asyncFs.readFileAsync('/some/file/path').then(fileData => { ... });
/*
Promisie also exposes a "try" method which works just like "then" but conveniently wrapped in a try/catch block
 */
readFileAsync('/some/file/path')
	.try(data => {
		return data.some.fake.property; //Cant't read property ... of undefined
	})
	.catch(e => { ... });
/*
This would normally halt the execution of your async code because of an unhandled error but the "try" method properly rejects with the error
 */
/*
Promisie also has a series static method which runs and array of functions in series passing the result of each function to the next function.
Additionally there are pipe and compose static methods which return a function expecting arguments that will be passed to the first function in the series (compose reverses the order of the functions it is passed)
*/
let array_of_functions = [fn, fn1, fn2, fn3];
Promisie.series(array_of_functions)
    .then(result => {
        //result is the resolved value of the last function in the array
    })
let pipe = Promisie.pipe(array_of_functions);
pipe('some', 'random', 'arguments')
    .then(result => {
        //result is still the resolved value of the last function in the array with the difference being the first function will be passed the arguments of pipe()
    })
/*
Promisie now has many more helpful methods:
- .map
- .each
- .parallel
- .doWhilst
- .iterate
- .settle
- .all
- .retry
See documentation for more details and test for usage
*/

Notes

Testing

$ npm i promisie
$ cd ./node_modules/promisie
$ npm i
$ npm test

For generating documentation

$ grunt doc
$ jsdoc2md utility/**/*.js index.js > doc/api.md

Todos

  • Add more prototype and static methods
    • Filter
    • Reduce
    • Queue

License

MIT