Full Code of petkaantonov/bluebird for AI

master c220cfe48086 cached
369 files
1.7 MB
413.1k tokens
656 symbols
1 requests
Download .txt
Showing preview only (1,846K chars total). Download the full file or copy to clipboard to get everything.
Repository: petkaantonov/bluebird
Branch: master
Commit: c220cfe48086
Files: 369
Total size: 1.7 MB

Directory structure:
gitextract_5o3u1a2h/

├── .editorconfig
├── .gitignore
├── .istanbul.yml
├── .jshintignore
├── .jshintrc
├── .travis.yml
├── API.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bench
├── benchmark/
│   ├── README.md
│   ├── analysis/
│   │   ├── promises-bluebird-parallel.js
│   │   └── promises-bluebird.js
│   ├── doxbee-sequential/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-waterfall.js
│   │   ├── callbacks-suguru03-neo-async-waterfall.js
│   │   ├── generators-tj-co.js
│   │   ├── observables-Reactive-Extensions-RxJS.js
│   │   ├── observables-baconjs-bacon.js.js
│   │   ├── observables-caolan-highland.js
│   │   ├── observables-pozadi-kefir.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-ecmascript6-native.js
│   │   ├── promises-kriskowal-q.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-native-async-await.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── doxbee-sequential-errors/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-waterfall.js
│   │   ├── callbacks-suguru03-neo-async-waterfall.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-kriskowal-q.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── lib/
│   │   ├── catcher.js
│   │   ├── dummy.js
│   │   ├── fakemaker.js
│   │   ├── fakes-ctx.js
│   │   ├── fakes.js
│   │   ├── fakesC.js
│   │   ├── fakesO.js
│   │   ├── fakesObservable.js
│   │   ├── fakesP-ctx.js
│   │   ├── fakesP.js
│   │   ├── fakesSJS-dst.js
│   │   ├── fakesSJS-src.sjs
│   │   ├── promiseSupport.js
│   │   └── timers-ctx.js
│   ├── madeup-parallel/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-parallel.js
│   │   ├── callbacks-suguru03-neo-async-parallel.js
│   │   ├── generators-tj-co.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-ecmascript6-native.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-native-async-await.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── package.json
│   └── performance.js
├── bower.json
├── build
├── changelog.md
├── deprecated_apis.md
├── docs/
│   ├── .gitignore
│   ├── Gemfile
│   ├── README.md
│   ├── _config.yml
│   ├── _layouts/
│   │   ├── api.html
│   │   ├── default.html
│   │   └── page.html
│   ├── _plugins/
│   │   ├── mdate.rb
│   │   └── plugin.rb
│   ├── css/
│   │   ├── main.css
│   │   └── mono-blue.css
│   ├── docs/
│   │   ├── anti-patterns.md
│   │   ├── api/
│   │   │   ├── aggregateerror.md
│   │   │   ├── all.md
│   │   │   ├── any.md
│   │   │   ├── ascallback.md
│   │   │   ├── bind.md
│   │   │   ├── built-in-error-types.md
│   │   │   ├── call.md
│   │   │   ├── cancel.md
│   │   │   ├── cancellation.md
│   │   │   ├── cancellationerror.md
│   │   │   ├── catch.md
│   │   │   ├── catchreturn.md
│   │   │   ├── catchthrow.md
│   │   │   ├── collections.md
│   │   │   ├── core.md
│   │   │   ├── deferred-migration.md
│   │   │   ├── delay.md
│   │   │   ├── disposer.md
│   │   │   ├── done.md
│   │   │   ├── each.md
│   │   │   ├── environment-variables.md
│   │   │   ├── error-management-configuration.md
│   │   │   ├── error.md
│   │   │   ├── filter.md
│   │   │   ├── finally.md
│   │   │   ├── generators.md
│   │   │   ├── get.md
│   │   │   ├── iscancelled.md
│   │   │   ├── isfulfilled.md
│   │   │   ├── ispending.md
│   │   │   ├── isrejected.md
│   │   │   ├── map.md
│   │   │   ├── mapseries.md
│   │   │   ├── new-promise.md
│   │   │   ├── operationalerror.md
│   │   │   ├── progression-migration.md
│   │   │   ├── promise.all.md
│   │   │   ├── promise.any.md
│   │   │   ├── promise.bind.md
│   │   │   ├── promise.config.md
│   │   │   ├── promise.coroutine.addyieldhandler.md
│   │   │   ├── promise.coroutine.md
│   │   │   ├── promise.delay.md
│   │   │   ├── promise.each.md
│   │   │   ├── promise.filter.md
│   │   │   ├── promise.fromcallback.md
│   │   │   ├── promise.getnewlibrarycopy.md
│   │   │   ├── promise.join.md
│   │   │   ├── promise.longstacktraces.md
│   │   │   ├── promise.map.md
│   │   │   ├── promise.mapseries.md
│   │   │   ├── promise.method.md
│   │   │   ├── promise.noconflict.md
│   │   │   ├── promise.onpossiblyunhandledrejection.md
│   │   │   ├── promise.onunhandledrejectionhandled.md
│   │   │   ├── promise.promisify.md
│   │   │   ├── promise.promisifyall.md
│   │   │   ├── promise.props.md
│   │   │   ├── promise.race.md
│   │   │   ├── promise.reduce.md
│   │   │   ├── promise.reject.md
│   │   │   ├── promise.resolve.md
│   │   │   ├── promise.setscheduler.md
│   │   │   ├── promise.some.md
│   │   │   ├── promise.try.md
│   │   │   ├── promise.using.md
│   │   │   ├── promiseinspection.md
│   │   │   ├── promisification.md
│   │   │   ├── props.md
│   │   │   ├── race.md
│   │   │   ├── reason.md
│   │   │   ├── reduce.md
│   │   │   ├── reflect.md
│   │   │   ├── resource-management.md
│   │   │   ├── return.md
│   │   │   ├── some.md
│   │   │   ├── spread.md
│   │   │   ├── suppressunhandledrejections.md
│   │   │   ├── synchronous-inspection.md
│   │   │   ├── tap.md
│   │   │   ├── tapcatch.md
│   │   │   ├── then.md
│   │   │   ├── throw.md
│   │   │   ├── timeout.md
│   │   │   ├── timeouterror.md
│   │   │   ├── timers.md
│   │   │   ├── utility.md
│   │   │   └── value.md
│   │   ├── api-reference.md
│   │   ├── async-dialogs.md
│   │   ├── beginners-guide.md
│   │   ├── benchmarks.md
│   │   ├── changelog.md
│   │   ├── coming-from-other-languages.md
│   │   ├── coming-from-other-libraries.md
│   │   ├── contribute.md
│   │   ├── deprecated-apis.md
│   │   ├── deprecated_apis.md
│   │   ├── download-api-reference.md
│   │   ├── error-explanations.md
│   │   ├── features.md
│   │   ├── getting-started.md
│   │   ├── install.md
│   │   ├── new-in-bluebird-3.md
│   │   ├── support.md
│   │   ├── warning-explanations.md
│   │   ├── what-about-generators.md
│   │   ├── why-bluebird.md
│   │   ├── why-performance.md
│   │   ├── why-promises.md
│   │   └── working-with-callbacks.md
│   ├── helpers.rb
│   ├── img/
│   │   └── README.txt
│   └── index.html
├── issue_template.md
├── package.json
├── src/
│   ├── any.js
│   ├── assert.js
│   ├── async.js
│   ├── bind.js
│   ├── bluebird.js
│   ├── call_get.js
│   ├── cancel.js
│   ├── catch_filter.js
│   ├── constants.js
│   ├── context.js
│   ├── debuggability.js
│   ├── direct_resolve.js
│   ├── each.js
│   ├── errors.js
│   ├── es5.js
│   ├── filter.js
│   ├── finally.js
│   ├── generators.js
│   ├── join.js
│   ├── map.js
│   ├── method.js
│   ├── nodeback.js
│   ├── nodeify.js
│   ├── promise.js
│   ├── promise_array.js
│   ├── promisify.js
│   ├── props.js
│   ├── queue.js
│   ├── race.js
│   ├── reduce.js
│   ├── schedule.js
│   ├── settle.js
│   ├── some.js
│   ├── synchronous_inspection.js
│   ├── thenables.js
│   ├── timers.js
│   ├── using.js
│   └── util.js
├── test/
│   ├── browser/
│   │   ├── es5-sham.js
│   │   ├── es5-shim.js
│   │   ├── have_getters.js
│   │   ├── index.html
│   │   ├── json.js
│   │   ├── main.js
│   │   ├── mocha.css
│   │   ├── mocha.js
│   │   ├── package.json
│   │   ├── promise_debug.js
│   │   ├── promise_instrumented.js
│   │   └── worker.js
│   └── mocha/
│       ├── 2.1.2.js
│       ├── 2.1.3.js
│       ├── 2.2.1.js
│       ├── 2.2.2.js
│       ├── 2.2.3.js
│       ├── 2.2.4.js
│       ├── 2.2.5.js
│       ├── 2.2.6.js
│       ├── 2.2.7.js
│       ├── 2.3.1.js
│       ├── 2.3.2.js
│       ├── 2.3.3.js
│       ├── 2.3.4.js
│       ├── 3.2.1.js
│       ├── 3.2.2.js
│       ├── 3.2.3.js
│       ├── 3.2.4.js
│       ├── 3.2.5.js
│       ├── 3.2.6.js
│       ├── any.js
│       ├── api_exceptions.js
│       ├── async.js
│       ├── async_hooks.js
│       ├── bind.js
│       ├── bluebird-multiple-instances.js
│       ├── call.js
│       ├── cancel.js
│       ├── catch_filter.js
│       ├── collections_thenables.js
│       ├── constructor.js
│       ├── cycles.js
│       ├── direct_resolving.js
│       ├── domain.js
│       ├── done.js
│       ├── each.js
│       ├── error.js
│       ├── filter.js
│       ├── finally.js
│       ├── following.js
│       ├── generator.js
│       ├── get.js
│       ├── getNewLibraryCopy.js
│       ├── github-2xx-76.js
│       ├── github-3.6.4.js
│       ├── github-3.7.3.js
│       ├── github-4.1.7.js
│       ├── github36.js
│       ├── helpers/
│       │   ├── assert_long_trace.js
│       │   ├── bluebird0_7_0.js
│       │   ├── error.js
│       │   ├── reasons.js
│       │   ├── testThreeCases.js
│       │   ├── thenables.js
│       │   └── util.js
│       ├── is.js
│       ├── join.js
│       ├── late_buffer_safety.js
│       ├── long_stack_traces.js
│       ├── map.js
│       ├── method.js
│       ├── monitoring.js
│       ├── multiple-copies.js
│       ├── no_conflict.js
│       ├── nodeify.js
│       ├── promise_array.js
│       ├── promisify.js
│       ├── props.js
│       ├── race.js
│       ├── reduce.js
│       ├── reflect.js
│       ├── regress.js
│       ├── rejections.js
│       ├── resolution.js
│       ├── schedule.js
│       ├── settle.js
│       ├── some.js
│       ├── spread.js
│       ├── synchronous_inspection.js
│       ├── tap.js
│       ├── tapCatch.js
│       ├── timers.js
│       ├── try.js
│       ├── unhandled_rejections.js
│       └── using.js
├── tests
└── tools/
    ├── README.md
    ├── ast_passes.js
    ├── browser_test_generator.js
    ├── browser_test_runner.js
    ├── build.js
    ├── job-runner/
    │   └── job-runner.js
    ├── jshint.js
    ├── jshintrc_generator.js
    ├── mocha_runner.js
    ├── saucelabs_runner.js
    ├── test.js
    └── utils.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.js]
indent_style = space
indent_size = 4


