diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5760be5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 922d9c7..bfb1212 100644 --- a/.gitignore +++ b/.gitignore @@ -16,12 +16,14 @@ coverage # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt +# node-waf configuration +.lock-wscript + # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory -# Deployed apps should consider commenting this line out: -# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules .DS_Store diff --git a/LICENSE b/LICENSE index 0882d5f..9aedc0d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,21 @@ The MIT License (MIT) -Copyright (c) 2014 Blaine Bublitz +Copyright (c) 2015 Blaine Bublitz, Eric Schoffstall and other contributors -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: +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. +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. diff --git a/README.md b/README.md index 6c58ac7..b97b008 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ -async-done -========== +
+ + + +
-[![build status](https://secure.travis-ci.org/gulpjs/async-done.png)](http://travis-ci.org/gulpjs/async-done) +# async-done -Handles completion and errors for callbacks, promises, observables, child processes and streams. +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] -Will run call the function on `nextTick`. This will cause all functions to be async. +Force async using `nextTick` and normalize completion/errors for callbacks, promises, observables, child processes and streams. ## Usage @@ -49,21 +52,21 @@ Optionally takes a callback to call when async tasks are complete. #### Completion and Error Resolution -* `Callback` called +* `Callback` (`done`) called - Completion: called with null error - Error: called with non-null error * `Stream` or `EventEmitter` returned - - Completion: [end-of-stream](https://www.npmjs.org/package/end-of-stream) module - - Error: [domains](http://nodejs.org/api/domain.html) + - Completion: [end-of-stream][end-of-stream] module + - Error: [domains][domains] * `Child Process` returned - - Completion [end-of-stream](https://www.npmjs.org/package/end-of-stream) module - - Error: [domains](http://nodejs.org/api/domain.html) + - Completion [end-of-stream][end-of-stream] module + - Error: [domains][domains] * `Promise` returned - - Completion: [onFulfilled](http://promisesaplus.com/#point-26) method called - - Error: [onRejected](http://promisesaplus.com/#point-30) method called + - Completion: [onFulfilled][promise-onfulfilled] method called + - Error: [onRejected][promise-onrejected] method called * `Observable` returned - - Completion: [onCompleted](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/observable.md#rxobservableprototypesubscribeobserver--onnext-onerror-oncompleted) method called - - Error: [onError](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/observable.md#rxobservableprototypesubscribeobserver--onnext-onerror-oncompleted) method called + - Completion: [onCompleted][observable-subscribe] method called + - Error: [onError][observable-subscribe] method called __Warning:__ Sync tasks are __not supported__ and your function will never complete if the one of the above strategies is not used to signal completion. However, thrown errors will be caught by the domain. @@ -84,3 +87,25 @@ Errors can be caused by: ## License MIT + +[end-of-stream]: https://www.npmjs.org/package/end-of-stream +[domains]: http://nodejs.org/api/domain.html +[promise-onfulfilled]: http://promisesaplus.com/#point-26 +[promise-onrejected]: http://promisesaplus.com/#point-30 +[observable-subscribe]: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/subscribe.md + +[downloads-image]: http://img.shields.io/npm/dm/async-done.svg +[npm-url]: https://npmjs.org/package/async-done +[npm-image]: http://img.shields.io/npm/v/async-done.svg + +[travis-url]: https://travis-ci.org/gulpjs/async-done +[travis-image]: http://img.shields.io/travis/gulpjs/async-done.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/async-done +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/async-done.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/async-done +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/async-done/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..625fc10 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,25 @@ +# http://www.appveyor.com/docs/appveyor-yml +# http://www.appveyor.com/docs/lang/nodejs-iojs + +environment: + matrix: + # node.js + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "4" + - nodejs_version: "5" + - nodejs_version: "6" + +install: + - ps: Install-Product node $env:nodejs_version + - npm install + +test_script: + - node --version + - npm --version + - cmd: npm test + +build: off + +# build version format +version: "{build}" diff --git a/package.json b/package.json index 38d6db5..12b9e0e 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "async-done", "version": "1.2.0", - "description": "Handles completion and errors for callbacks, promises, observables and streams.", - "author": "Blaine Bublitz