traceur-rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (410) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +2 -2
  3. data/lib/js/compile.js +7 -15
  4. data/lib/traceur.rb +2 -1
  5. data/lib/traceur/compilation_error.rb +27 -0
  6. data/lib/traceur/compiler.rb +4 -1
  7. data/lib/traceur/configuration.rb +1 -1
  8. data/lib/traceur/node/runner.rb +1 -1
  9. data/lib/traceur/version.rb +1 -1
  10. data/spec/examples/syntax_error.js +3 -0
  11. data/spec/integration/examples_spec.rb +6 -0
  12. data/vendor/node_modules/traceur/LICENSE +202 -0
  13. data/vendor/node_modules/traceur/README.md +5 -5
  14. data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
  15. data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
  16. data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
  17. data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
  18. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
  19. data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
  20. data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
  21. data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
  22. data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
  23. data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
  24. data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
  25. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  26. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  27. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
  28. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  29. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  30. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  31. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
  32. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  33. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  34. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
  35. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
  36. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  37. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
  38. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  39. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  40. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
  41. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
  42. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  43. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  44. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  45. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
  46. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  47. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  48. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  49. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  50. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  51. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  52. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  53. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  54. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  55. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
  56. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  57. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  58. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  59. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  60. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  61. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  62. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
  63. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  64. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  65. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  66. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  67. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  68. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  69. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  70. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  71. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  72. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  73. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  74. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  75. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  76. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  77. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  78. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  79. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  80. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  81. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  82. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
  83. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  84. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  85. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  86. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  87. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
  88. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
  89. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  90. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  91. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
  92. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  93. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  94. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
  95. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
  96. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
  97. data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
  98. data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
  99. data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
  100. data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
  101. data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
  102. data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
  103. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
  104. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
  105. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
  106. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
  107. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
  108. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
  109. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
  110. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
  111. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
  112. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
  113. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
  114. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
  115. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
  116. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
  117. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
  118. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
  119. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
  120. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
  121. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
  122. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
  123. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
  124. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
  125. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
  126. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
  127. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
  128. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
  129. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
  130. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
  131. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
  132. data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
  133. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
  134. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
  135. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
  136. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
  137. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
  138. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
  139. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
  140. data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
  141. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
  142. data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
  143. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
  144. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  145. data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
  146. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
  147. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  148. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
  149. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
  150. data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
  151. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
  152. data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
  153. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
  154. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
  155. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
  156. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
  157. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
  158. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
  159. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
  160. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
  161. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
  162. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
  163. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
  164. data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
  165. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
  166. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
  167. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
  168. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
  169. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
  170. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
  171. data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
  172. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
  173. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
  174. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
  175. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
  176. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
  177. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
  178. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  179. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
  180. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
  181. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  182. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
  183. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
  184. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
  185. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
  186. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
  187. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  188. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
  189. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  190. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
  191. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
  192. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
  193. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
  194. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  195. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  196. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  197. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  198. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  199. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
  200. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
  201. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
  202. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  203. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  204. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
  205. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  206. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  207. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
  208. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
  209. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
  210. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
  211. data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
  212. data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
  213. data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
  214. data/vendor/node_modules/traceur/package.json +234 -20
  215. data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
  216. data/vendor/node_modules/traceur/src/node/System.js +32 -5
  217. data/vendor/node_modules/traceur/src/node/api.js +28 -93
  218. data/vendor/node_modules/traceur/src/node/command.js +84 -19
  219. data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
  220. data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
  221. data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
  222. data/vendor/node_modules/traceur/src/node/require.js +7 -21
  223. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
  224. data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
  225. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
  226. data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
  227. metadata +196 -190
  228. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
  229. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
  230. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
  231. data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
  232. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
  233. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
  234. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
  235. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
  236. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
  237. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
  238. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
  239. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
  240. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
  241. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
  242. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
  243. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
  244. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
  245. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
  246. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
  247. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
  248. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
  249. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
  250. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
  251. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
  252. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
  253. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
  254. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
  255. data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
  256. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
  257. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
  258. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
  259. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
  260. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
  261. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
  262. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
  263. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
  264. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
  265. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
  266. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
  267. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
  268. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
  269. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
  270. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
  271. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
  272. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
  273. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
  274. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
  275. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
  276. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
  277. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
  278. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
  279. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
  280. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
  281. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
  282. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
  283. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
  284. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
  285. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
  286. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
  287. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
  288. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
  289. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
  290. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
  291. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
  292. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
  293. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
  294. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
  295. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
  296. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
  297. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
  298. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
  299. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
  300. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
  301. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
  302. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
  303. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
  304. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
  305. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
  306. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
  307. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
  308. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
  309. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
  310. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
  311. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
  312. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
  313. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
  314. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
  315. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
  316. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
  317. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
  318. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
  319. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
  320. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
  321. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
  322. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
  323. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
  324. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
  325. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
  326. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
  327. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
  328. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
  329. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
  330. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
  331. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
  332. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
  333. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
  334. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
  335. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
  336. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
  337. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
  338. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
  339. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
  340. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
  341. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
  342. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
  343. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
  344. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
  345. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
  346. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
  347. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
  348. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
  349. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
  350. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
  351. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
  352. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
  353. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
  354. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
  355. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
  356. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
  357. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
  358. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
  359. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
  360. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
  361. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
  362. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
  363. data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
  364. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
  365. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
  366. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
  367. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
  368. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
  369. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
  370. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
  371. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
  372. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
  373. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
  374. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
  375. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
  376. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
  377. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
  378. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
  379. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
  380. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
  381. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
  382. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
  383. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
  384. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
  385. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
  386. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
  387. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
  388. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
  389. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
  390. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
  391. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
  392. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
  393. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
  394. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
  395. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
  396. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
  397. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  398. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  399. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
  400. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
  401. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
  402. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
  403. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
  404. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
  405. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
  406. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
  407. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
  408. data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
  409. data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
  410. data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -1,19 +0,0 @@