================================================
FILE: .gitignore
================================================
docs/Gemfile.lock
gh-pages
node_modules
gh-pages
test/browser/bundle.js
test/browser/worker_bundle.js
js/*
zalgo.js
coverage/*
.vscode
.idea
.jekyll-cache/*
_site


================================================
FILE: .istanbul.yml
================================================
verbose: false
instrumentation:
    root: .
    default-excludes: true
    excludes: []
    embed-source: false
    variable: __coverage__
    compact: true
    preserve-comments: false
    complete-copy: false
    save-baseline: false
    baseline-file: ./coverage/coverage-baseline.json
    include-all-sources: false
reporting:
    print: summary
    reports:
        - lcov
    dir: ./coverage
    watermarks:
        statements: [50, 80]
        lines: [50, 80]
        functions: [50, 80]
        branches: [50, 80]
    report-config:
        clover: {file: clover.xml}
        cobertura: {file: cobertura-coverage.xml}
        json: {file: coverage-final.json}
        json-summary: {file: coverage-summary.json}
        lcovonly: {file: lcov.info}
        teamcity: {file: null}
        text: {file: null, maxCols: 0}
        text-summary: {file: null}
hooks:
    hook-run-in-context: false
    post-require-hook: null
    handle-sigint: false
check:
    global:
        statements: 0
        lines: 0
        branches: 0
        functions: 0
        excludes: []
    each:
        statements: 0
        lines: 0
        branches: 0
        functions: 0
        excludes: []


================================================
FILE: .jshintignore
================================================
src/constants.js


================================================
FILE: .jshintrc
================================================
{
    "bitwise": false,
    "camelcase": true,
    "curly": true,
    "eqeqeq": true,
    "es3": true,
    "forin": true,
    "immed": true,
    "latedef": false,
    "newcap": true,
    "noarg": true,
    "noempty": true,
    "nonew": true,
    "plusplus": false,
    "quotmark": "double",
    "undef": true,
    "unused": true,
    "strict": false,
    "maxparams": 6,
    "maxlen": 80,
    "asi": false,
    "boss": true,
    "eqnull": true,
    "evil": true,
    "expr": false,
    "funcscope": false,
    "globalstrict": false,
    "lastsemic": false,
    "laxcomma": false,
    "laxbreak": false,
    "loopfunc": true,
    "multistr": true,
    "proto": false,
    "scripturl": true,
    "shadow": true,
    "sub": true,
    "supernew": false,
    "validthis": true,
    "browser": true,
    "jquery": true,
    "devel": true,
    "-W014": true,
    "-W116": true,
    "-W106": true,
    "-W064": true,
    "-W097": true,
    "globals": {
        "Symbol": false,
        "Map": false,
        "JSON": false,
        "Error": true,
        "args": true,
        "chrome": true,
        "INLINE_SLICE": false,
        "INLINE_SLICE_LEFT_PADDED": false,
        "BIT_FIELD_CHECK": false,
        "BIT_FIELD_READ": false,
        "USE": false,
        "global": true,
        "setImmediate": true,
        "Promise": true,
        "WebKitMutationObserver": true,
        "TypeError": true,
        "RangeError": true,
        "__DEBUG__": false,
        "__BROWSER__": false,
        "process": true,
        "self": true,
        "console": false,
        "require": false,
        "module": false,
        "define": false,
        "LATE_QUEUE_CAPACITY": false,
        "NORMAL_QUEUE_CAPACITY": false,
        "ERROR_HANDLED_KEY": false,
        "OPERATIONAL_ERROR_KEY": false,
        "DEFAULT_STATE": false,
        "STACK_ATTACHED": false,
        "ERROR_HANDLED": false,
        "GENERATED_CLASS_COUNT": false,
        "USE_BOUND": false,
        "DONT_USE_BOUND": false,
        "PROPAGATE_CANCEL": false,
        "PROPAGATE_BIND": false,
        "PROPAGATE_ALL": false,
        "CALLBACK_FULFILL_OFFSET": false,
        "CALLBACK_REJECT_OFFSET": false,
        "CALLBACK_PROMISE_OFFSET": false,
        "CALLBACK_RECEIVER_OFFSET": false,
        "CALLBACK_SIZE": false,
        "ASYNC_GUARANTEE_SHIFT": false,
        "NO_STATE": false,
        "NO_ASYNC_GUARANTEE": false,
        "RETURNED_NON_UNDEFINED": false,
        "IS_ASYNC_GUARANTEED": false,
        "IS_FOLLOWING": false,
        "IS_FULFILLED": false,
        "IS_REJECTED": false,
        "WILL_BE_CANCELLED": false,
        "IS_FINAL": false,
        "IS_BOUND": false,
        "IS_REJECTION_UNHANDLED": false,
        "IS_REJECTION_IGNORED": false,
        "IS_UNHANDLED_REJECTION_NOTIFIED": false,
        "IS_DISPOSABLE": false,
        "IS_CANCELLED": false,
        "IS_CANCELLED_OR_WILL_BE_CANCELLED": false,
        "LENGTH_MASK": false,
        "LENGTH_CLEAR_MASK": false,
        "MAX_LENGTH": false,
        "IS_REJECTED_OR_CANCELLED": false,
        "IS_REJECTED_OR_FULFILLED": false,
        "IS_REJECTED_OR_FULFILLED_OR_CANCELLED": false,
        "IS_PENDING_AND_WAITING_NEG": false,
        "IS_FATE_SEALED": false,
        "AFTER_PROMISIFIED_SUFFIX": false,
        "UNHANDLED_REJECTION_EVENT": false,
        "REJECTION_HANDLED_EVENT": false,
        "RESOLVE_UNDEFINED": false,
        "RESOLVE_ARRAY": false,
        "RESOLVE_OBJECT": false,
        "RESOLVE_FOREVER_PENDING": false,
        "RESOLVE_CALL_METHOD": false,
        "RESOLVE_MAP": false,
        "QUEUE_MAX_CAPACITY": false,
        "QUEUE_MIN_CAPACITY": false,
        "FROM_PREVIOUS_EVENT": false,
        "NO_STACK_TRACE": false,
        "ADDITIONAL_STACK_TRACE": false,
        "UNHANDLED_REJECTION_HEADER": false,
        "FINALLY_TYPE": false,
        "TAP_TYPE": false,
        "THROW": false,
        "RETURN": false,
        "MAX_PARAM_COUNT": false,
        "PARAM_COUNTS_TO_TRY": false,
        "BLUEBIRD_ERRORS": false,
        "OBJECT_PROMISIFY_DEPRECATED": false,
        "SPAWN_DEPRECATED": false,
        "LATE_CANCELLATION_OBSERVER": false,
        "TIMEOUT_ERROR": false,
        "COLLECTION_ERROR": false,
        "OBJECT_ERROR": false,
        "FUNCTION_ERROR": false,
        "CONSTRUCT_ERROR_INVOCATION": false,
        "NOT_GENERATOR_ERROR": false,
        "LONG_STACK_TRACES_ERROR": false,
        "INSPECTION_VALUE_ERROR": false,
        "INSPECTION_REASON_ERROR": false,
        "PROMISIFY_TYPE_ERROR": false,
        "CIRCULAR_RESOLUTION_ERROR": false,
        "PROPS_TYPE_ERROR": false,
        "POSITIVE_INTEGER_ERROR": false,
        "YIELDED_NON_PROMISE_ERROR": false,
        "FROM_COROUTINE_CREATED_AT": false,
        "UNBOUND_RESOLVER_INVOCATION": false,
        "PROMISIFICATION_NORMAL_METHODS_ERROR": false,
        "SUFFIX_NOT_IDENTIFIER": false,
        "NO_ASYNC_SCHEDULER": false
    }
}

================================================
FILE: .travis.yml
================================================
language: node_js
sudo: false
matrix:
  include:
    - node_js: "0.10"
    - node_js: "0.12"
    - node_js: "4"
    - node_js: "5"
    - node_js: "6"
    - node_js: "7"
    - node_js: "8"
    - node_js: "10"
  fast_finish: true
git:
  depth: 5
env:
  - "NODE_FLAGS='--expose-gc' SCRIPT_FLAGS=''"
before_script:
- git submodule update --init --recursive
script: "node $NODE_FLAGS tools/test.js $SCRIPT_FLAGS"
branches:
  only:
    - master
cache:
  directories:
  - "$HOME/.npm"


================================================
FILE: API.md
================================================
[http://bluebirdjs.com/docs/api-reference.html](http://bluebirdjs.com/docs/api-reference.html)


================================================
FILE: CONTRIBUTING.md
================================================

# Questions and issues

Please see [The Support Page](http://bluebirdjs.com/docs/support.html)
The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests.

# Contributing to the library

Contributions are welcome and appreciated. See the [Contribution Page](http://bluebirdjs.com/docs/contribute.html) on bluebirdjs.com


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2013-2018 Petka Antonov

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.


================================================
FILE: README.md
================================================
<a href="http://promisesaplus.com/">
    <img src="http://promisesaplus.com/assets/logo-small.png" alt="Promises/A+ logo"
         title="Promises/A+ 1.1 compliant" align="right" />
</a>


[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird)
[![coverage-98%](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html)

**Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises)

# Introduction

Bluebird is a fully featured promise library with focus on innovative features and performance

See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here.

For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x).

## ⚠️Note⚠️ 

**Please use native promises instead if at all possible**. Native Promises have been stable in Node.js and browsers for around 10 years now and they have been fast for around 7. Any utility bluebird has like `.map` has native equivalents (like Node streams' `.map`).

This is a good thing, the people working on Bluebird and promises have been able to help incorporate most of the useful things from Bluebird into JavaScript itself and platforms/engines.

If there is a feature that keeps you using bluebird. Please let us know so we can try and upstream it :)

Currently - it is only recommended to use Bluebird if you need to support _really old_ browsers or EoL Node.js or as an intermediate step to use warnings/monitoring to find bugs.

# Questions and issues

The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`.


## Thanks

Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8. 

# License

The MIT License (MIT)

Copyright (c) 2013-2021 Petka Antonov

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.



================================================
FILE: bench
================================================
#!/usr/bin/env bash
./build --release --no-debug
benchmark=$1
nodepath=${2:-node}
shift 2;
cwd=${PWD}

export NODE_ENV=production

trap 'cd "$cwd"' EXIT

if [ "$benchmark" = "doxbee" ]; then
    cd "$cwd/benchmark"
    npm install
    echo "Doxbee sequential"
    $nodepath performance.js --n 10000 --t 1 ./doxbee-sequential/*.js --harmony "$@"
    exit 0
elif [ "$benchmark" = "doxbee-errors" ]; then
    cd "$cwd/benchmark"
    npm install
    echo "Doxbee sequential with 10% errors"
    $nodepath performance.js --n 10000 --t 1 --e 0.1 ./doxbee-sequential-errors/*.js --harmony "$@"
    exit 0
elif [ "$benchmark" = "parallel" ]; then
    cd "$cwd/benchmark"
    npm install
    echo "Madeup parallel"
    $nodepath performance.js --n 10000 --t 1 --p 25 ./madeup-parallel/*.js --harmony "$@"
    exit 0
elif [ "$benchmark" = "analysis" ]; then
    cd "$cwd/benchmark"
    npm install
    echo "analysis"
    $nodepath performance.js --n 10000 --t 1 ./analysis/*.js --harmony "$@"
    exit 0
else
    echo "Invalid benchmark name $benchmark"
    exit -1
fi


================================================
FILE: benchmark/README.md
================================================
**2018-07-16** Latest results, using latest versions of modules:

    ├── async@2.6.1
    ├── davy@1.3.0
    ├── deferred@0.7.9
    ├── kew@0.7.0
    ├── lie@3.3.0
    ├── optimist@0.6.1
    ├── promise@8.0.1
    ├── q@1.5.1
    ├── rsvp@4.8.3
    ├── vow@0.4.17
    ├── when@3.7.8

bench doxbee-sequential `ls ./doxbee-sequential/*.js | sed -e 's|\.js||' | xargs node ./performance.js --p 1 --t 1 --n 10000`

    file                                    time(ms)  memory(MB)
    callbacks-baseline                           162       28.12
    callbacks-suguru03-neo-async-waterfall       195       42.39
    promises-bluebird-generator                  199       40.23
    callbacks-caolan-async-waterfall             225       46.36
    promises-native-async-await                  245       57.39
    promises-bluebird                            257       47.03
    promises-lvivski-davy                        313       87.59
    promises-cujojs-when                         318       64.34
    promises-then-promise                        323       64.49
    generators-tj-co                             334       58.03
    promises-ecmascript6-native                  335       65.40
    promises-tildeio-rsvp                        420       86.79
    promises-calvinmetcalf-lie                   514      138.58
    promises-dfilatov-vow                        629      135.28
    promises-obvious-kew                         693      190.43
    streamline-generators                        762       90.18
    promises-medikoo-deferred                    781      149.33
    observables-pozadi-kefir                     824      180.54
    streamline-callbacks                        1088      114.73
    observables-Reactive-Extensions-RxJS        1208      243.74
    observables-caolan-highland                 3094      424.63
    promises-kriskowal-q                        3505      367.13
    observables-baconjs-bacon.js                5224      660.07

    Platform info:
    Darwin 17.7.0 x64
    Node.JS 10.6.0
    V8 6.7.288.46-node.13
    Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz × 4

bench parallel (`--p 25`)

results for 10000 parallel executions, 1 ms per I/O op `ls ./madeup-parallel/*.js | sed -e 's|\.js||' | xargs node ./performance.js --p 25 --t 1 --n 10000`

    results for 10000 parallel executions, 1 ms per I/O op

    file                                   time(ms)  memory(MB)
    callbacks-baseline                          309       74.47
    callbacks-suguru03-neo-async-parallel       374       84.18
    promises-bluebird-generator                 455      106.49
    promises-bluebird                           472       98.00
    callbacks-caolan-async-parallel             510      119.34
    promises-lvivski-davy                       671      163.84
    promises-cujojs-when                        701      168.99
    promises-native-async-await                1087      242.02
    promises-tildeio-rsvp                      1237      344.17
    promises-calvinmetcalf-lie                 1401      370.65
    promises-ecmascript6-native                1509      242.91
    promises-then-promise                      1533      303.89
    promises-medikoo-deferred                  1923      334.75
    promises-dfilatov-vow                      2534      534.80
    promises-obvious-kew                       2623      306.68

    Platform info:
    Darwin 17.7.0 x64
    Node.JS 10.6.0
    V8 6.7.288.46-node.13
    Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz × 4


================================================
FILE: benchmark/analysis/promises-bluebird-parallel.js
================================================
global.useBluebird = true;
global.useQ = false;
global.parallelQueries = 25;
var Promise = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    Promise.all(queries).then().then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/analysis/promises-bluebird.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    bluebird.join(blobIdP, fileP, function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/callbacks-baseline.js
================================================
require('../lib/fakes');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    function backoff(err) {
        tx.rollback();
        return done(err);
    }
    blob.put(stream, function (err, blobId) {
        if (err) return done(err);
        self.byUuidOrPath(idOrPath).get(function (err, file) {
            if (err) return done(err);
            var previousId = file ? file.version : null;
            var version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, function (err) {
                if (err) return backoff(err);
                if (!file) {
                    var splitPath = idOrPath.split('/');
                    var fileName = splitPath[splitPath.length - 1];
                    var newId = uuid.v1();
                    self.createQuery(idOrPath, {
                        id: newId,
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    }, function (err, q) {
                        if (err) return backoff(err);
                        q.execWithin(tx, function (err) {
                            afterFileExists(err, newId);
                        });

                    })
                }
                else return afterFileExists(null, file.id);
            });
            function afterFileExists(err, fileId) {
                if (err) return backoff(err);
                FileVersion.insert({fileId: fileId,versionId: version.id})
                    .execWithin(tx, function (err) {
                        if (err) return backoff(err);
                        File.whereUpdate({id: fileId}, {
                            version: version.id
                        }).execWithin(tx, function (err) {
                            if (err) return backoff(err);
                            tx.commit(done);
                        });
                })
            }
        });
    });
}


================================================
FILE: benchmark/doxbee-sequential/callbacks-caolan-async-waterfall.js
================================================
require('../lib/fakes');
var async = require('async');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobId, file, version, fileId;
    async.waterfall([
        function writeBlob(callback) {
            blob.put(stream, callback);
        },
        function afterBlobWritten(callback) {
            blobId = undefined // iBlobId;
            self.byUuidOrPath(idOrPath).get(callback);
        },
        function afterFileFetched(callback) {
            file = undefined; //iFile;
            var previousId = file ? file.version : null;
            version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
                mergedId: null,
                mergeType: 'mine',
                comment: '',
                tag: tag
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, callback);
        },
        function afterVersionInserted(callback) {
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                var newId = uuid.v1();
                self.createQuery(idOrPath, {
                    id: newId,
                    userAccountId: userAccount.id,
                    type: 'file',
                    name: fileName,
                    version: version.id
                }, function (err, q) {
                    if (err) return backoff(err);
                    q.execWithin(tx, function (err) {
                        callback(err, newId);
                    });

                })
            }
            else return callback(null, file.id);
        },
        function afterFileExists(iFileId, callback) {
            fileId = iFileId; 
            FileVersion.insert({fileId: fileId, versionId: version.id})
                .execWithin(tx, callback);
        },
        function afterFileVersionInserted(callback) {
            File.whereUpdate({id: fileId}, { version: version.id })
                .execWithin(tx, callback);
        },
        function afterFileUpdated(callback) {
            tx.commit(callback);
        }
    ],
    function (err) {
        if (err) tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/callbacks-suguru03-neo-async-waterfall.js
================================================
require('../lib/fakes');
var async = require('neo-async');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobId, file, version, fileId;
    async.waterfall([
        function writeBlob(callback) {
            blob.put(stream, callback);
        },
        function afterBlobWritten(callback) {
            blobId = undefined // iBlobId;
            self.byUuidOrPath(idOrPath).get(callback);
        },
        function afterFileFetched(callback) {
            file = undefined; //iFile;
            var previousId = file ? file.version : null;
            version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
                mergedId: null,
                mergeType: 'mine',
                comment: '',
                tag: tag
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, callback);
        },
        function afterVersionInserted(callback) {
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                var newId = uuid.v1();
                self.createQuery(idOrPath, {
                    id: newId,
                    userAccountId: userAccount.id,
                    type: 'file',
                    name: fileName,
                    version: version.id
                }, function (err, q) {
                    if (err) return backoff(err);
                    q.execWithin(tx, function (err) {
                        callback(err, newId);
                    });

                })
            }
            else return callback(null, file.id);
        },
        function afterFileExists(iFileId, callback) {
            fileId = iFileId;
            FileVersion.insert({fileId: fileId, versionId: version.id})
                .execWithin(tx, callback);
        },
        function afterFileVersionInserted(callback) {
            File.whereUpdate({id: fileId}, { version: version.id })
                .execWithin(tx, callback);
        },
        function afterFileUpdated(callback) {
            tx.commit(callback);
        }
    ],
    function (err) {
        if (err) tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/generators-tj-co.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}
var co = require("co");
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    co(function* () {
        try {
            var blob = blobManager.create(account);
            var tx = db.begin();
            var blobId = yield blob.put(stream);
            var file = yield self.byUuidOrPath(idOrPath).get();

            var previousId = file ? file.version : null;
            version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
            };
            version.id = Version.createHash(version);
            yield Version.insert(version).execWithin(tx);
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                file = {
                    id: uuid.v1(),
                    userAccountId: userAccount.id,
                    name: fileName,
                    version: version.id
                }
                var query = yield self.createQuery(idOrPath, file);
                yield query.execWithin(tx);
            }
            yield FileVersion.insert({fileId: file.id, versionId: version.id})
                .execWithin(tx);
            yield File.whereUpdate({id: file.id}, {version: version.id})
                .execWithin(tx);
            tx.commit();
            done();
        } catch (err) {
            tx.rollback();
            done(err);
        }
    });
};


================================================
FILE: benchmark/doxbee-sequential/observables-Reactive-Extensions-RxJS.js
================================================
global.useRx = true;
var Rx = require('rx');
require('../lib/fakesObservable');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;


    Rx.Observable.forkJoin(blobIdP, fileP).flatMap(function(v) {
        file = v[1];
        var blobId = v[0];
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).flatMap(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).flatMap(function(q) {
                return q.execWithin(tx);
            }).map(function() {
                return newId;
            });
        } else {
            return Rx.Observable.return(file.id);
        }
    }).flatMap(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).flatMap(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).subscribe(function() {

    }, function() {
        tx.rollback();
        done(err);
    }, function() {
        tx.commit();
        done();
    });
}


================================================
FILE: benchmark/doxbee-sequential/observables-baconjs-bacon.js.js
================================================
global.useBacon = true;
var Bacon = require('baconjs').Bacon;
require('../lib/fakesObservable');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;


    var stream = Bacon.combineAsArray(blobIdP, fileP).flatMap(function(v) {
        file = v[1];
        var blobId = v[0];
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).flatMap(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).flatMap(function(q) {
                return q.execWithin(tx);
            }).map(function() {
                return newId;
            });
        } else {
            return Bacon.constant(file.id);
        }
    }).flatMap(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).flatMap(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    });
    stream.onError(function() {
        tx.rollback();
        done(err);
    });
    stream.onValue(function() {
        tx.commit();
        done();
    });
}


================================================
FILE: benchmark/doxbee-sequential/observables-caolan-highland.js
================================================
global.useHighland = true;
var _ = require("highland");
require('../lib/fakesObservable');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    _([blobIdP, fileP]).merge().apply(function(blobId, file) {
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        Version.insert(version).execWithin(tx).flatMap(function() {
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                var newId = uuid.v1();
                return self.createQuery(idOrPath, {
                    id: newId,
                    userAccountId: userAccount.id,
                    name: fileName,
                    version: version.id
                }).flatMap(function(q) {
                    return q.execWithin(tx);
                }).map(function() {
                    return newId;
                });
            } else {
                return _([file.id]);
            }
        }).flatMap(function(fileIdV) {
            fileId = fileIdV;
            return FileVersion.insert({
                fileId: fileId,
                versionId: version.id
            }).execWithin(tx);
        }).flatMap(function() {
            return File.whereUpdate({id: fileId}, {version: version.id})
                .execWithin(tx);
        }).stopOnError(function(err) {
            tx.rollback();
            done(err);
        }).apply(function(v) {
            tx.commit();
            done();
        });
    });
}


================================================
FILE: benchmark/doxbee-sequential/observables-pozadi-kefir.js
================================================
global.useKefir = true;
var Kefir = require('kefir').Kefir;
require('../lib/fakesObservable');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;


    var stream = Kefir.zip([blobIdP, fileP]).flatMap(function(v) {
        file = v[1];
        var blobId = v[0];
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).flatMap(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).flatMap(function(q) {
                return q.execWithin(tx);
            }).map(function() {
                return newId;
            });
        } else {
            return Kefir.constant(file.id);
        }
    }).flatMap(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).flatMap(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    });
    stream.onError(function() {
        tx.rollback();
        done(err);
    });
    stream.onValue(function() {
        tx.commit();
        done();
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-bluebird-generator.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = bluebird.coroutine(function* upload(stream, idOrPath, tag, done) {
    try {
        var blob = blobManager.create(account);
        var tx = db.begin();
        var blobId = yield blob.put(stream);
        var file = yield self.byUuidOrPath(idOrPath).get();

        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        yield Version.insert(version).execWithin(tx);
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            file = {
                id: uuid.v1(),
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }
            var query = yield self.createQuery(idOrPath, file);
            yield query.execWithin(tx);
        }
        yield FileVersion.insert({fileId: file.id, versionId: version.id})
            .execWithin(tx);
        yield File.whereUpdate({id: file.id}, {version: version.id})
            .execWithin(tx);
        tx.commit();
        done();
    } catch (err) {
        tx.rollback();
        done(err);
    }
});


================================================
FILE: benchmark/doxbee-sequential/promises-bluebird.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    bluebird.join(blobIdP, fileP, function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-calvinmetcalf-lie.js
================================================
global.useLie = true;

var promise = require("lie");

require('../lib/fakesP');


module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    promise.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-cujojs-when.js
================================================
var when = require('when'), 
    fn = require('when/function'), 
    p = require('../lib/promiseSupport.js');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream); 
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    when([blobIdP, fileP]).spread(function(blobId, fileV) {        
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-dfilatov-vow.js
================================================
var vow = require('vow'),
    p = require('../lib/promiseSupport.js');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    vow.all([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-ecmascript6-native.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    Promise.all([blobIdP, fileP]).then(function(result) {
        var blobId = result[0];
        var fileV = result[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-kriskowal-q.js
================================================
global.useQ = true;

var q = require('q');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream); 
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    q.spread([blobIdP, fileP], function(blobId, fileV) {        
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-lvivski-davy.js
================================================
global.useDavy = true;
var davy = require('davy');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    davy.all([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-medikoo-deferred.js
================================================
global.useDeferred = true;

var deferred = require('deferred');

require('../lib/fakesP');

function identity(v) {
    return v;
}

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    //Couldn't find .all in docs, this seems closest
    deferred.map([blobIdP, fileP], identity)(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    })(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            })(function(q) {
                return q.execWithin(tx);
            })(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    })(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    })(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    })(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-native-async-await.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}

require('../lib/fakesP');

module.exports = async function upload(stream, idOrPath, tag, done) {
    try {
        var blob = blobManager.create(account);
        var tx = db.begin();
        var blobId = await blob.put(stream);
        var file = await self.byUuidOrPath(idOrPath).get();

        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        await Version.insert(version).execWithin(tx);
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            file = {
                id: uuid.v1(),
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }
            var query = await self.createQuery(idOrPath, file);
            await query.execWithin(tx);
        }
        await FileVersion.insert({fileId: file.id, versionId: version.id})
            .execWithin(tx);
        await File.whereUpdate({id: file.id}, {version: version.id})
            .execWithin(tx);
        tx.commit();
        done();
    } catch (err) {
        tx.rollback();
        done(err);
    }
};


================================================
FILE: benchmark/doxbee-sequential/promises-obvious-kew.js
================================================
global.useKew = true;

var q = require('kew');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream); 
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    q.all([blobIdP, fileP]).then(function(all) {        
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-then-promise.js
================================================
global.useThenPromise = true;

var promise = require("promise");

require('../lib/fakesP');


module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    promise.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/promises-tildeio-rsvp.js
================================================
global.useRSVP = true;

var rsvp = require('rsvp');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    rsvp.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential/streamline-callbacks.js
================================================
'use strict';

var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential/streamline._js';
require('../lib/fakes');

module.exports = _streamline.async(regeneratorRuntime.mark(function _$$upload$$(stream, idOrPath, tag, _2) {
    var blob, tx, blobId, file, previousId, version, splitPath, fileName, query;
    return regeneratorRuntime.wrap(function _$$upload$$$(_context) {
        while (1) {
            switch (_context.prev = _context.next) {
                case 0:
                    _context.prev = 0;
                    blob = blobManager.create(account);
                    tx = db.begin();
                    _context.next = 5;
                    return _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);

                case 5:
                    blobId = _context.sent;
                    _context.next = 8;
                    return _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);

                case 8:
                    file = _context.sent;
                    previousId = file ? file.version : null;
                    version = {
                        userAccountId: userAccount.id,
                        date: new Date(),
                        blobId: blobId,
                        creatorId: userAccount.id,
                        previousId: previousId
                    };

                    version.id = Version.createHash(version);
                    _context.next = 14;
                    return _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);

                case 14:
                    if (file) {
                            _context.next = 23;
                            break;
                        }

                    splitPath = idOrPath.split('/');
                    fileName = splitPath[splitPath.length - 1];

                    file = {
                        id: uuid.v1(),
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    };
                    _context.next = 20;
                    return _streamline.await(_filename, 29, self, 'createQuery', 2, null, false, [idOrPath, file, true]);

                case 20:
                    query = _context.sent;
                    _context.next = 23;
                    return _streamline.await(_filename, 30, query, 'execWithin', 1, null, false, [tx, true]);

                case 23:
                    _context.next = 25;
                    return _streamline.await(_filename, 32, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);

                case 25:
                    _context.next = 27;
                    return _streamline.await(_filename, 34, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);

                case 27:
                    tx.commit();
                    _context.next = 34;
                    break;

                case 30:
                    _context.prev = 30;
                    _context.t0 = _context['catch'](0);

                    tx.rollback();
                    throw _context.t0;

                case 34:
                case 'end':
                    return _context.stop();
            }
        }
    }, _$$upload$$, this, [[0, 30]]);
}), 3, 4);

================================================
FILE: benchmark/doxbee-sequential/streamline-generators.js
================================================
'use strict';

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : Streamline.require('streamline-runtime/lib/generators/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential/streamline._js';
require('../lib/fakes');

module.exports = _streamline.async(function* _$$upload$$(stream, idOrPath, tag, _2) {
    {
        try {
            var blob = blobManager.create(account);
            var tx = db.begin();
            var blobId = yield _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);
            var file = yield _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);

            var previousId = file ? file.version : null;
            var version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId
            };
            version.id = Version.createHash(version);
            yield _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);
            if (!file) {
                    var splitPath = idOrPath.split('/');
                    var fileName = splitPath[splitPath.length - 1];
                    file = {
                        id: uuid.v1(),
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    };
                    var query = yield _streamline.await(_filename, 29, self, 'createQuery', 2, null, false, [idOrPath, file, true]);
                    yield _streamline.await(_filename, 30, query, 'execWithin', 1, null, false, [tx, true]);
                }
            yield _streamline.await(_filename, 32, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);
            yield _streamline.await(_filename, 34, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);
            tx.commit();
        } catch (err) {
            tx.rollback();
            throw err;
        }
    }
}, 3, 4);

================================================
FILE: benchmark/doxbee-sequential/streamline._js
================================================
require('../lib/fakes');

module.exports = function upload(stream, idOrPath, tag, _) {
    try {
        var blob = blobManager.create(account);
        var tx = db.begin();
        var blobId = blob.put(stream, _);
        var file = self.byUuidOrPath(idOrPath).get(_);

        var previousId = file ? file.version : null;
        var version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        Version.insert(version).execWithin(tx, _);
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            file = {
                id: uuid.v1(),
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }
            var query = self.createQuery(idOrPath, file, _);
            query.execWithin(tx, _);
        }
        FileVersion.insert({fileId: file.id, versionId: version.id})
            .execWithin(tx, _);
        File.whereUpdate({id: file.id}, {version: version.id})
            .execWithin(tx, _);
        tx.commit();
    } catch (err) {
        tx.rollback();
        throw err;
    }
}


================================================
FILE: benchmark/doxbee-sequential-errors/callbacks-baseline.js
================================================
require('../lib/fakes');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    function backoff(err) {
        tx.rollback();
        return done(err);
    }
    var intentionalErrorShouldBeTriggered = function(){
        return LIKELIHOOD_OF_REJECTION && Math.random() <= LIKELIHOOD_OF_REJECTION;
    }

    blob.put(stream, function (err, blobId) {
        if (err) return done(err);
        self.byUuidOrPath(idOrPath).get(function (err, file) {
            if (err) return done(err);
            var previousId = file ? file.version : null;
            var version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, function (err) {
                if (err) return backoff(err);
                if(intentionalErrorShouldBeTriggered()) return done(new Error("intentional failure"));
                if (!file) {
                    var splitPath = idOrPath.split('/');
                    var fileName = splitPath[splitPath.length - 1];
                    var newId = uuid.v1();
                    self.createQuery(idOrPath, {
                        id: newId,
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    }, function (err, q) {
                        if (err) return backoff(err);
                        if(intentionalErrorShouldBeTriggered()) return done(new Error("intentional failure"));
                        q.execWithin(tx, function (err) {
                            afterFileExists(err, newId);
                        });

                    })
                }
                else return afterFileExists(null, file.id);
            });
            function afterFileExists(err, fileId) {
                if (err) return backoff(err);
                if(intentionalErrorShouldBeTriggered()) return done(new Error("intentional failure"));
                FileVersion.insert({fileId: fileId,versionId: version.id})
                    .execWithin(tx, function (err) {
                        if (err) return backoff(err);
                        if(intentionalErrorShouldBeTriggered()) return done(new Error("intentional failure"));
                        File.whereUpdate({id: fileId}, {
                            version: version.id
                        }).execWithin(tx, function (err) {
                            if (err) return backoff(err);
                            if(intentionalErrorShouldBeTriggered()) return done(new Error("intentional failure"));
                            tx.commit(done);
                        });
                })
            }
        });
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/callbacks-caolan-async-waterfall.js
================================================
require('../lib/fakes');
var async = require('async');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobId, file, version, fileId;
    async.waterfall([
        function writeBlob(callback) {
            blob.put(stream, callback);
        },
        function afterBlobWritten(callback) {
            blobId = undefined // iBlobId;
            self.byUuidOrPath(idOrPath).get(callback);
        },
        function afterFileFetched(callback) {
            file = undefined; //iFile;
            var previousId = file ? file.version : null;
            version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
                mergedId: null,
                mergeType: 'mine',
                comment: '',
                tag: tag
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, callback);
        },
        function afterVersionInserted(callback) {
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                var newId = uuid.v1();
                self.createQuery(idOrPath, {
                    id: newId,
                    userAccountId: userAccount.id,
                    type: 'file',
                    name: fileName,
                    version: version.id
                }, function (err, q) {
                    if (err) return backoff(err);
                    q.execWithin(tx, function (err) {
                        callback(err, newId);
                    });

                })
            }
            else return callback(null, file.id);
        },
        function afterFileExists(iFileId, callback) {
            fileId = iFileId; 
            FileVersion.insert({fileId: fileId, versionId: version.id})
                .execWithin(tx, callback);
        },
        function afterFileVersionInserted(callback) {
            File.whereUpdate({id: fileId}, { version: version.id })
                .execWithin(tx, callback);
        },
        function afterFileUpdated(callback) {
            tx.commit(callback);
        }
    ],
    function (err) {
        if (err) tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/callbacks-suguru03-neo-async-waterfall.js
================================================
require('../lib/fakes');
var async = require('neo-async');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobId, file, version, fileId;
    async.waterfall([
        function writeBlob(callback) {
            blob.put(stream, callback);
        },
        function afterBlobWritten(callback) {
            blobId = undefined // iBlobId;
            self.byUuidOrPath(idOrPath).get(callback);
        },
        function afterFileFetched(callback) {
            file = undefined; //iFile;
            var previousId = file ? file.version : null;
            version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId,
                mergedId: null,
                mergeType: 'mine',
                comment: '',
                tag: tag
            };
            version.id = Version.createHash(version);
            Version.insert(version).execWithin(tx, callback);
        },
        function afterVersionInserted(callback) {
            if (!file) {
                var splitPath = idOrPath.split('/');
                var fileName = splitPath[splitPath.length - 1];
                var newId = uuid.v1();
                self.createQuery(idOrPath, {
                    id: newId,
                    userAccountId: userAccount.id,
                    type: 'file',
                    name: fileName,
                    version: version.id
                }, function (err, q) {
                    if (err) return backoff(err);
                    q.execWithin(tx, function (err) {
                        callback(err, newId);
                    });

                })
            }
            else return callback(null, file.id);
        },
        function afterFileExists(iFileId, callback) {
            fileId = iFileId;
            FileVersion.insert({fileId: fileId, versionId: version.id})
                .execWithin(tx, callback);
        },
        function afterFileVersionInserted(callback) {
            File.whereUpdate({id: fileId}, { version: version.id })
                .execWithin(tx, callback);
        },
        function afterFileUpdated(callback) {
            tx.commit(callback);
        }
    ],
    function (err) {
        if (err) tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-bluebird-generator.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = bluebird.coroutine(function* upload(stream, idOrPath, tag, done) {
    try {
        var blob = blobManager.create(account);
        var tx = db.begin();
        var blobId = yield blob.put(stream);
        var file = yield self.byUuidOrPath(idOrPath).get();

        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        yield Version.insert(version).execWithin(tx);
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            file = {
                id: uuid.v1(),
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }
            var query = yield self.createQuery(idOrPath, file);
            yield query.execWithin(tx);
            triggerIntentionalError();
        }
        yield FileVersion.insert({fileId: file.id, versionId: version.id})
            .execWithin(tx);
        triggerIntentionalError();
        yield File.whereUpdate({id: file.id}, {version: version.id})
            .execWithin(tx);
        triggerIntentionalError();
        tx.commit();
        done();
    } catch (err) {
        tx.rollback();
        done(err);
    }
});


================================================
FILE: benchmark/doxbee-sequential-errors/promises-bluebird.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    bluebird.all([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-calvinmetcalf-lie.js
================================================
global.useLie = true;

var promise = require("lie");

require('../lib/fakesP');


module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    promise.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-cujojs-when.js
================================================
var when = require('when'),
    fn = require('when/function'),
    p = require('../lib/promiseSupport.js');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    when([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-dfilatov-vow.js
================================================
var vow = require('vow'),
    p = require('../lib/promiseSupport.js');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    vow.all([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-kriskowal-q.js
================================================
global.useQ = true;

var q = require('q');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    q.spread([blobIdP, fileP], function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-lvivski-davy.js
================================================
global.useDavy = true;
var davy = require('davy');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;

    davy.all([blobIdP, fileP]).spread(function(blobId, fileV) {
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQuery(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-medikoo-deferred.js
================================================
global.useDeferred = true;

var deferred = require('deferred');

require('../lib/fakesP');

function identity(v) {
    return v;
}

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    //Couldn't find .all in docs, this seems closest
    deferred.map([blobIdP, fileP], identity)(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    })(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            })(function(q) {
                return q.execWithin(tx);
            })(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    })(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    })(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    })(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-obvious-kew.js
================================================
global.useKew = true;

var q = require('kew');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    q.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-then-promise.js
================================================
global.useThenPromise = true;

var promise = require("promise");

require('../lib/fakesP');


module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    promise.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/promises-tildeio-rsvp.js
================================================
global.useRSVP = true;

var rsvp = require('rsvp');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var blob = blobManager.create(account);
    var tx = db.begin();
    var blobIdP = blob.put(stream);
    var fileP = self.byUuidOrPath(idOrPath).get();
    var version, fileId, file;
    rsvp.all([blobIdP, fileP]).then(function(all) {
        var blobId = all[0], fileV = all[1];
        file = fileV;
        var previousId = file ? file.version : null;
        version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        return Version.insert(version).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            var newId = uuid.v1();
            return self.createQueryCtxless(idOrPath, {
                id: newId,
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }).then(function(q) {
                return q.execWithin(tx);
            }).then(function() {
                return newId;
            });
        } else {
            return file.id;
        }
    }).then(function(fileIdV) {
        triggerIntentionalError();
        fileId = fileIdV;
        return FileVersion.insert({
            fileId: fileId,
            versionId: version.id
        }).execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        return File.whereUpdate({id: fileId}, {version: version.id})
            .execWithin(tx);
    }).then(function() {
        triggerIntentionalError();
        tx.commit();
        return done();
    }).then(null, function(err) {
        tx.rollback();
        return done(err);
    });
}


================================================
FILE: benchmark/doxbee-sequential-errors/streamline-callbacks.js
================================================
'use strict';

var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential-errors/streamline._js';
require('../lib/fakes');

module.exports = _streamline.async(regeneratorRuntime.mark(function _$$upload$$(stream, idOrPath, tag, _2) {
    var blob, tx, blobId, file, previousId, version, splitPath, fileName, query;
    return regeneratorRuntime.wrap(function _$$upload$$$(_context) {
        while (1) {
            switch (_context.prev = _context.next) {
                case 0:
                    _context.prev = 0;
                    blob = blobManager.create(account);
                    tx = db.begin();
                    _context.next = 5;
                    return _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);

                case 5:
                    blobId = _context.sent;
                    _context.next = 8;
                    return _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);

                case 8:
                    file = _context.sent;
                    previousId = file ? file.version : null;
                    version = {
                        userAccountId: userAccount.id,
                        date: new Date(),
                        blobId: blobId,
                        creatorId: userAccount.id,
                        previousId: previousId
                    };

                    version.id = Version.createHash(version);
                    _context.next = 14;
                    return _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);

                case 14:
                    triggerIntentionalError();

                    if (file) {
                            _context.next = 25;
                            break;
                        }

                    splitPath = idOrPath.split('/');
                    fileName = splitPath[splitPath.length - 1];

                    file = {
                        id: uuid.v1(),
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    };
                    _context.next = 21;
                    return _streamline.await(_filename, 30, self, 'createQuery', 2, null, false, [idOrPath, file, true]);

                case 21:
                    query = _context.sent;
                    _context.next = 24;
                    return _streamline.await(_filename, 31, query, 'execWithin', 1, null, false, [tx, true]);

                case 24:
                    triggerIntentionalError();

                case 25:
                    _context.next = 27;
                    return _streamline.await(_filename, 34, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);

                case 27:
                    triggerIntentionalError();
                    _context.next = 30;
                    return _streamline.await(_filename, 37, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);

                case 30:
                    triggerIntentionalError();
                    tx.commit();
                    _context.next = 38;
                    break;

                case 34:
                    _context.prev = 34;
                    _context.t0 = _context['catch'](0);

                    tx.rollback();
                    throw _context.t0;

                case 38:
                case 'end':
                    return _context.stop();
            }
        }
    }, _$$upload$$, this, [[0, 34]]);
}), 3, 4);

================================================
FILE: benchmark/doxbee-sequential-errors/streamline-generators.js
================================================
'use strict';

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : Streamline.require('streamline-runtime/lib/generators/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential-errors/streamline._js';
require('../lib/fakes');

module.exports = _streamline.async(function* _$$upload$$(stream, idOrPath, tag, _2) {
    {
        try {
            var blob = blobManager.create(account);
            var tx = db.begin();
            var blobId = yield _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);
            var file = yield _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);

            var previousId = file ? file.version : null;
            var version = {
                userAccountId: userAccount.id,
                date: new Date(),
                blobId: blobId,
                creatorId: userAccount.id,
                previousId: previousId
            };
            version.id = Version.createHash(version);
            yield _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);
            triggerIntentionalError();
            if (!file) {
                    var splitPath = idOrPath.split('/');
                    var fileName = splitPath[splitPath.length - 1];
                    file = {
                        id: uuid.v1(),
                        userAccountId: userAccount.id,
                        name: fileName,
                        version: version.id
                    };
                    var query = yield _streamline.await(_filename, 30, self, 'createQuery', 2, null, false, [idOrPath, file, true]);
                    yield _streamline.await(_filename, 31, query, 'execWithin', 1, null, false, [tx, true]);
                    triggerIntentionalError();
                }
            yield _streamline.await(_filename, 34, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);
            triggerIntentionalError();
            yield _streamline.await(_filename, 37, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);
            triggerIntentionalError();
            tx.commit();
        } catch (err) {
            tx.rollback();
            throw err;
        }
    }
}, 3, 4);

================================================
FILE: benchmark/doxbee-sequential-errors/streamline._js
================================================
require('../lib/fakes');

module.exports = function upload(stream, idOrPath, tag, _) {
    try {
        var blob = blobManager.create(account);
        var tx = db.begin();
        var blobId = blob.put(stream, _);
        var file = self.byUuidOrPath(idOrPath).get(_);

        var previousId = file ? file.version : null;
        var version = {
            userAccountId: userAccount.id,
            date: new Date(),
            blobId: blobId,
            creatorId: userAccount.id,
            previousId: previousId,
        };
        version.id = Version.createHash(version);
        Version.insert(version).execWithin(tx, _);
        triggerIntentionalError();
        if (!file) {
            var splitPath = idOrPath.split('/');
            var fileName = splitPath[splitPath.length - 1];
            file = {
                id: uuid.v1(),
                userAccountId: userAccount.id,
                name: fileName,
                version: version.id
            }
            var query = self.createQuery(idOrPath, file, _);
            query.execWithin(tx, _);
            triggerIntentionalError();
        }
        FileVersion.insert({fileId: file.id, versionId: version.id})
            .execWithin(tx, _);
        triggerIntentionalError();
        File.whereUpdate({id: file.id}, {version: version.id})
            .execWithin(tx, _);
        triggerIntentionalError();
        tx.commit();
    } catch (err) {
        tx.rollback();
        throw err;
    }
};

================================================
FILE: benchmark/lib/catcher.js
================================================

exports.longStackSupport = global.longStackSupport;


function invoke(ctx, cb, value, myhandler) {            
    try {
        cb.call(ctx, value); // no error
    } catch (e) {
        if (myhandler)
            myhandler.call(ctx, e);
        else
            console.error(e);
    }
}

module.exports = function() {
    var self = {};
    var notCaught = true, myhandler;
    self.try = function $try(cb) {
        if (exports.longStackSupport) {
            var ex = {};
            Error.captureStackTrace(ex);
        }
        return function wrapper(err, value) {
            if (err) {
               if (notCaught) {
                   notCaught = false;
                   if (err.stack && ex) {
                       var asyncStackRaw =
                           ex.stack.substr(ex.stack.indexOf('\n'));
                       err.stack += '\nFrom previous event:' 
                           + asyncStackRaw;
                   }
                   if (myhandler) myhandler(err);
                   else console.error(err);
               }
            }
            else if (myhandler) 
                invoke(this, cb, value, myhandler);
            else cb(value);
        }
    }
    self.catch = function $catch(handler) {
        myhandler = handler
    };
    return self;
};



================================================
FILE: benchmark/lib/dummy.js
================================================
// A typical node callback function
// with the callback at the Nth position
exports.dummy = function dummy(n) {
    return function dummy_n() {
        var cb = arguments[n - 1] || function(){};
        if (global.asyncTime)
            setTimeout(cb, global.asyncTime || 100);
        else
            process.nextTick(cb);
    }
}

// A throwing callback function
exports.dummyt = function dummyt(n) {
    return function dummy_throwing_n() {
        var cb = arguments[n - 1];
        if (global.testThrow) 
            throw(new Error("Exception happened"));
        setTimeout(function throwTimeout() {
            if (global.testThrowAsync) {
                throw(new Error("Exception happened"));
            } else if (global.testError) {
                return cb(new Error("Error happened"));
            }
            else cb();
        }, global.asyncTime || 100);
    }
}




================================================
FILE: benchmark/lib/fakemaker.js
================================================

module.exports = function fakemaker(dummy, dummyt, wrap) {

    var dummy_2 = dummy(2), 
        dummy_1 = dummy(1);

    var dummyt_2, dummyt_1;

    if (global.testError || global.testThrow 
        || global.testThrowAsync) {
        dummyt_2 = dummyt(2);
        dummyt_1 = dummyt(1);
    } else {
        dummyt_2 = dummy_2;
        dummyt_1 = dummy_1;
    }

    // a queryish object with all
    // kinds of functions
    function queryish() {
        return {
            execWithin: dummy_2,
            exec: dummy_1,
            get: dummy_1,
            all: dummy_1,
        };
    }

    // a queryish object with functions
    // that throw
    function queryisht() {
        return {
            execWithin: dummyt_2,
            exec: dummyt_1,
            get: dummyt_1,
            all: dummyt_1,
        };
    }

    global.uuid = { v1: function v1() {} };

    global.userAccount = { };

    global.account = { };

    global.blobManager = {
        create: function create() {
            return { 
                put: dummy_2, 
            }
        }
    };

    var cqQueryish = queryish();

    global.self = {
        byUuidOrPath: queryish,
        createQuery: wrap(function createQuery(x, y, cb, ctx) {
            cb.call(ctx, null, cqQueryish);
        }),
        createQueryCtxless: wrap(function createQuery(x, y, cb) {
            cb.call(this, null, cqQueryish);
        })
    };


    global.File = {
        insert: queryish,
        whereUpdate: queryish
    };

    global.FileVersion = {
        insert: queryisht
    };

    global.Version  = {
        createHash: function createHash(v) { return 1; },
        insert: queryish
    };

    global.db = {
        begin: function begin() {
            return { 
                commit: dummy_1,
                rollback: dummy_1,
            };
        }
    };

};




================================================
FILE: benchmark/lib/fakes-ctx.js
================================================
var timers = require('./timers-ctx');

var fakemaker = require('./fakemaker');

var f = {};
f.dummy = function dummy(n) {
    return function dummy_n() {
        var cb = arguments[n - 1],
            ctx = arguments[n];
        //console.log(cb, ctx);

        timers.setTimeout(cb, ctx, global.asyncTime || 100);
    }
}

// A throwing callback function
f.dummyt = function dummyt(n) {
    return function dummy_throwing_n() {
        var cb = arguments[n - 1],
            ctx = arguments[n];
        if (global.testThrow) 
            throw(new Error("Exception happened"));
        setTimeout(function throwTimeout() {
            if (global.testThrowAsync) {
                throw(new Error("Exception happened"));
            } else if (global.testError) {
                return cb.call(ctx, new Error("Error happened"));
            }
            else cb.call(ctx);
        }, global.asyncTime || 100);
    }
}




fakemaker(f.dummy, f.dummyt, function wrap_identity(f) { return f; });




================================================
FILE: benchmark/lib/fakes.js
================================================


var fakemaker = require('./fakemaker'),
    f = require('./dummy');

fakemaker(f.dummy, f.dummyt, function wrap_identity(f) { return f; });




================================================
FILE: benchmark/lib/fakesC.js
================================================

var co = require('co');

var f = require('./dummy');

var makefakes = require('./fakemaker');

// Continuable versions made with co.wrap
function dummyC(n) {
    return co.wrap(f.dummy(n));
}
function dummytC(n) {
    return co.wrap(f.dummyt(n));
}

makefakes(dummyC, dummytC, co.wrap);




================================================
FILE: benchmark/lib/fakesO.js
================================================

var Rx = require('rx');
var f = require('./dummy');

var dummy1 = f.dummy(1),
    dummyt1 = f.dummyt(1);

// Observable wrapper
function dummyObsWrap(fn) {
    return function() {
        return Rx.Observable.create(function(observer) {
            fn(function(err, res) {
                if(err) 
                    return observer.onError(err);
                observer.onNext(res);
                observer.onCompleted();
            });
        });
    }
}
function dummyO() {
    return dummyObsWrap(dummy(1)); 
}
function dummytO() {
    return dummyObsWrap(dummyt(1));
}

makefakes(dummyO, dummytO, dummyObsWrap);



================================================
FILE: benchmark/lib/fakesObservable.js
================================================
var lifter, fromNodeCallback;
if (global.useRx) {
    lifter = require("rx").Observable.fromNodeCallback;
} else if (global.useBacon) {
    fromNodeCallback = require("baconjs").fromNodeCallback;
} else if (global.useKefir) {
    fromNodeCallback = require("kefir").Kefir.fromNodeCallback;
    lifter = function(nodeFn) {
        return function() {
            var args = [].slice.call(arguments);            
            function thunk(callback) {
                args.push(callback);
                nodeFn.apply(null, args);
                args.pop();
            }
            return fromNodeCallback(thunk);
        }
    };
} else if (global.useHighland) {
    lifter = require("highland").wrapCallback;
}

if (!lifter) {
    lifter = function(nodeFn) {
        return function() {
            var args = [].slice.call(arguments);
            args.unshift(nodeFn);
            return fromNodeCallback.apply(undefined, args);
        };
    };
}

var f = require('./dummy');

var makefakes = require('./fakemaker');

// A function taking n values or promises and returning
// a promise
function dummyP(n) {
    return lifter(f.dummy(n));
}

// Throwing version of above
function dummytP(n) {
    return lifter(f.dummyt(n));
}

makefakes(dummyP, dummytP, lifter);


================================================
FILE: benchmark/lib/fakesP-ctx.js
================================================
var timers = require('./timers-ctx');

var fakemaker = require('./fakemaker');

var f = {};
f.dummy = function dummy(n) {
    return function dummy_n() {
        var cb = arguments[n - 1],
            ctx = arguments[n];
        timers.setTimeout(cb, ctx, global.asyncTime || 100);
    }
}

// A throwing callback function
f.dummyt = function dummyt(n) {
    return function dummy_throwing_n() {
        var cb = arguments[n - 1],
            ctx = arguments[n];
        if (global.testThrow) 
            throw(new Error("Exception happened"));
        setTimeout(function throwTimeout() {
            if (global.testThrowAsync) {
                throw(new Error("Exception happened"));
            } else if (global.testError) {
                return cb.call(ctx, new Error("Error happened"));
            }
            else cb.call(ctx);
        }, global.asyncTime || 100);
    }
}



//Currently promisifies only Node style callbacks
//var lifter = require('bluebird').promisify;

var Promise = require('bluebird');

function nodeback(err, result) {
    if (err == null) this.fulfill(result);
    else this.reject(err);
}

function lifter(f) {
    return function lifted(a1, a2, a3, a4, a5) {
        "use strict";
        var len = arguments.length;
        var deferred = Promise.pending();
        try {
            switch(len) {
                case 1: f(a1, nodeback, deferred); break;
                case 2: f(a1, a2, nodeback, deferred); break;
                case 0: f(nodeback, deferred); break;
                case 3: f(a1, a2, a3, nodeback, deferred); break;
                case 4: f(a1, a2, a3, a4, nodeback, deferred); break;
                case 5: f(a1, a2, a3, a4, a5, nodeback, deferred); break;
            }
        } catch (err) { deferred.reject(err); }
        return deferred.promise;
    }
}

// A function taking n values or promises and returning 
// a promise
function dummyP(n) {    
    return function lifted() {
        var deferred = Promise.pending();
        timers.setTimeout(nodeback, deferred, global.asyncTime || 100);
        return deferred.promise;
    }
}

// Throwing version of above
function dummytP(n) {
    return lifter(f.dummyt(n));
}

fakemaker(dummyP, dummytP, lifter);



================================================
FILE: benchmark/lib/fakesP.js
================================================


if (global.useQ)
    var lifter = require('q').denodeify;
else if (global.useBluebird)
    //Currently promisifies only Node style callbacks
    var lifter = require('../../js/release/bluebird.js').promisify;
else if (global.useKew) {
    var q = require('kew');
    var slicer = [].slice;
    var lifter = function lifter(nodefn) {
        return function() {
            var p = q.defer();
            arguments[arguments.length++] = function(err, res) {
                if (err) p.reject(err);
                else p.resolve(res)
            };
            try {
                nodefn.apply(this, arguments);
            }
            catch (e) {
                p.reject(e);
            }
            return p;
        }
    }
}
else if(global.useLie) {
    var Lie = require('lie');
    var lifter = function(nodefn) {
        return function() {
            var self = this;
            var l = arguments.length;
            var args = new Array(l + 1);
            for (var i = 0; i < l; ++i) {
                args[i] = arguments[i];
            }
            return new Lie(function(resolve, reject) {
                args[l] = function(err, val) {
                    if (err) reject(err);
                    else resolve(val);
                };
                nodefn.apply(self, args);
            });
        };
    };
}
else if(global.useThenPromise) {
    var lifter = require("promise").denodeify;
}
else if( global.useRSVP ) {
    var lifter = require("rsvp").denodeify;
}
else if( global.useDeferred) {
    var lifter = require("deferred").promisify;
}
else if( global.useDavy) {
    var lifter = require("davy").wrap;
}
else if (global.useNative) {
    try {
        if (Promise.race.toString() !== 'function race() { [native code] }')
            throw 0;
    } catch (e) {
        throw new Error("No ES6 promises available");
    }
    var lifter = function(nodefn) {
        return function() {
            var self = this;
            var l = arguments.length;
            var args = new Array(l + 1);
            for (var i = 0; i < l; ++i) {
                args[i] = arguments[i];
            }
            return new Promise(function(resolve, reject) {
                args[l] = function(err, val) {
                    if (err) reject(err);
                    else resolve(val);
                };
                nodefn.apply(self, args);
            });
        };
    };
}
else {
    var lifter = require('when/node').lift;
}

var f = require('./dummy');

var makefakes = require('./fakemaker');

// A function taking n values or promises and returning
// a promise
function dummyP(n) {
    return lifter(f.dummy(n));
}

// Throwing version of above
function dummytP(n) {
    return lifter(f.dummyt(n));
}

makefakes(dummyP, dummytP, lifter);



================================================
FILE: benchmark/lib/fakesSJS-dst.js
================================================


var f,makefakes;function wrap(f){return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Nb(function(){return __oni_rt.Return(function (x,y){var err,val;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Suspend(function(__oni_env,resume){return __oni_rt.ex(__oni_rt.Nb(function(){return f(x,y,resume);},8),__oni_env)}, function() {err=arguments[0];val=arguments[1];}),__oni_rt.Nb(function(){if(err){throw err;}return __oni_rt.Return(val);},10)])});},12)])}function dummySJS0(){var inner;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Nb(function(){inner=f.dummy(1);return __oni_rt.Return(function (){var err,val;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Suspend(function(__oni_env,resume){return __oni_rt.ex(__oni_rt.Nb(function(){return inner(resume);},19),__oni_env)}, function() {err=arguments[0];val=arguments[1];}),__oni_rt.Nb(function(){if(err){throw err;}return __oni_rt.Return(val);},21)])});},17)])}function dummySJS1(){var inner;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Nb(function(){inner=f.dummy(2);return __oni_rt.Return(function (x){var err,val;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Suspend(function(__oni_env,resume){return __oni_rt.ex(__oni_rt.Nb(function(){return inner(x,resume);},30),__oni_env)}, function() {err=arguments[0];val=arguments[1];}),__oni_rt.Nb(function(){if(err){throw err;}return __oni_rt.Return(val);},32)])});},28)])}function dummySJS(n){if(n === 1){return dummySJS0();}if(n === 2){return dummySJS1();}}function dummytSJS(n){var inner;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Nb(function(){inner=f.dummyt(n);return __oni_rt.Return(function (){var args,err,val;return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Suspend(function(__oni_env,resume){return __oni_rt.ex(__oni_rt.Nb(function(){args=Array.prototype.slice.apply(this.aobj);args.push(resume);inner.apply(this,args);},0),__oni_env)}, function() {err=arguments[0];val=arguments[1];}),__oni_rt.Nb(function(){if(err){throw err;}return __oni_rt.Return(val);},51)])});},44)])}__oni_rt.exseq(this.arguments,this,'lib/fakesSJS-src.sjs',[24,__oni_rt.Sc(3,function(_oniX){return f=_oniX;},__oni_rt.C(function(){return require('./dummy.js')},1)),__oni_rt.Sc(5,function(_oniX){return makefakes=_oniX;},__oni_rt.C(function(){return require('./fakemaker.js')},3)),__oni_rt.Nb(function(){return makefakes(dummySJS,dummytSJS,wrap,global);},56)])



================================================
FILE: benchmark/lib/fakesSJS-src.sjs
================================================
var f = require('./dummy.js');

var makefakes = require('./fakemaker.js');

function wrap(f) {
  return function(x, y) {
    waitfor(var err, val) {
      f(x, y, resume);
    }
    if (err) throw err;
    return val;
  };
}

function dummySJS0() {
  var inner = f.dummy(1);
  return function() {
    waitfor (var err, val) {
      inner(resume);
    }
    if (err) throw err;
    return val;
  }
}

function dummySJS1() {
  var inner = f.dummy(2);
  return function(x) {
    waitfor (var err, val) {
      inner(x, resume);
    }
    if (err) throw err;
    return val;
  }
}

function dummySJS(n) {
  if (n === 1) return dummySJS0();
  if (n === 2) return dummySJS1();
}

function dummytSJS(n) {
  var inner = f.dummyt(n);
  return function() {
    waitfor(var err, val) {
      var args = Array.prototype.slice.apply(arguments);
      args.push(resume);
      inner.apply(this, args);
    }
    
    if (err) throw err;
    return val;
  }
}

makefakes(dummySJS, dummytSJS, wrap, global);


================================================
FILE: benchmark/lib/promiseSupport.js
================================================
var when = require('when');
var fn = require('when/function');



exports.ternary = fn.lift(function(truthy, iftrue, iffalse) {
    return truthy ? iftrue: iffalse;
})

exports.not = function not(truthyP) {
    return when(truthyP).then(function(truthyVal) {
        return !truthyVal;
    });
}

exports.allObject = function allObject(objWithPromises) {
    return when(objWithPromises).then(function(objWithPromises) {
        var keys = Object.keys(objWithPromises);
        return when.all(keys.map(function(key) { 
            return objWithPromise; 
        })).then(function(vals) {
            var init = {};
            for (var k = 0; k < keys.length; ++k) {
                init[keys[k]] = vals[k];
            }
            return init;
        });
    });
}

exports.set = fn.lift(function(obj, values) {
    for (var key in values)
        obj[key] = values[key];
    return obj;
});

exports.if = function ifP (truthyP, fnTrue, fnFalse) {
    return truthyP.then(function(truthy) {
        if (truthy) return fnTrue();
        else return fnFalse();
    });
}

exports.get = fn.lift(function (obj, key) {
    return obj[key];
});

exports.eventuallyCall = fn.lift(function(obj, fnkey) {
    var args = [].slice.call(arguments, 2);
    obj[fnkey].apply(obj, args);
});


================================================
FILE: benchmark/lib/timers-ctx.js
================================================
// Copyright Joyent, Inc. and other Node 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:
//
// 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.

var Timer = process.binding('timer_wrap').Timer;
var L = require('_linklist');
var assert = require('assert').ok;

var kOnTimeout = Timer.kOnTimeout | 0;

// Timeout values > TIMEOUT_MAX are set to 1.
var TIMEOUT_MAX = 2147483647; // 2^31-1


var debug = require('util').debuglog('timer');


// IDLE TIMEOUTS
//
// Because often many sockets will have the same idle timeout we will not
// use one timeout watcher per item. It is too much overhead.  Instead
// we'll use a single watcher for all sockets with the same timeout value
// and a linked list. This technique is described in the libev manual:
// http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Be_smart_about_timeouts

// Object containing all lists, timers
// key = time in milliseconds
// value = list
var lists = {};

// the main function - creates lists on demand and the watchers associated
// with them.
function insert(item, msecs) {
  item._idleStart = Timer.now();
  item._idleTimeout = msecs;

  if (msecs < 0) return;

  var list;

  if (lists[msecs]) {
    list = lists[msecs];
  } else {
    list = new Timer();
    list.start(msecs, 0);

    L.init(list);

    lists[msecs] = list;
    list.msecs = msecs;
    list[kOnTimeout] = listOnTimeout;
  }

  L.append(list, item);
  assert(!L.isEmpty(list)); // list is not empty
}

function listOnTimeout() {
  var msecs = this.msecs;
  var list = this;

  debug('timeout callback %d', msecs);

  var now = Timer.now();
  debug('now: %s', now);

  var first;
  while (first = L.peek(list)) {
    var diff = now - first._idleStart;
    if (diff < msecs) {
      list.start(msecs - diff, 0);
      debug('%d list wait because diff is %d', msecs, diff);
      return;
    } else {
      L.remove(first);
      assert(first !== L.peek(list));

      if (!first._onTimeout) continue;

      // v0.4 compatibility: if the timer callback throws and the
      // domain or uncaughtException handler ignore the exception,
      // other timers that expire on this tick should still run.
      //
      // https://github.com/joyent/node/issues/2631
      var domain = first.domain;
      if (domain && domain._disposed) continue;
      try {
        if (domain)
          domain.enter();
        var threw = true;
        if (!first._ctx || first._ctx === first)
          first._onTimeout();     
        else
          first._onTimeout.call(first._ctx);
 
        if (domain)
          domain.exit();
        threw = false;
      } finally {
        if (threw) {
          process.nextTick(function() {
            list[kOnTimeout]();
          });
        }
      }
    }
  }

  debug('%d list empty', msecs);
  assert(L.isEmpty(list));
  list.close();
  delete lists[msecs];
}


var unenroll = exports.unenroll = function(item) {
  L.remove(item);

  var list = lists[item._idleTimeout];
  // if empty then stop the watcher
  debug('unenroll');
  if (list && L.isEmpty(list)) {
    debug('unenroll: list empty');
    list.close();
    delete lists[item._idleTimeout];
  }
  // if active is called later, then we want to make sure not to insert again
  item._idleTimeout = -1;
};


// Does not start the time, just sets up the members needed.
exports.enroll = function(item, msecs) {
  // if this item was already in a list somewhere
  // then we should unenroll it from that
  if (item._idleNext) unenroll(item);

  // Ensure that msecs fits into signed int32
  if (msecs > 0x7fffffff) {
    msecs = 0x7fffffff;
  }

  item._idleTimeout = msecs;
  L.init(item);
};


// call this whenever the item is active (not idle)
// it will reset its timeout.
exports.active = function(item) {
  var msecs = item._idleTimeout;
  if (msecs >= 0) {

    var list = lists[msecs];
    if (!list || L.isEmpty(list)) {
      insert(item, msecs);
    } else {
      item._idleStart = Timer.now();
      L.append(list, item);
    }
  }
};


/*
 * DOM-style timers
 */


