apr-asyncify
Advanced tools
Comparing version 1.0.1 to 1.0.2
25
index.js
@@ -0,1 +1,26 @@ | ||
/** | ||
* <a id="asyncify"></a> | ||
* Take a sync function and make it async. This is useful for plugging sync functions into a [`waterfall`](#waterfall), [`series`](#series), or other async functions. | ||
* | ||
* [![](https://img.shields.io/npm/v/apr-asyncify.svg?style=flat-square)](https://www.npmjs.com/package/apr-asyncify) [![](https://img.shields.io/npm/l/apr-asyncify.svg?style=flat-square)](https://www.npmjs.com/package/apr-asyncify) | ||
* | ||
* @kind function | ||
* @name asyncify | ||
* @param {Function} function | ||
* @returns {Function} | ||
* | ||
* @example | ||
* import awaitify from 'apr-awaitify'; | ||
* import asyncify from 'apr-asyncify'; | ||
* import waterfall from 'apr-waterfall'; | ||
* import apply from 'apr-apply'; | ||
* | ||
* const readFile = awaitify(require('fs').readFile); | ||
* const pkgPath = path.join(__dirname, './package.json'); | ||
* | ||
* const pkg = await waterfall([ | ||
* apply(readFile, pkgPath, 'utf8'), | ||
* asyncify(JSON.parse) | ||
* ]); | ||
*/ | ||
module.exports = (fn) => { | ||
@@ -2,0 +27,0 @@ return (...args) => { |
{ | ||
"name": "apr-asyncify", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/ramitos/apr/tree/master/packages/asyncify", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2586
3
36
1
32