1
-
2
- Copyright 2009–2012 Kristopher Michael Kowal. All rights reserved.
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
- IN THE SOFTWARE.
@@ -1,813 +0,0 @@
1
- [![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
2
-
3
- <a href="http://promises-aplus.github.com/promises-spec">
4
- <img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
5
- align="right" alt="Promises/A+ logo" />
6
- </a>
7
-
8
- If a function cannot return a value or throw an exception without
9
- blocking, it can return a promise instead. A promise is an object
10
- that represents the return value or the thrown exception that the
11
- function may eventually provide. A promise can also be used as a
12
- proxy for a [remote object][Q-Connection] to overcome latency.
13
-
14
- [Q-Connection]: https://github.com/kriskowal/q-connection
15
-
16
- On the first pass, promises can mitigate the “[Pyramid of
17
- Doom][POD]”: the situation where code marches to the right faster
18
- than it marches forward.
19
-
20
- [POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
21
-
22
- ```javascript
23
- step1(function (value1) {
24
- step2(value1, function(value2) {
25
- step3(value2, function(value3) {
26
- step4(value3, function(value4) {
27
- // Do something with value4
28
- });
29
- });
30
- });
31
- });
32
- ```
33
-
34
- With a promise library, you can flatten the pyramid.
35
-
36
- ```javascript
37
- Q.fcall(promisedStep1)
38
- .then(promisedStep2)
39
- .then(promisedStep3)
40
- .then(promisedStep4)
41
- .then(function (value4) {
42
- // Do something with value4
43
- })
44
- .catch(function (error) {
45
- // Handle any error from all above steps
46
- })
47
- .done();
48
- ```
49
-
50
- With this approach, you also get implicit error propagation, just like `try`,
51
- `catch`, and `finally`. An error in `promisedStep1` will flow all the way to
52
- the `catch` function, where it’s caught and handled. (Here `promisedStepN` is
53
- a version of `stepN` that returns a promise.)
54
-
55
- The callback approach is called an “inversion of control”.
56
- A function that accepts a callback instead of a return value
57
- is saying, “Don’t call me, I’ll call you.”. Promises
58
- [un-invert][IOC] the inversion, cleanly separating the input
59
- arguments from control flow arguments. This simplifies the
60
- use and creation of API’s, particularly variadic,
61
- rest and spread arguments.
62
-
63
- [IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
64
-
65
-
66
- ## Getting Started
67
-
68
- The Q module can be loaded as:
69
-
70
- - A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
71
- gzipped.
72
- - A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
73
- the [q](https://npmjs.org/package/q) package
74
- - An AMD module
75
- - A [component](https://github.com/component/component) as ``microjs/q``
76
- - Using [bower](http://bower.io/) as ``q``
77
- - Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
78
-
79
- Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
80
-
81
- ## Resources
82
-
83
- Our [wiki][] contains a number of useful resources, including:
84
-
85
- - A method-by-method [Q API reference][reference].
86
- - A growing [examples gallery][examples], showing how Q can be used to make
87
- everything better. From XHR to database access to accessing the Flickr API,
88
- Q is there for you.
89
- - There are many libraries that produce and consume Q promises for everything
90
- from file system/database access or RPC to templating. For a list of some of
91
- the more popular ones, see [Libraries][].
92
- - If you want materials that introduce the promise concept generally, and the
93
- below tutorial isn't doing it for you, check out our collection of
94
- [presentations, blog posts, and podcasts][resources].
95
- - A guide for those [coming from jQuery's `$.Deferred`][jquery].
96
-
97
- We'd also love to have you join the Q-Continuum [mailing list][].
98
-
99
- [wiki]: https://github.com/kriskowal/q/wiki
100
- [reference]: https://github.com/kriskowal/q/wiki/API-Reference
101
- [examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
102
- [Libraries]: https://github.com/kriskowal/q/wiki/Libraries
103
- [resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources
104
- [jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
105
- [mailing list]: https://groups.google.com/forum/#!forum/q-continuum
106
-
107
-
108
- ## Tutorial
109
-
110
- Promises have a ``then`` method, which you can use to get the eventual
111
- return value (fulfillment) or thrown exception (rejection).
112
-
113
- ```javascript
114
- promiseMeSomething()
115
- .then(function (value) {
116
- }, function (reason) {
117
- });
118
- ```
119
-
120
- If ``promiseMeSomething`` returns a promise that gets fulfilled later
121
- with a return value, the first function (the fulfillment handler) will be
122
- called with the value. However, if the ``promiseMeSomething`` function
123
- gets rejected later by a thrown exception, the second function (the
124
- rejection handler) will be called with the exception.
125
-
126
- Note that resolution of a promise is always asynchronous: that is, the
127
- fulfillment or rejection handler will always be called in the next turn of the
128
- event loop (i.e. `process.nextTick` in Node). This gives you a nice
129
- guarantee when mentally tracing the flow of your code, namely that
130
- ``then`` will always return before either handler is executed.
131
-
132
- In this tutorial, we begin with how to consume and work with promises. We'll
133
- talk about how to create them, and thus create functions like
134
- `promiseMeSomething` that return promises, [below](#the-beginning).
135
-
136
-
137
- ### Propagation
138
-
139
- The ``then`` method returns a promise, which in this example, I’m
140
- assigning to ``outputPromise``.
141
-
142
- ```javascript
143
- var outputPromise = getInputPromise()
144
- .then(function (input) {
145
- }, function (reason) {
146
- });
147
- ```
148
-
149
- The ``outputPromise`` variable becomes a new promise for the return
150
- value of either handler. Since a function can only either return a
151
- value or throw an exception, only one handler will ever be called and it
152
- will be responsible for resolving ``outputPromise``.
153
-
154
- - If you return a value in a handler, ``outputPromise`` will get
155
- fulfilled.
156
-
157
- - If you throw an exception in a handler, ``outputPromise`` will get
158
- rejected.
159
-
160
- - If you return a **promise** in a handler, ``outputPromise`` will
161
- “become” that promise. Being able to become a new promise is useful
162
- for managing delays, combining results, or recovering from errors.
163
-
164
- If the ``getInputPromise()`` promise gets rejected and you omit the
165
- rejection handler, the **error** will go to ``outputPromise``:
166
-
167
- ```javascript
168
- var outputPromise = getInputPromise()
169
- .then(function (value) {
170
- });
171
- ```
172
-
173
- If the input promise gets fulfilled and you omit the fulfillment handler, the
174
- **value** will go to ``outputPromise``:
175
-
176
- ```javascript
177
- var outputPromise = getInputPromise()
178
- .then(null, function (error) {
179
- });
180
- ```
181
-
182
- Q promises provide a ``fail`` shorthand for ``then`` when you are only
183
- interested in handling the error:
184
-
185
- ```javascript
186
- var outputPromise = getInputPromise()
187
- .fail(function (error) {
188
- });
189
- ```
190
-
191
- If you are writing JavaScript for modern engines only or using
192
- CoffeeScript, you may use `catch` instead of `fail`.
193
-
194
- Promises also have a ``fin`` function that is like a ``finally`` clause.
195
- The final handler gets called, with no arguments, when the promise
196
- returned by ``getInputPromise()`` either returns a value or throws an
197
- error. The value returned or error thrown by ``getInputPromise()``
198
- passes directly to ``outputPromise`` unless the final handler fails, and
199
- may be delayed if the final handler returns a promise.
200
-
201
- ```javascript
202
- var outputPromise = getInputPromise()
203
- .fin(function () {
204
- // close files, database connections, stop servers, conclude tests
205
- });
206
- ```
207
-
208
- - If the handler returns a value, the value is ignored
209
- - If the handler throws an error, the error passes to ``outputPromise``
210
- - If the handler returns a promise, ``outputPromise`` gets postponed. The
211
- eventual value or error has the same effect as an immediate return
212
- value or thrown error: a value would be ignored, an error would be
213
- forwarded.
214
-
215
- If you are writing JavaScript for modern engines only or using
216
- CoffeeScript, you may use `finally` instead of `fin`.
217
-
218
- ### Chaining
219
-
220
- There are two ways to chain promises. You can chain promises either
221
- inside or outside handlers. The next two examples are equivalent.
222
-
223
- ```javascript
224
- return getUsername()
225
- .then(function (username) {
226
- return getUser(username)
227
- .then(function (user) {
228
- // if we get here without an error,
229
- // the value returned here
230
- // or the exception thrown here
231
- // resolves the promise returned
232
- // by the first line
233
- })
234
- });
235
- ```
236
-
237
- ```javascript
238
- return getUsername()
239
- .then(function (username) {
240
- return getUser(username);
241
- })
242
- .then(function (user) {
243
- // if we get here without an error,
244
- // the value returned here
245
- // or the exception thrown here
246
- // resolves the promise returned
247
- // by the first line
248
- });
249
- ```
250
-
251
- The only difference is nesting. It’s useful to nest handlers if you
252
- need to capture multiple input values in your closure.
253
-
254
- ```javascript
255
- function authenticate() {
256
- return getUsername()
257
- .then(function (username) {
258
- return getUser(username);
259
- })
260
- // chained because we will not need the user name in the next event
261
- .then(function (user) {
262
- return getPassword()
263
- // nested because we need both user and password next
264
- .then(function (password) {
265
- if (user.passwordHash !== hash(password)) {
266
- throw new Error("Can't authenticate");
267
- }
268
- });
269
- });
270
- }
271
- ```
272
-
273
-
274
- ### Combination
275
-
276
- You can turn an array of promises into a promise for the whole,
277
- fulfilled array using ``all``.
278
-
279
- ```javascript
280
- return Q.all([
281
- eventualAdd(2, 2),
282
- eventualAdd(10, 20)
283
- ]);
284
- ```
285
-
286
- If you have a promise for an array, you can use ``spread`` as a
287
- replacement for ``then``. The ``spread`` function “spreads” the
288
- values over the arguments of the fulfillment handler. The rejection handler
289
- will get called at the first sign of failure. That is, whichever of
290
- the recived promises fails first gets handled by the rejection handler.
291
-
292
- ```javascript
293
- function eventualAdd(a, b) {
294
- return Q.spread([a, b], function (a, b) {
295
- return a + b;
296
- })
297
- }
298
- ```
299
-
300
- But ``spread`` calls ``all`` initially, so you can skip it in chains.
301
-
302
- ```javascript
303
- return getUsername()
304
- .then(function (username) {
305
- return [username, getUser(username)];
306
- })
307
- .spread(function (username, user) {
308
- });
309
- ```
310
-
311
- The ``all`` function returns a promise for an array of values. When this
312
- promise is fulfilled, the array contains the fulfillment values of the original
313
- promises, in the same order as those promises. If one of the given promises
314
- is rejected, the returned promise is immediately rejected, not waiting for the
315
- rest of the batch. If you want to wait for all of the promises to either be
316
- fulfilled or rejected, you can use ``allSettled``.
317
-
318
- ```javascript
319
- Q.allSettled(promises)
320
- .then(function (results) {
321
- results.forEach(function (result) {
322
- if (result.state === "fulfilled") {
323
- var value = result.value;
324
- } else {
325
- var reason = result.reason;
326
- }
327
- });
328
- });
329
- ```
330
-
331
-
332
- ### Sequences
333
-
334
- If you have a number of promise-producing functions that need
335
- to be run sequentially, you can of course do so manually:
336
-
337
- ```javascript
338
- return foo(initialVal).then(bar).then(baz).then(qux);
339
- ```
340
-
341
- However, if you want to run a dynamically constructed sequence of
342
- functions, you'll want something like this:
343
-
344
- ```javascript
345
- var funcs = [foo, bar, baz, qux];
346
-
347
- var result = Q(initialVal);
348
- funcs.forEach(function (f) {
349
- result = result.then(f);
350
- });
351
- return result;
352
- ```
353
-
354
- You can make this slightly more compact using `reduce`:
355
-
356
- ```javascript
357
- return funcs.reduce(function (soFar, f) {
358
- return soFar.then(f);
359
- }, Q(initialVal));
360
- ```
361
-
362
- Or, you could use th ultra-compact version:
363
-
364
- ```javascript
365
- return funcs.reduce(Q.when, Q());
366
- ```
367
-
368
- ### Handling Errors
369
-
370
- One sometimes-unintuive aspect of promises is that if you throw an
371
- exception in the fulfillment handler, it will not be be caught by the error
372
- handler.
373
-
374
- ```javascript
375
- return foo()
376
- .then(function (value) {
377
- throw new Error("Can't bar.");
378
- }, function (error) {
379
- // We only get here if "foo" fails
380
- });
381
- ```
382
-
383
- To see why this is, consider the parallel between promises and
384
- ``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error
385
- handler represents a ``catch`` for ``foo()``, while the fulfillment handler
386
- represents code that happens *after* the ``try``/``catch`` block.
387
- That code then needs its own ``try``/``catch`` block.
388
-
389
- In terms of promises, this means chaining your rejection handler:
390
-
391
- ```javascript
392
- return foo()
393
- .then(function (value) {
394
- throw new Error("Can't bar.");
395
- })
396
- .fail(function (error) {
397
- // We get here with either foo's error or bar's error
398
- });
399
- ```
400
-
401
- ### Progress Notification
402
-
403
- It's possible for promises to report their progress, e.g. for tasks that take a
404
- long time like a file upload. Not all promises will implement progress
405
- notifications, but for those that do, you can consume the progress values using
406
- a third parameter to ``then``:
407
-
408
- ```javascript
409
- return uploadFile()
410
- .then(function () {
411
- // Success uploading the file
412
- }, function (err) {
413
- // There was an error, and we get the reason for error
414
- }, function (progress) {
415
- // We get notified of the upload's progress as it is executed
416
- });
417
- ```
418
-
419
- Like `fail`, Q also provides a shorthand for progress callbacks
420
- called `progress`:
421
-
422
- ```javascript
423
- return uploadFile().progress(function (progress) {
424
- // We get notified of the upload's progress
425
- });
426
- ```
427
-
428
- ### The End
429
-
430
- When you get to the end of a chain of promises, you should either
431
- return the last promise or end the chain. Since handlers catch
432
- errors, it’s an unfortunate pattern that the exceptions can go
433
- unobserved.
434
-
435
- So, either return it,
436
-
437
- ```javascript
438
- return foo()
439
- .then(function () {
440
- return "bar";
441
- });
442
- ```
443
-
444
- Or, end it.
445
-
446
- ```javascript
447
- foo()
448
- .then(function () {
449
- return "bar";
450
- })
451
- .done();
452
- ```
453
-
454
- Ending a promise chain makes sure that, if an error doesn’t get
455
- handled before the end, it will get rethrown and reported.
456
-
457
- This is a stopgap. We are exploring ways to make unhandled errors
458
- visible without any explicit handling.
459
-
460
-
461
- ### The Beginning
462
-
463
- Everything above assumes you get a promise from somewhere else. This
464
- is the common case. Every once in a while, you will need to create a
465
- promise from scratch.
466
-
467
- #### Using ``Q.fcall``
468
-
469
- You can create a promise from a value using ``Q.fcall``. This returns a
470
- promise for 10.
471
-
472
- ```javascript
473
- return Q.fcall(function () {
474
- return 10;
475
- });
476
- ```
477
-
478
- You can also use ``fcall`` to get a promise for an exception.
479
-
480
- ```javascript
481
- return Q.fcall(function () {
482
- throw new Error("Can't do it");
483
- });
484
- ```
485
-
486
- As the name implies, ``fcall`` can call functions, or even promised
487
- functions. This uses the ``eventualAdd`` function above to add two
488
- numbers.
489
-
490
- ```javascript
491
- return Q.fcall(eventualAdd, 2, 2);
492
- ```
493
-
494
-
495
- #### Using Deferreds
496
-
497
- If you have to interface with asynchronous functions that are callback-based
498
- instead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and
499
- friends). But much of the time, the solution will be to use *deferreds*.
500
-
501
- ```javascript
502
- var deferred = Q.defer();
503
- FS.readFile("foo.txt", "utf-8", function (error, text) {
504
- if (error) {
505
- deferred.reject(new Error(error));
506
- } else {
507
- deferred.resolve(text);
508
- }
509
- });
510
- return deferred.promise;
511
- ```
512
-
513
- Note that a deferred can be resolved with a value or a promise. The
514
- ``reject`` function is a shorthand for resolving with a rejected
515
- promise.
516
-
517
- ```javascript
518
- // this:
519
- deferred.reject(new Error("Can't do it"));
520
-
521
- // is shorthand for:
522
- var rejection = Q.fcall(function () {
523
- throw new Error("Can't do it");
524
- });
525
- deferred.resolve(rejection);
526
- ```
527
-
528
- This is a simplified implementation of ``Q.delay``.
529
-
530
- ```javascript
531
- function delay(ms) {
532
- var deferred = Q.defer();
533
- setTimeout(deferred.resolve, ms);
534
- return deferred.promise;
535
- }
536
- ```
537
-
538
- This is a simplified implementation of ``Q.timeout``
539
-
540
- ```javascript
541
- function timeout(promise, ms) {
542
- var deferred = Q.defer();
543
- Q.when(promise, deferred.resolve);
544
- delay(ms).then(function () {
545
- deferred.reject(new Error("Timed out"));
546
- });
547
- return deferred.promise;
548
- }
549
- ```
550
-
551
- Finally, you can send a progress notification to the promise with
552
- ``deferred.notify``.
553
-
554
- For illustration, this is a wrapper for XML HTTP requests in the browser. Note
555
- that a more [thorough][XHR] implementation would be in order in practice.
556
-
557
- [XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73
558
-
559
- ```javascript
560
- function requestOkText(url) {
561
- var request = new XMLHttpRequest();
562
- var deferred = Q.defer();
563
-
564
- request.open("GET", url, true);
565
- request.onload = onload;
566
- request.onerror = onerror;
567
- request.onprogress = onprogress;
568
- request.send();
569
-
570
- function onload() {
571
- if (request.status === 200) {
572
- deferred.resolve(request.responseText);
573
- } else {
574
- deferred.reject(new Error("Status code was " + request.status));
575
- }
576
- }
577
-
578
- function onerror() {
579
- deferred.reject(new Error("Can't XHR " + JSON.stringify(url)));
580
- }
581
-
582
- function onprogress(event) {
583
- deferred.notify(event.loaded / event.total);
584
- }
585
-
586
- return deferred.promise;
587
- }
588
- ```
589
-
590
- Below is an example of how to use this ``requestOkText`` function:
591
-
592
- ```javascript
593
- requestOkText("http://localhost:3000")
594
- .then(function (responseText) {
595
- // If the HTTP response returns 200 OK, log the response text.
596
- console.log(responseText);
597
- }, function (error) {
598
- // If there's an error or a non-200 status code, log the error.
599
- console.error(error);
600
- }, function (progress) {
601
- // Log the progress as it comes in.
602
- console.log("Request progress: " + Math.round(progress * 100) + "%");
603
- });
604
- ```
605
-
606
- ### The Middle
607
-
608
- If you are using a function that may return a promise, but just might
609
- return a value if it doesn’t need to defer, you can use the “static”
610
- methods of the Q library.
611
-
612
- The ``when`` function is the static equivalent for ``then``.
613
-
614
- ```javascript
615
- return Q.when(valueOrPromise, function (value) {
616
- }, function (error) {
617
- });
618
- ```
619
-
620
- All of the other methods on a promise have static analogs with the
621
- same name.
622
-
623
- The following are equivalent:
624
-
625
- ```javascript
626
- return Q.all([a, b]);
627
- ```
628
-
629
- ```javascript
630
- return Q.fcall(function () {
631
- return [a, b];
632
- })
633
- .all();
634
- ```
635
-
636
- When working with promises provided by other libraries, you should
637
- convert it to a Q promise. Not all promise libraries make the same
638
- guarantees as Q and certainly don’t provide all of the same methods.
639
- Most libraries only provide a partially functional ``then`` method.
640
- This thankfully is all we need to turn them into vibrant Q promises.
641
-
642
- ```javascript
643
- return Q($.ajax(...))
644
- .then(function () {
645
- });
646
- ```
647
-
648
- If there is any chance that the promise you receive is not a Q promise
649
- as provided by your library, you should wrap it using a Q function.
650
- You can even use ``Q.invoke`` as a shorthand.
651
-
652
- ```javascript
653
- return Q.invoke($, 'ajax', ...)
654
- .then(function () {
655
- });
656
- ```
657
-
658
-
659
- ### Over the Wire
660
-
661
- A promise can serve as a proxy for another object, even a remote
662
- object. There are methods that allow you to optimistically manipulate
663
- properties or call functions. All of these interactions return
664
- promises, so they can be chained.
665
-
666
- ```
667
- direct manipulation using a promise as a proxy
668
- -------------------------- -------------------------------
669
- value.foo promise.get("foo")
670
- value.foo = value promise.put("foo", value)
671
- delete value.foo promise.del("foo")
672
- value.foo(...args) promise.post("foo", [args])
673
- value.foo(...args) promise.invoke("foo", ...args)
674
- value(...args) promise.fapply([args])
675
- value(...args) promise.fcall(...args)
676
- ```
677
-
678
- If the promise is a proxy for a remote object, you can shave
679
- round-trips by using these functions instead of ``then``. To take
680
- advantage of promises for remote objects, check out [Q-Connection][].
681
-
682
- [Q-Connection]: https://github.com/kriskowal/q-connection
683
-
684
- Even in the case of non-remote objects, these methods can be used as
685
- shorthand for particularly-simple fulfillment handlers. For example, you
686
- can replace
687
-
688
- ```javascript
689
- return Q.fcall(function () {
690
- return [{ foo: "bar" }, { foo: "baz" }];
691
- })
692
- .then(function (value) {
693
- return value[0].foo;
694
- });
695
- ```
696
-
697
- with
698
-
699
- ```javascript
700
- return Q.fcall(function () {
701
- return [{ foo: "bar" }, { foo: "baz" }];
702
- })
703
- .get(0)
704
- .get("foo");
705
- ```
706
-
707
-
708
- ### Adapting Node
709
-
710
- If you're working with functions that make use of the Node.js callback pattern,
711
- where callbacks are in the form of `function(err, result)`, Q provides a few
712
- useful utility functions for converting between them. The most straightforward
713
- are probably `Q.nfcall` and `Q.nfapply` ("Node function call/apply") for calling
714
- Node.js-style functions and getting back a promise:
715
-
716
- ```javascript
717
- return Q.nfcall(FS.readFile, "foo.txt", "utf-8");
718
- return Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
719
- ```
720
-
721
- If you are working with methods, instead of simple functions, you can easily
722
- run in to the usual problems where passing a method to another function—like
723
- `Q.nfcall`—"un-binds" the method from its owner. To avoid this, you can either
724
- use `Function.prototype.bind` or some nice shortcut methods we provide:
725
-
726
- ```javascript
727
- return Q.ninvoke(redisClient, "get", "user:1:id");
728
- return Q.npost(redisClient, "get", ["user:1:id"]);
729
- ```
730
-
731
- You can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:
732
-
733
- ```javascript
734
- var readFile = Q.denodeify(FS.readFile);
735
- return readFile("foo.txt", "utf-8");
736
-
737
- var redisClientGet = Q.nbind(redisClient.get, redisClient);
738
- return redisClientGet("user:1:id");
739
- ```
740
-
741
- Finally, if you're working with raw deferred objects, there is a
742
- `makeNodeResolver` method on deferreds that can be handy:
743
-
744
- ```javascript
745
- var deferred = Q.defer();
746
- FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
747
- return deferred.promise;
748
- ```
749
-
750
- ### Long Stack Traces
751
-
752
- Q comes with optional support for “long stack traces,” wherein the `stack`
753
- property of `Error` rejection reasons is rewritten to be traced along
754
- asynchronous jumps instead of stopping at the most recent one. As an example:
755
-
756
- ```js
757
- function theDepthsOfMyProgram() {
758
- Q.delay(100).done(function explode() {
759
- throw new Error("boo!");
760
- });
761
- }
762
-
763
- theDepthsOfMyProgram();
764
- ```
765
-
766
- usually would give a rather unhelpful stack trace looking something like
767
-
768
- ```
769
- Error: boo!
770
- at explode (/path/to/test.js:3:11)
771
- at _fulfilled (/path/to/test.js:q:54)
772
- at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)
773
- at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)
774
- at pending (/path/to/q.js:397:39)
775
- at process.startup.processNextTick.process._tickCallback (node.js:244:9)
776
- ```
777
-
778
- But, if you turn this feature on by setting
779
-
780
- ```js
781
- Q.longStackSupport = true;
782
- ```
783
-
784
- then the above code gives a nice stack trace to the tune of
785
-
786
- ```
787
- Error: boo!
788
- at explode (/path/to/test.js:3:11)
789
- From previous event:
790
- at theDepthsOfMyProgram (/path/to/test.js:2:16)
791
- at Object.<anonymous> (/path/to/test.js:7:1)
792
- ```
793
-
794
- Note how you can see the the function that triggered the async operation in the
795
- stack trace! This is very helpful for debugging, as otherwise you end up getting
796
- only the first line, plus a bunch of Q internals, with no sign of where the
797
- operation started.
798
-
799
- This feature does come with somewhat-serious performance and memory overhead,
800
- however. If you're working with lots of promises, or trying to scale a server
801
- to many users, you should probably keep it off. But in development, go for it!
802
-
803
- ## Tests
804
-
805
- You can view the results of the Q test suite [in your browser][tests]!
806
-
807
- [tests]: https://rawgithub.com/kriskowal/q/master/spec/q-spec.html
808
-
809
- ## License
810
-
811
- Copyright 2009–2013 Kristopher Michael Kowal
812
- MIT License (enclosed)
813
-