exports.setTimeout = function(callback, ctx, after) {
  var timer;

  after *= 1; // coalesce to number or NaN

  if (!(after >= 1 && after <= TIMEOUT_MAX)) {
    after = 1; // schedule on next tick, follows browser behaviour
  }

  timer = new Timeout(after);
  timer._ctx = ctx;
  timer._onTimeout = callback;

  if (process.domain) timer.domain = process.domain;

  exports.active(timer);

  return timer;
};


exports.clearTimeout = function(timer) {
  if (timer && (timer[kOnTimeout] || timer._onTimeout)) {
    timer[kOnTimeout] = timer._onTimeout = null;
    if (timer instanceof Timeout) {
      timer.close(); // for after === 0
    } else {
      exports.unenroll(timer);
    }
  }
};


exports.setInterval = function(callback, repeat) {
  repeat *= 1; // coalesce to number or NaN

  if (!(repeat >= 1 && repeat <= TIMEOUT_MAX)) {
    repeat = 1; // schedule on next tick, follows browser behaviour
  }

  var timer = new Timeout(repeat);
  var args = Array.prototype.slice.call(arguments, 2);
  timer._onTimeout = wrapper;
  timer._repeat = true;

  if (process.domain) timer.domain = process.domain;
  exports.active(timer);

  return timer;

  function wrapper() {
    callback.apply(this, args);
    // If callback called clearInterval().
    if (timer._repeat === false) return;
    // If timer is unref'd (or was - it's permanently removed from the list.)
    if (this._handle) {
      this._handle.start(repeat, 0);
    } else {
      timer._idleTimeout = repeat;
      exports.active(timer);
    }
  }
};


exports.clearInterval = function(timer) {
  if (timer && timer._repeat) {
    timer._repeat = false;
    clearTimeout(timer);
  }
};


var Timeout = function(after) {
  this._idleTimeout = after;
  this._idlePrev = this;
  this._idleNext = this;
  this._idleStart = null;
  this._onTimeout = null;
  this._repeat = false;
  this._ctx = this;
};

Timeout.prototype.unref = function() {
  if (!this._handle) {
    var now = Timer.now();
    if (!this._idleStart) this._idleStart = now;
    var delay = this._idleStart + this._idleTimeout - now;
    if (delay < 0) delay = 0;
    exports.unenroll(this);
    this._handle = new Timer();
    this._handle[kOnTimeout] = this._onTimeout;
    this._handle.start(delay, 0);
    this._handle.domain = this.domain;
    this._handle.unref();
  } else {
    this._handle.unref();
  }
};

Timeout.prototype.ref = function() {
  if (this._handle)
    this._handle.ref();
};

Timeout.prototype.close = function() {
  this._onTimeout = this._ctx = null;
  if (this._handle) {
    this._handle[kOnTimeout] = null;
    this._handle.close();
  } else {
    exports.unenroll(this);
  }
};


var immediateQueue = {};
L.init(immediateQueue);


function processImmediate() {
  var queue = immediateQueue;

  immediateQueue = {};
  L.init(immediateQueue);

  while (L.isEmpty(queue) === false) {
    var immediate = L.shift(queue);
    var domain = immediate.domain;
    if (domain) domain.enter();
    immediate._onImmediate();
    if (domain) domain.exit();
  }

  // Only round-trip to C++ land if we have to. Calling clearImmediate() on an
  // immediate that's in |queue| is okay. Worst case is we make a superfluous
  // call to NeedImmediateCallbackSetter().
  if (L.isEmpty(immediateQueue)) {
    process._needImmediateCallback = false;
  }
}


exports.setImmediate = function(callback) {
  var immediate = {}, args;

  L.init(immediate);

  immediate._onImmediate = callback;

  if (arguments.length > 1) {
    args = Array.prototype.slice.call(arguments, 1);

    immediate._onImmediate = function() {
      callback.apply(immediate, args);
    };
  }

  if (!process._needImmediateCallback) {
    process._needImmediateCallback = true;
    process._immediateCallback = processImmediate;
  }

  if (process.domain) immediate.domain = process.domain;

  L.append(immediateQueue, immediate);

  return immediate;
};


exports.clearImmediate = function(immediate) {
  if (!immediate) return;

  immediate._onImmediate = undefined;

  L.remove(immediate);

  if (L.isEmpty(immediateQueue)) {
    process._needImmediateCallback = false;
  }
};


// Internal APIs that need timeouts should use timers._unrefActive isntead of
// timers.active as internal timeouts shouldn't hold the loop open

var unrefList, unrefTimer;


function unrefTimeout() {
  var now = Timer.now();

  debug('unrefTimer fired');

  var first;
  while (first = L.peek(unrefList)) {
    var diff = now - first._idleStart;

    if (diff < first._idleTimeout) {
      diff = first._idleTimeout - diff;
      unrefTimer.start(diff, 0);
      unrefTimer.when = now + diff;
      debug('unrefTimer rescheudling for later');
      return;
    }

    L.remove(first);

    var domain = first.domain;

    if (!first._onTimeout) continue;
    if (domain && domain._disposed) continue;

    try {
      if (domain) domain.enter();
      var threw = true;
      debug('unreftimer firing timeout');
      if (!first._ctx || first._ctx === first)
          first._onTimeout();     
      else
          first._onTimeout.call(first._ctx);
      threw = false;
      if (domain) domain.exit();
    } finally {
      if (threw) process.nextTick(unrefTimeout);
    }
  }

  debug('unrefList is empty');
  unrefTimer.when = -1;
}


