traceur-rb 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +8 -8
  2. data/lib/traceur/configuration.rb +1 -1
  3. data/lib/traceur/version.rb +1 -1
  4. data/{vendor/node_modules → node_modules}/.bin/traceur +0 -0
  5. data/{vendor/node_modules → node_modules}/traceur/LICENSE +0 -0
  6. data/{vendor/node_modules → node_modules}/traceur/README.md +0 -0
  7. data/node_modules/traceur/bin/traceur-runtime.js +3420 -0
  8. data/node_modules/traceur/bin/traceur.js +30354 -0
  9. data/{vendor/node_modules → node_modules}/traceur/node_modules/.bin/semver +0 -0
  10. data/node_modules/traceur/node_modules/commander/History.md +256 -0
  11. data/node_modules/traceur/node_modules/commander/LICENSE +22 -0
  12. data/node_modules/traceur/node_modules/commander/Readme.md +342 -0
  13. data/node_modules/traceur/node_modules/commander/index.js +1103 -0
  14. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/.npmignore +3 -0
  15. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/.travis.yml +5 -0
  16. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/LICENSE +22 -0
  17. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/README.md +17 -0
  18. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/index.js +12 -0
  19. data/node_modules/traceur/node_modules/commander/node_modules/graceful-readlink/package.json +48 -0
  20. data/node_modules/traceur/node_modules/commander/package.json +75 -0
  21. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/LICENSE +0 -0
  22. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/README.md +0 -0
  23. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/common.js +0 -0
  24. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/glob.js +0 -0
  25. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/.eslintrc +0 -0
  26. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/LICENSE +0 -0
  27. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/README.md +0 -0
  28. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/inflight.js +0 -0
  29. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +0 -0
  30. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +0 -0
  31. data/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +52 -0
  32. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +0 -0
  33. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +0 -0
  34. data/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
  35. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inflight/test.js +0 -0
  36. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inherits/LICENSE +0 -0
  37. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inherits/README.md +0 -0
  38. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inherits/inherits.js +0 -0
  39. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +0 -0
  40. data/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +50 -0
  41. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/inherits/test.js +0 -0
  42. data/{vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy → node_modules/traceur/node_modules/glob/node_modules/minimatch}/LICENSE +0 -0
  43. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/README.md +0 -0
  44. data/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1159 -0
  45. data/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +912 -0
  46. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +0 -0
  47. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +0 -0
  48. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -0
  49. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +0 -0
  50. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -0
  51. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +0 -0
  52. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +0 -0
  53. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +0 -0
  54. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +0 -0
  55. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +0 -0
  56. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +0 -0
  57. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +0 -0
  58. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +0 -0
  59. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +0 -0
  60. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +0 -0
  61. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +0 -0
  62. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +0 -0
  63. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +0 -0
  64. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +0 -0
  65. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +0 -0
  66. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -0
  67. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +0 -0
  68. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +0 -0
  69. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +0 -0
  70. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +0 -0
  71. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +0 -0
  72. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +0 -0
  73. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +0 -0
  74. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +0 -0
  75. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +0 -0
  76. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +0 -0
  77. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +0 -0
  78. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +0 -0
  79. data/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +63 -0
  80. data/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +15 -0
  81. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/README.md +0 -0
  82. data/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  83. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +0 -0
  84. data/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +52 -0
  85. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +0 -0
  86. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +0 -0
  87. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/once.js +0 -0
  88. data/node_modules/traceur/node_modules/glob/node_modules/once/package.json +60 -0
  89. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/node_modules/once/test/once.js +0 -0
  90. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/package.json +0 -0
  91. data/{vendor/node_modules → node_modules}/traceur/node_modules/glob/sync.js +0 -0
  92. data/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +255 -0
  93. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/LICENSE +0 -0
  94. data/node_modules/traceur/node_modules/rsvp/README.md +366 -0
  95. data/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1597 -0
  96. data/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
  97. data/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +70 -0
  98. data/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +51 -0
  99. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/-internal.js +0 -0
  100. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +73 -0
  101. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/all.js +0 -0
  102. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +112 -0
  103. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/config.js +0 -0
  104. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
  105. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +130 -0
  106. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +205 -0
  107. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/filter.js +0 -0
  108. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +126 -0
  109. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
  110. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
  111. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/map.js +0 -0
  112. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
  113. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/platform.js +14 -0
  114. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +52 -0
  115. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
  116. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +0 -0
  117. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
  118. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
  119. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
  120. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/race.js +0 -0
  121. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
  122. data/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
  123. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +0 -0
  124. data/{vendor/node_modules → node_modules}/traceur/node_modules/rsvp/lib/rsvp/utils.js +0 -0
  125. data/node_modules/traceur/node_modules/rsvp/package.json +106 -0
  126. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/.npmignore +0 -0
  127. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/LICENSE +0 -0
  128. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/Makefile +0 -0
  129. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/README.md +0 -0
  130. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/bin/semver +0 -0
  131. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/foot.js +0 -0
  132. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/head.js +0 -0
  133. data/node_modules/traceur/node_modules/semver/package.json +50 -0
  134. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/semver.browser.js +0 -0
  135. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  136. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/semver.js +0 -0
  137. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/semver.min.js +0 -0
  138. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/semver.min.js.gz +0 -0
  139. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/test/amd.js +0 -0
  140. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/test/gtr.js +0 -0
  141. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/test/index.js +0 -0
  142. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/test/ltr.js +0 -0
  143. data/{vendor/node_modules → node_modules}/traceur/node_modules/semver/test/no-module.js +0 -0
  144. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/.npmignore +0 -0
  145. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/LICENSE.md +0 -0
  146. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/README.md +0 -0
  147. data/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
  148. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/amd-test/index.html +0 -0
  149. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/amd-test/require.js +0 -0
  150. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/amd-test/script.coffee +0 -0
  151. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/amd-test/script.js +0 -0
  152. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/amd-test/script.map +0 -0
  153. data/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
  154. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/browser-test/index.html +0 -0
  155. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/browser-test/script.coffee +0 -0
  156. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/browser-test/script.js +0 -0
  157. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/browser-test/script.map +0 -0
  158. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/build.js +0 -0
  159. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/header-test/index.html +0 -0
  160. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/header-test/script.coffee +0 -0
  161. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/header-test/script.js +0 -0
  162. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/header-test/script.map +0 -0
  163. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/header-test/server.js +0 -0
  164. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +0 -0
  165. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/.travis.yml +0 -0
  166. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +0 -0
  167. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +0 -0
  168. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +0 -0
  169. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/README.md +0 -0
  170. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +0 -0
  171. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +0 -0
  172. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +0 -0
  173. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +0 -0
  174. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +0 -0
  175. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +0 -0
  176. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +0 -0
  177. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +0 -0
  178. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +0 -0
  179. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +0 -0
  180. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +0 -0
  181. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +0 -0
  182. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +0 -0
  183. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +0 -0
  184. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +0 -0
  185. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +0 -0
  186. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +0 -0
  187. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +0 -0
  188. data/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  189. data/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  190. data/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +301 -0
  191. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +0 -0
  192. data/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +47 -0
  193. data/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
  194. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +0 -0
  195. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +0 -0
  196. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +0 -0
  197. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +0 -0
  198. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +0 -0
  199. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +0 -0
  200. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +0 -0
  201. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +0 -0
  202. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +0 -0
  203. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +0 -0
  204. data/{vendor/node_modules → node_modules}/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +0 -0
  205. data/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
  206. data/node_modules/traceur/node_modules/source-map-support/source-map-support.js +386 -0
  207. data/node_modules/traceur/node_modules/source-map-support/test.js +384 -0
  208. data/node_modules/traceur/package.json +286 -0
  209. data/node_modules/traceur/src/node/NodeCompiler.js +81 -0
  210. data/{vendor/node_modules → node_modules}/traceur/src/node/System.js +0 -0
  211. data/{vendor/node_modules → node_modules}/traceur/src/node/api.js +0 -0
  212. data/node_modules/traceur/src/node/command.js +203 -0
  213. data/{vendor/node_modules → node_modules}/traceur/src/node/compileAllJsFilesInDir.js +0 -0
  214. data/{vendor/node_modules → node_modules}/traceur/src/node/deferred.js +0 -0
  215. data/{vendor/node_modules → node_modules}/traceur/src/node/file-util.js +0 -0
  216. data/{vendor/node_modules → node_modules}/traceur/src/node/getopt.js +0 -0
  217. data/node_modules/traceur/src/node/interpreter.js +37 -0
  218. data/{vendor/node_modules → node_modules}/traceur/src/node/nodeLoader.js +0 -0
  219. data/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
  220. data/{vendor/node_modules → node_modules}/traceur/src/node/require.js +0 -0
  221. data/{vendor/node_modules → node_modules}/traceur/src/node/to-amd-compiler.js +0 -0
  222. data/{vendor/node_modules → node_modules}/traceur/src/node/to-closure-compiler.js +0 -0
  223. data/{vendor/node_modules → node_modules}/traceur/src/node/to-commonjs-compiler.js +0 -0
  224. data/{vendor/node_modules → node_modules}/traceur/src/node/traceur.js +0 -0
  225. data/{vendor/node_modules → node_modules}/traceur/traceur +0 -0
  226. data/package.json +15 -0
  227. data/spec/traceur/configuration_spec.rb +3 -3
  228. metadata +225 -161
