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
@@ -0,0 +1,120 @@
1
+ import Promise from './promise';
2
+ import {
3
+ isFunction
4
+ } from './utils';
5
+
6
+ /**
7
+ `RSVP.filter` is similar to JavaScript's native `filter` method, except that it
8
+ waits for all promises to become fulfilled before running the `filterFn` on
9
+ each item in given to `promises`. `RSVP.filter` returns a promise that will
10
+ become fulfilled with the result of running `filterFn` on the values the
11
+ promises become fulfilled with.
12
+
13
+ For example:
14
+
15
+ ```javascript
16
+
17
+ var promise1 = RSVP.resolve(1);
18
+ var promise2 = RSVP.resolve(2);
19
+ var promise3 = RSVP.resolve(3);
20
+
21
+ var promises = [promise1, promise2, promise3];
22
+
23
+ var filterFn = function(item){
24
+ return item > 1;
25
+ };
26
+
27
+ RSVP.filter(promises, filterFn).then(function(result){
28
+ // result is [ 2, 3 ]
29
+ });
30
+ ```
31
+
32
+ If any of the `promises` given to `RSVP.filter` are rejected, the first promise
33
+ that is rejected will be given as an argument to the returned promise's
34
+ rejection handler. For example:
35
+
36
+ ```javascript
37
+ var promise1 = RSVP.resolve(1);
38
+ var promise2 = RSVP.reject(new Error('2'));
39
+ var promise3 = RSVP.reject(new Error('3'));
40
+ var promises = [ promise1, promise2, promise3 ];
41
+
42
+ var filterFn = function(item){
43
+ return item > 1;
44
+ };
45
+
46
+ RSVP.filter(promises, filterFn).then(function(array){
47
+ // Code here never runs because there are rejected promises!
48
+ }, function(reason) {
49
+ // reason.message === '2'
50
+ });
51
+ ```
52
+
53
+ `RSVP.filter` will also wait for any promises returned from `filterFn`.
54
+ For instance, you may want to fetch a list of users then return a subset
55
+ of those users based on some asynchronous operation:
56
+
57
+ ```javascript
58
+
59
+ var alice = { name: 'alice' };
60
+ var bob = { name: 'bob' };
61
+ var users = [ alice, bob ];
62
+
63
+ var promises = users.map(function(user){
64
+ return RSVP.resolve(user);
65
+ });
66
+
67
+ var filterFn = function(user){
68
+ // Here, Alice has permissions to create a blog post, but Bob does not.
69
+ return getPrivilegesForUser(user).then(function(privs){
70
+ return privs.can_create_blog_post === true;
71
+ });
72
+ };
73
+ RSVP.filter(promises, filterFn).then(function(users){
74
+ // true, because the server told us only Alice can create a blog post.
75
+ users.length === 1;
76
+ // false, because Alice is the only user present in `users`
77
+ users[0] === bob;
78
+ });
79
+ ```
80
+
81
+ @method filter
82
+ @static
83
+ @for RSVP
84
+ @param {Array} promises
85
+ @param {Function} filterFn - function to be called on each resolved value to
86
+ filter the final results.
87
+ @param {String} label optional string describing the promise. Useful for
88
+ tooling.
89
+ @return {Promise}
90
+ */
91
+ export default function filter(promises, filterFn, label) {
92
+ return Promise.all(promises, label).then(function(values) {
93
+ if (!isFunction(filterFn)) {
94
+ throw new TypeError("You must pass a function as filter's second argument.");
95
+ }
96
+
97
+ var length = values.length;
98
+ var filtered = new Array(length);
99
+
100
+ for (var i = 0; i < length; i++) {
101
+ filtered[i] = filterFn(values[i]);
102
+ }
103
+
104
+ return Promise.all(filtered, label).then(function(filtered) {
105
+ var results = new Array(length);
106
+ var newLength = 0;
107
+
108
+ for (var i = 0; i < length; i++) {
109
+ if (filtered[i]) {
110
+ results[newLength] = values[i];
111
+ newLength++;
112
+ }
113
+ }
114
+
115
+ results.length = newLength;
116
+
117
+ return results;
118
+ });
119
+ });
120
+ }
@@ -0,0 +1,124 @@
1
+ import Promise from './promise';
2
+ import { makeSettledResult } from './enumerator';
3
+ import PromiseHash from './promise-hash';
4
+ import Enumerator from './enumerator';
5
+ import {
6
+ o_create
7
+ } from './utils';
8
+
9
+ function HashSettled(Constructor, object, label) {
10
+ this._superConstructor(Constructor, object, false, label);
11
+ }
12
+
13
+ HashSettled.prototype = o_create(PromiseHash.prototype);
14
+ HashSettled.prototype._superConstructor = Enumerator;
15
+ HashSettled.prototype._makeResult = makeSettledResult;
16
+
17
+ HashSettled.prototype._validationError = function() {
18
+ return new Error('hashSettled must be called with an object');
19
+ };
20
+
21
+ /**
22
+ `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
23
+ instead of an array for its `promises` argument.
24
+
25
+ Unlike `RSVP.all` or `RSVP.hash`, which implement a fail-fast method,
26
+ but like `RSVP.allSettled`, `hashSettled` waits until all the
27
+ constituent promises have returned and then shows you all the results
28
+ with their states and values/reasons. This is useful if you want to
29
+ handle multiple promises' failure states together as a set.
30
+
31
+ Returns a promise that is fulfilled when all the given promises have been
32
+ settled, or rejected if the passed parameters are invalid.
33
+
34
+ The returned promise is fulfilled with a hash that has the same key names as
35
+ the `promises` object argument. If any of the values in the object are not
36
+ promises, they will be copied over to the fulfilled object and marked with state
37
+ 'fulfilled'.
38
+
39
+ Example:
40
+
41
+ ```javascript
42
+ var promises = {
43
+ myPromise: RSVP.Promise.resolve(1),
44
+ yourPromise: RSVP.Promise.resolve(2),
45
+ theirPromise: RSVP.Promise.resolve(3),
46
+ notAPromise: 4
47
+ };
48
+
49
+ RSVP.hashSettled(promises).then(function(hash){
50
+ // hash here is an object that looks like:
51
+ // {
52
+ // myPromise: { state: 'fulfilled', value: 1 },
53
+ // yourPromise: { state: 'fulfilled', value: 2 },
54
+ // theirPromise: { state: 'fulfilled', value: 3 },
55
+ // notAPromise: { state: 'fulfilled', value: 4 }
56
+ // }
57
+ });
58
+ ```
59
+
60
+ If any of the `promises` given to `RSVP.hash` are rejected, the state will
61
+ be set to 'rejected' and the reason for rejection provided.
62
+
63
+ Example:
64
+
65
+ ```javascript
66
+ var promises = {
67
+ myPromise: RSVP.Promise.resolve(1),
68
+ rejectedPromise: RSVP.Promise.reject(new Error('rejection')),
69
+ anotherRejectedPromise: RSVP.Promise.reject(new Error('more rejection')),
70
+ };
71
+
72
+ RSVP.hashSettled(promises).then(function(hash){
73
+ // hash here is an object that looks like:
74
+ // {
75
+ // myPromise: { state: 'fulfilled', value: 1 },
76
+ // rejectedPromise: { state: 'rejected', reason: Error },
77
+ // anotherRejectedPromise: { state: 'rejected', reason: Error },
78
+ // }
79
+ // Note that for rejectedPromise, reason.message == 'rejection',
80
+ // and for anotherRejectedPromise, reason.message == 'more rejection'.
81
+ });
82
+ ```
83
+
84
+ An important note: `RSVP.hashSettled` is intended for plain JavaScript objects that
85
+ are just a set of keys and values. `RSVP.hashSettled` will NOT preserve prototype
86
+ chains.
87
+
88
+ Example:
89
+
90
+ ```javascript
91
+ function MyConstructor(){
92
+ this.example = RSVP.Promise.resolve('Example');
93
+ }
94
+
95
+ MyConstructor.prototype = {
96
+ protoProperty: RSVP.Promise.resolve('Proto Property')
97
+ };
98
+
99
+ var myObject = new MyConstructor();
100
+
101
+ RSVP.hashSettled(myObject).then(function(hash){
102
+ // protoProperty will not be present, instead you will just have an
103
+ // object that looks like:
104
+ // {
105
+ // example: { state: 'fulfilled', value: 'Example' }
106
+ // }
107
+ //
108
+ // hash.hasOwnProperty('protoProperty'); // false
109
+ // 'undefined' === typeof hash.protoProperty
110
+ });
111
+ ```
112
+
113
+ @method hashSettled
114
+ @for RSVP
115
+ @param {Object} promises
116
+ @param {String} label optional string that describes the promise.
117
+ Useful for tooling.
118
+ @return {Promise} promise that is fulfilled when when all properties of `promises`
119
+ have been settled.
120
+ @static
121
+ */
122
+ export default function hashSettled(object, label) {
123
+ return new HashSettled(Promise, object, label).promise;
124
+ }
@@ -0,0 +1,94 @@
1
+ import Promise from './promise';
2
+ import PromiseHash from './promise-hash';
3
+
4
+ /**
5
+ `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
6
+ for its `promises` argument.
7
+
8
+ Returns a promise that is fulfilled when all the given promises have been
9
+ fulfilled, or rejected if any of them become rejected. The returned promise
10
+ is fulfilled with a hash that has the same key names as the `promises` object
11
+ argument. If any of the values in the object are not promises, they will
12
+ simply be copied over to the fulfilled object.
13
+
14
+ Example:
15
+
16
+ ```javascript
17
+ var promises = {
18
+ myPromise: RSVP.resolve(1),
19
+ yourPromise: RSVP.resolve(2),
20
+ theirPromise: RSVP.resolve(3),
21
+ notAPromise: 4
22
+ };
23
+
24
+ RSVP.hash(promises).then(function(hash){
25
+ // hash here is an object that looks like:
26
+ // {
27
+ // myPromise: 1,
28
+ // yourPromise: 2,
29
+ // theirPromise: 3,
30
+ // notAPromise: 4
31
+ // }
32
+ });
33
+ ````
34
+
35
+ If any of the `promises` given to `RSVP.hash` are rejected, the first promise
36
+ that is rejected will be given as the reason to the rejection handler.
37
+
38
+ Example:
39
+
40
+ ```javascript
41
+ var promises = {
42
+ myPromise: RSVP.resolve(1),
43
+ rejectedPromise: RSVP.reject(new Error('rejectedPromise')),
44
+ anotherRejectedPromise: RSVP.reject(new Error('anotherRejectedPromise')),
45
+ };
46
+
47
+ RSVP.hash(promises).then(function(hash){
48
+ // Code here never runs because there are rejected promises!
49
+ }, function(reason) {
50
+ // reason.message === 'rejectedPromise'
51
+ });
52
+ ```
53
+
54
+ An important note: `RSVP.hash` is intended for plain JavaScript objects that
55
+ are just a set of keys and values. `RSVP.hash` will NOT preserve prototype
56
+ chains.
57
+
58
+ Example:
59
+
60
+ ```javascript
61
+ function MyConstructor(){
62
+ this.example = RSVP.resolve('Example');
63
+ }
64
+
65
+ MyConstructor.prototype = {
66
+ protoProperty: RSVP.resolve('Proto Property')
67
+ };
68
+
69
+ var myObject = new MyConstructor();
70
+
71
+ RSVP.hash(myObject).then(function(hash){
72
+ // protoProperty will not be present, instead you will just have an
73
+ // object that looks like:
74
+ // {
75
+ // example: 'Example'
76
+ // }
77
+ //
78
+ // hash.hasOwnProperty('protoProperty'); // false
79
+ // 'undefined' === typeof hash.protoProperty
80
+ });
81
+ ```
82
+
83
+ @method hash
84
+ @static
85
+ @for RSVP
86
+ @param {Object} promises
87
+ @param {String} label optional string that describes the promise.
88
+ Useful for tooling.
89
+ @return {Promise} promise that is fulfilled when all properties of `promises`
90
+ have been fulfilled, or rejected if any of them become rejected.
91
+ */
92
+ export default function hash(object, label) {
93
+ return new PromiseHash(Promise, object, label).promise;
94
+ }
@@ -0,0 +1,41 @@
1
+ import { config } from './config';
2
+ import { now } from './utils';
3
+
4
+ var queue = [];
5
+
6
+ function scheduleFlush() {
7
+ setTimeout(function() {
8
+ var entry;
9
+ for (var i = 0; i < queue.length; i++) {
10
+ entry = queue[i];
11
+
12
+ var payload = entry.payload;
13
+
14
+ payload.guid = payload.key + payload.id;
15
+ payload.childGuid = payload.key + payload.childId;
16
+ if (payload.error) {
17
+ payload.stack = payload.error.stack;
18
+ }
19
+
20
+ config['trigger'](entry.name, entry.payload);
21
+ }
22
+ queue.length = 0;
23
+ }, 50);
24
+ }
25
+
26
+ export default function instrument(eventName, promise, child) {
27
+ if (1 === queue.push({
28
+ name: eventName,
29
+ payload: {
30
+ key: promise._guidKey,
31
+ id: promise._id,
32
+ eventName: eventName,
33
+ detail: promise._result,
34
+ childId: child && child._id,
35
+ label: promise._label,
36
+ timeStamp: now(),
37
+ error: config["instrument-with-stack"] ? new Error(promise._label) : null
38
+ }})) {
39
+ scheduleFlush();
40
+ }
41
+ }
@@ -0,0 +1,99 @@
1
+ import Promise from './promise';
2
+ import {
3
+ isFunction
4
+ } from './utils';
5
+
6
+ /**
7
+ `RSVP.map` is similar to JavaScript's native `map` method, except that it
8
+ waits for all promises to become fulfilled before running the `mapFn` on
9
+ each item in given to `promises`. `RSVP.map` returns a promise that will
10
+ become fulfilled with the result of running `mapFn` on the values the promises
11
+ become fulfilled with.
12
+
13
+ For example:
14
+
15
+ ```javascript
16
+
17
+ var promise1 = RSVP.resolve(1);
18
+ var promise2 = RSVP.resolve(2);
19
+ var promise3 = RSVP.resolve(3);
20
+ var promises = [ promise1, promise2, promise3 ];
21
+
22
+ var mapFn = function(item){
23
+ return item + 1;
24
+ };
25
+
26
+ RSVP.map(promises, mapFn).then(function(result){
27
+ // result is [ 2, 3, 4 ]
28
+ });
29
+ ```
30
+
31
+ If any of the `promises` given to `RSVP.map` are rejected, the first promise
32
+ that is rejected will be given as an argument to the returned promise's
33
+ rejection handler. For example:
34
+
35
+ ```javascript
36
+ var promise1 = RSVP.resolve(1);
37
+ var promise2 = RSVP.reject(new Error('2'));
38
+ var promise3 = RSVP.reject(new Error('3'));
39
+ var promises = [ promise1, promise2, promise3 ];
40
+
41
+ var mapFn = function(item){
42
+ return item + 1;
43
+ };
44
+
45
+ RSVP.map(promises, mapFn).then(function(array){
46
+ // Code here never runs because there are rejected promises!
47
+ }, function(reason) {
48
+ // reason.message === '2'
49
+ });
50
+ ```
51
+
52
+ `RSVP.map` will also wait if a promise is returned from `mapFn`. For example,
53
+ say you want to get all comments from a set of blog posts, but you need
54
+ the blog posts first because they contain a url to those comments.
55
+
56
+ ```javscript
57
+
58
+ var mapFn = function(blogPost){
59
+ // getComments does some ajax and returns an RSVP.Promise that is fulfilled
60
+ // with some comments data
61
+ return getComments(blogPost.comments_url);
62
+ };
63
+
64
+ // getBlogPosts does some ajax and returns an RSVP.Promise that is fulfilled
65
+ // with some blog post data
66
+ RSVP.map(getBlogPosts(), mapFn).then(function(comments){
67
+ // comments is the result of asking the server for the comments
68
+ // of all blog posts returned from getBlogPosts()
69
+ });
70
+ ```
71
+
72
+ @method map
73
+ @static
74
+ @for RSVP
75
+ @param {Array} promises
76
+ @param {Function} mapFn function to be called on each fulfilled promise.
77
+ @param {String} label optional string for labeling the promise.
78
+ Useful for tooling.
79
+ @return {Promise} promise that is fulfilled with the result of calling
80
+ `mapFn` on each fulfilled promise or value when they become fulfilled.
81
+ The promise will be rejected if any of the given `promises` become rejected.
82
+ @static
83
+ */
84
+ export default function map(promises, mapFn, label) {
85
+ return Promise.all(promises, label).then(function(values) {
86
+ if (!isFunction(mapFn)) {
87
+ throw new TypeError("You must pass a function as map's second argument.");
88
+ }
89
+
90
+ var length = values.length;
91
+ var results = new Array(length);
92
+
93
+ for (var i = 0; i < length; i++) {
94
+ results[i] = mapFn(values[i]);
95
+ }
96
+
97
+ return Promise.all(results, label);
98
+ });
99
+ }