exports._unrefActive = function(item) {
  var msecs = item._idleTimeout;
  if (!msecs || msecs < 0) return;
  assert(msecs >= 0);

  L.remove(item);

  if (!unrefList) {
    debug('unrefList initialized');
    unrefList = {};
    L.init(unrefList);

    debug('unrefTimer initialized');
    unrefTimer = new Timer();
    unrefTimer.unref();
    unrefTimer.when = -1;
    unrefTimer[kOnTimeout] = unrefTimeout;
  }

  var now = Timer.now();
  item._idleStart = now;

  if (L.isEmpty(unrefList)) {
    debug('unrefList empty');
    L.append(unrefList, item);

    unrefTimer.start(msecs, 0);
    unrefTimer.when = now + msecs;
    debug('unrefTimer scheduled');
    return;
  }

  var when = now + msecs;

  debug('unrefList find where we can insert');

  var cur, them;

  for (cur = unrefList._idlePrev; cur != unrefList; cur = cur._idlePrev) {
    them = cur._idleStart + cur._idleTimeout;

    if (when < them) {
      debug('unrefList inserting into middle of list');

      L.append(cur, item);

      if (unrefTimer.when > when) {
        debug('unrefTimer is scheduled to fire too late, reschedule');
        unrefTimer.start(msecs, 0);
        unrefTimer.when = when;
      }

      return;
    }
  }

  debug('unrefList append to end');
  L.append(unrefList, item);
};


================================================
FILE: benchmark/madeup-parallel/callbacks-baseline.js
================================================
require('../lib/fakes');

module.exports = function upload(stream, idOrPath, tag, done) {
    var tx = db.begin();
    var current = 0;
    var total = global.parallelQueries;



    for( var i = 0; i < total; ++i ) {
        FileVersion.insert({index: i}).execWithin(tx, function onComplete(err) {
            if (onComplete.called) return;
            onComplete.called = true;
            if( err ) {
                tx.rollback();
                done(err);
            }
            else {
                current++;
                if( current === total ) {
                    tx.commit();
                    done();
                }
            }
        });
    }
}


================================================
FILE: benchmark/madeup-parallel/callbacks-caolan-async-parallel.js
================================================
require('../lib/fakes');
var async = require('async');

function fileInsertFor(i, tx) {
    return function(callback) {
        FileVersion.insert({index: i})
            .execWithin(tx, callback);
    };
}

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = fileInsertFor(i, tx);
    }

    async.parallel(queries, function(err, callback) {
        if (err) {
            tx.rollback();
            done(err);
        }
        else {
            tx.commit();
            done();
        }
    });
}


================================================
FILE: benchmark/madeup-parallel/callbacks-suguru03-neo-async-parallel.js
================================================
require('../lib/fakes');
var async = require('neo-async');

function fileInsertFor(i, tx) {
    return function(callback) {
        FileVersion.insert({index: i})
            .execWithin(tx, callback);
    };
}

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = fileInsertFor(i, tx);
    }

    async.parallel(queries, function(err, callback) {
        if (err) {
            tx.rollback();
            done(err);
        }
        else {
            tx.commit();
            done();
        }
    });
}


================================================
FILE: benchmark/madeup-parallel/generators-tj-co.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}

var co = require('co');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    return co(function* () {
        var queries = new Array(global.parallelQueries);
        var tx = db.begin();

        for( var i = 0, len = queries.length; i < len; ++i ) {
            queries[i] = FileVersion.insert({index: i}).execWithin(tx);
        }

        try {
            yield Promise.all(queries);
            tx.commit();
            done();
        }
        catch(e) {
            tx.rollback();
            done(e);
        }
    });
};


================================================
FILE: benchmark/madeup-parallel/promises-bluebird-generator.js
================================================
global.useBluebird = true;
global.useQ = false;
var bluebird = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = bluebird.coroutine(function* upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    try {
        yield bluebird.all(queries);
        tx.commit();
        done();
    }
    catch(e) {
        tx.rollback();
        done(e);
    }
});


================================================
FILE: benchmark/madeup-parallel/promises-bluebird.js
================================================
global.useBluebird = true;
global.useQ = false;
var Promise = require('../../js/release/bluebird.js');
require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    Promise.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-calvinmetcalf-lie.js
================================================
global.useLie = true;

var Promise = require("lie");

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    Promise.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-cujojs-when.js
================================================
global.useWhen = true;

var when = require('when');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    when.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
};


================================================
FILE: benchmark/madeup-parallel/promises-dfilatov-vow.js
================================================
var vow = require('vow'),
    p = require('../lib/promiseSupport.js');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    vow.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-ecmascript6-native.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    Promise.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-lvivski-davy.js
================================================
global.useDavy = true;

var davy = require('davy');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    davy.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-medikoo-deferred.js
================================================
global.useDeferred = true;

var deferred = require('deferred');

require('../lib/fakesP');

function identity(v) {
    return v;
}

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    //Couldn't find .all in docs, this seems closest
    deferred.map(queries, identity)(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-native-async-await.js
================================================
global.useNative = true;

try {
    if (Promise.race.toString() !== 'function race() { [native code] }')
        throw 0;
} catch (e) {
    throw new Error("No ES6 promises available");
}

require('../lib/fakesP');

module.exports = async function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    try {
        await Promise.all(queries);
        tx.commit();
        done();
    }
    catch(e) {
        tx.rollback();
        done(e);
    }
};


================================================
FILE: benchmark/madeup-parallel/promises-obvious-kew.js
================================================
global.useKew = true;

var q = require('kew');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    q.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-then-promise.js
================================================
global.useThenPromise = true;

var Promise = require("promise");

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    Promise.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
}


================================================
FILE: benchmark/madeup-parallel/promises-tildeio-rsvp.js
================================================
global.useRSVP = true;

var RSVP = require('rsvp');

require('../lib/fakesP');

module.exports = function upload(stream, idOrPath, tag, done) {
    var queries = new Array(global.parallelQueries);
    var tx = db.begin();

    for( var i = 0, len = queries.length; i < len; ++i ) {
        queries[i] = FileVersion.insert({index: i}).execWithin(tx);
    }

    RSVP.all(queries).then(function() {
        tx.commit();
        done();
    }, function(err) {
        tx.rollback();
        done(err);
    });
};


================================================
FILE: benchmark/madeup-parallel/streamline-callbacks.js
================================================
'use strict';

var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/madeup-parallel/streamline._js';

var execWithin = _streamline.async(regeneratorRuntime.mark(function _$$execWithin$$(query, tx, _2) {
    return regeneratorRuntime.wrap(function _$$execWithin$$$(_context) {
        while (1) {
            switch (_context.prev = _context.next) {
                case 0:
                    _context.next = 2;
                    return _streamline.await(_filename, 5, query, 'execWithin', 1, null, false, [tx, true]);

                case 2:
                    return _context.abrupt('return', _context.sent);

                case 3:
                case 'end':
                    return _context.stop();
            }
        }
    }, _$$execWithin$$, this);
}), 2, 3);

require('../lib/fakes');

// Futures work on streamlined function so we need to wrap execWithin


module.exports = _streamline.async(regeneratorRuntime.mark(function _$$upload$$(stream, idOrPath, tag, _3) {
    var queries, tx, i, len;
    return regeneratorRuntime.wrap(function _$$upload$$$(_context2) {
        while (1) {
            switch (_context2.prev = _context2.next) {
                case 0:
                    _context2.prev = 0;
                    queries = new Array(global.parallelQueries);
                    tx = db.begin();


                    for (i = 0, len = queries.length; i < len; ++i) {
                        queries[i] = _streamline.future(_filename, 14, null, execWithin, 2, null, false, [FileVersion.insert({ index: i }), tx, false]);
                    }

                    i = 0, len = queries.length;

                case 5:
                    if (!(i < len)) {
                            _context2.next = 11;
                            break;
                        }

                    _context2.next = 8;
                    return _streamline.await(_filename, 18, queries, i, 0, null, false, [true]);

                case 8:
                    ++i;
                    _context2.next = 5;
                    break;

                case 11:

                    tx.commit();
                    _context2.next = 18;
                    break;

                case 14:
                    _context2.prev = 14;
                    _context2.t0 = _context2['catch'](0);

                    tx.rollback();
                    throw _context2.t0;

                case 18:
                case 'end':
                    return _context2.stop();
            }
        }
    }, _$$upload$$, this, [[0, 14]]);
}), 3, 4);

================================================
FILE: benchmark/madeup-parallel/streamline-generators.js
================================================
'use strict';

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : Streamline.require('streamline-runtime/lib/generators/runtime');

var _filename = '/Users/bruno/dev/bluebird/benchmark/madeup-parallel/streamline._js';

var execWithin = _streamline.async(function* _$$execWithin$$(query, tx, _2) {
    {
        return yield _streamline.await(_filename, 5, query, 'execWithin', 1, null, false, [tx, true]);
    }
}, 2, 3);

require('../lib/fakes');

// Futures work on streamlined function so we need to wrap execWithin


module.exports = _streamline.async(function* _$$upload$$(stream, idOrPath, tag, _3) {
    {
        try {
            var queries = new Array(global.parallelQueries);
            var tx = db.begin();

            for (var i = 0, len = queries.length; i < len; ++i) {
                queries[i] = _streamline.future(_filename, 14, null, execWithin, 2, null, false, [FileVersion.insert({ index: i }), tx, false]);
            }

            for (var i = 0, len = queries.length; i < len; ++i) {
                yield _streamline.await(_filename, 18, queries, i, 0, null, false, [true]);
            }

            tx.commit();
        } catch (err) {
            tx.rollback();
            throw err;
        }
    }
}, 3, 4);

================================================
FILE: benchmark/madeup-parallel/streamline._js
================================================
require('../lib/fakes');

// Futures work on streamlined function so we need to wrap execWithin
function execWithin(query, tx, _) {
    return query.execWithin(tx, _);
}

module.exports = function upload(stream, idOrPath, tag, _) {
    try {
        var queries = new Array(global.parallelQueries);
        var tx = db.begin();

        for (var i = 0, len = queries.length; i < len; ++i ) {
            queries[i] = execWithin(FileVersion.insert({index: i}), tx, !_);
        }

        for (var i = 0, len = queries.length; i < len; ++i ) {
            queries[i](_);
        }

        tx.commit();
    } catch (err) {
        tx.rollback();
        throw err;
    }
};


================================================
FILE: benchmark/package.json
================================================
{
  "name": "async-compare",
  "version": "0.1.1",
  "description": "Compare the performance and code of multiple async patterns",
  "main": "perf.js",
  "dependencies": {
    "async": "^2.6.1",
    "davy": "^1.3.0",
    "deferred": "^0.7.9",
    "kew": "^0.7.0",
    "lie": "^3.3.0",
    "neo-async": "^2.5.1",
    "optimist": "^0.6.1",
    "promise": "^8.0.1",
    "q": "^1.5.1",
    "rsvp": "^4.8.3",
    "streamline": "^2.1.3",
    "streamline-runtime": "^1.1.15",
    "text-table": "^0.2.0",
    "vow": "^0.4.17",
    "when": "^3.7.8"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "generators",
    "fibers",
    "promises",
    "callbacks",
    "comparison",
    "compare",
    "async"
  ],
  "author": "spion",
  "license": "MIT",
  "engines": {
    "node": ">8.11.0 <9"
  }
}


================================================
FILE: benchmark/performance.js
================================================

var args = require('optimist').argv;

var path = require('path');

global.LIKELIHOOD_OF_REJECTION = args.e || 0.1;
global.triggerIntentionalError = function(){
    if(LIKELIHOOD_OF_REJECTION && Math.random() <= LIKELIHOOD_OF_REJECTION) throw new Error("intentional failure");
}

function printPlatform() {
    console.log("\nPlatform info:");
    var os = require("os");
    var v8 = process.versions.v8;
    var node = process.versions.node;
    var plat = os.type() + " " + os.release() + " " + os.arch() + "\nNode.JS " + node + "\nV8 " + v8;
    var cpus = os.cpus().map(function(cpu){
        return cpu.model;
    }).reduce(function(o, model){
        if( !o[model] ) o[model] = 0;
        o[model]++;
        return o;
    }, {});
    cpus = Object.keys(cpus).map(function( key ){
        return key + " \u00d7 " + cpus[key];
    }).join("\n");
    console.log(plat + "\n" + cpus + "\n");
}

var perf = module.exports = function(args, done) {

    var errs = 0;
    var lastErr;
    var times = args.n;

    global.asyncTime = args.t;
    global.parallelQueries = args.p || 10;

    if (args.longStackSupport) {
        global.longStackSupport = require('q').longStackSupport
            = args.longStackSupport;
        require('bluebird').longStackTraces();
    }

    var fn = require(args.file);

    var start = Date.now();


    var warmedUp = 0;
    var tot =  Math.min( 350, times );
    for (var k = 0, kn = tot; k < kn; ++k)
        fn(k,'b','c', warmup);

    var memMax; var memStart; var start;
    function warmup() {
        warmedUp++
        if( warmedUp === tot ) {
            start = Date.now();

            memStart = process.memoryUsage().rss;
            for (var k = 0, kn = args.n; k < kn; ++k)
                fn(k, 'b', 'c', cb);
            memMax = process.memoryUsage().rss;
        }
    }

    function cb (err) {
        if (err && err.message !== "intentional failure") {
            ++errs;
            lastErr = err;
        }
        memMax = Math.max(memMax, process.memoryUsage().rss);
        if (!--times) {
            fn.end && fn.end();
            done(null, {
                time: Date.now() - start,
                mem: (memMax - memStart)/1024/1024,
                errors: errs,
                lastErr: lastErr ? lastErr.stack : null
            });
        }
    }
}


function report(err, res) {
    console.log(JSON.stringify(res));
}

if (args.file) {
    perf(args, function(err, res) {
        report(err, res);
        if (res.lastErr)
            console.error(res.lastErr);
    });
} else {
    var cp    = require('child_process')
    var async = require('async');
    var table = require('text-table');

    var files = args._.filter(function(f) {
        return !/^src-/.test(path.basename(f));
    });

    measure(files, args.n, args.t, args.p, function(err, res) {
        console.log("");
        console.log("results for", args.n, "parallel executions,",
                    args.t, "ms per I/O op");
        if(args.e) console.log("Likelihood of rejection:", args.e);

        res.sort(function(r1, r2) {
            return parseFloat(r1.data.time) - parseFloat(r2.data.time)
        });
        console.log("");
        res = res.map(function(r) {
            var failText = 'OOM';
            if (r.data.timeout) failText = 'T/O';
            return [path.basename(r.file),
                r.data.mem != null ? r.data.time: failText,
                r.data.mem != null ? r.data.mem.toFixed(2) : failText]
        });

        res = [['file', 'time(ms)', 'memory(MB)']].concat(res)

        console.log(table(res, {align: ['l', 'r', 'r']}));
        printPlatform();

    });
}


function measure(files, requests, time, parg, callback) {
    async.mapSeries(files, function(f, done) {
        console.log("benchmarking", f);
        var logFile = path.basename(f) + ".log";
        var profileFlags = ["--prof", "--logfile=C:/etc/v8/" + logFile];

        var argsFork = [__filename,
            '--n', requests,
            '--t', time,
            '--p', parg,
            '--file', f];
        if (args.profile) argsFork = profileFlags.concat(argsFork);
        if (args.harmony) argsFork.unshift('--harmony');
        if (args.longStackSupport) argsFork.push('--longStackSupport');
        var p = cp.spawn(process.execPath, argsFork);

        var complete = false, timedout = false;
        if (args.timeout) setTimeout(function() {
            if (complete) return;
            timedout = true;
            p.kill();
        }, args.timeout);

        var r = { file: f, data: [] };
        p.stdout.on('data', function(d) { r.data.push(d.toString()); });
        p.stdout.pipe(process.stdout);
        p.stderr.pipe(process.stderr);
        p.stdout.on('end', function(code) {
            complete = true;
            try {
                r.data = JSON.parse(r.data.join(''));
            } catch(e) {
                r.data = {time: Number.POSITIVE_INFINITY, mem: null,
                    missing: true, timeout: timedout};
            }
            done(null, r);
        });
    }, callback);
}


================================================
FILE: bower.json
================================================
{
  "name": "bluebird",
  "version": "3.7.2",
  "homepage": "https://github.com/petkaantonov/bluebird",
  "authors": [
    "Petka Antonov <petka_antonov@hotmail.com>"
  ],
  "description": "Bluebird is a full featured promise library with unmatched performance.",
  "main": "js/browser/bluebird.js",
  "license": "MIT",
  "ignore": [
    "**/.*",
    "benchmark",
    "bower_components",
    "./browser",
    "node_modules",
    "test"
  ],
  "keywords": [
    "promise",
    "performance",
    "promises",
    "promises-a",
    "promises-aplus",
    "async",
    "await",
    "deferred",
    "deferreds",
    "future",
    "flow control",
    "dsl",
    "fluent interface"
  ]
}


================================================
FILE: build
================================================
#!/usr/bin/env bash
node tools/build.js "$@"


================================================
FILE: changelog.md
================================================
[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)


