It appears that the repository has undergone several changes and renamings:

This commit is contained in:
2025-06-10 13:23:37 +02:00
parent a4a293a744
commit 7e4bfbd4d7
11470 changed files with 704 additions and 1206091 deletions

View File

@ -1,11 +0,0 @@
1.6.0 / 2015-01-11
==================
* feat: exports thenify
* support node 0.8+
1.5.0 / 2015-01-09
==================
* feat: support backward compatible with callback

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,66 +0,0 @@
# thenify-all
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Gittip][gittip-image]][gittip-url]
Promisifies all the selected functions in an object.
```js
var thenifyAll = require('thenify-all');
var fs = thenifyAll(require('fs'), {}, [
'readFile',
'writeFile',
]);
fs.readFile(__filename).then(function (buffer) {
console.log(buffer.toString());
});
```
## API
### var obj = thenifyAll(source, [obj], [methods])
Promisifies all the selected functions in an object.
- `source` - the source object for the async functions
- `obj` - the destination to set all the promisified methods
- `methods` - an array of method names of `source`
### var obj = thenifyAll.withCallback(source, [obj], [methods])
Promisifies all the selected functions in an object and backward compatible with callback.
- `source` - the source object for the async functions
- `obj` - the destination to set all the promisified methods
- `methods` - an array of method names of `source`
### thenifyAll.thenify
Exports [thenify](https://github.com/thenables/thenify) this package uses.
[gitter-image]: https://badges.gitter.im/thenables/thenify-all.png
[gitter-url]: https://gitter.im/thenables/thenify-all
[npm-image]: https://img.shields.io/npm/v/thenify-all.svg?style=flat-square
[npm-url]: https://npmjs.org/package/thenify-all
[github-tag]: http://img.shields.io/github/tag/thenables/thenify-all.svg?style=flat-square
[github-url]: https://github.com/thenables/thenify-all/tags
[travis-image]: https://img.shields.io/travis/thenables/thenify-all.svg?style=flat-square
[travis-url]: https://travis-ci.org/thenables/thenify-all
[coveralls-image]: https://img.shields.io/coveralls/thenables/thenify-all.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/thenables/thenify-all
[david-image]: http://img.shields.io/david/thenables/thenify-all.svg?style=flat-square
[david-url]: https://david-dm.org/thenables/thenify-all
[license-image]: http://img.shields.io/npm/l/thenify-all.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/thenify-all.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/thenify-all
[gittip-image]: https://img.shields.io/gratipay/jonathanong.svg?style=flat-square
[gittip-url]: https://gratipay.com/jonathanong/

View File

@ -1,73 +0,0 @@
var thenify = require('thenify')
module.exports = thenifyAll
thenifyAll.withCallback = withCallback
thenifyAll.thenify = thenify
/**
* Promisifies all the selected functions in an object.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
function thenifyAll(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify)
}
/**
* Promisifies all the selected functions in an object and backward compatible with callback.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
function withCallback(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
}
function promisifyAll(source, destination, methods, promisify) {
if (!destination) {
destination = {};
methods = Object.keys(source)
}
if (Array.isArray(destination)) {
methods = destination
destination = {}
}
if (!methods) {
methods = Object.keys(source)
}
if (typeof source === 'function') destination = promisify(source)
methods.forEach(function (name) {
// promisify only if it's a function
if (typeof source[name] === 'function') destination[name] = promisify(source[name])
})
// proxy the rest
Object.keys(source).forEach(function (name) {
if (deprecated(source, name)) return
if (destination[name]) return
destination[name] = source[name]
})
return destination
}
function deprecated(source, name) {
var desc = Object.getOwnPropertyDescriptor(source, name)
if (!desc || !desc.get) return false
if (desc.get.name === 'deprecated') return true
return false
}

View File

@ -1,34 +0,0 @@
{
"name": "thenify-all",
"description": "Promisifies all the selected functions in an object",
"version": "1.6.0",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
"license": "MIT",
"repository": "thenables/thenify-all",
"dependencies": {
"thenify": ">= 3.1.0 < 4"
},
"devDependencies": {
"bluebird": "2",
"istanbul": "0",
"mocha": "2"
},
"scripts": {
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/.bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter dot"
},
"keywords": [
"promisify",
"promise",
"thenify",
"then",
"es6"
],
"files": [
"index.js"
],
"engines": {
"node": ">=0.8"
}
}