Skip to content

All Promise Utils functions from github.com/sindresorhus bundled together!

License

Notifications You must be signed in to change notification settings

Kladdkaka/p-fun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

p-fun


All Promise Utils functions from github.com/sindresorhus bundled together!

Installation


npm install p-fun --save

Usage


const p = require('p-fun')

/*
    That's it!, now you can call any of his functions :)
*/

p.delay(1000)
 .then(() => console.log('I waited 1000 milliseconds to send this message! :D'))

Information


One important thing is that due to not all of the packages being legal variable names in JavaScript (for example the package p-map would be interpreted as p - map, like it would be a math equation)

Due to this, the keys in the object that represent the function will follow this naming convention:

  1. If the module does not start with p-, it will be temporary be added to the module name, like this require('delay') -> require('p-delay')
  2. p- will now be removed from the key name, due to the recommended varible the require('p-fun') being assigned to is p or P, like the example above!
  3. If the module name has hyphens (-) in it, it will get removed, and the following character will be capitalized, like this require('do-whilst') -> require('doWhilst')
  4. Now the module name will get added to the object that this module is exporting, for example like this:
    const p = {
        doWhilst: require('p-do-whilst')
    }

Documentation


require('p-fun')

Returns an object with all the Promise util functions!

They will be mapped just like this:

License

MIT

About

All Promise Utils functions from github.com/sindresorhus bundled together!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published