================================================
FILE: deprecated_apis.md
================================================
[http://bluebirdjs.com/docs/deprecated-apis.html](http://bluebirdjs.com/docs/deprecated-apis.html)


================================================
FILE: docs/.gitignore
================================================
_site
.sass-cache
Gemfile.lock


================================================
FILE: docs/Gemfile
================================================
source "https://rubygems.org"

gem "jekyll", '3.9.0'
gem "jekyll-redirect-from"
gem "sanitize", '4.0.1'
gem "redcarpet"
gem "pygments.rb"
gem 'wdm', '>= 0.1.0' if Gem.win_platform?


================================================
FILE: docs/README.md
================================================
Requires ruby and [jekyll](http://jekyllrb.com/). See the gem file for dependencies.

Change directory to `bluebird/docs` and run `jekyll serve`. The docs will be hosted under `/docs` directory in relation to the web root. Typically something like `http://localhost:4000/docs/`




================================================
FILE: docs/_config.yml
================================================
name: bluebird
description: Bluebird is a fully featured JavaScript promises library with unmatched performance.
url: "http://bluebirdjs.com"
baseurl: ""
title: bluebird
timezone: Helsinki/Finland
highlighter: pygments
exclude:
  - Gemfile
  - Gemfile.lock
  - helpers.rb
defaults:
  - scope:
      path: docs
      type: pages
    values:
      layout: page
markdown: redcarpet
redcarpet:
  extensions:
    - fenced_code_blocks
version: 3.7.2
gems:
  - jekyll-redirect-from
destination: ../gh-pages/
keep_files:
  - .git
  - .gitignore
  - logo.png
  - CNAME
  - coverage
safe: false
encoding: utf-8
host: 0.0.0.0



================================================
FILE: docs/_layouts/api.html
================================================
---
layout: default
---

<div class="post">
  <article class="post-content">
    {{ content }}
  </article>
</div>


================================================
FILE: docs/_layouts/default.html
================================================
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
 <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href='http://fonts.googleapis.com/css?family=Raleway:400,300,200,700,500,100,800,600,900' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
    <title>{% if page.title %}{{ page.title }} | {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
    <meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
    <link rel="stylesheet" href="{{ "/css/mono-blue.css" | prepend: site.baseurl }}" type='text/css' />
    <link rel="stylesheet" href="{{ "/css/hover-min.css" | prepend: site.baseurl }}" media="all">
    <link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
    <link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
    <link rel="icon" href="{{ "/img/favicon.png" | prepend: site.baseurl }}" type="image/png" />
  </head>

  <body>

    <nav class="navbar" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <a href="/" class="title">
                    <img src="{{ "/img/libbblog_v3.png" | prepend: site.baseurl }}" class="hidden-xs" alt="bluebird logo" />

                    <span class="tagline">bluebird</span>
                </a>
            </div>
            <div id="navbar" class="navbar-collapse navbar-bluebird navbar-right collapse">
                <ul class="nav navbar-nav bb-nav">
                    {% if page.path == 'docs/api-reference.md' %}
                        {% assign name = 'api' %}
                    {% elsif page.path == 'docs/support.md' %}
                        {% assign name = 'support' %}
                    {% elsif page.path == 'docs/install.md' %}
                        {% assign name = 'install' %}
                    {% else %}
                        {% assign name = 'docs' %}
                    {% endif %}

                    <li class="{% if name == 'api' %}active{% endif %}"><a href="{{ "/docs/api-reference.html" | prepend: site.baseurl }}">API</a></li>
                    <li class="{% if name == 'docs' %}active{% endif %}"><a href="{{ "/docs/getting-started.html" | prepend: site.baseurl }}">Docs</a></li>
                    <li class="{% if name == 'support' %}active{% endif %}"><a href="{{ "/docs/support.html" | prepend: site.baseurl }}">Support</a></li>
                    <li class="{% if name == 'install' %}active{% endif %}"><a href="{{ "/docs/install.html" | prepend: site.baseurl }}">Install</a></li>
                    <li><a href="https://github.com/petkaantonov/bluebird/">Github</a></li>
                </ul>
            </div><!--/.navbar-collapse -->
        </div>
    </nav>

   <div class="container">
      <div class="row">
        <div class="col-sm-3">
            <ul class="nav left-nav">
                <li><a href="{{ "/docs/getting-started.html" | prepend: site.baseurl }}">Getting Started</a></li>
                <li><a href="{{ "/docs/features.html" | prepend: site.baseurl }}">Features</a></li>
                <li><a href="{{ "/docs/changelog.html" | prepend: site.baseurl }}">Changelog</a></li>
                <li><a href="{{ "/docs/api-reference.html" | prepend: site.baseurl }}"><strong>API Reference</strong></a></li>
                <li><a href="{{ "/docs/new-in-bluebird-3.html" | prepend: site.baseurl }}"><strong>New in 3.0</strong></a></li>
                <li><a href="{{ "/docs/warning-explanations.html" | prepend: site.baseurl }}">Warning Explanations</a></li>
                <li><a href="{{ "/docs/error-explanations.html" | prepend: site.baseurl }}">Error Explanations</a></li>
                <li><a href="{{ "/docs/contribute.html" | prepend: site.baseurl }}">Contribute</a></li>
                <li><a href="{{ "/docs/benchmarks.html" | prepend: site.baseurl }}">Benchmarks</a></li>
                <li><a href="{{ "/docs/deprecated-apis.html" | prepend: site.baseurl }}">Deprecated APIs</a></li>
                <li><a href="{{ "/docs/download-api-reference.html" | prepend: site.baseurl }}">Download API Reference</a></li>
                <li><hr></li>
                <li>Why?
                    <ul class="nav nav-child">
                        <li><a href="{{ "/docs/why-promises.html" | prepend: site.baseurl }}">Why Promises?</a></li>
                        <li><a href="{{ "/docs/why-bluebird.html" | prepend: site.baseurl }}">Why bluebird?</a></li>
                        <li><a href="{{ "/docs/why-performance.html" | prepend: site.baseurl }}">Why Performance?</a></li>
                        <li><a href="{{ "/docs/what-about-generators.html" | prepend: site.baseurl }}">What About Generators?</a></li>
                    </ul>
                </li>
                <li><hr></li>
                <li>
                    Tutorials
                    <ul class="nav nav-child">
                        <li><a href="{{ "/docs/async-dialogs.html" | prepend: site.baseurl }}">Async Dialogs</a></li>
                    </ul>
                </li>
                <li><hr></li>
                <li>
                    Guides
                    <ul class="nav nav-child">
                        <li><a href="{{ "/docs/beginners-guide.html" | prepend: site.baseurl }}">Beginner's Guide</a></li>
                        <li><a href="{{ "/docs/anti-patterns.html" | prepend: site.baseurl }}">Anti-patterns</a></li>
                        <li><a href="{{ "/docs/working-with-callbacks.html" | prepend: site.baseurl }}">Working with Callbacks</a></li>
                        <li><a href="{{ "/docs/coming-from-other-languages.html" | prepend: site.baseurl }}">Coming from Other Languages</a></li>
                        <li><a href="{{ "/docs/coming-from-other-libraries.html" | prepend: site.baseurl }}">Coming from Other Libraries</a></li>
                    </ul>
                </li>
                <li><hr></li>

            </ul>
        </div>
        <div class="col-sm-9">
            {% if page.path %}
            <div class="post-info">
                <a href="{{ page.path | prepend: "https://github.com/petkaantonov/bluebird/edit/master/docs/" }}">
                    <i class="fa fa-edit"></i>
                    Edit on Github</a>
                <br>
                <i>Updated {{ page.path | file_date | date_to_string }}</i>
            </div>
            <div class="clearfix"></div>
            {% endif %}
            {{ content }}
        </div>
      </div>
    </div>
    <footer></footer>
    <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
    <script src="//cdn.jsdelivr.net/npm/bluebird@{{ site.version }}/js/browser/bluebird.js"></script>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-46253177-1', 'auto');
      ga('send', 'pageview');

    </script>
</body>

</html>


================================================
FILE: docs/_layouts/page.html
================================================
---
layout: default
---
<div class="post">

  <header class="post-header">
    <h1 class="post-title">{{ page.title }}</h1>
  </header>

  <article class="post-content">
    {{ content }}
  </article>

</div>


================================================
FILE: docs/_plugins/mdate.rb
================================================
module Jekyll
  module MyFilters
    def file_date(input)
      File.mtime(input)
    end

    def check_active(page_path, link_type)
        if (link_type == "support" and page_path =~ /support/) or
            (link_type == "install" and page_path =~ /install/) or
            (link_type == "docs")
            "active"
        else
            ""
        end
    end
  end
end

Liquid::Template.register_filter(Jekyll::MyFilters)


================================================
FILE: docs/_plugins/plugin.rb
================================================
require "redcarpet"
require "pygments"
require_relative "../helpers"


class Redcarpet::Render::HTML
    def header(title, level)
        anchor = Helpers.clean(title)

        return <<-eos
            <h#{level}>
                <a class="header-anchor"
                    name="#{anchor}"
                    aria-hidden="true"
                    href="##{anchor}"><i class="fa fa-link"></i></a>
                #{title}
            </h#{level}>
        eos
    end
    # Hacks to get markdown working inside html blocks ....
    def block_html(html)
        html.gsub(/<markdown>([\d\D]+?)<\/markdown>/) {|_|
            extensions = {fenced_code_blocks: true}
            renderer = Redcarpet::Markdown.new(WithHighlights, extensions)
            renderer.render(Regexp.last_match[1])
        }
    end

    def link(link, title, content)
        if link == "unfinished-article"
            return <<-eos
            <div class="info-box">
                This article is partially or completely unfinished.
                You are welcome to create <a href="https://github.com/petkaantonov/bluebird/edit/master/docs/docs/#{content}.md">pull requests</a>
                to help completing this article.
            </div>
            eos
        elsif link == "."
            if content =~ /#\d+/
                url = "https://github.com/petkaantonov/bluebird/issues/" + content[1..-1]
            else
                url = "/docs/api/" + Helpers.clean(content) + ".html"
            end
            return "<a href='#{url}'><code>#{content}</code></a>"
        else
            return "<a href='#{link}' title='#{title}'>#{content}</a>"
        end
    end
end

class WithHighlights < Redcarpet::Render::HTML
    def block_code(code, language)
        Pygments.highlight(code, :lexer => language)
    end
end


================================================
FILE: docs/css/main.css
================================================
body {
    font-size: 16px;
}

body > .container {
    padding-bottom: 50px;
}

.navbar-bluebird {
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    margin-top: 50px;
    text-transform:uppercase;
}

.nav {
    font-family: 'Raleway', sans-serif;
}

.nav.bb-nav > li > a{
    transition: all 0.3s ease-in-out;
    border-bottom: 1px solid rgba(0,0,0,0);
}
.nav.bb-nav > li > a:focus, .nav.bb-nav > li > a:hover,
.nav.bb-nav > li.active > a {
    background-color:initial;
    border-bottom:1px solid #BE7306;
}

.nav a {
    color: #BE7306;
}

.nav.left-nav li a {
    padding: 2px 0px;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
}

.nav.left-nav li a:focus, .nav.left-nav li a:hover {
    background: none;
    text-decoration: underline;
}

.navbar-bluebird li {
    text-align:center;
}
h1,h2,h3,h4,h5,h6{
    font-family: 'Raleway', sans-serif;
    /*color:#5275B4;*/
    color: #1B4288;
}
.api-code-section h2, code, pre {
    font-family: 'Consolas', 'Lucida Console', 'Courier New', 'monospace'
}
body {
    margin-top:10px;
}

.icon-bar {
    background-color:#5275B4;
}
.promises-showroom .arrow {
    text-align: center;
    margin-top: 100px;
    color:#EC9313;
}

pre{
    background-color: initial;
    border: none;
    margin:0px;
    padding:0px;
}
.promises-showroom .hljs{
    border-radius: 6px;
    padding-left: 30px;
    padding-bottom: 15px;
}
.take-action{
    position:relative;
    min-height:300px;

}

.take-action .cloud-bg{
    width: 100%;
    height: 300px;
    border: none;
}

.take-action .action-buttons{
    position:absolute;
    top:50%;
    text-align:center;
    width:100%;
}
.btn-bb {
    font-family: 'Raleway', sans-serif;
    color: white;
}
.btn-beak{
    background-color: #EC9313;
    border-bottom: 4px solid #BE7306;
}
.btn-wings {
    background-color: #265584;
    border-bottom: 4px solid #1A3A59;
}
.btn-bb:hover{
    color:white;
}
.undo-margin{
    margin-left:-15px;
}

.main-line{
    font-family: 'Raleway', sans-serif;
    margin-bottom: 59px;
    margin-top: -74px;
    font-size: 20px;
    color:white;
}

.tagline {
    font-family: 'Raleway', sans-serif;
    font-size:26px;
    color:#5275B4;
    font-weight:200;
}

.nav-child {
    margin-left:20px;
}
.title:hover{
    text-decoration:none;
}

.header-anchor {
  opacity: 0;

  -webkit-transition: opacity 0.2s ease-in-out 0.1s;
  -moz-transition: opacity 0.2s ease-in-out 0.1s;
  -ms-transition: opacity 0.2s ease-in-out 0.1s;
  outline: none;
}

.header-anchor:active, .header-anchor:focus  {
    outline: none;
}

h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
  opacity: 1;
}

.api-reference-menu {
    -moz-column-count: 2;
    -webkit-column-count: 2;
    columns: 2;
    margin-bottom: 50px;
}

.post-info {
    float: right;
}

.info-box {
    margin-top: 20px;
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px dashed #8a6d3b;
    border-radius: 4px;
}

.supporter.reaktor {
    width: 200px;
    margin: 0px auto;
}


================================================
FILE: docs/css/mono-blue.css
================================================
.highlight {
    display: block;
    overflow-x: auto;
    padding: 0.5em;
    margin: 15px 0px;
    background: #eaeef3;
    -webkit-text-size-adjust: none;
    color: #00193a;
}

code {
  color: #00193a;
  background: #eaeef3;
}

a code {
  color: #337AB7;
}

.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #738191; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #4c81c9; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .cm { color: #738191; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
.highlight .c1 { color: #738191; font-style: italic } /* Comment.Single */
.highlight .cs { color: #738191; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #808080 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
.highlight .kc { color: #4c81c9; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #4c81c9; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #4c81c9; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #4c81c9 } /* Keyword.Pseudo */
.highlight .kr { color: #4c81c9; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666666 } /* Literal.Number */
.highlight .s { color: #BE7306;} /* Literal.String */
.highlight .na { color: #7D9029 } /* Name.Attribute */
.highlight .nb { color: #4c81c9 } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0000FF } /* Name.Function */
.highlight .nl { color: #A0A000 } /* Name.Label */
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #4c81c9; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #666666 } /* Literal.Number.Float */
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
.highlight .sb { color: #BE7306 } /* Literal.String.Backtick */
.highlight .sc { color: #BE7306 } /* Literal.String.Char */
.highlight .sd { color: #BE7306; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BE7306 } /* Literal.String.Double */
.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BE7306 } /* Literal.String.Heredoc */
.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #BE7306 } /* Literal.String.Other */
.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
.highlight .s1 { color: #BE7306 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #4c81c9 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */


================================================
FILE: docs/docs/anti-patterns.md
================================================
---
id: anti-patterns
title: Anti-patterns
---

This page will contain common promise anti-patterns that are exercised in the wild.


- [The explicit construction anti-pattern](#the-explicit-construction-anti-pattern)
- [The `.then(success, fail)` anti-pattern](#the-.then)

##The Explicit Construction Anti-Pattern

This is the most common anti-pattern. It is easy to fall into this when you don't really understand promises and think of them as glorified event emitters or callback utility. It's also sometimes called the promise constructor anti-pattern. Let's recap: promises are about making asynchronous code retain most of the lost properties of synchronous code such as flat indentation and one exception channel. This pattern is also called the deferred anti-pattern.

In the explicit construction anti-pattern, promise objects are created for no reason, complicating code.

First example is creating deferred object when you already have a promise or thenable:

```js
//Code copyright by Twisternha http://stackoverflow.com/a/19486699/995876 CC BY-SA 2.5
myApp.factory('Configurations', function (Restangular, MotorRestangular, $q) {
    var getConfigurations = function () {
        var deferred = $q.defer();

        MotorRestangular.all('Motors').getList().then(function (Motors) {
            //Group by Config
            var g = _.groupBy(Motors, 'configuration');
            //Map values
            var mapped = _.map(g, function (m) {
                return {
                    id: m[0].configuration,
                    configuration: m[0].configuration,
                    sizes: _.map(m, function (a) {
                        return a.sizeMm
                    })
                }
            });
            deferred.resolve(mapped);
        });
        return deferred.promise;
    };

    return {
        config: getConfigurations()
    }

});
```

This superfluous wrapping is also dangerous, any kind of errors and rejections are swallowed and not propagated to the caller of this function.

Instead of using the Deferred anti-pattern, the code should simply return the promise it already has and propagate values using `return`:

```js
myApp.factory('Configurations', function (Restangular, MotorRestangular, $q) {
    var getConfigurations = function () {
        //Just return the promise we already have!
        return MotorRestangular.all('Motors').getList().then(function (Motors) {
            //Group by Cofig
            var g = _.groupBy(Motors, 'configuration');
            //Return the mapped array as the value of this promise
            return _.map(g, function (m) {
                return {
                    id: m[0].configuration,
                    configuration: m[0].configuration,
                    sizes: _.map(m, function (a) {
                        return a.sizeMm
                    })
                }
            });
        });
    };

    return {
        config: getConfigurations()
    }

});
```

Not only is the code shorter but more importantly, if there is any error it will propagate properly to the final consumer.

Second example is creating a function that does nothing but manually wrap a callback API and doing a poor job at that:

```js
function applicationFunction(arg1) {
    return new Promise(function(resolve, reject){ //Or Q.defer() in Q
      libraryFunction(arg1, function (err, value) {
        if (err) {
          reject(err);
        } else {
          resolve(value);
        }
    });
}
```

This is reinventing the square wheel because any callback API wrapping can and should be done immediately using the promise library's promisification methods:

```js
var applicationFunction = Promise.promisify(libraryFunction);
```

The generic promisification is likely to be faster because it can use internals directly but also handles edge cases like `libraryFunction` throwing synchronously or using multiple success values.


**So when should deferred be used?**

Well simply, when you have to.

You might have to use a deferred object when wrapping a callback API that doesn't follow the standard convention. Like `setTimeout`:

```js
//setTimeout that returns a promise
function delay(ms) {
    var deferred = Promise.defer(); // warning, defer is deprecated, use the promise constructor
    setTimeout(function(){
        deferred.fulfill();
    }, ms);
    return deferred.promise;
}
```

Such wrappers should be rare, if they're common for the reason that the promise library cannot generically promisify them, you should file an issue.

If you cannot do static promisification (promisify and promisifyAll perform too slowly to use at runtime), you may use [Promise.fromCallback](.).

Also see [this StackOverflow question](http://stackoverflow.com/questions/23803743/what-is-the-deferred-antipattern-and-how-do-i-avoid-it) for more examples and a debate around it.

##The `.then(success, fail)` anti-pattern

*Almost* a sure sign of using promises as glorified callbacks. Instead of `doThat(function(err, success))` you do `doThat().then(success, err)` and rationalize to yourself that at least the code is "less coupled" or something.

The `.then` signature is mostly about interop, there is *almost* never a reason to use `.then(success, fail)` in application code. It is even awkward to express it in the sync parallel:

```js
var t0;
try {
    t0 = doThat();
}
catch(e) {

}
//deal with t0 here and waste the try-catch
var stuff = JSON.parse(t0);
```

It is more likely that you would write this instead in the sync world:

```js
try {
    var stuff = JSON.parse(doThat());
}
catch(e) {

}
```

So please write the same when using promises too:

```js
doThat()
.then(function(v) {
    return JSON.parse(v);
})
.catch(function(e) {

});
```

`.catch` is specified for built-in Javascript promises and is "sugar" for `.then(null, function(){})`. Since the way errors work in promises is almost the entire point (and the only thing jQuery never got right, even if it used `.pipe` as a `.then`), I really hope the implementation you are using provides this method for readability.


================================================
FILE: docs/docs/api/aggregateerror.md
================================================
---
layout: api
id: aggregateerror
title: AggregateError
---


[← Back To API Reference](/docs/api-reference.html)
<div class="api-code-section"><markdown>
##AggregateError

```js
new AggregateError() extends Array -> AggregateError
```


A collection of errors. `AggregateError` is an array-like object, with numeric indices and a `.length` property. It supports all generic array methods such as `.forEach` directly.

`AggregateError`s are caught in [`.error`](.) handlers, even if the contained errors are not operational.

[Promise.some](.) and [Promise.any](.)  use `AggregateError` as rejection reason when they fail.


Example:

```js
//Assumes AggregateError has been made global
var err = new AggregateError();
err.push(new Error("first error"));
err.push(new Error("second error"));
throw err;
```

<hr>
</markdown></div>

<div id="disqus_thread"></div>
<script type="text/javascript">
    var disqus_title = "AggregateError";
    var disqus_shortname = "bluebirdjs";
    var disqus_identifier = "disqus-id-aggregateerror";
    
    (function() {
        var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
        dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
        (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

================================================
FILE: docs/docs/api/all.md
================================================
---
layout: api
id: all
title: .all
---


[← Back To API Reference](/docs/api-reference.html)
<div class="api-code-section"><markdown>
##.all

```js
.all() -> Promise
```

Consume the resolved [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) and wait for all items to fulfill similar to [Promise.all()](.).

[Promise.resolve(iterable).all()](.) is the same as [Promise.all(iterable)](.).
</markdown></div>

<div id="disqus_thread"></div>
<script type="text/javascript">
    var disqus_title = ".all";
    var disqus_shortname = "bluebirdjs";
    var disqus_identifier = "disqus-id-all";
    
    (function() {
        var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
        dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
        (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>


================================================
FILE: docs/docs/api/any.md
================================================
---
layout: api
id: any
title: .any
---


[← Back To API Reference](/docs/api-reference.html)
<div class="api-code-section"><markdown>
##.any

```js
.any() -> Promise
```

Same as [Promise.any(this)](.).
</markdown></div>

<div id="disqus_thread"></div>
<script type="text/javascript">
    var disqus_title = ".any";
    var disqus_shortname = "bluebirdjs";
    var disqus_identifier = "disqus-id-any";
    
    (function() {
        var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
        dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
        (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

================================================
FILE: docs/docs/api/ascallback.md
================================================
---
layout: api
id: ascallback
title: .asCallback
---


[← Back To API Reference](/docs/api-reference.html)
<div class="api-code-section"><markdown>
##.asCallback

```js
.asCallback(
    [function(any error, any value) callback],
    [Object {spread: boolean=false} options]
) -> this
```
```js
.nodeify(
    [function(any er
Download .txt
gitextract_5o3u1a2h/

├── .editorconfig
├── .gitignore
├── .istanbul.yml
├── .jshintignore
├── .jshintrc
├── .travis.yml
├── API.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bench
├── benchmark/
│   ├── README.md
│   ├── analysis/
│   │   ├── promises-bluebird-parallel.js
│   │   └── promises-bluebird.js
│   ├── doxbee-sequential/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-waterfall.js
│   │   ├── callbacks-suguru03-neo-async-waterfall.js
│   │   ├── generators-tj-co.js
│   │   ├── observables-Reactive-Extensions-RxJS.js
│   │   ├── observables-baconjs-bacon.js.js
│   │   ├── observables-caolan-highland.js
│   │   ├── observables-pozadi-kefir.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-ecmascript6-native.js
│   │   ├── promises-kriskowal-q.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-native-async-await.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── doxbee-sequential-errors/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-waterfall.js
│   │   ├── callbacks-suguru03-neo-async-waterfall.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-kriskowal-q.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── lib/
│   │   ├── catcher.js
│   │   ├── dummy.js
│   │   ├── fakemaker.js
│   │   ├── fakes-ctx.js
│   │   ├── fakes.js
│   │   ├── fakesC.js
│   │   ├── fakesO.js
│   │   ├── fakesObservable.js
│   │   ├── fakesP-ctx.js
│   │   ├── fakesP.js
│   │   ├── fakesSJS-dst.js
│   │   ├── fakesSJS-src.sjs
│   │   ├── promiseSupport.js
│   │   └── timers-ctx.js
│   ├── madeup-parallel/
│   │   ├── callbacks-baseline.js
│   │   ├── callbacks-caolan-async-parallel.js
│   │   ├── callbacks-suguru03-neo-async-parallel.js
│   │   ├── generators-tj-co.js
│   │   ├── promises-bluebird-generator.js
│   │   ├── promises-bluebird.js
│   │   ├── promises-calvinmetcalf-lie.js
│   │   ├── promises-cujojs-when.js
│   │   ├── promises-dfilatov-vow.js
│   │   ├── promises-ecmascript6-native.js
│   │   ├── promises-lvivski-davy.js
│   │   ├── promises-medikoo-deferred.js
│   │   ├── promises-native-async-await.js
│   │   ├── promises-obvious-kew.js
│   │   ├── promises-then-promise.js
│   │   ├── promises-tildeio-rsvp.js
│   │   ├── streamline-callbacks.js
│   │   ├── streamline-generators.js
│   │   └── streamline._js
│   ├── package.json
│   └── performance.js
├── bower.json
├── build
├── changelog.md
├── deprecated_apis.md
├── docs/
│   ├── .gitignore
│   ├── Gemfile
│   ├── README.md
│   ├── _config.yml
│   ├── _layouts/
│   │   ├── api.html
│   │   ├── default.html
│   │   └── page.html
│   ├── _plugins/
│   │   ├── mdate.rb
│   │   └── plugin.rb
│   ├── css/
│   │   ├── main.css
│   │   └── mono-blue.css
│   ├── docs/
│   │   ├── anti-patterns.md
│   │   ├── api/
│   │   │   ├── aggregateerror.md
│   │   │   ├── all.md
│   │   │   ├── any.md
│   │   │   ├── ascallback.md
│   │   │   ├── bind.md
│   │   │   ├── built-in-error-types.md
│   │   │   ├── call.md
│   │   │   ├── cancel.md
│   │   │   ├── cancellation.md
│   │   │   ├── cancellationerror.md
│   │   │   ├── catch.md
│   │   │   ├── catchreturn.md
│   │   │   ├── catchthrow.md
│   │   │   ├── collections.md
│   │   │   ├── core.md
│   │   │   ├── deferred-migration.md
│   │   │   ├── delay.md
│   │   │   ├── disposer.md
│   │   │   ├── done.md
│   │   │   ├── each.md
│   │   │   ├── environment-variables.md
│   │   │   ├── error-management-configuration.md
│   │   │   ├── error.md
│   │   │   ├── filter.md
│   │   │   ├── finally.md
│   │   │   ├── generators.md
│   │   │   ├── get.md
│   │   │   ├── iscancelled.md
│   │   │   ├── isfulfilled.md
│   │   │   ├── ispending.md
│   │   │   ├── isrejected.md
│   │   │   ├── map.md
│   │   │   ├── mapseries.md
│   │   │   ├── new-promise.md
│   │   │   ├── operationalerror.md
│   │   │   ├── progression-migration.md
│   │   │   ├── promise.all.md
│   │   │   ├── promise.any.md
│   │   │   ├── promise.bind.md
│   │   │   ├── promise.config.md
│   │   │   ├── promise.coroutine.addyieldhandler.md
│   │   │   ├── promise.coroutine.md
│   │   │   ├── promise.delay.md
│   │   │   ├── promise.each.md
│   │   │   ├── promise.filter.md
│   │   │   ├── promise.fromcallback.md
│   │   │   ├── promise.getnewlibrarycopy.md
│   │   │   ├── promise.join.md
│   │   │   ├── promise.longstacktraces.md
│   │   │   ├── promise.map.md
│   │   │   ├── promise.mapseries.md
│   │   │   ├── promise.method.md
│   │   │   ├── promise.noconflict.md
│   │   │   ├── promise.onpossiblyunhandledrejection.md
│   │   │   ├── promise.onunhandledrejectionhandled.md
│   │   │   ├── promise.promisify.md
│   │   │   ├── promise.promisifyall.md
│   │   │   ├── promise.props.md
│   │   │   ├── promise.race.md
│   │   │   ├── promise.reduce.md
│   │   │   ├── promise.reject.md
│   │   │   ├── promise.resolve.md
│   │   │   ├── promise.setscheduler.md
│   │   │   ├── promise.some.md
│   │   │   ├── promise.try.md
│   │   │   ├── promise.using.md
│   │   │   ├── promiseinspection.md
│   │   │   ├── promisification.md
│   │   │   ├── props.md
│   │   │   ├── race.md
│   │   │   ├── reason.md
│   │   │   ├── reduce.md
│   │   │   ├── reflect.md
│   │   │   ├── resource-management.md
│   │   │   ├── return.md
│   │   │   ├── some.md
│   │   │   ├── spread.md
│   │   │   ├── suppressunhandledrejections.md
│   │   │   ├── synchronous-inspection.md
│   │   │   ├── tap.md
│   │   │   ├── tapcatch.md
│   │   │   ├── then.md
│   │   │   ├── throw.md
│   │   │   ├── timeout.md
│   │   │   ├── timeouterror.md
│   │   │   ├── timers.md
│   │   │   ├── utility.md
│   │   │   └── value.md
│   │   ├── api-reference.md
│   │   ├── async-dialogs.md
│   │   ├── beginners-guide.md
│   │   ├── benchmarks.md
│   │   ├── changelog.md
│   │   ├── coming-from-other-languages.md
│   │   ├── coming-from-other-libraries.md
│   │   ├── contribute.md
│   │   ├── deprecated-apis.md
│   │   ├── deprecated_apis.md
│   │   ├── download-api-reference.md
│   │   ├── error-explanations.md
│   │   ├── features.md
│   │   ├── getting-started.md
│   │   ├── install.md
│   │   ├── new-in-bluebird-3.md
│   │   ├── support.md
│   │   ├── warning-explanations.md
│   │   ├── what-about-generators.md
│   │   ├── why-bluebird.md
│   │   ├── why-performance.md
│   │   ├── why-promises.md
│   │   └── working-with-callbacks.md
│   ├── helpers.rb
│   ├── img/
│   │   └── README.txt
│   └── index.html
├── issue_template.md
├── package.json
├── src/
│   ├── any.js
│   ├── assert.js
│   ├── async.js
│   ├── bind.js
│   ├── bluebird.js
│   ├── call_get.js
│   ├── cancel.js
│   ├── catch_filter.js
│   ├── constants.js
│   ├── context.js
│   ├── debuggability.js
│   ├── direct_resolve.js
│   ├── each.js
│   ├── errors.js
│   ├── es5.js
│   ├── filter.js
│   ├── finally.js
│   ├── generators.js
│   ├── join.js
│   ├── map.js
│   ├── method.js
│   ├── nodeback.js
│   ├── nodeify.js
│   ├── promise.js
│   ├── promise_array.js
│   ├── promisify.js
│   ├── props.js
│   ├── queue.js
│   ├── race.js
│   ├── reduce.js
│   ├── schedule.js
│   ├── settle.js
│   ├── some.js
│   ├── synchronous_inspection.js
│   ├── thenables.js
│   ├── timers.js
│   ├── using.js
│   └── util.js
├── test/
│   ├── browser/
│   │   ├── es5-sham.js
│   │   ├── es5-shim.js
│   │   ├── have_getters.js
│   │   ├── index.html
│   │   ├── json.js
│   │   ├── main.js
│   │   ├── mocha.css
│   │   ├── mocha.js
│   │   ├── package.json
│   │   ├── promise_debug.js
│   │   ├── promise_instrumented.js
│   │   └── worker.js
│   └── mocha/
│       ├── 2.1.2.js
│       ├── 2.1.3.js
│       ├── 2.2.1.js
│       ├── 2.2.2.js
│       ├── 2.2.3.js
│       ├── 2.2.4.js
│       ├── 2.2.5.js
│       ├── 2.2.6.js
│       ├── 2.2.7.js
│       ├── 2.3.1.js
│       ├── 2.3.2.js
│       ├── 2.3.3.js
│       ├── 2.3.4.js
│       ├── 3.2.1.js
│       ├── 3.2.2.js
│       ├── 3.2.3.js
│       ├── 3.2.4.js
│       ├── 3.2.5.js
│       ├── 3.2.6.js
│       ├── any.js
│       ├── api_exceptions.js
│       ├── async.js
│       ├── async_hooks.js
│       ├── bind.js
│       ├── bluebird-multiple-instances.js
│       ├── call.js
│       ├── cancel.js
│       ├── catch_filter.js
│       ├── collections_thenables.js
│       ├── constructor.js
│       ├── cycles.js
│       ├── direct_resolving.js
│       ├── domain.js
│       ├── done.js
│       ├── each.js
│       ├── error.js
│       ├── filter.js
│       ├── finally.js
│       ├── following.js
│       ├── generator.js
│       ├── get.js
│       ├── getNewLibraryCopy.js
│       ├── github-2xx-76.js
│       ├── github-3.6.4.js
│       ├── github-3.7.3.js
│       ├── github-4.1.7.js
│       ├── github36.js
│       ├── helpers/
│       │   ├── assert_long_trace.js
│       │   ├── bluebird0_7_0.js
│       │   ├── error.js
│       │   ├── reasons.js
│       │   ├── testThreeCases.js
│       │   ├── thenables.js
│       │   └── util.js
│       ├── is.js
│       ├── join.js
│       ├── late_buffer_safety.js
│       ├── long_stack_traces.js
│       ├── map.js
│       ├── method.js
│       ├── monitoring.js
│       ├── multiple-copies.js
│       ├── no_conflict.js
│       ├── nodeify.js
│       ├── promise_array.js
│       ├── promisify.js
│       ├── props.js
│       ├── race.js
│       ├── reduce.js
│       ├── reflect.js
│       ├── regress.js
│       ├── rejections.js
│       ├── resolution.js
│       ├── schedule.js
│       ├── settle.js
│       ├── some.js
│       ├── spread.js
│       ├── synchronous_inspection.js
│       ├── tap.js
│       ├── tapCatch.js
│       ├── timers.js
│       ├── try.js
│       ├── unhandled_rejections.js
│       └── using.js
├── tests
└── tools/
    ├── README.md
    ├── ast_passes.js
    ├── browser_test_generator.js
    ├── browser_test_runner.js
    ├── build.js
    ├── job-runner/
    │   └── job-runner.js
    ├── jshint.js
    ├── jshintrc_generator.js
    ├── mocha_runner.js
    ├── saucelabs_runner.js
    ├── test.js
    └── utils.js
Download .txt
SYMBOL INDEX (656 symbols across 106 files)

FILE: benchmark/doxbee-sequential-errors/callbacks-baseline.js
  function backoff (line 6) | function backoff(err) {
  function afterFileExists (line 50) | function afterFileExists(err, fileId) {

FILE: benchmark/doxbee-sequential-errors/promises-medikoo-deferred.js
  function identity (line 7) | function identity(v) {

FILE: benchmark/doxbee-sequential/callbacks-baseline.js
  function backoff (line 6) | function backoff(err) {
  function afterFileExists (line 44) | function afterFileExists(err, fileId) {

FILE: benchmark/doxbee-sequential/promises-medikoo-deferred.js
  function identity (line 7) | function identity(v) {

FILE: benchmark/lib/catcher.js
  function invoke (line 5) | function invoke(ctx, cb, value, myhandler) {

FILE: benchmark/lib/fakemaker.js
  function queryish (line 20) | function queryish() {
  function queryisht (line 31) | function queryisht() {

FILE: benchmark/lib/fakesC.js
  function dummyC (line 9) | function dummyC(n) {
  function dummytC (line 12) | function dummytC(n) {

FILE: benchmark/lib/fakesO.js
  function dummyObsWrap (line 9) | function dummyObsWrap(fn) {
  function dummyO (line 21) | function dummyO() {
  function dummytO (line 24) | function dummytO() {

FILE: benchmark/lib/fakesObservable.js
  function thunk (line 11) | function thunk(callback) {
  function dummyP (line 39) | function dummyP(n) {
  function dummytP (line 44) | function dummytP(n) {

FILE: benchmark/lib/fakesP-ctx.js
  function nodeback (line 39) | function nodeback(err, result) {
  function lifter (line 44) | function lifter(f) {
  function dummyP (line 65) | function dummyP(n) {
  function dummytP (line 74) | function dummytP(n) {

FILE: benchmark/lib/fakesP.js
  function dummyP (line 95) | function dummyP(n) {
  function dummytP (line 100) | function dummytP(n) {

FILE: benchmark/lib/fakesSJS-dst.js
  function wrap (line 3) | function wrap(f){return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src....
  function dummySJS0 (line 3) | function dummySJS0(){var inner;return __oni_rt.exseq(arguments,this,'lib...
  function dummySJS1 (line 3) | function dummySJS1(){var inner;return __oni_rt.exseq(arguments,this,'lib...
  function dummySJS (line 3) | function dummySJS(n){if(n === 1){return dummySJS0();}if(n === 2){return ...
  function dummytSJS (line 3) | function dummytSJS(n){var inner;return __oni_rt.exseq(arguments,this,'li...

FILE: benchmark/lib/timers-ctx.js
  function insert (line 50) | function insert(item, msecs) {
  function listOnTimeout (line 75) | function listOnTimeout() {
  function wrapper (line 237) | function wrapper() {
  function processImmediate (line 307) | function processImmediate() {
  function unrefTimeout (line 377) | function unrefTimeout() {

FILE: benchmark/madeup-parallel/callbacks-caolan-async-parallel.js
  function fileInsertFor (line 4) | function fileInsertFor(i, tx) {

FILE: benchmark/madeup-parallel/callbacks-suguru03-neo-async-parallel.js
  function fileInsertFor (line 4) | function fileInsertFor(i, tx) {

FILE: benchmark/madeup-parallel/promises-medikoo-deferred.js
  function identity (line 7) | function identity(v) {

FILE: benchmark/performance.js
  function printPlatform (line 11) | function printPlatform() {
  function warmup (line 56) | function warmup() {
  function cb (line 68) | function cb (err) {
  function report (line 87) | function report(err, res) {
  function measure (line 133) | function measure(files, requests, time, parg, callback) {

FILE: docs/_plugins/mdate.rb
  type Jekyll (line 1) | module Jekyll
    type MyFilters (line 2) | module MyFilters
      function file_date (line 3) | def file_date(input)
      function check_active (line 7) | def check_active(page_path, link_type)

FILE: docs/_plugins/plugin.rb
  class Redcarpet::Render::HTML (line 6) | class Redcarpet::Render::HTML
    method header (line 7) | def header(title, level)
    method block_html (line 21) | def block_html(html)
    method link (line 29) | def link(link, title, content)
  class WithHighlights (line 51) | class WithHighlights < Redcarpet::Render::HTML
    method block_code (line 52) | def block_code(code, language)

FILE: docs/helpers.rb
  class Helpers (line 3) | class Helpers
    method clean (line 4) | def self.clean(input)

FILE: src/any.js
  function any (line 6) | function any(promises) {

FILE: src/assert.js
  function AssertionError (line 4) | function AssertionError(a) {
  function getParams (line 15) | function getParams(args) {
  function nativeAssert (line 21) | function nativeAssert(callName, args, expect) {

FILE: src/async.js
  function Async (line 8) | function Async() {
  function AsyncInvokeLater (line 68) | function AsyncInvokeLater(fn, receiver, arg) {
  function AsyncInvoke (line 74) | function AsyncInvoke(fn, receiver, arg) {
  function AsyncSettlePromises (line 80) | function AsyncSettlePromises(promise) {
  function _drainQueue (line 90) | function _drainQueue(queue) {
  function _drainQueueStep (line 98) | function _drainQueueStep(queue) {

FILE: src/bluebird.js
  function noConflict (line 4) | function noConflict() {

FILE: src/call_get.js
  function ensureMethod (line 69) | function ensureMethod(obj, methodName) {
  function caller (line 80) | function caller(obj) {
  function namedGetter (line 100) | function namedGetter(obj) {
  function indexedGetter (line 103) | function indexedGetter(obj) {

FILE: src/catch_filter.js
  function catchFilter (line 8) | function catchFilter(instances, cb, promise) {

FILE: src/context.js
  function Context (line 11) | function Context() {
  function createContext (line 31) | function createContext() {
  function peekContext (line 35) | function peekContext() {

FILE: src/debuggability.js
  function unhandledRejectionCheck (line 38) | function unhandledRejectionCheck() {
  function unhandledRejectionClear (line 45) | function unhandledRejectionClear() {
  function generatePromiseLifecycleEventObject (line 282) | function generatePromiseLifecycleEventObject(name, promise) {
  function defaultFireEvent (line 385) | function defaultFireEvent() { return false; }
  function cancellationExecute (line 409) | function cancellationExecute(executor, resolve, reject) {
  function cancellationAttachCancellationCallback (line 424) | function cancellationAttachCancellationCallback(onCancel) {
  function cancellationOnCancel (line 439) | function cancellationOnCancel() {
  function cancellationSetOnCancel (line 444) | function cancellationSetOnCancel(onCancel) {
  function cancellationClearCancellationData (line 449) | function cancellationClearCancellationData() {
  function cancellationPropagateFrom (line 454) | function cancellationPropagateFrom(parent, flags) {
  function bindingPropagateFrom (line 469) | function bindingPropagateFrom(parent, flags) {
  function boundValueFunction (line 477) | function boundValueFunction() {
  function longStackTracesCaptureStackTrace (line 491) | function longStackTracesCaptureStackTrace() {
  function longStackTracesAttachExtraTrace (line 496) | function longStackTracesAttachExtraTrace(error, ignoreSelf) {
  function longStackTracesDereferenceTrace (line 513) | function longStackTracesDereferenceTrace() {
  function checkForgottenReturns (line 517) | function checkForgottenReturns(returnValue, promiseCreated, name, promise,
  function deprecated (line 564) | function deprecated(name, replacement) {
  function warn (line 571) | function warn(message, shouldUseOwnTrace, promise) {
  function reconstructStack (line 589) | function reconstructStack(message, stacks) {
  function removeDuplicateOrEmptyJumps (line 600) | function removeDuplicateOrEmptyJumps(stacks) {
  function removeCommonRoots (line 610) | function removeCommonRoots(stacks) {
  function cleanStack (line 638) | function cleanStack(stack) {
  function stackFramesAsArray (line 658) | function stackFramesAsArray(error) {
  function parseStackAndMessage (line 673) | function parseStackAndMessage(error) {
  function formatAndLogError (line 684) | function formatAndLogError(error, title, isSoft) {
  function fireRejectionEvent (line 702) | function fireRejectionEvent(name, localHandler, reason, promise) {
  function formatNonError (line 726) | function formatNonError(obj) {
  function snip (line 752) | function snip(str) {
  function longStackTracesIsSupported (line 760) | function longStackTracesIsSupported() {
  function parseLineInfo (line 767) | function parseLineInfo(line) {
  function setBounds (line 777) | function setBounds(firstLineError, lastLineError) {
  function CapturedTrace (line 819) | function CapturedTrace(parent) {

FILE: src/direct_resolve.js
  function returner (line 3) | function returner() {
  function thrower (line 6) | function thrower() {

FILE: src/each.js
  function promiseAllThis (line 6) | function promiseAllThis() {
  function PromiseMapSeries (line 10) | function PromiseMapSeries(promises, fn) {

FILE: src/errors.js
  function subError (line 8) | function subError(nameProperty, defaultMessage) {
  function OperationalError (line 72) | function OperationalError(message) {

FILE: src/finally.js
  function PassThroughHandlerContext (line 8) | function PassThroughHandlerContext(promise, type, handler) {
  function FinallyHandlerCancelReaction (line 20) | function FinallyHandlerCancelReaction(finallyHandler) {
  function checkCancel (line 28) | function checkCancel(ctx, reason) {
  function succeed (line 41) | function succeed() {
  function fail (line 44) | function fail(reason) {
  function finallyHandler (line 49) | function finallyHandler(reasonOrValue) {

FILE: src/generators.js
  function promiseFromYieldHandler (line 16) | function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
  function PromiseSpawn (line 33) | function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {

FILE: src/map.js
  function MappingPromiseArray (line 14) | function MappingPromiseArray(promises, fn, limit, _filter) {
  function map (line 158) | function map(promises, fn, options, _filter) {

FILE: src/nodeback.js
  function isUntypedError (line 8) | function isUntypedError(obj) {
  function wrapAsOperationalError (line 14) | function wrapAsOperationalError(obj) {
  function nodebackForPromise (line 34) | function nodebackForPromise(promise, multiArgs) {

FILE: src/nodeify.js
  function spreadAdapter (line 9) | function spreadAdapter(val, nodeback) {
  function successAdapter (line 19) | function successAdapter(val, nodeback) {
  function errorAdapter (line 30) | function errorAdapter(reason, nodeback) {

FILE: src/promise.js
  function Proxyable (line 12) | function Proxyable() {}
  function check (line 85) | function check(self, executor) {
  function Promise (line 95) | function Promise(executor) {
  function deferResolve (line 800) | function deferResolve(v) {this.promise._resolveCallback(v);}
  function deferReject (line 801) | function deferReject(v) {this.promise._rejectCallback(v, false);}

FILE: src/promise_array.js
  function toResolutionValue (line 10) | function toResolutionValue(val) {
  function PromiseArray (line 19) | function PromiseArray(values) {

FILE: src/promisify.js
  function propsFilter (line 31) | function propsFilter(key) {
  function isPromisified (line 35) | function isPromisified(fn) {
  function hasPromisified (line 44) | function hasPromisified(obj, key, suffix) {
  function checkValid (line 49) | function checkValid(ret, suffix, suffixRegexp) {
  function promisifiableMethods (line 67) | function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
  function generateCallForArgumentCount (line 130) | function generateCallForArgumentCount(count) {
  function generateArgumentSwitchCase (line 144) | function generateArgumentSwitchCase() {
  function makeNodePromisifiedClosure (line 217) | function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multi...
  function promisifyAll (line 248) | function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
  function promisify (line 275) | function promisify(callback, receiver, multiArgs) {

FILE: src/props.js
  function extractEntry (line 15) | function extractEntry(value, key) {
  function PropertiesPromiseArray (line 41) | function PropertiesPromiseArray(obj) {
  function props (line 99) | function props(promises) {

FILE: src/queue.js
  function arrayMove (line 3) | function arrayMove(src, srcIndex, dst, dstIndex, len) {
  function Queue (line 10) | function Queue(capacity) {

FILE: src/race.js
  function race (line 12) | function race(promises, parent) {

FILE: src/reduce.js
  function ReductionPromiseArray (line 11) | function ReductionPromiseArray(promises, fn, initialValue, _each) {
  function completed (line 139) | function completed(valueOrReason, array) {
  function reduce (line 147) | function reduce(promises, fn, initialValue, _each) {
  function gotAccum (line 155) | function gotAccum(accum) {
  function gotValue (line 167) | function gotValue(value) {

FILE: src/settle.js
  function SettledPromiseArray (line 8) | function SettledPromiseArray(values) {

FILE: src/some.js
  function SomePromiseArray (line 12) | function SomePromiseArray(values) {
  function some (line 137) | function some(promises, howMany) {

FILE: src/synchronous_inspection.js
  function PromiseInspection (line 3) | function PromiseInspection(promise) {

FILE: src/thenables.js
  function tryConvertToPromise (line 8) | function tryConvertToPromise(obj, context) {
  function doGetThen (line 36) | function doGetThen(obj) {
  function getThen (line 40) | function getThen(obj) {
  function isAnyBluebirdPromise (line 50) | function isAnyBluebirdPromise(obj) {
  function doThenable (line 58) | function doThenable(x, then, context) {

FILE: src/timers.js
  function HandleWrapper (line 6) | function HandleWrapper(handle)  {
  function successClear (line 60) | function successClear(value) {
  function failureClear (line 65) | function failureClear(reason) {

FILE: src/using.js
  function thrower (line 11) | function thrower(e) {
  function castPreservingDisposable (line 15) | function castPreservingDisposable(thenable) {
  function dispose (line 25) | function dispose(resources, inspection) {
  function Disposer (line 52) | function Disposer(data, promise, context) {
  function FunctionDisposer (line 91) | function FunctionDisposer(fn, promise, context) {
  function maybeUnwrapDisposer (line 101) | function maybeUnwrapDisposer(value) {
  function ResourceList (line 109) | function ResourceList(length) {

FILE: src/util.js
  function tryCatcher (line 16) | function tryCatcher() {
  function tryCatch (line 26) | function tryCatch(fn) {
  function T (line 37) | function T() {
  function isPrimitive (line 54) | function isPrimitive(val) {
  function isObject (line 60) | function isObject(value) {
  function maybeWrapAsError (line 65) | function maybeWrapAsError(maybeError) {
  function withAppended (line 71) | function withAppended(target, appendee) {
  function getDataPropertyOrDefault (line 82) | function getDataPropertyOrDefault(obj, key, defaultValue) {
  function notEnumerableProp (line 96) | function notEnumerableProp(obj, name, value) {
  function thrower (line 108) | function thrower(r) {
  function isClass (line 179) | function isClass(fn) {
  function FastObject (line 203) | function FastObject(o) {
  function toFastProperties (line 219) | function toFastProperties(obj) {
  function isIdentifier (line 226) | function isIdentifier(str) {
  function filledRange (line 230) | function filledRange(count, prefix, suffix) {
  function safeToString (line 238) | function safeToString(obj) {
  function isError (line 246) | function isError(obj) {
  function markAsOriginatingFromRejection (line 254) | function markAsOriginatingFromRejection(e) {
  function originatesFromRejection (line 261) | function originatesFromRejection(e) {
  function canAttachTrace (line 267) | function canAttachTrace(obj) {
  function classString (line 286) | function classString(obj) {
  function copyDescriptors (line 290) | function copyDescriptors(from, to, filter) {
  function env (line 338) | function env(key) {
  function getNativePromise (line 342) | function getNativePromise() {
  function contextBind (line 354) | function contextBind(ctx, cb) {

FILE: test/browser/es5-sham.js
  function doesGetOwnPropertyDescriptorWork (line 54) | function doesGetOwnPropertyDescriptorWork(object) {
  function Empty (line 188) | function Empty() {}
  function Type (line 201) | function Type() {}  // An empty constructor.
  function doesDefinePropertyWork (line 243) | function doesDefinePropertyWork(object) {

FILE: test/browser/es5-shim.js
  function Empty (line 35) | function Empty() {}
  function makeArray (line 194) | function makeArray(l) {
  function Date (line 795) | function Date(Y, M, D, h, m, s, ms) {
  function dayFromMonth (line 845) | function dayFromMonth(year, month) {
  function toUTC (line 856) | function toUTC(t) {
  function multiply (line 957) | function multiply(n, c) {
  function divide (line 966) | function divide(n) {
  function toString (line 975) | function toString() {
  function pow (line 991) | function pow(x, n, acc) {
  function log (line 995) | function log(x) {
  function toInteger (line 1268) | function toInteger(n) {
  function isPrimitive (line 1278) | function isPrimitive(input) {
  function toPrimitive (line 1289) | function toPrimitive(input) {

FILE: test/browser/json.js
  function K (line 2) | function K(p,q){function s(a){if(s[a]!==v)return s[a];var c;if("bug-stri...

FILE: test/browser/main.js
  function checkTimers (line 15) | function checkTimers() {
  function setInterval (line 33) | function setInterval(fn, time) {
  function setTimeout (line 46) | function setTimeout(fn, time) {
  function clearTimeout (line 59) | function clearTimeout(id) {
  function logFailure (line 120) | function logFailure(test, err) {
  function postCoverage (line 135) | function postCoverage() {

FILE: test/browser/mocha.js
  function require (line 5) | function require(p){
  function clonePath (line 77) | function clonePath(path) {
  function removeEmpty (line 80) | function removeEmpty(array) {
  function escapeHTML (line 89) | function escapeHTML(s) {
  function contextLines (line 253) | function contextLines(lines) {
  function eofNL (line 256) | function eofNL(curRange, i, current) {
  function isArray (line 442) | function isArray(obj) {
  function EventEmitter (line 452) | function EventEmitter(){}
  function on (line 487) | function on () {
  function Progress (line 635) | function Progress() {
  function Context (line 782) | function Context(){}
  function Hook (line 877) | function Hook(title, fn) {
  function F (line 886) | function F(){}
  function visit (line 1085) | function visit(obj, file) {
  function image (line 1453) | function image(name) {
  function Mocha (line 1475) | function Mocha(options) {
  function parse (line 1849) | function parse(str) {
  function shortFormat (line 1888) | function shortFormat(ms) {
  function longFormat (line 1904) | function longFormat(ms) {
  function plural (line 1916) | function plural(ms, n, name) {
  function Base (line 2143) | function Base(runner) {
  function pad (line 2251) | function pad(str, len) {
  function inlineDiff (line 2265) | function inlineDiff(err, escape) {
  function unifiedDiff (line 2299) | function unifiedDiff(err, escape) {
  function errorDiff (line 2331) | function errorDiff(err, type, escape) {
  function escapeInvisibles (line 2348) | function escapeInvisibles(line) {
  function colorLines (line 2363) | function colorLines(name, str) {
  function sameType (line 2378) | function sameType(a, b) {
  function Doc (line 2407) | function Doc(runner) {
  function Dot (line 2473) | function Dot(runner) {
  function F (line 2514) | function F(){}
  function HTMLCov (line 2543) | function HTMLCov(runner) {
  function coverageClass (line 2567) | function coverageClass(n) {
  function HTML (line 2620) | function HTML(runner) {
  function error (line 2788) | function error(msg) {
  function fragment (line 2796) | function fragment(html) {
  function hideSuitesWithout (line 2816) | function hideSuitesWithout(classname) {
  function unhide (line 2828) | function unhide() {
  function text (line 2839) | function text(el, str) {
  function on (line 2851) | function on(el, event, fn) {
  function JSONCov (line 2903) | function JSONCov(runner, output) {
  function map (line 2946) | function map(cov) {
  function coverage (line 2985) | function coverage(filename, data) {
  function clean (line 3028) | function clean(test) {
  function List (line 3059) | function List(runner) {
  function clean (line 3094) | function clean(test) {
  function JSONReporter (line 3126) | function JSONReporter(runner) {
  function clean (line 3175) | function clean(test) {
  function errorJSON (line 3190) | function errorJSON(err) {
  function Landing (line 3240) | function Landing(runner) {
  function F (line 3296) | function F(){}
  function List (line 3326) | function List(runner) {
  function F (line 3367) | function F(){}
  function Markdown (line 3396) | function Markdown(runner) {
  function Min (line 3490) | function Min(runner) {
  function F (line 3507) | function F(){}
  function NyanCat (line 3536) | function NyanCat(runner) {
  function draw (line 3600) | function draw(color, n) {
  function write (line 3767) | function write(string) {
  function F (line 3775) | function F(){}
  function Progress (line 3812) | function Progress(runner, options) {
  function F (line 3875) | function F(){}
  function Spec (line 3905) | function Spec(runner) {
  function F (line 3965) | function F(){}
  function TAP (line 3995) | function TAP(runner) {
  function title (line 4043) | function title(test) {
  function XUnit (line 4081) | function XUnit(runner) {
  function F (line 4119) | function F(){}
  function test (line 4129) | function test(test) {
  function tag (line 4150) | function tag(name, attrs, close, content) {
  function cdata (line 4168) | function cdata(str) {
  function Runnable (line 4213) | function Runnable(title, fn) {
  function F (line 4229) | function F(){}
  function multiple (line 4370) | function multiple(err) {
  function done (line 4377) | function done(err) {
  function callFn (line 4428) | function callFn(fn) {
  function Runner (line 4498) | function Runner(suite) {
  function F (line 4524) | function F(){}
  function next (line 4695) | function next(i) {
  function next (line 4744) | function next(suite) {
  function hookErr (line 4845) | function hookErr(err, errSuite, after) {
  function next (line 4869) | function next(err, errSuite) {
  function next (line 4943) | function next(errSuite) {
  function done (line 4964) | function done(errSuite) {
  function uncaught (line 5030) | function uncaught(err){
  function filterLeaks (line 5076) | function filterLeaks(ok, globals) {
  function extraGlobals (line 5108) | function extraGlobals() {
  function Suite (line 5176) | function Suite(title, parentContext) {
  function F (line 5199) | function F(){}
  function Test (line 5502) | function Test(title, fn) {
  function F (line 5512) | function F(){}
  function ignored (line 5684) | function ignored(path){
  function highlight (line 5789) | function highlight(js) {
  function timeslice (line 5987) | function timeslice() {

FILE: test/browser/worker.js
  function handler (line 5) | function handler(ev) {

FILE: test/mocha/2.2.1.js
  function testNonFunction (line 11) | function testNonFunction(nonFunction, stringRepresentation) {
  function testNonFunction (line 27) | function testNonFunction(nonFunction, stringRepresentation) {

FILE: test/mocha/2.2.6.js
  function callbackAggregator (line 14) | function callbackAggregator(times, ultimateCallback) {

FILE: test/mocha/2.2.7.js
  function testReason (line 32) | function testReason(expectedReason, stringRepresentation) {
  function testNonFunction (line 65) | function testNonFunction(nonFunction, stringRepresentation) {
  function testNonFunction (line 89) | function testNonFunction(nonFunction, stringRepresentation) {

FILE: test/mocha/2.3.2.js
  function testPromiseResolution (line 13) | function testPromiseResolution(xFactory, test) {
  function xFactory (line 34) | function xFactory() {
  function xFactory (line 61) | function xFactory() {
  function xFactory (line 76) | function xFactory() {
  function xFactory (line 95) | function xFactory() {
  function xFactory (line 110) | function xFactory() {

FILE: test/mocha/2.3.3.js
  function testPromiseResolution (line 17) | function testPromiseResolution(xFactory, test) {
  function testCallingResolvePromise (line 35) | function testCallingResolvePromise(yFactory, stringRepresentation, test) {
  function testCallingRejectPromise (line 65) | function testCallingRejectPromise(r, stringRepresentation, test) {
  function testCallingResolvePromiseFulfillsWith (line 95) | function testCallingResolvePromiseFulfillsWith(yFactory, stringRepresent...
  function testCallingResolvePromiseRejectsWith (line 105) | function testCallingResolvePromiseRejectsWith(yFactory, stringRepresenta...
  function testCallingRejectPromiseRejectsWith (line 115) | function testCallingRejectPromiseRejectsWith(reason, stringRepresentatio...
  function xFactory (line 134) | function xFactory() {
  function xFactory (line 163) | function xFactory() {
  function xFactory (line 192) | function xFactory() {
  function testRejectionViaThrowingGetter (line 219) | function testRejectionViaThrowingGetter(e, stringRepresentation) {
  function xFactory (line 249) | function xFactory() {
  function xFactory (line 276) | function xFactory() {
  function yFactory (line 312) | function yFactory() {
  function yFactory (line 320) | function yFactory() {
  function yFactory (line 337) | function yFactory() {
  function yFactory (line 349) | function yFactory() {
  function xFactory (line 370) | function xFactory() {
  function xFactory (line 389) | function xFactory() {
  function xFactory (line 411) | function xFactory() {
  function xFactory (line 436) | function xFactory() {
  function xFactory (line 461) | function xFactory() {
  function xFactory (line 484) | function xFactory() {
  function xFactory (line 503) | function xFactory() {
  function xFactory (line 525) | function xFactory() {
  function xFactory (line 549) | function xFactory() {
  function xFactory (line 568) | function xFactory() {
  function xFactory (line 590) | function xFactory() {
  function xFactory (line 615) | function xFactory() {
  function xFactory (line 640) | function xFactory() {
  function xFactory (line 664) | function xFactory() {
  function xFactory (line 682) | function xFactory() {
  function xFactory (line 703) | function xFactory() {
  function xFactory (line 728) | function xFactory() {
  function xFactory (line 781) | function xFactory() {
  function xFactory (line 799) | function xFactory() {
  function xFactory (line 822) | function xFactory() {
  function xFactory (line 845) | function xFactory() {
  function xFactory (line 863) | function xFactory() {
  function xFactory (line 882) | function xFactory() {
  function xFactory (line 903) | function xFactory() {
  function xFactory (line 920) | function xFactory() {
  function xFactory (line 940) | function xFactory() {
  function testFulfillViaNonFunction (line 963) | function testFulfillViaNonFunction(then, stringRepresentation) {

FILE: test/mocha/2.3.4.js
  function testValue (line 10) | function testValue(expectedValue, stringRepresentation, beforeEachHook, ...

FILE: test/mocha/3.2.1.js
  function testNonFunction (line 11) | function testNonFunction(nonFunction, stringRepresentation) {
  function testNonFunction (line 27) | function testNonFunction(nonFunction, stringRepresentation) {

FILE: test/mocha/3.2.5.js
  function callbackAggregator (line 14) | function callbackAggregator(times, ultimateCallback) {

FILE: test/mocha/3.2.6.js
  function testValue (line 28) | function testValue(expectedValue, stringRepresentation) {
  function testReason (line 65) | function testReason(expectedReason, stringRepresentation) {
  function testNonFunction (line 278) | function testNonFunction(nonFunction, stringRepresentation) {
  function testNonFunction (line 302) | function testNonFunction(nonFunction, stringRepresentation) {

FILE: test/mocha/api_exceptions.js
  function assertErrorHasLongTraces (line 7) | function assertErrorHasLongTraces(e) {
  function testCollection (line 11) | function testCollection(name, a1, a2, a3) {

FILE: test/mocha/async.js
  function a (line 11) | function a() {
  function b (line 15) | function b() {
  function c (line 19) | function c() {
  function assertArr (line 24) | function assertArr() {
  function assertStackIsNotGrowing (line 91) | function assertStackIsNotGrowing(stack) {
  function test (line 97) | function test(i){
  function test (line 110) | function test(i){
  function test (line 123) | function test(i){
  function test (line 139) | function test(i){
  function getHeapUsed (line 158) | function getHeapUsed() {

FILE: test/mocha/async_hooks.js
  function runTests (line 13) | function runTests() {

FILE: test/mocha/bind.js
  function timedThenableOf (line 6) | function timedThenableOf(value) {
  function timedPromiseOf (line 16) | function timedPromiseOf(value) {
  function immediatePromiseOf (line 20) | function immediatePromiseOf(value) {
  function immediateThenableOf (line 24) | function immediateThenableOf(value) {
  function timedRejectedThenableOf (line 32) | function timedRejectedThenableOf(value) {
  function timedRejectedPromiseOf (line 42) | function timedRejectedPromiseOf(value) {
  function immediateRejectedPromiseOf (line 48) | function immediateRejectedPromiseOf(value) {
  function immediateRejectedThenableOf (line 52) | function immediateRejectedThenableOf(value) {
  function toValue (line 60) | function toValue(valueOrPromise) {
  function CustomError1 (line 69) | function CustomError1() {}
  function CustomError2 (line 71) | function CustomError2() {}
  function makeTest (line 1000) | function makeTest(a, b, c) {
  function makeThisArgRejectedTest (line 1099) | function makeThisArgRejectedTest(reason) {
  function makeThisArgRejectedTestMethod (line 1117) | function makeThisArgRejectedTestMethod(reason) {

FILE: test/mocha/catch_filter.js
  function BadError (line 14) | function BadError(msg) {
  function predicatesUndefined (line 19) | function predicatesUndefined(e) {
  function predicatesPrimitiveString (line 23) | function predicatesPrimitiveString(e) {

FILE: test/mocha/collections_thenables.js
  function Thenable (line 7) | function Thenable(value, defer, reject) {
  function testFulfillSync (line 28) | function testFulfillSync(name, cb, a1, a2, a3) {
  function testFulfillAsync (line 37) | function testFulfillAsync(name, cb, a1, a2, a3) {
  function testRejectSync (line 45) | function testRejectSync(name, cb, a1, a2, a3) {
  function testRejectAsync (line 54) | function testRejectAsync(name, cb, a1, a2, a3) {
  function mapper (line 243) | function mapper(v) {
  function reducer (line 250) | function reducer(a, b) {
  function filterer (line 253) | function filterer(v) {

FILE: test/mocha/constructor.js
  function fulfills (line 7) | function fulfills(value, test) {
  function rejects (line 23) | function rejects(reason, test) {
  function testFulfilled (line 39) | function testFulfilled(value, test) {
  function testRejected (line 82) | function testRejected(reason, test) {

FILE: test/mocha/direct_resolving.js
  function passthru (line 11) | function passthru(fn) {
  function wrap (line 17) | function wrap(fn, val) {
  function returnValue (line 24) | function returnValue(value) {
  function throwValue (line 32) | function throwValue(value) {
  function returnThenable (line 40) | function returnThenable(thenable, expected) {
  function returnThenableReject (line 48) | function returnThenableReject(thenable, expected) {

FILE: test/mocha/domain.js
  function callsBack (line 32) | function callsBack(cb) {
  function createGroupDone (line 74) | function createGroupDone(limit, next) {

FILE: test/mocha/each.js
  function promised (line 7) | function promised(val) {
  function thenabled (line 15) | function thenabled(val, arr) {

FILE: test/mocha/error.js
  function callsback (line 9) | function callsback(a, b, c, fn) {
  function callsback (line 47) | function callsback(a, b, c, fn) {
  function f (line 99) | function f(cb) {

FILE: test/mocha/filter.js
  function ThrownError (line 10) | function ThrownError() {}
  function assertArr (line 15) | function assertArr(arr) {
  function assertErr (line 21) | function assertErr(e) {
  function assertFail (line 25) | function assertFail() {

FILE: test/mocha/following.js
  function incrementCalled (line 14) | function incrementCalled() {
  function incrementCalled (line 40) | function incrementCalled() {
  function incrementCalled (line 69) | function incrementCalled() {
  function incrementCalled (line 133) | function incrementCalled() {
  function incrementCalled (line 164) | function incrementCalled() {

FILE: test/mocha/generator.js
  function get (line 8) | function get(arg) {
  function fail (line 16) | function fail(arg) {
  function MyClass (line 344) | function MyClass() {

FILE: test/mocha/github-3.6.4.js
  function defer (line 6) | function defer() {

FILE: test/mocha/helpers/assert_long_trace.js
  function assertLongTrace (line 3) | function assertLongTrace(error, expectedJumpCount, expectedFramesForJump...

FILE: test/mocha/helpers/bluebird0_7_0.js
  function AssertionError (line 28) | function AssertionError( a ) {
  function safeToEmbedString (line 62) | function safeToEmbedString( str ) {
  function tryCatch1 (line 66) | function tryCatch1( fn, receiver, arg ) {
  function tryCatch2 (line 78) | function tryCatch2( fn, receiver, arg, arg2 ) {
  function tryCatchApply (line 90) | function tryCatchApply( fn, args ) {
  function F (line 103) | function F(){}
  function makeNodePromisified (line 108) | function makeNodePromisified( callback, receiver ) {
  function T (line 154) | function T() {
  function subError (line 170) | function subError( constructorName, nameProperty, defaultMessage ) {
  function CapturedTrace (line 208) | function CapturedTrace( ignoreUntil ) {
  function GetterCache (line 334) | function GetterCache(){}
  function FunctionCache (line 335) | function FunctionCache(){}
  function isJsIdentifier (line 353) | function isJsIdentifier( val ) {
  function formatPropertyRead (line 358) | function formatPropertyRead( val ) {
  function getGetter (line 367) | function getGetter( propertyName ) {
  function getFunction (line 378) | function getFunction( propertyName ) {
  function Async (line 409) | function Async() {
  function Thenable (line 506) | function Thenable() {
  function CatchFilter (line 639) | function CatchFilter( instances, callback ) {
  function isObject (line 666) | function isObject( value ) {
  function isPromise (line 674) | function isPromise( obj ) {
  function isError (line 680) | function isError( obj ) {
  function Promise (line 694) | function Promise( resolver ) {
  function thrower (line 768) | function thrower( r ) {
  function slowFinally (line 771) | function slowFinally( ret, reasonOrValue ) {
  function mapper (line 966) | function mapper( fulfilleds ) {
  function reducer (line 997) | function reducer( fulfilleds, initialValue ) {
  function slowReduce (line 1017) | function slowReduce( promises, fn, initialValue ) {
  function cast (line 1365) | function cast( obj ) {
  function nullToUndefined (line 1865) | function nullToUndefined( val ) {
  function isPromise (line 1874) | function isPromise( obj ) {
  function PromiseArray (line 1884) | function PromiseArray( values, caller ) {
  function Integer (line 2016) | function Integer( value ) {
  function SettledPromiseArray (line 2041) | function SettledPromiseArray( values, caller ) {
  function AnyPromiseArray (line 2079) | function AnyPromiseArray( values, caller ) {
  function SomePromiseArray (line 2108) | function SomePromiseArray( values, caller ) {
  function PromiseInspection (line 2169) | function PromiseInspection( promise ) {
  function PromiseResolver (line 2212) | function PromiseResolver( promise ) {

FILE: test/mocha/helpers/testThreeCases.js
  function success (line 8) | function success(done) {
  function fail (line 14) | function fail(done) {
  function handlePromise (line 20) | function handlePromise(val, done) {

FILE: test/mocha/helpers/util.js
  function replaceListeners (line 5) | function replaceListeners(by) {
  function resolve (line 161) | function resolve(e) {

FILE: test/mocha/join.js
  function a (line 91) | function a() {

FILE: test/mocha/late_buffer_safety.js
  function async (line 7) | function async(cb){

FILE: test/mocha/long_stack_traces.js
  function circle1 (line 109) | function circle1() {
  function circle2 (line 120) | function circle2() {
  function circle3 (line 131) | function circle3() {
  function u1_1 (line 142) | function u1_1() {
  function u1_2 (line 146) | function u1_2() {
  function u2_1 (line 150) | function u2_1() {
  function u2_2 (line 154) | function u2_2() {
  function u3_1 (line 158) | function u3_1() {
  function u3_2 (line 162) | function u3_2() {

FILE: test/mocha/map.js
  function mapper (line 33) | function mapper(val) {
  function deferredMapper (line 37) | function deferredMapper(val) {
  function mapper (line 117) | function mapper(val) {
  function mapper (line 131) | function mapper(val) {
  function mapper (line 145) | function mapper(val) {
  function mapper (line 162) | function mapper(val) {
  function deferredMapper (line 166) | function deferredMapper(val) {
  function immediate (line 250) | function immediate(index) {
  function late (line 258) | function late(index) {
  function promiseByIndex (line 266) | function promiseByIndex(index) {
  function resolve (line 270) | function resolve(item) {

FILE: test/mocha/monitoring.js
  function nodeOn (line 27) | function nodeOn(eventName, eventHandler) {
  function nodeOff (line 30) | function nodeOff(eventName, eventHandler) {
  function browserSimpleOn (line 33) | function browserSimpleOn(eventName, eventHandler) {
  function browserSimpleOff (line 37) | function browserSimpleOff(eventName, eventHandler) {
  function browserDomOn (line 42) | function browserDomOn (eventName, eventHandler) {
  function browserDomOff (line 46) | function browserDomOff (eventName, eventHandler) {
  function testCreated (line 51) | function testCreated(onCreated) {
  function testChained (line 62) | function testChained(onChained) {
  function testRejected (line 73) | function testRejected(onRejected) {
  function testFulfilled (line 91) | function testFulfilled(onFulfilled) {

FILE: test/mocha/nodeify.js
  function thrower (line 73) | function thrower() {

FILE: test/mocha/promisify.js
  function Test (line 271) | function Test(data) {
  function Model (line 376) | function Model() {
  function f (line 389) | function f() {
  function HasArgs (line 417) | function HasArgs() { }
  function Test (line 457) | function Test() {
  function RedisClient (line 480) | function RedisClient() {}
  function Multi (line 482) | function Multi() {}
  function Mongoose (line 503) | function Mongoose() {}
  function MongoClient (line 519) | function MongoClient() {this.connect = 3;}
  function makeClass (line 532) | function makeClass() {
  function assertLongStackTraces (line 630) | function assertLongStackTraces(e) {
  function isUntypedError (line 886) | function isUntypedError(obj) {
  function stringback (line 900) | function stringback(cb) {
  function errback (line 904) | function errback(cb) {
  function typeback (line 908) | function typeback(cb) {
  function stringthrow (line 912) | function stringthrow(cb) {
  function errthrow (line 916) | function errthrow(cb) {
  function typethrow (line 920) | function typethrow(cb) {

FILE: test/mocha/reduce.js
  function promised (line 7) | function promised(val) {
  function promising (line 14) | function promising(val) {
  function promisingThen (line 19) | function promisingThen(val) {
  function thenabled (line 27) | function thenabled(val) {
  function thenabling (line 36) | function thenabling(val) {
  function evaluate (line 40) | function evaluate(val) {
  function plus (line 457) | function plus(sum, val) {
  function later (line 461) | function later(val) {
  function insertIntoArray (line 597) | function insertIntoArray(arr, val, i) {
  function later (line 611) | function later(val, ms) {
  function plus (line 615) | function plus(sum, val) {
  function plusDelayed (line 619) | function plusDelayed(sum, val) {
  function check (line 625) | function check(delay1, delay2, delay3) {
  function checkDelayed (line 635) | function checkDelayed(delay1, delay2, delay3) {

FILE: test/mocha/resolution.js
  function expect (line 26) | function expect(count, callback) {
  function expect (line 33) | function expect(count, done) {

FILE: test/mocha/tapCatch.js
  function rejection (line 4) | function rejection() {

FILE: test/mocha/unhandled_rejections.js
  function yesE (line 9) | function yesE() {
  function notE (line 13) | function notE() {
  function cleanUp (line 18) | function cleanUp() {
  function setupCleanUps (line 23) | function setupCleanUps() {
  function detachEvents (line 630) | function detachEvents() {
  function attachEvent (line 637) | function attachEvent(type, fn) {

FILE: test/mocha/using.js
  function Resource (line 10) | function Resource() {
  function _connect (line 61) | function _connect() {
  function _connect2 (line 69) | function _connect2() {
  function connectCloseAsync (line 77) | function connectCloseAsync(arr, value) {
  function promiseForConnectCloseAsync (line 85) | function promiseForConnectCloseAsync(arr, value) {
  function connect (line 91) | function connect() {
  function connect2 (line 95) | function connect2() {
  function connectError (line 100) | function connectError() {
  function transactionDisposer (line 108) | function transactionDisposer(tx, outcome) {
  function transactionDisposerAsync (line 112) | function transactionDisposerAsync(tx, outcome) {
  function transaction (line 116) | function transaction() {
  function transactionWithImmediatePromiseAfterConnect (line 120) | function transactionWithImmediatePromiseAfterConnect() {
  function transactionWithEventualPromiseAfterConnect (line 126) | function transactionWithEventualPromiseAfterConnect() {
  function transactionAsync (line 132) | function transactionAsync() {

FILE: tools/ast_passes.js
  function equals (line 7) | function equals( a, b ) {
  function getReceiver (line 27) | function getReceiver( expr ) {
  function nodeToString (line 34) | function nodeToString( expr ) {
  function DynamicCall (line 118) | function DynamicCall( receiver, fnDereference, arg, start, end ) {
  function DirectCall (line 133) | function DirectCall( receiver, fnName, arg, start, end ) {
  function ConstantReplacement (line 146) | function ConstantReplacement( value, start, end ) {
  function Empty (line 156) | function Empty(start, end) {
  function Assertion (line 164) | function Assertion( expr, exprStr, start, end ) {
  function BitFieldRead (line 174) | function BitFieldRead(mask, start, end, fieldExpr) {
  function BitFieldCheck (line 201) | function BitFieldCheck(value, inverted, start, end, fieldExpr) {
  function InlineSlice (line 215) | function InlineSlice(varExpr, collectionExpression, startExpression, end...
  function safeToEmbedString (line 383) | function safeToEmbedString( str ) {
  function parse (line 387) | function parse( src, opts, fileName) {
  function doInline (line 499) | function doInline(node) {

FILE: tools/browser_test_generator.js
  function dependsOnSinon (line 12) | function dependsOnSinon(test) {

FILE: tools/browser_test_runner.js
  function createServer (line 38) | function createServer() {

FILE: tools/build.js
  function applyOptionalRequires (line 21) | function applyOptionalRequires(code, depsRequireCode) {
  function getOptionalRequireCode (line 68) | function getOptionalRequireCode(srcs) {
  function getBrowserBuildHeader (line 81) | function getBrowserBuildHeader(sources, npmPackage) {
  function getSourcePaths (line 105) | function getSourcePaths(features) {
  function ensureDirectory (line 124) | function ensureDirectory(dir, isUsed, clean) {
  function buildRelease (line 131) | function buildRelease(sources, depsRequireCode, dir) {
  function buildDebug (line 157) | function buildDebug(sources, depsRequireCode, dir) {
  function buildBrowser (line 183) | function buildBrowser(sources, dir, tmpDir, depsRequireCode, minify, npm...
  function build (line 270) | function build(options) {

FILE: tools/job-runner/job-runner.js
  function sanitizeCpCount (line 10) | function sanitizeCpCount(input) {
  function debug (line 25) | function debug() {
  function ResultWithOutput (line 32) | function ResultWithOutput(result, stdout, stderr) {
  function leastTotalRunningTime (line 45) | function leastTotalRunningTime(a, b) {
  function each (line 49) | function each(fn) {
  function retLogger (line 59) | function retLogger(result) {
  function throwLogger (line 67) | function throwLogger(result) {
  function reinit (line 75) | function reinit() {
  function checkShutDown (line 79) | function checkShutDown(secondCheck) {
  function schedule (line 91) | function schedule(task, queued) {
  function Worker (line 184) | function Worker(id, requirePath, initTaskFn) {
  function getFunctionSource (line 304) | function getFunctionSource(fn) {
  function bind (line 409) | function bind(fn, ctx) {return function() {return fn.apply(ctx, argument...
  function getTaskFunction (line 412) | function getTaskFunction(context, code) {
  function waitForOutput (line 432) | function waitForOutput() {
  function waitForPreviousOutput (line 453) | function waitForPreviousOutput(id) {
  function waitForFlushAck (line 462) | function waitForFlushAck(id) {
  function toSerializableError (line 474) | function toSerializableError(err) {

FILE: tools/jshint.js
  function log (line 13) | function log(value) {

FILE: tools/mocha_runner.js
  function checkTimers (line 6) | function checkTimers() {
  function setInterval (line 26) | function setInterval(fn, time) {
  function setTimeout (line 40) | function setTimeout(fn, time) {
  function clearTimeout (line 54) | function clearTimeout(id) {
  function failAdvice (line 120) | function failAdvice(failedTestFileName) {

FILE: tools/saucelabs_runner.js
  function reportProgress (line 36) | function reportProgress(notification) {
  function createTunnel (line 75) | function createTunnel(arg) {
  function runTask (line 106) | function runTask(arg, framework) {
  function unsupportedPort (line 154) | function unsupportedPort(url) {

FILE: tools/test.js
  function getTests (line 19) | function getTests(options) {
  function getColorForCoverage (line 69) | function getColorForCoverage(coveragePct) {
  function getCoverage (line 86) | function getCoverage() {
  function generateCoverageBadge (line 101) | function generateCoverageBadge(coverage) {
  function writeCoverageFile (line 110) | function writeCoverageFile(coverage, groupNumber) {
  function needsFreshProcess (line 117) | function needsFreshProcess(testName) {
  function runTestGroup (line 122) | function runTestGroup(testGroup, options, progress) {
  function combineTests (line 136) | function combineTests(tests) {

FILE: tools/utils.js
  function noStackError (line 10) | function noStackError(message) {
  function checkAscii (line 16) | function checkAscii(fileName, contents) {
  function getLicense (line 34) | function getLicense() {
  function cursorTo (line 44) | function cursorTo(x, y) {
  function clearScreenDown (line 49) | function clearScreenDown() {
  function run (line 54) | function run(cmd, args, dir, log) {
  function parseDeps (line 86) | function parseDeps(src) {
  function stripVTControlCharacters (line 104) | function stripVTControlCharacters(str) {
  function showTable (line 128) | function showTable() {
  function addTests (line 141) | function addTests(tests) {
  function getPosition (line 162) | function getPosition(test) {
  function update (line 176) | function update(test, message) {
  function testFail (line 183) | function testFail(test) {
  function testSuccess (line 188) | function testSuccess(test) {
  function stringToStream (line 199) | function stringToStream(str) {
Condensed preview — 369 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,878K chars).
[
  {
    "path": ".editorconfig",
    "chars": 252,
    "preview": "# This file is for unifying the coding style for different editors and IDEs\n# editorconfig.org\n\nroot = true\n\n[*]\nend_of_"
  },
  {
    "path": ".gitignore",
    "chars": 163,
    "preview": "docs/Gemfile.lock\ngh-pages\nnode_modules\ngh-pages\ntest/browser/bundle.js\ntest/browser/worker_bundle.js\njs/*\nzalgo.js\ncove"
  },
  {
    "path": ".istanbul.yml",
    "chars": 1183,
    "preview": "verbose: false\ninstrumentation:\n    root: .\n    default-excludes: true\n    excludes: []\n    embed-source: false\n    vari"
  },
  {
    "path": ".jshintignore",
    "chars": 17,
    "preview": "src/constants.js\n"
  },
  {
    "path": ".jshintrc",
    "chars": 4885,
    "preview": "{\n    \"bitwise\": false,\n    \"camelcase\": true,\n    \"curly\": true,\n    \"eqeqeq\": true,\n    \"es3\": true,\n    \"forin\": true"
  },
  {
    "path": ".travis.yml",
    "chars": 478,
    "preview": "language: node_js\nsudo: false\nmatrix:\n  include:\n    - node_js: \"0.10\"\n    - node_js: \"0.12\"\n    - node_js: \"4\"\n    - no"
  },
  {
    "path": "API.md",
    "chars": 95,
    "preview": "[http://bluebirdjs.com/docs/api-reference.html](http://bluebirdjs.com/docs/api-reference.html)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 389,
    "preview": "\n# Questions and issues\n\nPlease see [The Support Page](http://bluebirdjs.com/docs/support.html)\nThe [github issue tracke"
  },
  {
    "path": "LICENSE",
    "chars": 1086,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2013-2018 Petka Antonov\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "README.md",
    "chars": 3471,
    "preview": "<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo"
  },
  {
    "path": "bench",
    "chars": 1060,
    "preview": "#!/usr/bin/env bash\n./build --release --no-debug\nbenchmark=$1\nnodepath=${2:-node}\nshift 2;\ncwd=${PWD}\n\nexport NODE_ENV=p"
  },
  {
    "path": "benchmark/README.md",
    "chars": 3511,
    "preview": "**2018-07-16** Latest results, using latest versions of modules:\n\n    ├── async@2.6.1\n    ├── davy@1.3.0\n    ├── deferre"
  },
  {
    "path": "benchmark/analysis/promises-bluebird-parallel.js",
    "chars": 598,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nglobal.parallelQueries = 25;\nvar Promise = require('../../js/release/blu"
  },
  {
    "path": "benchmark/analysis/promises-bluebird.js",
    "chars": 1876,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/doxbee-sequential/callbacks-baseline.js",
    "chars": 2297,
    "preview": "require('../lib/fakes');\n\nmodule.exports = function upload(stream, idOrPath, tag, done) {\n    var blob = blobManager.cre"
  },
  {
    "path": "benchmark/doxbee-sequential/callbacks-caolan-async-waterfall.js",
    "chars": 2460,
    "preview": "require('../lib/fakes');\nvar async = require('async');\n\nmodule.exports = function upload(stream, idOrPath, tag, done) {\n"
  },
  {
    "path": "benchmark/doxbee-sequential/callbacks-suguru03-neo-async-waterfall.js",
    "chars": 2463,
    "preview": "require('../lib/fakes');\nvar async = require('neo-async');\n\nmodule.exports = function upload(stream, idOrPath, tag, done"
  },
  {
    "path": "benchmark/doxbee-sequential/generators-tj-co.js",
    "chars": 1773,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/doxbee-sequential/observables-Reactive-Extensions-RxJS.js",
    "chars": 1900,
    "preview": "global.useRx = true;\nvar Rx = require('rx');\nrequire('../lib/fakesObservable');\n\nmodule.exports = function upload(stream"
  },
  {
    "path": "benchmark/doxbee-sequential/observables-baconjs-bacon.js.js",
    "chars": 1931,
    "preview": "global.useBacon = true;\nvar Bacon = require('baconjs').Bacon;\nrequire('../lib/fakesObservable');\n\nmodule.exports = funct"
  },
  {
    "path": "benchmark/doxbee-sequential/observables-caolan-highland.js",
    "chars": 1959,
    "preview": "global.useHighland = true;\nvar _ = require(\"highland\");\nrequire('../lib/fakesObservable');\n\nmodule.exports = function up"
  },
  {
    "path": "benchmark/doxbee-sequential/observables-pozadi-kefir.js",
    "chars": 1920,
    "preview": "global.useKefir = true;\nvar Kefir = require('kefir').Kefir;\nrequire('../lib/fakesObservable');\n\nmodule.exports = functio"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-bluebird-generator.js",
    "chars": 1508,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-bluebird.js",
    "chars": 1876,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-calvinmetcalf-lie.js",
    "chars": 1873,
    "preview": "global.useLie = true;\n\nvar promise = require(\"lie\");\n\nrequire('../lib/fakesP');\n\n\nmodule.exports = function upload(strea"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-cujojs-when.js",
    "chars": 1891,
    "preview": "var when = require('when'), \n    fn = require('when/function'), \n    p = require('../lib/promiseSupport.js');\n\nrequire('"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-dfilatov-vow.js",
    "chars": 1847,
    "preview": "var vow = require('vow'),\n    p = require('../lib/promiseSupport.js');\n\nrequire('../lib/fakesP');\n\nmodule.exports = func"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-ecmascript6-native.js",
    "chars": 2022,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-kriskowal-q.js",
    "chars": 1821,
    "preview": "global.useQ = true;\n\nvar q = require('q');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, idOrPath"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-lvivski-davy.js",
    "chars": 1827,
    "preview": "global.useDavy = true;\nvar davy = require('davy');\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, i"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-medikoo-deferred.js",
    "chars": 1952,
    "preview": "global.useDeferred = true;\n\nvar deferred = require('deferred');\n\nrequire('../lib/fakesP');\n\nfunction identity(v) {\n    r"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-native-async-await.js",
    "chars": 1578,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-obvious-kew.js",
    "chars": 1869,
    "preview": "global.useKew = true;\n\nvar q = require('kew');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, idOr"
  },
  {
    "path": "benchmark/doxbee-sequential/promises-then-promise.js",
    "chars": 1885,
    "preview": "global.useThenPromise = true;\n\nvar promise = require(\"promise\");\n\nrequire('../lib/fakesP');\n\n\nmodule.exports = function "
  },
  {
    "path": "benchmark/doxbee-sequential/promises-tildeio-rsvp.js",
    "chars": 1868,
    "preview": "global.useRSVP = true;\n\nvar rsvp = require('rsvp');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream,"
  },
  {
    "path": "benchmark/doxbee-sequential/streamline-callbacks.js",
    "chars": 3843,
    "preview": "'use strict';\n\nvar regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regene"
  },
  {
    "path": "benchmark/doxbee-sequential/streamline-generators.js",
    "chars": 2267,
    "preview": "'use strict';\n\nvar _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : "
  },
  {
    "path": "benchmark/doxbee-sequential/streamline._js",
    "chars": 1343,
    "preview": "require('../lib/fakes');\n\nmodule.exports = function upload(stream, idOrPath, tag, _) {\n    try {\n        var blob = blob"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/callbacks-baseline.js",
    "chars": 2987,
    "preview": "require('../lib/fakes');\n\nmodule.exports = function upload(stream, idOrPath, tag, done) {\n    var blob = blobManager.cre"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/callbacks-caolan-async-waterfall.js",
    "chars": 2460,
    "preview": "require('../lib/fakes');\nvar async = require('async');\n\nmodule.exports = function upload(stream, idOrPath, tag, done) {\n"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/callbacks-suguru03-neo-async-waterfall.js",
    "chars": 2463,
    "preview": "require('../lib/fakes');\nvar async = require('neo-async');\n\nmodule.exports = function upload(stream, idOrPath, tag, done"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-bluebird-generator.js",
    "chars": 1652,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-bluebird.js",
    "chars": 2035,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-calvinmetcalf-lie.js",
    "chars": 2024,
    "preview": "global.useLie = true;\n\nvar promise = require(\"lie\");\n\nrequire('../lib/fakesP');\n\n\nmodule.exports = function upload(strea"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-cujojs-when.js",
    "chars": 2031,
    "preview": "var when = require('when'),\n    fn = require('when/function'),\n    p = require('../lib/promiseSupport.js');\n\nrequire('.."
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-dfilatov-vow.js",
    "chars": 1998,
    "preview": "var vow = require('vow'),\n    p = require('../lib/promiseSupport.js');\n\nrequire('../lib/fakesP');\n\nmodule.exports = func"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-kriskowal-q.js",
    "chars": 1963,
    "preview": "global.useQ = true;\n\nvar q = require('q');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, idOrPath"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-lvivski-davy.js",
    "chars": 1978,
    "preview": "global.useDavy = true;\nvar davy = require('davy');\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, i"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-medikoo-deferred.js",
    "chars": 2092,
    "preview": "global.useDeferred = true;\n\nvar deferred = require('deferred');\n\nrequire('../lib/fakesP');\n\nfunction identity(v) {\n    r"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-obvious-kew.js",
    "chars": 2011,
    "preview": "global.useKew = true;\n\nvar q = require('kew');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, idOr"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-then-promise.js",
    "chars": 2036,
    "preview": "global.useThenPromise = true;\n\nvar promise = require(\"promise\");\n\nrequire('../lib/fakesP');\n\n\nmodule.exports = function "
  },
  {
    "path": "benchmark/doxbee-sequential-errors/promises-tildeio-rsvp.js",
    "chars": 2019,
    "preview": "global.useRSVP = true;\n\nvar rsvp = require('rsvp');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream,"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/streamline-callbacks.js",
    "chars": 4065,
    "preview": "'use strict';\n\nvar regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regene"
  },
  {
    "path": "benchmark/doxbee-sequential-errors/streamline-generators.js",
    "chars": 2438,
    "preview": "'use strict';\n\nvar _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : "
  },
  {
    "path": "benchmark/doxbee-sequential-errors/streamline._js",
    "chars": 1487,
    "preview": "require('../lib/fakes');\n\nmodule.exports = function upload(stream, idOrPath, tag, _) {\n    try {\n        var blob = blob"
  },
  {
    "path": "benchmark/lib/catcher.js",
    "chars": 1302,
    "preview": "\nexports.longStackSupport = global.longStackSupport;\n\n\nfunction invoke(ctx, cb, value, myhandler) {            \n    try "
  },
  {
    "path": "benchmark/lib/dummy.js",
    "chars": 889,
    "preview": "// A typical node callback function\n// with the callback at the Nth position\nexports.dummy = function dummy(n) {\n    ret"
  },
  {
    "path": "benchmark/lib/fakemaker.js",
    "chars": 1863,
    "preview": "\nmodule.exports = function fakemaker(dummy, dummyt, wrap) {\n\n    var dummy_2 = dummy(2), \n        dummy_1 = dummy(1);\n\n "
  },
  {
    "path": "benchmark/lib/fakes-ctx.js",
    "chars": 997,
    "preview": "var timers = require('./timers-ctx');\n\nvar fakemaker = require('./fakemaker');\n\nvar f = {};\nf.dummy = function dummy(n) "
  },
  {
    "path": "benchmark/lib/fakes.js",
    "chars": 144,
    "preview": "\n\nvar fakemaker = require('./fakemaker'),\n    f = require('./dummy');\n\nfakemaker(f.dummy, f.dummyt, function wrap_identi"
  },
  {
    "path": "benchmark/lib/fakesC.js",
    "chars": 290,
    "preview": "\nvar co = require('co');\n\nvar f = require('./dummy');\n\nvar makefakes = require('./fakemaker');\n\n// Continuable versions "
  },
  {
    "path": "benchmark/lib/fakesO.js",
    "chars": 624,
    "preview": "\nvar Rx = require('rx');\nvar f = require('./dummy');\n\nvar dummy1 = f.dummy(1),\n    dummyt1 = f.dummyt(1);\n\n// Observable"
  },
  {
    "path": "benchmark/lib/fakesObservable.js",
    "chars": 1270,
    "preview": "var lifter, fromNodeCallback;\nif (global.useRx) {\n    lifter = require(\"rx\").Observable.fromNodeCallback;\n} else if (glo"
  },
  {
    "path": "benchmark/lib/fakesP-ctx.js",
    "chars": 2232,
    "preview": "var timers = require('./timers-ctx');\n\nvar fakemaker = require('./fakemaker');\n\nvar f = {};\nf.dummy = function dummy(n) "
  },
  {
    "path": "benchmark/lib/fakesP.js",
    "chars": 2782,
    "preview": "\n\nif (global.useQ)\n    var lifter = require('q').denodeify;\nelse if (global.useBluebird)\n    //Currently promisifies onl"
  },
  {
    "path": "benchmark/lib/fakesSJS-dst.js",
    "chars": 2537,
    "preview": "\n\nvar f,makefakes;function wrap(f){return __oni_rt.exseq(arguments,this,'lib/fakesSJS-src.sjs',[1,__oni_rt.Nb(function()"
  },
  {
    "path": "benchmark/lib/fakesSJS-src.sjs",
    "chars": 992,
    "preview": "var f = require('./dummy.js');\n\nvar makefakes = require('./fakemaker.js');\n\nfunction wrap(f) {\n  return function(x, y) {"
  },
  {
    "path": "benchmark/lib/promiseSupport.js",
    "chars": 1283,
    "preview": "var when = require('when');\nvar fn = require('when/function');\n\n\n\nexports.ternary = fn.lift(function(truthy, iftrue, iff"
  },
  {
    "path": "benchmark/lib/timers-ctx.js",
    "chars": 11519,
    "preview": "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person"
  },
  {
    "path": "benchmark/madeup-parallel/callbacks-baseline.js",
    "chars": 677,
    "preview": "require('../lib/fakes');\n\nmodule.exports = function upload(stream, idOrPath, tag, done) {\n    var tx = db.begin();\n    v"
  },
  {
    "path": "benchmark/madeup-parallel/callbacks-caolan-async-parallel.js",
    "chars": 673,
    "preview": "require('../lib/fakes');\nvar async = require('async');\n\nfunction fileInsertFor(i, tx) {\n    return function(callback) {\n"
  },
  {
    "path": "benchmark/madeup-parallel/callbacks-suguru03-neo-async-parallel.js",
    "chars": 677,
    "preview": "require('../lib/fakes');\nvar async = require('neo-async');\n\nfunction fileInsertFor(i, tx) {\n    return function(callback"
  },
  {
    "path": "benchmark/madeup-parallel/generators-tj-co.js",
    "chars": 763,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/madeup-parallel/promises-bluebird-generator.js",
    "chars": 583,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar bluebird = require('../../js/release/bluebird.js');\nrequire('../lib/"
  },
  {
    "path": "benchmark/madeup-parallel/promises-bluebird.js",
    "chars": 562,
    "preview": "global.useBluebird = true;\nglobal.useQ = false;\nvar Promise = require('../../js/release/bluebird.js');\nrequire('../lib/f"
  },
  {
    "path": "benchmark/madeup-parallel/promises-calvinmetcalf-lie.js",
    "chars": 513,
    "preview": "global.useLie = true;\n\nvar Promise = require(\"lie\");\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream"
  },
  {
    "path": "benchmark/madeup-parallel/promises-cujojs-when.js",
    "chars": 510,
    "preview": "global.useWhen = true;\n\nvar when = require('when');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream,"
  },
  {
    "path": "benchmark/madeup-parallel/promises-dfilatov-vow.js",
    "chars": 527,
    "preview": "var vow = require('vow'),\n    p = require('../lib/promiseSupport.js');\n\nrequire('../lib/fakesP');\n\nmodule.exports = func"
  },
  {
    "path": "benchmark/madeup-parallel/promises-ecmascript6-native.js",
    "chars": 648,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/madeup-parallel/promises-lvivski-davy.js",
    "chars": 509,
    "preview": "global.useDavy = true;\n\nvar davy = require('davy');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream,"
  },
  {
    "path": "benchmark/madeup-parallel/promises-medikoo-deferred.js",
    "chars": 623,
    "preview": "global.useDeferred = true;\n\nvar deferred = require('deferred');\n\nrequire('../lib/fakesP');\n\nfunction identity(v) {\n    r"
  },
  {
    "path": "benchmark/madeup-parallel/promises-native-async-await.js",
    "chars": 652,
    "preview": "global.useNative = true;\n\ntry {\n    if (Promise.race.toString() !== 'function race() { [native code] }')\n        throw 0"
  },
  {
    "path": "benchmark/madeup-parallel/promises-obvious-kew.js",
    "chars": 501,
    "preview": "global.useKew = true;\n\nvar q = require('kew');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream, idOr"
  },
  {
    "path": "benchmark/madeup-parallel/promises-then-promise.js",
    "chars": 525,
    "preview": "global.useThenPromise = true;\n\nvar Promise = require(\"promise\");\n\nrequire('../lib/fakesP');\n\nmodule.exports = function u"
  },
  {
    "path": "benchmark/madeup-parallel/promises-tildeio-rsvp.js",
    "chars": 510,
    "preview": "global.useRSVP = true;\n\nvar RSVP = require('rsvp');\n\nrequire('../lib/fakesP');\n\nmodule.exports = function upload(stream,"
  },
  {
    "path": "benchmark/madeup-parallel/streamline-callbacks.js",
    "chars": 2904,
    "preview": "'use strict';\n\nvar regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regene"
  },
  {
    "path": "benchmark/madeup-parallel/streamline-generators.js",
    "chars": 1299,
    "preview": "'use strict';\n\nvar _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : "
  },
  {
    "path": "benchmark/madeup-parallel/streamline._js",
    "chars": 673,
    "preview": "require('../lib/fakes');\n\n// Futures work on streamlined function so we need to wrap execWithin\nfunction execWithin(quer"
  },
  {
    "path": "benchmark/package.json",
    "chars": 866,
    "preview": "{\n  \"name\": \"async-compare\",\n  \"version\": \"0.1.1\",\n  \"description\": \"Compare the performance and code of multiple async "
  },
  {
    "path": "benchmark/performance.js",
    "chars": 5087,
    "preview": "\nvar args = require('optimist').argv;\n\nvar path = require('path');\n\nglobal.LIKELIHOOD_OF_REJECTION = args.e || 0.1;\nglob"
  },
  {
    "path": "bower.json",
    "chars": 680,
    "preview": "{\n  \"name\": \"bluebird\",\n  \"version\": \"3.7.2\",\n  \"homepage\": \"https://github.com/petkaantonov/bluebird\",\n  \"authors\": [\n "
  },
  {
    "path": "build",
    "chars": 45,
    "preview": "#!/usr/bin/env bash\nnode tools/build.js \"$@\"\n"
  },
  {
    "path": "changelog.md",
    "chars": 87,
    "preview": "[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)\n"
  },
  {
    "path": "deprecated_apis.md",
    "chars": 99,
    "preview": "[http://bluebirdjs.com/docs/deprecated-apis.html](http://bluebirdjs.com/docs/deprecated-apis.html)\n"
  },
  {
    "path": "docs/.gitignore",
    "chars": 31,
    "preview": "_site\n.sass-cache\nGemfile.lock\n"
  },
  {
    "path": "docs/Gemfile",
    "chars": 181,
    "preview": "source \"https://rubygems.org\"\n\ngem \"jekyll\", '3.9.0'\ngem \"jekyll-redirect-from\"\ngem \"sanitize\", '4.0.1'\ngem \"redcarpet\"\n"
  },
  {
    "path": "docs/README.md",
    "chars": 280,
    "preview": "Requires ruby and [jekyll](http://jekyllrb.com/). See the gem file for dependencies.\n\nChange directory to `bluebird/docs"
  },
  {
    "path": "docs/_config.yml",
    "chars": 616,
    "preview": "name: bluebird\ndescription: Bluebird is a fully featured JavaScript promises library with unmatched performance.\nurl: \"h"
  },
  {
    "path": "docs/_layouts/api.html",
    "chars": 115,
    "preview": "---\nlayout: default\n---\n\n<div class=\"post\">\n  <article class=\"post-content\">\n    {{ content }}\n  </article>\n</div>\n"
  },
  {
    "path": "docs/_layouts/default.html",
    "chars": 8328,
    "preview": "<!DOCTYPE html>\n<!--[if lt IE 7]>      <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\"> <![endif]-->\n<!--[if IE 7]>         <ht"
  },
  {
    "path": "docs/_layouts/page.html",
    "chars": 209,
    "preview": "---\nlayout: default\n---\n<div class=\"post\">\n\n  <header class=\"post-header\">\n    <h1 class=\"post-title\">{{ page.title }}</"
  },
  {
    "path": "docs/_plugins/mdate.rb",
    "chars": 433,
    "preview": "module Jekyll\n  module MyFilters\n    def file_date(input)\n      File.mtime(input)\n    end\n\n    def check_active(page_pat"
  },
  {
    "path": "docs/_plugins/plugin.rb",
    "chars": 1820,
    "preview": "require \"redcarpet\"\nrequire \"pygments\"\nrequire_relative \"../helpers\"\n\n\nclass Redcarpet::Render::HTML\n    def header(titl"
  },
  {
    "path": "docs/css/main.css",
    "chars": 3170,
    "preview": "body {\n    font-size: 16px;\n}\n\nbody > .container {\n    padding-bottom: 50px;\n}\n\n.navbar-bluebird {\n    font-family: 'Ral"
  },
  {
    "path": "docs/css/mono-blue.css",
    "chars": 4131,
    "preview": ".highlight {\n    display: block;\n    overflow-x: auto;\n    padding: 0.5em;\n    margin: 15px 0px;\n    background: #eaeef3"
  },
  {
    "path": "docs/docs/anti-patterns.md",
    "chars": 6091,
    "preview": "---\nid: anti-patterns\ntitle: Anti-patterns\n---\n\nThis page will contain common promise anti-patterns that are exercised i"
  },
  {
    "path": "docs/docs/api/aggregateerror.md",
    "chars": 1505,
    "preview": "---\nlayout: api\nid: aggregateerror\ntitle: AggregateError\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/all.md",
    "chars": 1110,
    "preview": "---\nlayout: api\nid: all\ntitle: .all\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-secti"
  },
  {
    "path": "docs/docs/api/any.md",
    "chars": 874,
    "preview": "---\nlayout: api\nid: any\ntitle: .any\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-secti"
  },
  {
    "path": "docs/docs/api/ascallback.md",
    "chars": 3298,
    "preview": "---\nlayout: api\nid: ascallback\ntitle: .asCallback\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\""
  },
  {
    "path": "docs/docs/api/bind.md",
    "chars": 934,
    "preview": "---\nlayout: api\nid: bind\ntitle: .bind\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/built-in-error-types.md",
    "chars": 1501,
    "preview": "---\nlayout: api\nid: built-in-error-types\ntitle: Built-in error types\n---\n\n\n[← Back To API Reference](/docs/api-reference"
  },
  {
    "path": "docs/docs/api/call.md",
    "chars": 2983,
    "preview": "---\nlayout: api\nid: call\ntitle: .call\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/cancel.md",
    "chars": 1054,
    "preview": "---\nlayout: api\nid: cancel\ntitle: .cancel\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/cancellation.md",
    "chars": 5697,
    "preview": "---\nlayout: api\nid: cancellation\ntitle: Cancellation\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/cancellationerror.md",
    "chars": 1051,
    "preview": "---\nlayout: api\nid: cancellationerror\ntitle: CancellationError\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)"
  },
  {
    "path": "docs/docs/api/catch.md",
    "chars": 7303,
    "preview": "---\nlayout: api\nid: catch\ntitle: .catch\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api/catchreturn.md",
    "chars": 1269,
    "preview": "---\nlayout: api\nid: catchreturn\ntitle: .catchReturn\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class"
  },
  {
    "path": "docs/docs/api/catchthrow.md",
    "chars": 1265,
    "preview": "---\nlayout: api\nid: catchthrow\ntitle: .catchThrow\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\""
  },
  {
    "path": "docs/docs/api/collections.md",
    "chars": 1341,
    "preview": "---\nlayout: api\nid: collections\ntitle: Collections\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/core.md",
    "chars": 897,
    "preview": "---\nlayout: api\nid: core\ntitle: Core\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sect"
  },
  {
    "path": "docs/docs/api/deferred-migration.md",
    "chars": 1449,
    "preview": "---\nlayout: api\nid: deferred-migration\ntitle: Deferred migration\n---\n\n\n[← Back To API Reference](/docs/api-reference.htm"
  },
  {
    "path": "docs/docs/api/delay.md",
    "chars": 906,
    "preview": "---\nlayout: api\nid: delay\ntitle: .delay\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api/disposer.md",
    "chars": 5941,
    "preview": "---\nlayout: api\nid: disposer\ntitle: .disposer\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-"
  },
  {
    "path": "docs/docs/api/done.md",
    "chars": 1171,
    "preview": "---\nlayout: api\nid: done\ntitle: .done\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/each.md",
    "chars": 2085,
    "preview": "---\nlayout: api\nid: each\ntitle: .each\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/environment-variables.md",
    "chars": 2363,
    "preview": "---\nlayout: api\nid: environment-variables\ntitle: Environment variables\n---\n\n\n[← Back To API Reference](/docs/api-referen"
  },
  {
    "path": "docs/docs/api/error-management-configuration.md",
    "chars": 4469,
    "preview": "---\nlayout: api\nid: error-management-configuration\ntitle: Error management configuration\n---\n\n\n[← Back To API Reference]"
  },
  {
    "path": "docs/docs/api/error.md",
    "chars": 3221,
    "preview": "---\nlayout: api\nid: error\ntitle: .error\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api/filter.md",
    "chars": 1020,
    "preview": "---\nlayout: api\nid: filter\ntitle: .filter\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/finally.md",
    "chars": 3914,
    "preview": "---\nlayout: api\nid: finally\ntitle: .finally\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-co"
  },
  {
    "path": "docs/docs/api/generators.md",
    "chars": 929,
    "preview": "---\nlayout: api\nid: generators\ntitle: Generators\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"a"
  },
  {
    "path": "docs/docs/api/get.md",
    "chars": 1448,
    "preview": "---\nlayout: api\nid: get\ntitle: .get\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-secti"
  },
  {
    "path": "docs/docs/api/iscancelled.md",
    "chars": 932,
    "preview": "---\nlayout: api\nid: iscancelled\ntitle: .isCancelled\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class"
  },
  {
    "path": "docs/docs/api/isfulfilled.md",
    "chars": 930,
    "preview": "---\nlayout: api\nid: isfulfilled\ntitle: .isFulfilled\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class"
  },
  {
    "path": "docs/docs/api/ispending.md",
    "chars": 954,
    "preview": "---\nlayout: api\nid: ispending\ntitle: .isPending\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"ap"
  },
  {
    "path": "docs/docs/api/isrejected.md",
    "chars": 923,
    "preview": "---\nlayout: api\nid: isrejected\ntitle: .isRejected\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\""
  },
  {
    "path": "docs/docs/api/map.md",
    "chars": 995,
    "preview": "---\nlayout: api\nid: map\ntitle: .map\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-secti"
  },
  {
    "path": "docs/docs/api/mapseries.md",
    "chars": 971,
    "preview": "---\nlayout: api\nid: mapseries\ntitle: .mapseries\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"ap"
  },
  {
    "path": "docs/docs/api/new-promise.md",
    "chars": 2656,
    "preview": "---\nlayout: api\nid: new-promise\ntitle: new Promise\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/operationalerror.md",
    "chars": 1345,
    "preview": "---\nlayout: api\nid: operationalerror\ntitle: OperationalError\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<"
  },
  {
    "path": "docs/docs/api/progression-migration.md",
    "chars": 3136,
    "preview": "---\nlayout: api\nid: progression-migration\ntitle: Progression migration\n---\n\n\n[← Back To API Reference](/docs/api-referen"
  },
  {
    "path": "docs/docs/api/promise.all.md",
    "chars": 1997,
    "preview": "---\nlayout: api\nid: promise.all\ntitle: Promise.all\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/promise.any.md",
    "chars": 1072,
    "preview": "---\nlayout: api\nid: promise.any\ntitle: Promise.any\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/promise.bind.md",
    "chars": 5939,
    "preview": "---\nlayout: api\nid: promise.bind\ntitle: Promise.bind\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/promise.config.md",
    "chars": 3630,
    "preview": "---\nlayout: api\nid: promise.config\ntitle: Promise.config\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/promise.coroutine.addyieldhandler.md",
    "chars": 4184,
    "preview": "---\nlayout: api\nid: promise.coroutine.addyieldhandler\ntitle: Promise.coroutine.addYieldHandler\n---\n\n\n[← Back To API Refe"
  },
  {
    "path": "docs/docs/api/promise.coroutine.md",
    "chars": 2376,
    "preview": "---\nlayout: api\nid: promise.coroutine\ntitle: Promise.coroutine\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)"
  },
  {
    "path": "docs/docs/api/promise.delay.md",
    "chars": 1559,
    "preview": "---\nlayout: api\nid: promise.delay\ntitle: Promise.delay\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div cl"
  },
  {
    "path": "docs/docs/api/promise.each.md",
    "chars": 4521,
    "preview": "---\nlayout: api\nid: promise.each\ntitle: Promise.each\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/promise.filter.md",
    "chars": 2642,
    "preview": "---\nlayout: api\nid: promise.filter\ntitle: Promise.filter\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/promise.fromcallback.md",
    "chars": 2888,
    "preview": "---\nlayout: api\nid: promise.fromcallback\ntitle: Promise.fromCallback\n---\n\n\n[← Back To API Reference](/docs/api-reference"
  },
  {
    "path": "docs/docs/api/promise.getnewlibrarycopy.md",
    "chars": 1991,
    "preview": "---\nlayout: api\nid: promise.getnewlibrarycopy\ntitle: Promise.getNewLibraryCopy\n---\n\n\n[← Back To API Reference](/docs/api"
  },
  {
    "path": "docs/docs/api/promise.join.md",
    "chars": 3190,
    "preview": "---\nlayout: api\nid: promise.join\ntitle: Promise.join\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/promise.longstacktraces.md",
    "chars": 3263,
    "preview": "---\nlayout: api\nid: promise.longstacktraces\ntitle: Promise.longStackTraces\n---\n\n\n[← Back To API Reference](/docs/api-ref"
  },
  {
    "path": "docs/docs/api/promise.map.md",
    "chars": 6018,
    "preview": "---\nlayout: api\nid: promise.map\ntitle: Promise.map\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/promise.mapseries.md",
    "chars": 3987,
    "preview": "---\nlayout: api\nid: promise.mapseries\ntitle: Promise.mapSeries\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)"
  },
  {
    "path": "docs/docs/api/promise.method.md",
    "chars": 2187,
    "preview": "---\nlayout: api\nid: promise.method\ntitle: Promise.method\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/promise.noconflict.md",
    "chars": 1635,
    "preview": "---\nlayout: api\nid: promise.noconflict\ntitle: Promise.noConflict\n---\n\n\n[← Back To API Reference](/docs/api-reference.htm"
  },
  {
    "path": "docs/docs/api/promise.onpossiblyunhandledrejection.md",
    "chars": 1666,
    "preview": "---\nlayout: api\nid: promise.onpossiblyunhandledrejection\ntitle: Promise.onPossiblyUnhandledRejection\n---\n\n\n[← Back To AP"
  },
  {
    "path": "docs/docs/api/promise.onunhandledrejectionhandled.md",
    "chars": 1965,
    "preview": "---\nlayout: api\nid: promise.onunhandledrejectionhandled\ntitle: Promise.onUnhandledRejectionHandled\n---\n\n\n[← Back To API "
  },
  {
    "path": "docs/docs/api/promise.promisify.md",
    "chars": 2935,
    "preview": "---\nlayout: api\nid: promise.promisify\ntitle: Promise.promisify\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)"
  },
  {
    "path": "docs/docs/api/promise.promisifyall.md",
    "chars": 9499,
    "preview": "---\nlayout: api\nid: promise.promisifyall\ntitle: Promise.promisifyAll\n---\n\n\n[← Back To API Reference](/docs/api-reference"
  },
  {
    "path": "docs/docs/api/promise.props.md",
    "chars": 4398,
    "preview": "---\nlayout: api\nid: promise.props\ntitle: Promise.props\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div cl"
  },
  {
    "path": "docs/docs/api/promise.race.md",
    "chars": 1767,
    "preview": "---\nlayout: api\nid: promise.race\ntitle: Promise.race\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/promise.reduce.md",
    "chars": 2718,
    "preview": "---\nlayout: api\nid: promise.reduce\ntitle: Promise.reduce\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/promise.reject.md",
    "chars": 972,
    "preview": "---\nlayout: api\nid: promise.reject\ntitle: Promise.reject\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div "
  },
  {
    "path": "docs/docs/api/promise.resolve.md",
    "chars": 2185,
    "preview": "---\nlayout: api\nid: promise.resolve\ntitle: Promise.resolve\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<di"
  },
  {
    "path": "docs/docs/api/promise.setscheduler.md",
    "chars": 1989,
    "preview": "---\nlayout: api\nid: promise.setscheduler\ntitle: Promise.setScheduler\n---\n\n\n[← Back To API Reference](/docs/api-reference"
  },
  {
    "path": "docs/docs/api/promise.some.md",
    "chars": 2191,
    "preview": "---\nlayout: api\nid: promise.some\ntitle: Promise.some\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/promise.try.md",
    "chars": 1596,
    "preview": "---\nlayout: api\nid: promise.try\ntitle: Promise.try\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class="
  },
  {
    "path": "docs/docs/api/promise.using.md",
    "chars": 3850,
    "preview": "---\nlayout: api\nid: promise.using\ntitle: Promise.using\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div cl"
  },
  {
    "path": "docs/docs/api/promiseinspection.md",
    "chars": 1178,
    "preview": "---\nlayout: api\nid: promiseinspection\ntitle: PromiseInspection\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)"
  },
  {
    "path": "docs/docs/api/promisification.md",
    "chars": 4548,
    "preview": "---\nlayout: api\nid: promisification\ntitle: Promisification\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<di"
  },
  {
    "path": "docs/docs/api/props.md",
    "chars": 888,
    "preview": "---\nlayout: api\nid: props\ntitle: .props\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api/race.md",
    "chars": 881,
    "preview": "---\nlayout: api\nid: race\ntitle: .race\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/reason.md",
    "chars": 1134,
    "preview": "---\nlayout: api\nid: reason\ntitle: .reason\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/reduce.md",
    "chars": 1015,
    "preview": "---\nlayout: api\nid: reduce\ntitle: .reduce\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/reflect.md",
    "chars": 2217,
    "preview": "---\nlayout: api\nid: reflect\ntitle: .reflect\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-co"
  },
  {
    "path": "docs/docs/api/resource-management.md",
    "chars": 2643,
    "preview": "---\nlayout: api\nid: resource-management\ntitle: Resource management\n---\n\n\n[← Back To API Reference](/docs/api-reference.h"
  },
  {
    "path": "docs/docs/api/return.md",
    "chars": 1991,
    "preview": "---\nlayout: api\nid: return\ntitle: .return\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/some.md",
    "chars": 897,
    "preview": "---\nlayout: api\nid: some\ntitle: .some\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/spread.md",
    "chars": 2373,
    "preview": "---\nlayout: api\nid: spread\ntitle: .spread\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code"
  },
  {
    "path": "docs/docs/api/suppressunhandledrejections.md",
    "chars": 2701,
    "preview": "---\nlayout: api\nid: suppressunhandledrejections\ntitle: .suppressUnhandledRejections\n---\n\n\n[← Back To API Reference](/doc"
  },
  {
    "path": "docs/docs/api/synchronous-inspection.md",
    "chars": 2891,
    "preview": "---\nlayout: api\nid: synchronous-inspection\ntitle: Synchronous inspection\n---\n\n\n[← Back To API Reference](/docs/api-refer"
  },
  {
    "path": "docs/docs/api/tap.md",
    "chars": 1859,
    "preview": "---\nlayout: api\nid: tap\ntitle: .tap\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-secti"
  },
  {
    "path": "docs/docs/api/tapcatch.md",
    "chars": 3449,
    "preview": "---\nlayout: api\nid: tapCatch\ntitle: .tapCatch\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-"
  },
  {
    "path": "docs/docs/api/then.md",
    "chars": 1123,
    "preview": "---\nlayout: api\nid: then\ntitle: .then\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-sec"
  },
  {
    "path": "docs/docs/api/throw.md",
    "chars": 1184,
    "preview": "---\nlayout: api\nid: throw\ntitle: .throw\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api/timeout.md",
    "chars": 1628,
    "preview": "---\nlayout: api\nid: timeout\ntitle: .timeout\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-co"
  },
  {
    "path": "docs/docs/api/timeouterror.md",
    "chars": 1014,
    "preview": "---\nlayout: api\nid: timeouterror\ntitle: TimeoutError\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div clas"
  },
  {
    "path": "docs/docs/api/timers.md",
    "chars": 907,
    "preview": "---\nlayout: api\nid: timers\ntitle: Timers\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-"
  },
  {
    "path": "docs/docs/api/utility.md",
    "chars": 898,
    "preview": "---\nlayout: api\nid: utility\ntitle: Utility\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-cod"
  },
  {
    "path": "docs/docs/api/value.md",
    "chars": 1132,
    "preview": "---\nlayout: api\nid: value\ntitle: .value\n---\n\n\n[← Back To API Reference](/docs/api-reference.html)\n<div class=\"api-code-s"
  },
  {
    "path": "docs/docs/api-reference.md",
    "chars": 3863,
    "preview": "---\nid: api-reference\ntitle: API Reference\nredirect_from: \"/docs/api/index.html\"\n---\n\n\n<div class=\"api-reference-menu\">\n"
  },
  {
    "path": "docs/docs/async-dialogs.md",
    "chars": 20838,
    "preview": "---\nid: async-dialogs\ntitle: Async Dialogs\n---\n\n[async-dialogs](unfinished-article)\n\nTypically *promises* are used in co"
  },
  {
    "path": "docs/docs/beginners-guide.md",
    "chars": 91,
    "preview": "---\nid: beginners-guide\ntitle: Beginner's Guide\n---\n\n[beginners-guide](unfinished-article)\n"
  },
  {
    "path": "docs/docs/benchmarks.md",
    "chars": 5405,
    "preview": "---\nid: benchmarks\ntitle: Benchmarks\n---\n\nBenchmarks have been ran with the following versions of modules.\n\n```\n├── asyn"
  },
  {
    "path": "docs/docs/changelog.md",
    "chars": 44368,
    "preview": "---\nid: changelog\ntitle: Changelog\n---\n\n## 3.7.2 (2019-11-28)\n\nBugfixes:\n\n - Fixes firefox settimeout not initialized er"
  },
  {
    "path": "docs/docs/coming-from-other-languages.md",
    "chars": 4477,
    "preview": "---\nid: coming-from-other-languages\ntitle: Coming from Other Languages\n---\n\nThis page describes parallels of using promi"
  }
]

// ... and 169 more files (download for full content)

About this extraction

This page contains the full source code of the petkaantonov/bluebird GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 369 files (1.7 MB), approximately 413.1k tokens, and a symbol index with 656 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!