@@ -0,0 +1,366 @@
1
+ # RSVP.js [![Build Status](https://secure.travis-ci.org/tildeio/rsvp.js.png?branch=master)](http://travis-ci.org/tildeio/rsvp.js) [![Inline docs](http://inch-ci.org/github/tildeio/rsvp.js.svg?branch=master)](http://inch-ci.org/github/tildeio/rsvp.js)
2
+
3
+ RSVP.js provides simple tools for organizing asynchronous code.
4
+
5
+ Specifically, it is a tiny implementation of Promises/A+.
6
+
7
+ It works in node and the browser (IE6+, all the popular evergreen ones).
8
+
9
+ ## downloads
10
+
11
+ - [rsvp-latest](http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.js)
12
+ - [rsvp-latest (minified)](http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.min.js)
13
+
14
+ ## Promises
15
+
16
+ Although RSVP is es6 compliant, it does bring along some extra toys. If you would prefer a strict es6 subset, I would suggest checking out our sibling project https://github.com/jakearchibald/es6-promise, It is RSVP but stripped down to the es6 spec features.
17
+
18
+ ## Bower
19
+
20
+ `bower install -S rsvp`
21
+
22
+ ## NPM
23
+
24
+ `npm install --save rsvp`
25
+
26
+ `RSVP.Promise` is an implementation of
27
+ [Promises/A+](http://promises-aplus.github.com/promises-spec/) that passes the
28
+ [test suite](https://github.com/promises-aplus/promises-tests).
29
+
30
+ It delivers all promises asynchronously, even if the value is already
31
+ available, to help you write consistent code that doesn't change if the
32
+ underlying data provider changes from synchronous to asynchronous.
33
+
34
+ It is compatible with [TaskJS](http://taskjs.org/), a library by Dave
35
+ Herman of Mozilla that uses ES6 generators to allow you to write
36
+ synchronous code with promises. It currently works in Firefox, and will
37
+ work in any browser that adds support for ES6 generators. See the
38
+ section below on TaskJS for more information.
39
+
40
+ ### Basic Usage
41
+
42
+ ```javascript
43
+ var RSVP = require('rsvp');
44
+
45
+ var promise = new RSVP.Promise(function(resolve, reject) {
46
+ // succeed
47
+ resolve(value);
48
+ // or reject
49
+ reject(error);
50
+ });
51
+
52
+ promise.then(function(value) {
53
+ // success
54
+ }, function(value) {
55
+ // failure
56
+ });
57
+ ```
58
+
59
+ Once a promise has been resolved or rejected, it cannot be resolved or
60
+ rejected again.
61
+
62
+ Here is an example of a simple XHR2 wrapper written using RSVP.js:
63
+
64
+ ```javascript
65
+ var getJSON = function(url) {
66
+ var promise = new RSVP.Promise(function(resolve, reject){
67
+ var client = new XMLHttpRequest();
68
+ client.open("GET", url);
69
+ client.onreadystatechange = handler;
70
+ client.responseType = "json";
71
+ client.setRequestHeader("Accept", "application/json");
72
+ client.send();
73
+
74
+ function handler() {
75
+ if (this.readyState === this.DONE) {
76
+ if (this.status === 200) { resolve(this.response); }
77
+ else { reject(this); }
78
+ }
79
+ };
80
+ });
81
+
82
+ return promise;
83
+ };
84
+
85
+ getJSON("/posts.json").then(function(json) {
86
+ // continue
87
+ }, function(error) {
88
+ // handle errors
89
+ });
90
+ ```
91
+
92
+ ### Chaining
93
+
94
+ One of the really awesome features of Promises/A+ promises are that they
95
+ can be chained together. In other words, the return value of the first
96
+ resolve handler will be passed to the second resolve handler.
97
+
98
+ If you return a regular value, it will be passed, as is, to the next
99
+ handler.
100
+
101
+ ```javascript
102
+ getJSON("/posts.json").then(function(json) {
103
+ return json.post;
104
+ }).then(function(post) {
105
+ // proceed
106
+ });
107
+ ```
108
+
109
+ The really awesome part comes when you return a promise from the first
110
+ handler:
111
+
112
+ ```javascript
113
+ getJSON("/post/1.json").then(function(post) {
114
+ // save off post
115
+ return getJSON(post.commentURL);
116
+ }).then(function(comments) {
117
+ // proceed with access to post and comments
118
+ });
119
+ ```
120
+
121
+ This allows you to flatten out nested callbacks, and is the main feature
122
+ of promises that prevents "rightward drift" in programs with a lot of
123
+ asynchronous code.
124
+
125
+ Errors also propagate:
126
+
127
+ ```javascript
128
+ getJSON("/posts.json").then(function(posts) {
129
+
130
+ }).catch(function(error) {
131
+ // since no rejection handler was passed to the
132
+ // first `.then`, the error propagates.
133
+ });
134
+ ```
135
+
136
+ You can use this to emulate `try/catch` logic in synchronous code.
137
+ Simply chain as many resolve callbacks as a you want, and add a failure
138
+ handler at the end to catch errors.
139
+
140
+ ```javascript
141
+ getJSON("/post/1.json").then(function(post) {
142
+ return getJSON(post.commentURL);
143
+ }).then(function(comments) {
144
+ // proceed with access to posts and comments
145
+ }).catch(function(error) {
146
+ // handle errors in either of the two requests
147
+ });
148
+ ```
149
+
150
+ You can also use `catch` for error handling, which is a shortcut for
151
+ `then(null, rejection)`, like so:
152
+
153
+ ```javascript
154
+ getJSON("/post/1.json").then(function(post) {
155
+ return getJSON(post.commentURL);
156
+ }).catch(function(error) {
157
+ // handle errors
158
+ });
159
+ ```
160
+
161
+ ## Error Handling
162
+
163
+ There are times when dealing with promises that it seems like any errors
164
+ are being 'swallowed', and not properly raised. This makes it extremely
165
+ difficult to track down where a given issue is coming from. Thankfully,
166
+ `RSVP` has a solution for this problem built in.
167
+
168
+ You can register functions to be called when an uncaught error occurs
169
+ within your promises. These callback functions can be anything, but a common
170
+ practice is to call `console.assert` to dump the error to the console.
171
+
172
+ ```javascript
173
+ RSVP.on('error', function(reason) {
174
+ console.assert(false, reason);
175
+ });
176
+ ```
177
+
178
+ **NOTE:** promises do allow for errors to be handled asynchronously, so
179
+ this callback may result in false positives.
180
+
181
+ **NOTE:** Usage of `RSVP.configure('onerror', yourCustomFunction);` is
182
+ deprecated in favor of using `RSVP.on`.
183
+
184
+
185
+ ## Finally
186
+
187
+ `finally` will be invoked regardless of the promise's fate, just as native
188
+ try/catch/finally behaves.
189
+
190
+ ```js
191
+ findAuthor().catch(function(reason){
192
+ return findOtherAuthor();
193
+ }).finally(function(){
194
+ // author was either found, or not
195
+ });
196
+ ```
197
+
198
+
199
+ ## Arrays of promises
200
+
201
+ Sometimes you might want to work with many promises at once. If you
202
+ pass an array of promises to the `all()` method it will return a new
203
+ promise that will be fulfilled when all of the promises in the array
204
+ have been fulfilled; or rejected immediately if any promise in the array
205
+ is rejected.
206
+
207
+ ```javascript
208
+ var promises = [2, 3, 5, 7, 11, 13].map(function(id){
209
+ return getJSON("/post/" + id + ".json");
210
+ });
211
+
212
+ RSVP.all(promises).then(function(posts) {
213
+ // posts contains an array of results for the given promises
214
+ }).catch(function(reason){
215
+ // if any of the promises fails.
216
+ });
217
+ ```
218
+
219
+ ## Hash of promises
220
+
221
+ If you need to reference many promises at once (like `all()`), but would like
222
+ to avoid encoding the actual promise order you can use `hash()`. If you pass
223
+ an object literal (where the values are promises) to the `hash()` method it will
224
+ return a new promise that will be fulfilled when all of the promises have been
225
+ fulfilled; or rejected immediately if any promise is rejected.
226
+
227
+ The key difference to the `all()` function is that both the fulfillment value
228
+ and the argument to the `hash()` function are object literals. This allows
229
+ you to simply reference the results directly off the returned object without
230
+ having to remember the initial order like you would with `all()`.
231
+
232
+ ```javascript
233
+ var promises = {
234
+ posts: getJSON("/posts.json"),
235
+ users: getJSON("/users.json")
236
+ };
237
+
238
+ RSVP.hash(promises).then(function(results) {
239
+ console.log(results.users) // print the users.json results
240
+ console.log(results.posts) // print the posts.json results
241
+ });
242
+ ```
243
+
244
+ ## All settled and hash settled
245
+
246
+ Sometimes you want to work with several promises at once, but instead of
247
+ rejecting immediately if any promise is rejected, as with `all()` or `hash()`,
248
+ you want to be able to inspect the results of all your promises, whether
249
+ they fulfill or reject. For this purpose, you can use `allSettled()` and
250
+ `hashSettled()`. These work exactly like `all()` and `hash()`, except that
251
+ they fulfill with an array or hash (respectively) of the constituent promises'
252
+ result states. Each state object will either indicate fulfillment or
253
+ rejection, and provide the corresponding value or reason. The states will take
254
+ one of the following formats:
255
+
256
+ ```javascript
257
+ { state: 'fulfilled', value: value }
258
+ or
259
+ { state: 'rejected', reason: reason }
260
+ ```
261
+
262
+ ## Deferred
263
+
264
+ > The `RSVP.Promise` constructor is generally a better, less error-prone choice
265
+ > than `RSVP.defer()`. Promises are recommended unless the specific
266
+ > properties of deferred are needed.
267
+
268
+ Sometimes one needs to create a deferred object, without immediately specifying
269
+ how it will be resolved. These deferred objects are essentially a wrapper around
270
+ a promise, whilst providing late access to the `resolve()` and `reject()` methods.
271
+
272
+ A deferred object has this form: `{ promise, resolve(x), reject(r) }`.
273
+
274
+ ```javascript
275
+ var deferred = RSVP.defer();
276
+ // ...
277
+ deferred.promise // access the promise
278
+ // ...
279
+ deferred.resolve();
280
+
281
+ ```
282
+
283
+ ## TaskJS
284
+
285
+ The [TaskJS](http://taskjs.org/) library makes it possible to take
286
+ promises-oriented code and make it synchronous using ES6 generators.
287
+
288
+ Let's review an earlier example:
289
+
290
+ ```javascript
291
+ getJSON("/post/1.json").then(function(post) {
292
+ return getJSON(post.commentURL);
293
+ }).then(function(comments) {
294
+ // proceed with access to posts and comments
295
+ }).catch(function(reason) {
296
+ // handle errors in either of the two requests
297
+ });
298
+ ```
299
+
300
+ Without any changes to the implementation of `getJSON`, you could write
301
+ the following code with TaskJS:
302
+
303
+ ```javascript
304
+ spawn(function *() {
305
+ try {
306
+ var post = yield getJSON("/post/1.json");
307
+ var comments = yield getJSON(post.commentURL);
308
+ } catch(error) {
309
+ // handle errors
310
+ }
311
+ });
312
+ ```
313
+
314
+ In the above example, `function *` is new syntax in ES6 for
315
+ [generators](http://wiki.ecmascript.org/doku.php?id=harmony:generators).
316
+ Inside a generator, `yield` pauses the generator, returning control to
317
+ the function that invoked the generator. In this case, the invoker is a
318
+ special function that understands the semantics of Promises/A, and will
319
+ automatically resume the generator as soon as the promise is resolved.
320
+
321
+ The cool thing here is the same promises that work with current
322
+ JavaScript using `.then` will work seamlessly with TaskJS once a browser
323
+ has implemented it!
324
+
325
+ ## Instrumentation
326
+
327
+ ```js
328
+ function listener (event) {
329
+ event.guid // guid of promise. Must be globally unique, not just within the implementation
330
+ event.childGuid // child of child promise (for chained via `then`)
331
+ event.eventName // one of ['created', 'chained', 'fulfilled', 'rejected']
332
+ event.detail // fulfillment value or rejection reason, if applicable
333
+ event.label // label passed to promise's constructor
334
+ event.timeStamp // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now
335
+ event.stack // stack at the time of the event. (if 'instrument-with-stack' is true)
336
+ }
337
+
338
+ RSVP.configure('instrument', true | false);
339
+ // capturing the stacks is slow, so you also have to opt in
340
+ RSVP.configure('instrument-with-stack', true | false);
341
+
342
+ // events
343
+ RSVP.on('created', listener);
344
+ RSVP.on('chained', listener);
345
+ RSVP.on('fulfilled', listener);
346
+ RSVP.on('rejected', listener);
347
+ ```
348
+
349
+ Events are only triggered when `RSVP.configure('instrument')` is true, although
350
+ listeners can be registered at any time.
351
+
352
+ ## Building & Testing
353
+
354
+ Custom tasks:
355
+
356
+ * `npm test` - build & test
357
+ * `npm test:node` - build & test just node
358
+ * `npm test:server` - build/watch & test
359
+ * `npm run build` - Build
360
+ * `npm run build:production` - Build production (with minified output)
361
+ * `npm start` - build, watch and run interactive server at http://localhost:4200'
362
+
363
+ ## Releasing
364
+
365
+ Check what release-it will do by running `npm run-script dry-run-release`.
366
+ To actually release, run `node_modules/.bin/release-it`.
@@ -0,0 +1,1597 @@
1
+ /*!
2
+ * @overview RSVP - a tiny implementation of Promises/A+.
3
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
4
+ * @license Licensed under MIT license
5
+ * See https://raw.githubusercontent.com/tildeio/rsvp.js/master/LICENSE
6
+ * @version 3.0.21
7
+ */
8
+
9
+ (function() {
10
+ "use strict";
11
+ function lib$rsvp$utils$$objectOrFunction(x) {
12
+ return typeof x === 'function' || (typeof x === 'object' && x !== null);
13
+ }
14
+
15
+ function lib$rsvp$utils$$isFunction(x) {
16
+ return typeof x === 'function';
17
+ }
18
+
19
+ function lib$rsvp$utils$$isMaybeThenable(x) {
20
+ return typeof x === 'object' && x !== null;
21
+ }
22
+
23
+ var lib$rsvp$utils$$_isArray;
24
+ if (!Array.isArray) {
25
+ lib$rsvp$utils$$_isArray = function (x) {
26
+ return Object.prototype.toString.call(x) === '[object Array]';
27
+ };
28
+ } else {
29
+ lib$rsvp$utils$$_isArray = Array.isArray;
30
+ }
31
+
32
+ var lib$rsvp$utils$$isArray = lib$rsvp$utils$$_isArray;
33
+
34
+ var lib$rsvp$utils$$now = Date.now || function() { return new Date().getTime(); };
35
+
36
+ function lib$rsvp$utils$$F() { }
37
+
38
+ var lib$rsvp$utils$$o_create = (Object.create || function (o) {
39
+ if (arguments.length > 1) {
40
+ throw new Error('Second argument not supported');
41
+ }
42
+ if (typeof o !== 'object') {
43
+ throw new TypeError('Argument must be an object');
44
+ }
45
+ lib$rsvp$utils$$F.prototype = o;
46
+ return new lib$rsvp$utils$$F();
47
+ });
48
+ function lib$rsvp$events$$indexOf(callbacks, callback) {
49
+ for (var i=0, l=callbacks.length; i<l; i++) {
50
+ if (callbacks[i] === callback) { return i; }
51
+ }
52
+
53
+ return -1;
54
+ }
55
+
56
+ function lib$rsvp$events$$callbacksFor(object) {
57
+ var callbacks = object._promiseCallbacks;
58
+
59
+ if (!callbacks) {
60
+ callbacks = object._promiseCallbacks = {};
61
+ }
62
+
63
+ return callbacks;
64
+ }
65
+
66
+ var lib$rsvp$events$$default = {
67
+
68
+ /**
69
+ `RSVP.EventTarget.mixin` extends an object with EventTarget methods. For
70
+ Example:
71
+
72
+ ```javascript
73
+ var object = {};
74
+
75
+ RSVP.EventTarget.mixin(object);
76
+
77
+ object.on('finished', function(event) {
78
+ // handle event
79
+ });
80
+
81
+ object.trigger('finished', { detail: value });
82
+ ```
83
+
84
+ `EventTarget.mixin` also works with prototypes:
85
+
86
+ ```javascript
87
+ var Person = function() {};
88
+ RSVP.EventTarget.mixin(Person.prototype);
89
+
90
+ var yehuda = new Person();
91
+ var tom = new Person();
92
+
93
+ yehuda.on('poke', function(event) {
94
+ console.log('Yehuda says OW');
95
+ });
96
+
97
+ tom.on('poke', function(event) {
98
+ console.log('Tom says OW');
99
+ });
100
+
101
+ yehuda.trigger('poke');
102
+ tom.trigger('poke');
103
+ ```
104
+
105
+ @method mixin
106
+ @for RSVP.EventTarget
107
+ @private
108
+ @param {Object} object object to extend with EventTarget methods
109
+ */
110
+ 'mixin': function(object) {
111
+ object['on'] = this['on'];
112
+ object['off'] = this['off'];
113
+ object['trigger'] = this['trigger'];
114
+ object._promiseCallbacks = undefined;
115
+ return object;
116
+ },
117
+
118
+ /**
119
+ Registers a callback to be executed when `eventName` is triggered
120
+
121
+ ```javascript
122
+ object.on('event', function(eventInfo){
123
+ // handle the event
124
+ });
125
+
126
+ object.trigger('event');
127
+ ```
128
+
129
+ @method on
130
+ @for RSVP.EventTarget
131
+ @private
132
+ @param {String} eventName name of the event to listen for
133
+ @param {Function} callback function to be called when the event is triggered.
134
+ */
135
+ 'on': function(eventName, callback) {
136
+ if (typeof callback !== 'function') {
137
+ throw new TypeError('Callback must be a function');
138
+ }
139
+
140
+ var allCallbacks = lib$rsvp$events$$callbacksFor(this), callbacks;
141
+
142
+ callbacks = allCallbacks[eventName];
143
+
144
+ if (!callbacks) {
145
+ callbacks = allCallbacks[eventName] = [];
146
+ }
147
+
148
+ if (lib$rsvp$events$$indexOf(callbacks, callback) === -1) {
149
+ callbacks.push(callback);
150
+ }
151
+ },
152
+
153
+ /**
154
+ You can use `off` to stop firing a particular callback for an event:
155
+
156
+ ```javascript
157
+ function doStuff() { // do stuff! }
158
+ object.on('stuff', doStuff);
159
+
160
+ object.trigger('stuff'); // doStuff will be called
161
+
162
+ // Unregister ONLY the doStuff callback
163
+ object.off('stuff', doStuff);
164
+ object.trigger('stuff'); // doStuff will NOT be called
165
+ ```
166
+
167
+ If you don't pass a `callback` argument to `off`, ALL callbacks for the
168
+ event will not be executed when the event fires. For example:
169
+
170
+ ```javascript
171
+ var callback1 = function(){};
172
+ var callback2 = function(){};
173
+
174
+ object.on('stuff', callback1);
175
+ object.on('stuff', callback2);
176
+
177
+ object.trigger('stuff'); // callback1 and callback2 will be executed.
178
+
179
+ object.off('stuff');
180
+ object.trigger('stuff'); // callback1 and callback2 will not be executed!
181
+ ```
182
+
183
+ @method off
184
+ @for RSVP.EventTarget
185
+ @private
186
+ @param {String} eventName event to stop listening to
187
+ @param {Function} callback optional argument. If given, only the function
188
+ given will be removed from the event's callback queue. If no `callback`
189
+ argument is given, all callbacks will be removed from the event's callback
190
+ queue.
191
+ */
192
+ 'off': function(eventName, callback) {
193
+ var allCallbacks = lib$rsvp$events$$callbacksFor(this), callbacks, index;
194
+
195
+ if (!callback) {
196
+ allCallbacks[eventName] = [];
197
+ return;
198
+ }
199
+
200
+ callbacks = allCallbacks[eventName];
201
+
202
+ index = lib$rsvp$events$$indexOf(callbacks, callback);
203
+
204
+ if (index !== -1) { callbacks.splice(index, 1); }
205
+ },
206
+
207
+ /**
208
+ Use `trigger` to fire custom events. For example:
209
+
210
+ ```javascript
211
+ object.on('foo', function(){
212
+ console.log('foo event happened!');
213
+ });
214
+ object.trigger('foo');
215
+ // 'foo event happened!' logged to the console
216
+ ```
217
+
218
+ You can also pass a value as a second argument to `trigger` that will be
219
+ passed as an argument to all event listeners for the event:
220
+
221
+ ```javascript
222
+ object.on('foo', function(value){
223
+ console.log(value.name);
224
+ });
225
+
226
+ object.trigger('foo', { name: 'bar' });
227
+ // 'bar' logged to the console
228
+ ```
229
+
230
+ @method trigger
231
+ @for RSVP.EventTarget
232
+ @private
233
+ @param {String} eventName name of the event to be triggered
234
+ @param {*} options optional value to be passed to any event handlers for
235
+ the given `eventName`
236
+ */
237
+ 'trigger': function(eventName, options) {
238
+ var allCallbacks = lib$rsvp$events$$callbacksFor(this), callbacks, callback;
239
+
240
+ if (callbacks = allCallbacks[eventName]) {
241
+ // Don't cache the callbacks.length since it may grow
242
+ for (var i=0; i<callbacks.length; i++) {
243
+ callback = callbacks[i];
244
+
245
+ callback(options);
246
+ }
247
+ }
248
+ }
249
+ };
250
+
251
+ var lib$rsvp$config$$config = {
252
+ instrument: false
253
+ };
254
+
255
+ lib$rsvp$events$$default['mixin'](lib$rsvp$config$$config);
256
+
257
+ function lib$rsvp$config$$configure(name, value) {
258
+ if (name === 'onerror') {
259
+ // handle for legacy users that expect the actual
260
+ // error to be passed to their function added via
261
+ // `RSVP.configure('onerror', someFunctionHere);`
262
+ lib$rsvp$config$$config['on']('error', value);
263
+ return;
264
+ }
265
+
266
+ if (arguments.length === 2) {
267
+ lib$rsvp$config$$config[name] = value;
268
+ } else {
269
+ return lib$rsvp$config$$config[name];
270
+ }
271
+ }
272
+
273
+ var lib$rsvp$instrument$$queue = [];
274
+
275
+ function lib$rsvp$instrument$$scheduleFlush() {
276
+ setTimeout(function() {
277
+ var entry;
278
+ for (var i = 0; i < lib$rsvp$instrument$$queue.length; i++) {
279
+ entry = lib$rsvp$instrument$$queue[i];
280
+
281
+ var payload = entry.payload;
282
+
283
+ payload.guid = payload.key + payload.id;
284
+ payload.childGuid = payload.key + payload.childId;
285
+ if (payload.error) {
286
+ payload.stack = payload.error.stack;
287
+ }
288
+
289
+ lib$rsvp$config$$config['trigger'](entry.name, entry.payload);
290
+ }
291
+ lib$rsvp$instrument$$queue.length = 0;
292
+ }, 50);
293
+ }
294
+
295
+ function lib$rsvp$instrument$$instrument(eventName, promise, child) {
296
+ if (1 === lib$rsvp$instrument$$queue.push({
297
+ name: eventName,
298
+ payload: {
299
+ key: promise._guidKey,
300
+ id: promise._id,
301
+ eventName: eventName,
302
+ detail: promise._result,
303
+ childId: child && child._id,
304
+ label: promise._label,
305
+ timeStamp: lib$rsvp$utils$$now(),
306
+ error: lib$rsvp$config$$config["instrument-with-stack"] ? new Error(promise._label) : null
307
+ }})) {
308
+ lib$rsvp$instrument$$scheduleFlush();
309
+ }
310
+ }
311
+ var lib$rsvp$instrument$$default = lib$rsvp$instrument$$instrument;
312
+
313
+ function lib$rsvp$$internal$$withOwnPromise() {
314
+ return new TypeError('A promises callback cannot return that same promise.');
315
+ }
316
+
317
+ function lib$rsvp$$internal$$noop() {}
318
+
319
+ var lib$rsvp$$internal$$PENDING = void 0;
320
+ var lib$rsvp$$internal$$FULFILLED = 1;
321
+ var lib$rsvp$$internal$$REJECTED = 2;
322
+
323
+ var lib$rsvp$$internal$$GET_THEN_ERROR = new lib$rsvp$$internal$$ErrorObject();
324
+
325
+ function lib$rsvp$$internal$$getThen(promise) {
326
+ try {
327
+ return promise.then;
328
+ } catch(error) {
329
+ lib$rsvp$$internal$$GET_THEN_ERROR.error = error;
330
+ return lib$rsvp$$internal$$GET_THEN_ERROR;
331
+ }
332
+ }
333
+
334
+ function lib$rsvp$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
335
+ try {
336
+ then.call(value, fulfillmentHandler, rejectionHandler);
337
+ } catch(e) {
338
+ return e;
339
+ }
340
+ }
341
+
342
+ function lib$rsvp$$internal$$handleForeignThenable(promise, thenable, then) {
343
+ lib$rsvp$config$$config.async(function(promise) {
344
+ var sealed = false;
345
+ var error = lib$rsvp$$internal$$tryThen(then, thenable, function(value) {
346
+ if (sealed) { return; }
347
+ sealed = true;
348
+ if (thenable !== value) {
349
+ lib$rsvp$$internal$$resolve(promise, value);
350
+ } else {
351
+ lib$rsvp$$internal$$fulfill(promise, value);
352
+ }
353
+ }, function(reason) {
354
+ if (sealed) { return; }
355
+ sealed = true;
356
+
357
+ lib$rsvp$$internal$$reject(promise, reason);
358
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
359
+
360
+ if (!sealed && error) {
361
+ sealed = true;
362
+ lib$rsvp$$internal$$reject(promise, error);
363
+ }
364
+ }, promise);
365
+ }
366
+
367
+ function lib$rsvp$$internal$$handleOwnThenable(promise, thenable) {
368
+ if (thenable._state === lib$rsvp$$internal$$FULFILLED) {
369
+ lib$rsvp$$internal$$fulfill(promise, thenable._result);
370
+ } else if (thenable._state === lib$rsvp$$internal$$REJECTED) {
371
+ thenable._onError = null;
372
+ lib$rsvp$$internal$$reject(promise, thenable._result);
373
+ } else {
374
+ lib$rsvp$$internal$$subscribe(thenable, undefined, function(value) {
375
+ if (thenable !== value) {
376
+ lib$rsvp$$internal$$resolve(promise, value);
377
+ } else {
378
+ lib$rsvp$$internal$$fulfill(promise, value);
379
+ }
380
+ }, function(reason) {
381
+ lib$rsvp$$internal$$reject(promise, reason);
382
+ });
383
+ }
384
+ }
385
+
386
+ function lib$rsvp$$internal$$handleMaybeThenable(promise, maybeThenable) {
387
+ if (maybeThenable.constructor === promise.constructor) {
388
+ lib$rsvp$$internal$$handleOwnThenable(promise, maybeThenable);
389
+ } else {
390
+ var then = lib$rsvp$$internal$$getThen(maybeThenable);
391
+
392
+ if (then === lib$rsvp$$internal$$GET_THEN_ERROR) {
393
+ lib$rsvp$$internal$$reject(promise, lib$rsvp$$internal$$GET_THEN_ERROR.error);
394
+ } else if (then === undefined) {
395
+ lib$rsvp$$internal$$fulfill(promise, maybeThenable);
396
+ } else if (lib$rsvp$utils$$isFunction(then)) {
397
+ lib$rsvp$$internal$$handleForeignThenable(promise, maybeThenable, then);
398
+ } else {
399
+ lib$rsvp$$internal$$fulfill(promise, maybeThenable);
400
+ }
401
+ }
402
+ }
403
+
404
+ function lib$rsvp$$internal$$resolve(promise, value) {
405
+ if (promise === value) {
406
+ lib$rsvp$$internal$$fulfill(promise, value);
407
+ } else if (lib$rsvp$utils$$objectOrFunction(value)) {
408
+ lib$rsvp$$internal$$handleMaybeThenable(promise, value);
409
+ } else {
410
+ lib$rsvp$$internal$$fulfill(promise, value);
411
+ }
412
+ }
413
+
414
+ function lib$rsvp$$internal$$publishRejection(promise) {
415
+ if (promise._onError) {
416
+ promise._onError(promise._result);
417
+ }
418
+
419
+ lib$rsvp$$internal$$publish(promise);
420
+ }
421
+
422
+ function lib$rsvp$$internal$$fulfill(promise, value) {
423
+ if (promise._state !== lib$rsvp$$internal$$PENDING) { return; }
424
+
425
+ promise._result = value;
426
+ promise._state = lib$rsvp$$internal$$FULFILLED;
427
+
428
+ if (promise._subscribers.length === 0) {
429
+ if (lib$rsvp$config$$config.instrument) {
430
+ lib$rsvp$instrument$$default('fulfilled', promise);
431
+ }
432
+ } else {
433
+ lib$rsvp$config$$config.async(lib$rsvp$$internal$$publish, promise);
434
+ }
435
+ }
436
+
437
+ function lib$rsvp$$internal$$reject(promise, reason) {
438
+ if (promise._state !== lib$rsvp$$internal$$PENDING) { return; }
439
+ promise._state = lib$rsvp$$internal$$REJECTED;
440
+ promise._result = reason;
441
+ lib$rsvp$config$$config.async(lib$rsvp$$internal$$publishRejection, promise);
442
+ }
443
+
444
+ function lib$rsvp$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
445
+ var subscribers = parent._subscribers;
446
+ var length = subscribers.length;
447
+
448
+ parent._onError = null;
449
+
450
+ subscribers[length] = child;
451
+ subscribers[length + lib$rsvp$$internal$$FULFILLED] = onFulfillment;
452
+ subscribers[length + lib$rsvp$$internal$$REJECTED] = onRejection;
453
+
454
+ if (length === 0 && parent._state) {
455
+ lib$rsvp$config$$config.async(lib$rsvp$$internal$$publish, parent);
456
+ }
457
+ }
458
+
459
+ function lib$rsvp$$internal$$publish(promise) {
460
+ var subscribers = promise._subscribers;
461
+ var settled = promise._state;
462
+
463
+ if (lib$rsvp$config$$config.instrument) {
464
+ lib$rsvp$instrument$$default(settled === lib$rsvp$$internal$$FULFILLED ? 'fulfilled' : 'rejected', promise);
465
+ }
466
+
467
+ if (subscribers.length === 0) { return; }
468
+
469
+ var child, callback, detail = promise._result;
470
+
471
+ for (var i = 0; i < subscribers.length; i += 3) {
472
+ child = subscribers[i];
473
+ callback = subscribers[i + settled];
474
+
475
+ if (child) {
476
+ lib$rsvp$$internal$$invokeCallback(settled, child, callback, detail);
477
+ } else {
478
+ callback(detail);
479
+ }
480
+ }
481
+
482
+ promise._subscribers.length = 0;
483
+ }
484
+
485
+ function lib$rsvp$$internal$$ErrorObject() {
486
+ this.error = null;
487
+ }
488
+
489
+ var lib$rsvp$$internal$$TRY_CATCH_ERROR = new lib$rsvp$$internal$$ErrorObject();
490
+
491
+ function lib$rsvp$$internal$$tryCatch(callback, detail) {
492
+ try {
493
+ return callback(detail);
494
+ } catch(e) {
495
+ lib$rsvp$$internal$$TRY_CATCH_ERROR.error = e;
496
+ return lib$rsvp$$internal$$TRY_CATCH_ERROR;
497
+ }
498
+ }
499
+
500
+ function lib$rsvp$$internal$$invokeCallback(settled, promise, callback, detail) {
501
+ var hasCallback = lib$rsvp$utils$$isFunction(callback),
502
+ value, error, succeeded, failed;
503
+
504
+ if (hasCallback) {
505
+ value = lib$rsvp$$internal$$tryCatch(callback, detail);
506
+
507
+ if (value === lib$rsvp$$internal$$TRY_CATCH_ERROR) {
508
+ failed = true;
509
+ error = value.error;
510
+ value = null;
511
+ } else {
512
+ succeeded = true;
513
+ }
514
+
515
+ if (promise === value) {
516
+ lib$rsvp$$internal$$reject(promise, lib$rsvp$$internal$$withOwnPromise());
517
+ return;
518
+ }
519
+
520
+ } else {
521
+ value = detail;
522
+ succeeded = true;
523
+ }
524
+
525
+ if (promise._state !== lib$rsvp$$internal$$PENDING) {
526
+ // noop
527
+ } else if (hasCallback && succeeded) {
528
+ lib$rsvp$$internal$$resolve(promise, value);
529
+ } else if (failed) {
530
+ lib$rsvp$$internal$$reject(promise, error);
531
+ } else if (settled === lib$rsvp$$internal$$FULFILLED) {
532
+ lib$rsvp$$internal$$fulfill(promise, value);
533
+ } else if (settled === lib$rsvp$$internal$$REJECTED) {
534
+ lib$rsvp$$internal$$reject(promise, value);
535
+ }
536
+ }
537
+
538
+ function lib$rsvp$$internal$$initializePromise(promise, resolver) {
539
+ var resolved = false;
540
+ try {
541
+ resolver(function resolvePromise(value){
542
+ if (resolved) { return; }
543
+ resolved = true;
544
+ lib$rsvp$$internal$$resolve(promise, value);
545
+ }, function rejectPromise(reason) {
546
+ if (resolved) { return; }
547
+ resolved = true;
548
+ lib$rsvp$$internal$$reject(promise, reason);
549
+ });
550
+ } catch(e) {
551
+ lib$rsvp$$internal$$reject(promise, e);
552
+ }
553
+ }
554
+
555
+ function lib$rsvp$enumerator$$makeSettledResult(state, position, value) {
556
+ if (state === lib$rsvp$$internal$$FULFILLED) {
557
+ return {
558
+ state: 'fulfilled',
559
+ value: value
560
+ };
561
+ } else {
562
+ return {
563
+ state: 'rejected',
564
+ reason: value
565
+ };
566
+ }
567
+ }
568
+
569
+ function lib$rsvp$enumerator$$Enumerator(Constructor, input, abortOnReject, label) {
570
+ var enumerator = this;
571
+
572
+ enumerator._instanceConstructor = Constructor;
573
+ enumerator.promise = new Constructor(lib$rsvp$$internal$$noop, label);
574
+ enumerator._abortOnReject = abortOnReject;
575
+
576
+ if (enumerator._validateInput(input)) {
577
+ enumerator._input = input;
578
+ enumerator.length = input.length;
579
+ enumerator._remaining = input.length;
580
+
581
+ enumerator._init();
582
+
583
+ if (enumerator.length === 0) {
584
+ lib$rsvp$$internal$$fulfill(enumerator.promise, enumerator._result);
585
+ } else {
586
+ enumerator.length = enumerator.length || 0;
587
+ enumerator._enumerate();
588
+ if (enumerator._remaining === 0) {
589
+ lib$rsvp$$internal$$fulfill(enumerator.promise, enumerator._result);
590
+ }
591
+ }
592
+ } else {
593
+ lib$rsvp$$internal$$reject(enumerator.promise, enumerator._validationError());
594
+ }
595
+ }
596
+
597
+ var lib$rsvp$enumerator$$default = lib$rsvp$enumerator$$Enumerator;
598
+
599
+ lib$rsvp$enumerator$$Enumerator.prototype._validateInput = function(input) {
600
+ return lib$rsvp$utils$$isArray(input);
601
+ };
602
+
603
+ lib$rsvp$enumerator$$Enumerator.prototype._validationError = function() {
604
+ return new Error('Array Methods must be provided an Array');
605
+ };
606
+
607
+ lib$rsvp$enumerator$$Enumerator.prototype._init = function() {
608
+ this._result = new Array(this.length);
609
+ };
610
+
611
+ lib$rsvp$enumerator$$Enumerator.prototype._enumerate = function() {
612
+ var enumerator = this;
613
+ var length = enumerator.length;
614
+ var promise = enumerator.promise;
615
+ var input = enumerator._input;
616
+
617
+ for (var i = 0; promise._state === lib$rsvp$$internal$$PENDING && i < length; i++) {
618
+ enumerator._eachEntry(input[i], i);
619
+ }
620
+ };
621
+
622
+ lib$rsvp$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
623
+ var enumerator = this;
624
+ var c = enumerator._instanceConstructor;
625
+ if (lib$rsvp$utils$$isMaybeThenable(entry)) {
626
+ if (entry.constructor === c && entry._state !== lib$rsvp$$internal$$PENDING) {
627
+ entry._onError = null;
628
+ enumerator._settledAt(entry._state, i, entry._result);
629
+ } else {
630
+ enumerator._willSettleAt(c.resolve(entry), i);
631
+ }
632
+ } else {
633
+ enumerator._remaining--;
634
+ enumerator._result[i] = enumerator._makeResult(lib$rsvp$$internal$$FULFILLED, i, entry);
635
+ }
636
+ };
637
+
638
+ lib$rsvp$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
639
+ var enumerator = this;
640
+ var promise = enumerator.promise;
641
+
642
+ if (promise._state === lib$rsvp$$internal$$PENDING) {
643
+ enumerator._remaining--;
644
+
645
+ if (enumerator._abortOnReject && state === lib$rsvp$$internal$$REJECTED) {
646
+ lib$rsvp$$internal$$reject(promise, value);
647
+ } else {
648
+ enumerator._result[i] = enumerator._makeResult(state, i, value);
649
+ }
650
+ }
651
+
652
+ if (enumerator._remaining === 0) {
653
+ lib$rsvp$$internal$$fulfill(promise, enumerator._result);
654
+ }
655
+ };
656
+
657
+ lib$rsvp$enumerator$$Enumerator.prototype._makeResult = function(state, i, value) {
658
+ return value;
659
+ };
660
+
661
+ lib$rsvp$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
662
+ var enumerator = this;
663
+
664
+ lib$rsvp$$internal$$subscribe(promise, undefined, function(value) {
665
+ enumerator._settledAt(lib$rsvp$$internal$$FULFILLED, i, value);
666
+ }, function(reason) {
667
+ enumerator._settledAt(lib$rsvp$$internal$$REJECTED, i, reason);
668
+ });
669
+ };
670
+ function lib$rsvp$promise$all$$all(entries, label) {
671
+ return new lib$rsvp$enumerator$$default(this, entries, true /* abort on reject */, label).promise;
672
+ }
673
+ var lib$rsvp$promise$all$$default = lib$rsvp$promise$all$$all;
674
+ function lib$rsvp$promise$race$$race(entries, label) {
675
+ /*jshint validthis:true */
676
+ var Constructor = this;
677
+
678
+ var promise = new Constructor(lib$rsvp$$internal$$noop, label);
679
+
680
+ if (!lib$rsvp$utils$$isArray(entries)) {
681
+ lib$rsvp$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
682
+ return promise;
683
+ }
684
+
685
+ var length = entries.length;
686
+
687
+ function onFulfillment(value) {
688
+ lib$rsvp$$internal$$resolve(promise, value);
689
+ }
690
+
691
+ function onRejection(reason) {
692
+ lib$rsvp$$internal$$reject(promise, reason);
693
+ }
694
+
695
+ for (var i = 0; promise._state === lib$rsvp$$internal$$PENDING && i < length; i++) {
696
+ lib$rsvp$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
697
+ }
698
+
699
+ return promise;
700
+ }
701
+ var lib$rsvp$promise$race$$default = lib$rsvp$promise$race$$race;
702
+ function lib$rsvp$promise$resolve$$resolve(object, label) {
703
+ /*jshint validthis:true */
704
+ var Constructor = this;
705
+
706
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
707
+ return object;
708
+ }
709
+
710
+ var promise = new Constructor(lib$rsvp$$internal$$noop, label);
711
+ lib$rsvp$$internal$$resolve(promise, object);
712
+ return promise;
713
+ }
714
+ var lib$rsvp$promise$resolve$$default = lib$rsvp$promise$resolve$$resolve;
715
+ function lib$rsvp$promise$reject$$reject(reason, label) {
716
+ /*jshint validthis:true */
717
+ var Constructor = this;
718
+ var promise = new Constructor(lib$rsvp$$internal$$noop, label);
719
+ lib$rsvp$$internal$$reject(promise, reason);
720
+ return promise;
721
+ }
722
+ var lib$rsvp$promise$reject$$default = lib$rsvp$promise$reject$$reject;
723
+
724
+ var lib$rsvp$promise$$guidKey = 'rsvp_' + lib$rsvp$utils$$now() + '-';
725
+ var lib$rsvp$promise$$counter = 0;
726
+
727
+ function lib$rsvp$promise$$needsResolver() {
728
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
729
+ }
730
+
731
+ function lib$rsvp$promise$$needsNew() {
732
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
733
+ }
734
+
735
+ function lib$rsvp$promise$$Promise(resolver, label) {
736
+ var promise = this;
737
+
738
+ promise._id = lib$rsvp$promise$$counter++;
739
+ promise._label = label;
740
+ promise._state = undefined;
741
+ promise._result = undefined;
742
+ promise._subscribers = [];
743
+
744
+ if (lib$rsvp$config$$config.instrument) {
745
+ lib$rsvp$instrument$$default('created', promise);
746
+ }
747
+
748
+ if (lib$rsvp$$internal$$noop !== resolver) {
749
+ if (!lib$rsvp$utils$$isFunction(resolver)) {
750
+ lib$rsvp$promise$$needsResolver();
751
+ }
752
+
753
+ if (!(promise instanceof lib$rsvp$promise$$Promise)) {
754
+ lib$rsvp$promise$$needsNew();
755
+ }
756
+
757
+ lib$rsvp$$internal$$initializePromise(promise, resolver);
758
+ }
759
+ }
760
+
761
+ var lib$rsvp$promise$$default = lib$rsvp$promise$$Promise;
762
+
763
+ // deprecated
764
+ lib$rsvp$promise$$Promise.cast = lib$rsvp$promise$resolve$$default;
765
+ lib$rsvp$promise$$Promise.all = lib$rsvp$promise$all$$default;
766
+ lib$rsvp$promise$$Promise.race = lib$rsvp$promise$race$$default;
767
+ lib$rsvp$promise$$Promise.resolve = lib$rsvp$promise$resolve$$default;
768
+ lib$rsvp$promise$$Promise.reject = lib$rsvp$promise$reject$$default;
769
+
770
+ lib$rsvp$promise$$Promise.prototype = {
771
+ constructor: lib$rsvp$promise$$Promise,
772
+
773
+ _guidKey: lib$rsvp$promise$$guidKey,
774
+
775
+ _onError: function (reason) {
776
+ var promise = this;
777
+ lib$rsvp$config$$config.after(function() {
778
+ if (promise._onError) {
779
+ lib$rsvp$config$$config['trigger']('error', reason);
780
+ }
781
+ });
782
+ },
783
+
784
+ /**
785
+ The primary way of interacting with a promise is through its `then` method,
786
+ which registers callbacks to receive either a promise's eventual value or the
787
+ reason why the promise cannot be fulfilled.
788
+
789
+ ```js
790
+ findUser().then(function(user){
791
+ // user is available
792
+ }, function(reason){
793
+ // user is unavailable, and you are given the reason why
794
+ });
795
+ ```
796
+
797
+ Chaining
798
+ --------
799
+
800
+ The return value of `then` is itself a promise. This second, 'downstream'
801
+ promise is resolved with the return value of the first promise's fulfillment
802
+ or rejection handler, or rejected if the handler throws an exception.
803
+
804
+ ```js
805
+ findUser().then(function (user) {
806
+ return user.name;
807
+ }, function (reason) {
808
+ return 'default name';
809
+ }).then(function (userName) {
810
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
811
+ // will be `'default name'`
812
+ });
813
+
814
+ findUser().then(function (user) {
815
+ throw new Error('Found user, but still unhappy');
816
+ }, function (reason) {
817
+ throw new Error('`findUser` rejected and we're unhappy');
818
+ }).then(function (value) {
819
+ // never reached
820
+ }, function (reason) {
821
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
822
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
823
+ });
824
+ ```
825
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
826
+
827
+ ```js
828
+ findUser().then(function (user) {
829
+ throw new PedagogicalException('Upstream error');
830
+ }).then(function (value) {
831
+ // never reached
832
+ }).then(function (value) {
833
+ // never reached
834
+ }, function (reason) {
835
+ // The `PedgagocialException` is propagated all the way down to here
836
+ });
837
+ ```
838
+
839
+ Assimilation
840
+ ------------
841
+
842
+ Sometimes the value you want to propagate to a downstream promise can only be
843
+ retrieved asynchronously. This can be achieved by returning a promise in the
844
+ fulfillment or rejection handler. The downstream promise will then be pending
845
+ until the returned promise is settled. This is called *assimilation*.
846
+
847
+ ```js
848
+ findUser().then(function (user) {
849
+ return findCommentsByAuthor(user);
850
+ }).then(function (comments) {
851
+ // The user's comments are now available
852
+ });
853
+ ```
854
+
855
+ If the assimliated promise rejects, then the downstream promise will also reject.
856
+
857
+ ```js
858
+ findUser().then(function (user) {
859
+ return findCommentsByAuthor(user);
860
+ }).then(function (comments) {
861
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
862
+ }, function (reason) {
863
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
864
+ });
865
+ ```
866
+
867
+ Simple Example
868
+ --------------
869
+
870
+ Synchronous Example
871
+
872
+ ```javascript
873
+ var result;
874
+
875
+ try {
876
+ result = findResult();
877
+ // success
878
+ } catch(reason) {
879
+ // failure
880
+ }
881
+ ```
882
+
883
+ Errback Example
884
+
885
+ ```js
886
+ findResult(function(result, err){
887
+ if (err) {
888
+ // failure
889
+ } else {
890
+ // success
891
+ }
892
+ });
893
+ ```
894
+
895
+ Promise Example;
896
+
897
+ ```javascript
898
+ findResult().then(function(result){
899
+ // success
900
+ }, function(reason){
901
+ // failure
902
+ });
903
+ ```
904
+
905
+ Advanced Example
906
+ --------------
907
+
908
+ Synchronous Example
909
+
910
+ ```javascript
911
+ var author, books;
912
+
913
+ try {
914
+ author = findAuthor();
915
+ books = findBooksByAuthor(author);
916
+ // success
917
+ } catch(reason) {
918
+ // failure
919
+ }
920
+ ```
921
+
922
+ Errback Example
923
+
924
+ ```js
925
+
926
+ function foundBooks(books) {
927
+
928
+ }
929
+
930
+ function failure(reason) {
931
+
932
+ }
933
+
934
+ findAuthor(function(author, err){
935
+ if (err) {
936
+ failure(err);
937
+ // failure
938
+ } else {
939
+ try {
940
+ findBoooksByAuthor(author, function(books, err) {
941
+ if (err) {
942
+ failure(err);
943
+ } else {
944
+ try {
945
+ foundBooks(books);
946
+ } catch(reason) {
947
+ failure(reason);
948
+ }
949
+ }
950
+ });
951
+ } catch(error) {
952
+ failure(err);
953
+ }
954
+ // success
955
+ }
956
+ });
957
+ ```
958
+
959
+ Promise Example;
960
+
961
+ ```javascript
962
+ findAuthor().
963
+ then(findBooksByAuthor).
964
+ then(function(books){
965
+ // found books
966
+ }).catch(function(reason){
967
+ // something went wrong
968
+ });
969
+ ```
970
+
971
+ @method then
972
+ @param {Function} onFulfillment
973
+ @param {Function} onRejection
974
+ @param {String} label optional string for labeling the promise.
975
+ Useful for tooling.
976
+ @return {Promise}
977
+ */
978
+ then: function(onFulfillment, onRejection, label) {
979
+ var parent = this;
980
+ var state = parent._state;
981
+
982
+ if (state === lib$rsvp$$internal$$FULFILLED && !onFulfillment || state === lib$rsvp$$internal$$REJECTED && !onRejection) {
983
+ if (lib$rsvp$config$$config.instrument) {
984
+ lib$rsvp$instrument$$default('chained', parent, parent);
985
+ }
986
+ return parent;
987
+ }
988
+
989
+ parent._onError = null;
990
+
991
+ var child = new parent.constructor(lib$rsvp$$internal$$noop, label);
992
+ var result = parent._result;
993
+
994
+ if (lib$rsvp$config$$config.instrument) {
995
+ lib$rsvp$instrument$$default('chained', parent, child);
996
+ }
997
+
998
+ if (state) {
999
+ var callback = arguments[state - 1];
1000
+ lib$rsvp$config$$config.async(function(){
1001
+ lib$rsvp$$internal$$invokeCallback(state, child, callback, result);
1002
+ });
1003
+ } else {
1004
+ lib$rsvp$$internal$$subscribe(parent, child, onFulfillment, onRejection);
1005
+ }
1006
+
1007
+ return child;
1008
+ },
1009
+
1010
+ /**
1011
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
1012
+ as the catch block of a try/catch statement.
1013
+
1014
+ ```js
1015
+ function findAuthor(){
1016
+ throw new Error('couldn't find that author');
1017
+ }
1018
+
1019
+ // synchronous
1020
+ try {
1021
+ findAuthor();
1022
+ } catch(reason) {
1023
+ // something went wrong
1024
+ }
1025
+
1026
+ // async with promises
1027
+ findAuthor().catch(function(reason){
1028
+ // something went wrong
1029
+ });
1030
+ ```
1031
+
1032
+ @method catch
1033
+ @param {Function} onRejection
1034
+ @param {String} label optional string for labeling the promise.
1035
+ Useful for tooling.
1036
+ @return {Promise}
1037
+ */
1038
+ 'catch': function(onRejection, label) {
1039
+ return this.then(undefined, onRejection, label);
1040
+ },
1041
+
1042
+ /**
1043
+ `finally` will be invoked regardless of the promise's fate just as native
1044
+ try/catch/finally behaves
1045
+
1046
+ Synchronous example:
1047
+
1048
+ ```js
1049
+ findAuthor() {
1050
+ if (Math.random() > 0.5) {
1051
+ throw new Error();
1052
+ }
1053
+ return new Author();
1054
+ }
1055
+
1056
+ try {
1057
+ return findAuthor(); // succeed or fail
1058
+ } catch(error) {
1059
+ return findOtherAuther();
1060
+ } finally {
1061
+ // always runs
1062
+ // doesn't affect the return value
1063
+ }
1064
+ ```
1065
+
1066
+ Asynchronous example:
1067
+
1068
+ ```js
1069
+ findAuthor().catch(function(reason){
1070
+ return findOtherAuther();
1071
+ }).finally(function(){
1072
+ // author was either found, or not
1073
+ });
1074
+ ```
1075
+
1076
+ @method finally
1077
+ @param {Function} callback
1078
+ @param {String} label optional string for labeling the promise.
1079
+ Useful for tooling.
1080
+ @return {Promise}
1081
+ */
1082
+ 'finally': function(callback, label) {
1083
+ var promise = this;
1084
+ var constructor = promise.constructor;
1085
+
1086
+ return promise.then(function(value) {
1087
+ return constructor.resolve(callback()).then(function(){
1088
+ return value;
1089
+ });
1090
+ }, function(reason) {
1091
+ return constructor.resolve(callback()).then(function(){
1092
+ throw reason;
1093
+ });
1094
+ }, label);
1095
+ }
1096
+ };
1097
+
1098
+ function lib$rsvp$all$settled$$AllSettled(Constructor, entries, label) {
1099
+ this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
1100
+ }
1101
+
1102
+ lib$rsvp$all$settled$$AllSettled.prototype = lib$rsvp$utils$$o_create(lib$rsvp$enumerator$$default.prototype);
1103
+ lib$rsvp$all$settled$$AllSettled.prototype._superConstructor = lib$rsvp$enumerator$$default;
1104
+ lib$rsvp$all$settled$$AllSettled.prototype._makeResult = lib$rsvp$enumerator$$makeSettledResult;
1105
+ lib$rsvp$all$settled$$AllSettled.prototype._validationError = function() {
1106
+ return new Error('allSettled must be called with an array');
1107
+ };
1108
+
1109
+ function lib$rsvp$all$settled$$allSettled(entries, label) {
1110
+ return new lib$rsvp$all$settled$$AllSettled(lib$rsvp$promise$$default, entries, label).promise;
1111
+ }
1112
+ var lib$rsvp$all$settled$$default = lib$rsvp$all$settled$$allSettled;
1113
+ function lib$rsvp$all$$all(array, label) {
1114
+ return lib$rsvp$promise$$default.all(array, label);
1115
+ }
1116
+ var lib$rsvp$all$$default = lib$rsvp$all$$all;
1117
+ var lib$rsvp$asap$$len = 0;
1118
+ var lib$rsvp$asap$$toString = {}.toString;
1119
+ var lib$rsvp$asap$$vertxNext;
1120
+ function lib$rsvp$asap$$asap(callback, arg) {
1121
+ lib$rsvp$asap$$queue[lib$rsvp$asap$$len] = callback;
1122
+ lib$rsvp$asap$$queue[lib$rsvp$asap$$len + 1] = arg;
1123
+ lib$rsvp$asap$$len += 2;
1124
+ if (lib$rsvp$asap$$len === 2) {
1125
+ // If len is 1, that means that we need to schedule an async flush.
1126
+ // If additional callbacks are queued before the queue is flushed, they
1127
+ // will be processed by this flush that we are scheduling.
1128
+ lib$rsvp$asap$$scheduleFlush();
1129
+ }
1130
+ }
1131
+
1132
+ var lib$rsvp$asap$$default = lib$rsvp$asap$$asap;
1133
+
1134
+ var lib$rsvp$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
1135
+ var lib$rsvp$asap$$browserGlobal = lib$rsvp$asap$$browserWindow || {};
1136
+ var lib$rsvp$asap$$BrowserMutationObserver = lib$rsvp$asap$$browserGlobal.MutationObserver || lib$rsvp$asap$$browserGlobal.WebKitMutationObserver;
1137
+ var lib$rsvp$asap$$isNode = typeof self === 'undefined' &&
1138
+ typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
1139
+
1140
+ // test for web worker but not in IE10
1141
+ var lib$rsvp$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
1142
+ typeof importScripts !== 'undefined' &&
1143
+ typeof MessageChannel !== 'undefined';
1144
+
1145
+ // node
1146
+ function lib$rsvp$asap$$useNextTick() {
1147
+ var nextTick = process.nextTick;
1148
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
1149
+ // setImmediate should be used instead instead
1150
+ var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
1151
+ if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
1152
+ nextTick = setImmediate;
1153
+ }
1154
+ return function() {
1155
+ nextTick(lib$rsvp$asap$$flush);
1156
+ };
1157
+ }
1158
+
1159
+ // vertx
1160
+ function lib$rsvp$asap$$useVertxTimer() {
1161
+ return function() {
1162
+ lib$rsvp$asap$$vertxNext(lib$rsvp$asap$$flush);
1163
+ };
1164
+ }
1165
+
1166
+ function lib$rsvp$asap$$useMutationObserver() {
1167
+ var iterations = 0;
1168
+ var observer = new lib$rsvp$asap$$BrowserMutationObserver(lib$rsvp$asap$$flush);
1169
+ var node = document.createTextNode('');
1170
+ observer.observe(node, { characterData: true });
1171
+
1172
+ return function() {
1173
+ node.data = (iterations = ++iterations % 2);
1174
+ };
1175
+ }
1176
+
1177
+ // web worker
1178
+ function lib$rsvp$asap$$useMessageChannel() {
1179
+ var channel = new MessageChannel();
1180
+ channel.port1.onmessage = lib$rsvp$asap$$flush;
1181
+ return function () {
1182
+ channel.port2.postMessage(0);
1183
+ };
1184
+ }
1185
+
1186
+ function lib$rsvp$asap$$useSetTimeout() {
1187
+ return function() {
1188
+ setTimeout(lib$rsvp$asap$$flush, 1);
1189
+ };
1190
+ }
1191
+
1192
+ var lib$rsvp$asap$$queue = new Array(1000);
1193
+ function lib$rsvp$asap$$flush() {
1194
+ for (var i = 0; i < lib$rsvp$asap$$len; i+=2) {
1195
+ var callback = lib$rsvp$asap$$queue[i];
1196
+ var arg = lib$rsvp$asap$$queue[i+1];
1197
+
1198
+ callback(arg);
1199
+
1200
+ lib$rsvp$asap$$queue[i] = undefined;
1201
+ lib$rsvp$asap$$queue[i+1] = undefined;
1202
+ }
1203
+
1204
+ lib$rsvp$asap$$len = 0;
1205
+ }
1206
+
1207
+ function lib$rsvp$asap$$attemptVertex() {
1208
+ try {
1209
+ var r = require;
1210
+ var vertx = r('vertx');
1211
+ lib$rsvp$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
1212
+ return lib$rsvp$asap$$useVertxTimer();
1213
+ } catch(e) {
1214
+ return lib$rsvp$asap$$useSetTimeout();
1215
+ }
1216
+ }
1217
+
1218
+ var lib$rsvp$asap$$scheduleFlush;
1219
+ // Decide what async method to use to triggering processing of queued callbacks:
1220
+ if (lib$rsvp$asap$$isNode) {
1221
+ lib$rsvp$asap$$scheduleFlush = lib$rsvp$asap$$useNextTick();
1222
+ } else if (lib$rsvp$asap$$BrowserMutationObserver) {
1223
+ lib$rsvp$asap$$scheduleFlush = lib$rsvp$asap$$useMutationObserver();
1224
+ } else if (lib$rsvp$asap$$isWorker) {
1225
+ lib$rsvp$asap$$scheduleFlush = lib$rsvp$asap$$useMessageChannel();
1226
+ } else if (lib$rsvp$asap$$browserWindow === undefined && typeof require === 'function') {
1227
+ lib$rsvp$asap$$scheduleFlush = lib$rsvp$asap$$attemptVertex();
1228
+ } else {
1229
+ lib$rsvp$asap$$scheduleFlush = lib$rsvp$asap$$useSetTimeout();
1230
+ }
1231
+ function lib$rsvp$defer$$defer(label) {
1232
+ var deferred = {};
1233
+
1234
+ deferred['promise'] = new lib$rsvp$promise$$default(function(resolve, reject) {
1235
+ deferred['resolve'] = resolve;
1236
+ deferred['reject'] = reject;
1237
+ }, label);
1238
+
1239
+ return deferred;
1240
+ }
1241
+ var lib$rsvp$defer$$default = lib$rsvp$defer$$defer;
1242
+ function lib$rsvp$filter$$filter(promises, filterFn, label) {
1243
+ return lib$rsvp$promise$$default.all(promises, label).then(function(values) {
1244
+ if (!lib$rsvp$utils$$isFunction(filterFn)) {
1245
+ throw new TypeError("You must pass a function as filter's second argument.");
1246
+ }
1247
+
1248
+ var length = values.length;
1249
+ var filtered = new Array(length);
1250
+
1251
+ for (var i = 0; i < length; i++) {
1252
+ filtered[i] = filterFn(values[i]);
1253
+ }
1254
+
1255
+ return lib$rsvp$promise$$default.all(filtered, label).then(function(filtered) {
1256
+ var results = new Array(length);
1257
+ var newLength = 0;
1258
+
1259
+ for (var i = 0; i < length; i++) {
1260
+ if (filtered[i]) {
1261
+ results[newLength] = values[i];
1262
+ newLength++;
1263
+ }
1264
+ }
1265
+
1266
+ results.length = newLength;
1267
+
1268
+ return results;
1269
+ });
1270
+ });
1271
+ }
1272
+ var lib$rsvp$filter$$default = lib$rsvp$filter$$filter;
1273
+
1274
+ function lib$rsvp$promise$hash$$PromiseHash(Constructor, object, label) {
1275
+ this._superConstructor(Constructor, object, true, label);
1276
+ }
1277
+
1278
+ var lib$rsvp$promise$hash$$default = lib$rsvp$promise$hash$$PromiseHash;
1279
+
1280
+ lib$rsvp$promise$hash$$PromiseHash.prototype = lib$rsvp$utils$$o_create(lib$rsvp$enumerator$$default.prototype);
1281
+ lib$rsvp$promise$hash$$PromiseHash.prototype._superConstructor = lib$rsvp$enumerator$$default;
1282
+ lib$rsvp$promise$hash$$PromiseHash.prototype._init = function() {
1283
+ this._result = {};
1284
+ };
1285
+
1286
+ lib$rsvp$promise$hash$$PromiseHash.prototype._validateInput = function(input) {
1287
+ return input && typeof input === 'object';
1288
+ };
1289
+
1290
+ lib$rsvp$promise$hash$$PromiseHash.prototype._validationError = function() {
1291
+ return new Error('Promise.hash must be called with an object');
1292
+ };
1293
+
1294
+ lib$rsvp$promise$hash$$PromiseHash.prototype._enumerate = function() {
1295
+ var enumerator = this;
1296
+ var promise = enumerator.promise;
1297
+ var input = enumerator._input;
1298
+ var results = [];
1299
+
1300
+ for (var key in input) {
1301
+ if (promise._state === lib$rsvp$$internal$$PENDING && Object.prototype.hasOwnProperty.call(input, key)) {
1302
+ results.push({
1303
+ position: key,
1304
+ entry: input[key]
1305
+ });
1306
+ }
1307
+ }
1308
+
1309
+ var length = results.length;
1310
+ enumerator._remaining = length;
1311
+ var result;
1312
+
1313
+ for (var i = 0; promise._state === lib$rsvp$$internal$$PENDING && i < length; i++) {
1314
+ result = results[i];
1315
+ enumerator._eachEntry(result.entry, result.position);
1316
+ }
1317
+ };
1318
+
1319
+ function lib$rsvp$hash$settled$$HashSettled(Constructor, object, label) {
1320
+ this._superConstructor(Constructor, object, false, label);
1321
+ }
1322
+
1323
+ lib$rsvp$hash$settled$$HashSettled.prototype = lib$rsvp$utils$$o_create(lib$rsvp$promise$hash$$default.prototype);
1324
+ lib$rsvp$hash$settled$$HashSettled.prototype._superConstructor = lib$rsvp$enumerator$$default;
1325
+ lib$rsvp$hash$settled$$HashSettled.prototype._makeResult = lib$rsvp$enumerator$$makeSettledResult;
1326
+
1327
+ lib$rsvp$hash$settled$$HashSettled.prototype._validationError = function() {
1328
+ return new Error('hashSettled must be called with an object');
1329
+ };
1330
+
1331
+ function lib$rsvp$hash$settled$$hashSettled(object, label) {
1332
+ return new lib$rsvp$hash$settled$$HashSettled(lib$rsvp$promise$$default, object, label).promise;
1333
+ }
1334
+ var lib$rsvp$hash$settled$$default = lib$rsvp$hash$settled$$hashSettled;
1335
+ function lib$rsvp$hash$$hash(object, label) {
1336
+ return new lib$rsvp$promise$hash$$default(lib$rsvp$promise$$default, object, label).promise;
1337
+ }
1338
+ var lib$rsvp$hash$$default = lib$rsvp$hash$$hash;
1339
+ function lib$rsvp$map$$map(promises, mapFn, label) {
1340
+ return lib$rsvp$promise$$default.all(promises, label).then(function(values) {
1341
+ if (!lib$rsvp$utils$$isFunction(mapFn)) {
1342
+ throw new TypeError("You must pass a function as map's second argument.");
1343
+ }
1344
+
1345
+ var length = values.length;
1346
+ var results = new Array(length);
1347
+
1348
+ for (var i = 0; i < length; i++) {
1349
+ results[i] = mapFn(values[i]);
1350
+ }
1351
+
1352
+ return lib$rsvp$promise$$default.all(results, label);
1353
+ });
1354
+ }
1355
+ var lib$rsvp$map$$default = lib$rsvp$map$$map;
1356
+
1357
+ function lib$rsvp$node$$Result() {
1358
+ this.value = undefined;
1359
+ }
1360
+
1361
+ var lib$rsvp$node$$ERROR = new lib$rsvp$node$$Result();
1362
+ var lib$rsvp$node$$GET_THEN_ERROR = new lib$rsvp$node$$Result();
1363
+
1364
+ function lib$rsvp$node$$getThen(obj) {
1365
+ try {
1366
+ return obj.then;
1367
+ } catch(error) {
1368
+ lib$rsvp$node$$ERROR.value= error;
1369
+ return lib$rsvp$node$$ERROR;
1370
+ }
1371
+ }
1372
+
1373
+
1374
+ function lib$rsvp$node$$tryApply(f, s, a) {
1375
+ try {
1376
+ f.apply(s, a);
1377
+ } catch(error) {
1378
+ lib$rsvp$node$$ERROR.value = error;
1379
+ return lib$rsvp$node$$ERROR;
1380
+ }
1381
+ }
1382
+
1383
+ function lib$rsvp$node$$makeObject(_, argumentNames) {
1384
+ var obj = {};
1385
+ var name;
1386
+ var i;
1387
+ var length = _.length;
1388
+ var args = new Array(length);
1389
+
1390
+ for (var x = 0; x < length; x++) {
1391
+ args[x] = _[x];
1392
+ }
1393
+
1394
+ for (i = 0; i < argumentNames.length; i++) {
1395
+ name = argumentNames[i];
1396
+ obj[name] = args[i + 1];
1397
+ }
1398
+
1399
+ return obj;
1400
+ }
1401
+
1402
+ function lib$rsvp$node$$arrayResult(_) {
1403
+ var length = _.length;
1404
+ var args = new Array(length - 1);
1405
+
1406
+ for (var i = 1; i < length; i++) {
1407
+ args[i - 1] = _[i];
1408
+ }
1409
+
1410
+ return args;
1411
+ }
1412
+
1413
+ function lib$rsvp$node$$wrapThenable(then, promise) {
1414
+ return {
1415
+ then: function(onFulFillment, onRejection) {
1416
+ return then.call(promise, onFulFillment, onRejection);
1417
+ }
1418
+ };
1419
+ }
1420
+
1421
+ function lib$rsvp$node$$denodeify(nodeFunc, options) {
1422
+ var fn = function() {
1423
+ var self = this;
1424
+ var l = arguments.length;
1425
+ var args = new Array(l + 1);
1426
+ var arg;
1427
+ var promiseInput = false;
1428
+
1429
+ for (var i = 0; i < l; ++i) {
1430
+ arg = arguments[i];
1431
+
1432
+ if (!promiseInput) {
1433
+ // TODO: clean this up
1434
+ promiseInput = lib$rsvp$node$$needsPromiseInput(arg);
1435
+ if (promiseInput === lib$rsvp$node$$GET_THEN_ERROR) {
1436
+ var p = new lib$rsvp$promise$$default(lib$rsvp$$internal$$noop);
1437
+ lib$rsvp$$internal$$reject(p, lib$rsvp$node$$GET_THEN_ERROR.value);
1438
+ return p;
1439
+ } else if (promiseInput && promiseInput !== true) {
1440
+ arg = lib$rsvp$node$$wrapThenable(promiseInput, arg);
1441
+ }
1442
+ }
1443
+ args[i] = arg;
1444
+ }
1445
+
1446
+ var promise = new lib$rsvp$promise$$default(lib$rsvp$$internal$$noop);
1447
+
1448
+ args[l] = function(err, val) {
1449
+ if (err)
1450
+ lib$rsvp$$internal$$reject(promise, err);
1451
+ else if (options === undefined)
1452
+ lib$rsvp$$internal$$resolve(promise, val);
1453
+ else if (options === true)
1454
+ lib$rsvp$$internal$$resolve(promise, lib$rsvp$node$$arrayResult(arguments));
1455
+ else if (lib$rsvp$utils$$isArray(options))
1456
+ lib$rsvp$$internal$$resolve(promise, lib$rsvp$node$$makeObject(arguments, options));
1457
+ else
1458
+ lib$rsvp$$internal$$resolve(promise, val);
1459
+ };
1460
+
1461
+ if (promiseInput) {
1462
+ return lib$rsvp$node$$handlePromiseInput(promise, args, nodeFunc, self);
1463
+ } else {
1464
+ return lib$rsvp$node$$handleValueInput(promise, args, nodeFunc, self);
1465
+ }
1466
+ };
1467
+
1468
+ fn.__proto__ = nodeFunc;
1469
+
1470
+ return fn;
1471
+ }
1472
+
1473
+ var lib$rsvp$node$$default = lib$rsvp$node$$denodeify;
1474
+
1475
+ function lib$rsvp$node$$handleValueInput(promise, args, nodeFunc, self) {
1476
+ var result = lib$rsvp$node$$tryApply(nodeFunc, self, args);
1477
+ if (result === lib$rsvp$node$$ERROR) {
1478
+ lib$rsvp$$internal$$reject(promise, result.value);
1479
+ }
1480
+ return promise;
1481
+ }
1482
+
1483
+ function lib$rsvp$node$$handlePromiseInput(promise, args, nodeFunc, self){
1484
+ return lib$rsvp$promise$$default.all(args).then(function(args){
1485
+ var result = lib$rsvp$node$$tryApply(nodeFunc, self, args);
1486
+ if (result === lib$rsvp$node$$ERROR) {
1487
+ lib$rsvp$$internal$$reject(promise, result.value);
1488
+ }
1489
+ return promise;
1490
+ });
1491
+ }
1492
+
1493
+ function lib$rsvp$node$$needsPromiseInput(arg) {
1494
+ if (arg && typeof arg === 'object') {
1495
+ if (arg.constructor === lib$rsvp$promise$$default) {
1496
+ return true;
1497
+ } else {
1498
+ return lib$rsvp$node$$getThen(arg);
1499
+ }
1500
+ } else {
1501
+ return false;
1502
+ }
1503
+ }
1504
+ var lib$rsvp$platform$$platform;
1505
+
1506
+ /* global self */
1507
+ if (typeof self === 'object') {
1508
+ lib$rsvp$platform$$platform = self;
1509
+
1510
+ /* global global */
1511
+ } else if (typeof global === 'object') {
1512
+ lib$rsvp$platform$$platform = global;
1513
+ } else {
1514
+ throw new Error('no global: `self` or `global` found');
1515
+ }
1516
+
1517
+ var lib$rsvp$platform$$default = lib$rsvp$platform$$platform;
1518
+ function lib$rsvp$race$$race(array, label) {
1519
+ return lib$rsvp$promise$$default.race(array, label);
1520
+ }
1521
+ var lib$rsvp$race$$default = lib$rsvp$race$$race;
1522
+ function lib$rsvp$reject$$reject(reason, label) {
1523
+ return lib$rsvp$promise$$default.reject(reason, label);
1524
+ }
1525
+ var lib$rsvp$reject$$default = lib$rsvp$reject$$reject;
1526
+ function lib$rsvp$resolve$$resolve(value, label) {
1527
+ return lib$rsvp$promise$$default.resolve(value, label);
1528
+ }
1529
+ var lib$rsvp$resolve$$default = lib$rsvp$resolve$$resolve;
1530
+ function lib$rsvp$rethrow$$rethrow(reason) {
1531
+ setTimeout(function() {
1532
+ throw reason;
1533
+ });
1534
+ throw reason;
1535
+ }
1536
+ var lib$rsvp$rethrow$$default = lib$rsvp$rethrow$$rethrow;
1537
+
1538
+ // defaults
1539
+ lib$rsvp$config$$config.async = lib$rsvp$asap$$default;
1540
+ lib$rsvp$config$$config.after = function(cb) {
1541
+ setTimeout(cb, 0);
1542
+ };
1543
+ var lib$rsvp$$cast = lib$rsvp$resolve$$default;
1544
+ function lib$rsvp$$async(callback, arg) {
1545
+ lib$rsvp$config$$config.async(callback, arg);
1546
+ }
1547
+
1548
+ function lib$rsvp$$on() {
1549
+ lib$rsvp$config$$config['on'].apply(lib$rsvp$config$$config, arguments);
1550
+ }
1551
+
1552
+ function lib$rsvp$$off() {
1553
+ lib$rsvp$config$$config['off'].apply(lib$rsvp$config$$config, arguments);
1554
+ }
1555
+
1556
+ // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
1557
+ if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
1558
+ var lib$rsvp$$callbacks = window['__PROMISE_INSTRUMENTATION__'];
1559
+ lib$rsvp$config$$configure('instrument', true);
1560
+ for (var lib$rsvp$$eventName in lib$rsvp$$callbacks) {
1561
+ if (lib$rsvp$$callbacks.hasOwnProperty(lib$rsvp$$eventName)) {
1562
+ lib$rsvp$$on(lib$rsvp$$eventName, lib$rsvp$$callbacks[lib$rsvp$$eventName]);
1563
+ }
1564
+ }
1565
+ }
1566
+
1567
+ var lib$rsvp$umd$$RSVP = {
1568
+ 'race': lib$rsvp$race$$default,
1569
+ 'Promise': lib$rsvp$promise$$default,
1570
+ 'allSettled': lib$rsvp$all$settled$$default,
1571
+ 'hash': lib$rsvp$hash$$default,
1572
+ 'hashSettled': lib$rsvp$hash$settled$$default,
1573
+ 'denodeify': lib$rsvp$node$$default,
1574
+ 'on': lib$rsvp$$on,
1575
+ 'off': lib$rsvp$$off,
1576
+ 'map': lib$rsvp$map$$default,
1577
+ 'filter': lib$rsvp$filter$$default,
1578
+ 'resolve': lib$rsvp$resolve$$default,
1579
+ 'reject': lib$rsvp$reject$$default,
1580
+ 'all': lib$rsvp$all$$default,
1581
+ 'rethrow': lib$rsvp$rethrow$$default,
1582
+ 'defer': lib$rsvp$defer$$default,
1583
+ 'EventTarget': lib$rsvp$events$$default,
1584
+ 'configure': lib$rsvp$config$$configure,
1585
+ 'async': lib$rsvp$$async
1586
+ };
1587
+
1588
+ /* global define:true module:true window: true */
1589
+ if (typeof define === 'function' && define['amd']) {
1590
+ define(function() { return lib$rsvp$umd$$RSVP; });
1591
+ } else if (typeof module !== 'undefined' && module['exports']) {
1592
+ module['exports'] = lib$rsvp$umd$$RSVP;
1593
+ } else if (typeof lib$rsvp$platform$$default !== 'undefined') {
1594
+ lib$rsvp$platform$$default['RSVP'] = lib$rsvp$umd$$RSVP;
1595
+ }
1596
+ }).call(this);
1597
+