sprockets-browserify 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (790) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +70 -0
  4. data/Rakefile +38 -0
  5. data/lib/sprockets/browserify/engine.rb +15 -0
  6. data/lib/sprockets/browserify.rb +37 -0
  7. data/lib/sprockets-browserify.rb +2 -0
  8. data/lib/tasks/sprockets-browserify_tasks.rake +4 -0
  9. data/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
  10. data/node_modules/JSONStream/LICENSE.MIT +24 -0
  11. data/node_modules/JSONStream/examples/all_docs.js +13 -0
  12. data/node_modules/JSONStream/index.js +189 -0
  13. data/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
  14. data/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
  15. data/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
  16. data/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
  17. data/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
  18. data/node_modules/JSONStream/node_modules/jsonparse/package.json +34 -0
  19. data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
  20. data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
  21. data/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
  22. data/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
  23. data/node_modules/JSONStream/package.json +38 -0
  24. data/node_modules/JSONStream/readme.markdown +145 -0
  25. data/node_modules/JSONStream/test/bool.js +41 -0
  26. data/node_modules/JSONStream/test/destroy_missing.js +22 -0
  27. data/node_modules/JSONStream/test/empty.js +44 -0
  28. data/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
  29. data/node_modules/JSONStream/test/fn.js +39 -0
  30. data/node_modules/JSONStream/test/memory.js +69 -0
  31. data/node_modules/JSONStream/test/multiple_objects.js +42 -0
  32. data/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
  33. data/node_modules/JSONStream/test/parsejson.js +28 -0
  34. data/node_modules/JSONStream/test/stringify.js +41 -0
  35. data/node_modules/JSONStream/test/stringify_object.js +47 -0
  36. data/node_modules/JSONStream/test/test.js +35 -0
  37. data/node_modules/JSONStream/test/test2.js +29 -0
  38. data/node_modules/JSONStream/test/two-ways.js +41 -0
  39. data/node_modules/browserify/LICENSE +63 -0
  40. data/node_modules/browserify/README.markdown +172 -0
  41. data/node_modules/browserify/bin/cmd.js +161 -0
  42. data/node_modules/browserify/builtins/__browserify_process.js +55 -0
  43. data/node_modules/browserify/builtins/assert.js +314 -0
  44. data/node_modules/browserify/builtins/child_process.js +2 -0
  45. data/node_modules/browserify/builtins/events.js +178 -0
  46. data/node_modules/browserify/builtins/fs.js +1 -0
  47. data/node_modules/browserify/builtins/https.js +1 -0
  48. data/node_modules/browserify/builtins/net.js +1 -0
  49. data/node_modules/browserify/builtins/path.js +175 -0
  50. data/node_modules/browserify/builtins/querystring.js +250 -0
  51. data/node_modules/browserify/builtins/stream.js +119 -0
  52. data/node_modules/browserify/builtins/string_decoder.js +161 -0
  53. data/node_modules/browserify/builtins/sys.js +1 -0
  54. data/node_modules/browserify/builtins/timers.js +39 -0
  55. data/node_modules/browserify/builtins/tls.js +1 -0
  56. data/node_modules/browserify/builtins/tty.js +2 -0
  57. data/node_modules/browserify/builtins/url.js +604 -0
  58. data/node_modules/browserify/builtins/util.js +351 -0
  59. data/node_modules/browserify/doc/methods.markdown +182 -0
  60. data/node_modules/browserify/doc/recipes.markdown +62 -0
  61. data/node_modules/browserify/example/debug/browserify.js +219 -0
  62. data/node_modules/browserify/example/debug/build.sh +3 -0
  63. data/node_modules/browserify/example/debug/index.html +7 -0
  64. data/node_modules/browserify/example/debug/js/entry.js +2 -0
  65. data/node_modules/browserify/example/debug/js/thrower.js +3 -0
  66. data/node_modules/browserify/example/debug/server.js +9 -0
  67. data/node_modules/browserify/example/simple-build/browserify.js +368 -0
  68. data/node_modules/browserify/example/simple-build/build.sh +3 -0
  69. data/node_modules/browserify/example/simple-build/index.html +9 -0
  70. data/node_modules/browserify/example/simple-build/js/bar.js +3 -0
  71. data/node_modules/browserify/example/simple-build/js/entry.js +5 -0
  72. data/node_modules/browserify/example/simple-build/js/foo.js +5 -0
  73. data/node_modules/browserify/example/simple-build/server.js +9 -0
  74. data/node_modules/browserify/example/test/b.js +5 -0
  75. data/node_modules/browserify/example/test/bar.js +3 -0
  76. data/node_modules/browserify/example/test/foo.js +3 -0
  77. data/node_modules/browserify/example/test/m.js +3 -0
  78. data/node_modules/browserify/example/test/n.js +3 -0
  79. data/node_modules/browserify/example/using-http/bundle.js +813 -0
  80. data/node_modules/browserify/example/using-http/entry.js +25 -0
  81. data/node_modules/browserify/example/using-http/index.html +9 -0
  82. data/node_modules/browserify/example/using-http/server.js +28 -0
  83. data/node_modules/browserify/index.js +202 -0
  84. data/node_modules/browserify/lib/watch.js +75 -0
  85. data/node_modules/browserify/lib/wrap.js +583 -0
  86. data/node_modules/browserify/lib/wrappers.js +10 -0
  87. data/node_modules/browserify/node_modules/buffer-browserify/README.md +11 -0
  88. data/node_modules/browserify/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
  89. data/node_modules/browserify/node_modules/buffer-browserify/index.js +1317 -0
  90. data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
  91. data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
  92. data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
  93. data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
  94. data/node_modules/browserify/node_modules/buffer-browserify/package.json +42 -0
  95. data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -0
  96. data/node_modules/browserify/node_modules/coffee-script/CNAME +1 -0
  97. data/node_modules/browserify/node_modules/coffee-script/CONTRIBUTING.md +9 -0
  98. data/node_modules/browserify/node_modules/coffee-script/LICENSE +22 -0
  99. data/node_modules/browserify/node_modules/coffee-script/README +51 -0
  100. data/node_modules/browserify/node_modules/coffee-script/Rakefile +79 -0
  101. data/node_modules/browserify/node_modules/coffee-script/bin/cake +7 -0
  102. data/node_modules/browserify/node_modules/coffee-script/bin/coffee +7 -0
  103. data/node_modules/browserify/node_modules/coffee-script/extras/jsl.conf +44 -0
  104. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/browser.js +101 -0
  105. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
  106. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js +218 -0
  107. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/command.js +506 -0
  108. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/grammar.js +623 -0
  109. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/helpers.js +150 -0
  110. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
  111. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/lexer.js +905 -0
  112. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/nodes.js +3088 -0
  113. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
  114. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/parser.js +608 -0
  115. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/repl.js +104 -0
  116. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/rewriter.js +478 -0
  117. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/scope.js +147 -0
  118. data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/sourcemap.js +237 -0
  119. data/node_modules/browserify/node_modules/coffee-script/package.json +48 -0
  120. data/node_modules/browserify/node_modules/commondir/README.markdown +45 -0
  121. data/node_modules/browserify/node_modules/commondir/example/base.js +3 -0
  122. data/node_modules/browserify/node_modules/commondir/example/dir.js +3 -0
  123. data/node_modules/browserify/node_modules/commondir/index.js +29 -0
  124. data/node_modules/browserify/node_modules/commondir/package.json +43 -0
  125. data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
  126. data/node_modules/browserify/node_modules/console-browserify/LICENCE +19 -0
  127. data/node_modules/browserify/node_modules/console-browserify/README.md +32 -0
  128. data/node_modules/browserify/node_modules/console-browserify/index.js +85 -0
  129. data/node_modules/browserify/node_modules/console-browserify/package.json +76 -0
  130. data/node_modules/browserify/node_modules/console-browserify/test/index.js +67 -0
  131. data/node_modules/browserify/node_modules/console-browserify/test/static/index.html +12 -0
  132. data/node_modules/browserify/node_modules/console-browserify/test/static/test-adapter.js +53 -0
  133. data/node_modules/browserify/node_modules/crypto-browserify/example/bundle.js +637 -0
  134. data/node_modules/browserify/node_modules/crypto-browserify/example/index.html +12 -0
  135. data/node_modules/browserify/node_modules/crypto-browserify/example/test.js +4 -0
  136. data/node_modules/browserify/node_modules/crypto-browserify/index.js +74 -0
  137. data/node_modules/browserify/node_modules/crypto-browserify/md5.js +384 -0
  138. data/node_modules/browserify/node_modules/crypto-browserify/package.json +30 -0
  139. data/node_modules/browserify/node_modules/crypto-browserify/readme.markdown +20 -0
  140. data/node_modules/browserify/node_modules/crypto-browserify/rng.js +37 -0
  141. data/node_modules/browserify/node_modules/crypto-browserify/sha.js +210 -0
  142. data/node_modules/browserify/node_modules/crypto-browserify/test/simple.js +35 -0
  143. data/node_modules/browserify/node_modules/deputy/README.markdown +55 -0
  144. data/node_modules/browserify/node_modules/deputy/example/cache.js +5 -0
  145. data/node_modules/browserify/node_modules/deputy/index.js +46 -0
  146. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/LICENSE +21 -0
  147. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/examples/pow.js +6 -0
  148. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/index.js +82 -0
  149. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/package.json +30 -0
  150. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/readme.markdown +63 -0
  151. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/chmod.js +38 -0
  152. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/clobber.js +37 -0
  153. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/mkdirp.js +28 -0
  154. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm.js +32 -0
  155. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm_sync.js +39 -0
  156. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/race.js +41 -0
  157. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/rel.js +32 -0
  158. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return.js +25 -0
  159. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return_sync.js +24 -0
  160. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/root.js +18 -0
  161. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/sync.js +32 -0
  162. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask.js +28 -0
  163. data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask_sync.js +32 -0
  164. data/node_modules/browserify/node_modules/deputy/package.json +43 -0
  165. data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
  166. data/node_modules/browserify/node_modules/detective/README.markdown +66 -0
  167. data/node_modules/browserify/node_modules/detective/example/strings.js +6 -0
  168. data/node_modules/browserify/node_modules/detective/example/strings_src.js +3 -0
  169. data/node_modules/browserify/node_modules/detective/index.js +60 -0
  170. data/node_modules/browserify/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
  171. data/node_modules/browserify/node_modules/detective/node_modules/esprima/README.md +74 -0
  172. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
  173. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
  174. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/javascript.js +360 -0
  175. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/json2.js +487 -0
  176. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/style.css +164 -0
  177. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-min.js +12 -0
  178. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
  179. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview.css +7 -0
  180. data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
  181. data/node_modules/browserify/node_modules/detective/node_modules/esprima/bin/esparse.js +42 -0
  182. data/node_modules/browserify/node_modules/detective/node_modules/esprima/changes +92 -0
  183. data/node_modules/browserify/node_modules/detective/node_modules/esprima/cm +696 -0
  184. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/checkenv.js +42 -0
  185. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.html +82 -0
  186. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.js +170 -0
  187. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.html +106 -0
  188. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.js +123 -0
  189. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.css +82 -0
  190. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.html +352 -0
  191. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/precedence.html +225 -0
  192. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.html +120 -0
  193. data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.js +71 -0
  194. data/node_modules/browserify/node_modules/detective/node_modules/esprima/esprima.js +3577 -0
  195. data/node_modules/browserify/node_modules/detective/node_modules/esprima/index.html +103 -0
  196. data/node_modules/browserify/node_modules/detective/node_modules/esprima/package.json +39 -0
  197. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
  198. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
  199. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
  200. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
  201. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
  202. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
  203. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
  204. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
  205. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
  206. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
  207. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
  208. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
  209. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
  210. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jslex.js +588 -0
  211. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
  212. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
  213. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
  214. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
  215. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/platform.js +878 -0
  216. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
  217. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
  218. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
  219. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
  220. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.js +328 -0
  221. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.html +140 -0
  222. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.js +270 -0
  223. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
  224. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
  225. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
  226. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
  227. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.html +3617 -0
  228. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/index.html +36 -0
  229. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/reflect.js +403 -0
  230. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/run.js +66 -0
  231. data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/test.js +16659 -0
  232. data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
  233. data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/update-coverage.sh +28 -0
  234. data/node_modules/browserify/node_modules/detective/package.json +43 -0
  235. data/node_modules/browserify/node_modules/detective/test/both.js +11 -0
  236. data/node_modules/browserify/node_modules/detective/test/chained.js +9 -0
  237. data/node_modules/browserify/node_modules/detective/test/files/both.js +4 -0
  238. data/node_modules/browserify/node_modules/detective/test/files/chained.js +5 -0
  239. data/node_modules/browserify/node_modules/detective/test/files/nested.js +22 -0
  240. data/node_modules/browserify/node_modules/detective/test/files/skip.js +7 -0
  241. data/node_modules/browserify/node_modules/detective/test/files/strings.js +13 -0
  242. data/node_modules/browserify/node_modules/detective/test/files/word.js +13 -0
  243. data/node_modules/browserify/node_modules/detective/test/nested.js +9 -0
  244. data/node_modules/browserify/node_modules/detective/test/skip.js +9 -0
  245. data/node_modules/browserify/node_modules/detective/test/strings.js +9 -0
  246. data/node_modules/browserify/node_modules/detective/test/word.js +12 -0
  247. data/node_modules/browserify/node_modules/http-browserify/example/get/index.html +9 -0
  248. data/node_modules/browserify/node_modules/http-browserify/example/get/main.js +14 -0
  249. data/node_modules/browserify/node_modules/http-browserify/example/get/server.js +12 -0
  250. data/node_modules/browserify/node_modules/http-browserify/example/headers/index.html +9 -0
  251. data/node_modules/browserify/node_modules/http-browserify/example/headers/main.js +18 -0
  252. data/node_modules/browserify/node_modules/http-browserify/example/headers/server.js +15 -0
  253. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/data.json +139 -0
  254. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/index.html +9 -0
  255. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/main.js +13 -0
  256. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
  257. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.MIT +24 -0
  258. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples/all_docs.js +13 -0
  259. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/index.js +189 -0
  260. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
  261. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
  262. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
  263. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
  264. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
  265. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/package.json +36 -0
  266. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
  267. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
  268. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
  269. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
  270. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/package.json +40 -0
  271. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/readme.markdown +145 -0
  272. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/bool.js +41 -0
  273. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/destroy_missing.js +22 -0
  274. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/empty.js +44 -0
  275. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
  276. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fn.js +39 -0
  277. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/memory.js +69 -0
  278. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js +42 -0
  279. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
  280. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/parsejson.js +28 -0
  281. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify.js +41 -0
  282. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify_object.js +47 -0
  283. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test.js +35 -0
  284. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test2.js +29 -0
  285. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/two-ways.js +41 -0
  286. data/node_modules/browserify/node_modules/http-browserify/example/json-stream/server.js +10 -0
  287. data/node_modules/browserify/node_modules/http-browserify/example/post/index.html +9 -0
  288. data/node_modules/browserify/node_modules/http-browserify/example/post/main.js +16 -0
  289. data/node_modules/browserify/node_modules/http-browserify/example/post/server.js +19 -0
  290. data/node_modules/browserify/node_modules/http-browserify/example/streaming/index.html +9 -0
  291. data/node_modules/browserify/node_modules/http-browserify/example/streaming/main.js +16 -0
  292. data/node_modules/browserify/node_modules/http-browserify/example/streaming/server.js +21 -0
  293. data/node_modules/browserify/node_modules/http-browserify/index.js +60 -0
  294. data/node_modules/browserify/node_modules/http-browserify/lib/request.js +128 -0
  295. data/node_modules/browserify/node_modules/http-browserify/lib/response.js +119 -0
  296. data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
  297. data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
  298. data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
  299. data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
  300. data/node_modules/browserify/node_modules/http-browserify/package.json +42 -0
  301. data/node_modules/browserify/node_modules/http-browserify/readme.markdown +128 -0
  302. data/node_modules/browserify/node_modules/nub/README.markdown +23 -0
  303. data/node_modules/browserify/node_modules/nub/index.js +64 -0
  304. data/node_modules/browserify/node_modules/nub/package.json +42 -0
  305. data/node_modules/browserify/node_modules/nub/test/by.js +51 -0
  306. data/node_modules/browserify/node_modules/nub/test/nub.js +46 -0
  307. data/node_modules/browserify/node_modules/optimist/LICENSE +21 -0
  308. data/node_modules/browserify/node_modules/optimist/README.markdown +487 -0
  309. data/node_modules/browserify/node_modules/optimist/example/bool.js +10 -0
  310. data/node_modules/browserify/node_modules/optimist/example/boolean_double.js +7 -0
  311. data/node_modules/browserify/node_modules/optimist/example/boolean_single.js +7 -0
  312. data/node_modules/browserify/node_modules/optimist/example/default_hash.js +8 -0
  313. data/node_modules/browserify/node_modules/optimist/example/default_singles.js +7 -0
  314. data/node_modules/browserify/node_modules/optimist/example/divide.js +8 -0
  315. data/node_modules/browserify/node_modules/optimist/example/line_count.js +20 -0
  316. data/node_modules/browserify/node_modules/optimist/example/line_count_options.js +29 -0
  317. data/node_modules/browserify/node_modules/optimist/example/line_count_wrap.js +29 -0
  318. data/node_modules/browserify/node_modules/optimist/example/nonopt.js +4 -0
  319. data/node_modules/browserify/node_modules/optimist/example/reflect.js +2 -0
  320. data/node_modules/browserify/node_modules/optimist/example/short.js +3 -0
  321. data/node_modules/browserify/node_modules/optimist/example/string.js +11 -0
  322. data/node_modules/browserify/node_modules/optimist/example/usage-options.js +19 -0
  323. data/node_modules/browserify/node_modules/optimist/example/xup.js +10 -0
  324. data/node_modules/browserify/node_modules/optimist/index.js +475 -0
  325. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
  326. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
  327. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
  328. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
  329. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/package.json +41 -0
  330. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
  331. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
  332. data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
  333. data/node_modules/browserify/node_modules/optimist/package.json +47 -0
  334. data/node_modules/browserify/node_modules/optimist/test/_/argv.js +2 -0
  335. data/node_modules/browserify/node_modules/optimist/test/_/bin.js +3 -0
  336. data/node_modules/browserify/node_modules/optimist/test/_.js +71 -0
  337. data/node_modules/browserify/node_modules/optimist/test/parse.js +433 -0
  338. data/node_modules/browserify/node_modules/optimist/test/usage.js +292 -0
  339. data/node_modules/browserify/node_modules/optimist/x.js +1 -0
  340. data/node_modules/browserify/node_modules/resolve/LICENSE +18 -0
  341. data/node_modules/browserify/node_modules/resolve/README.markdown +47 -0
  342. data/node_modules/browserify/node_modules/resolve/index.js +109 -0
  343. data/node_modules/browserify/node_modules/resolve/package.json +41 -0
  344. data/node_modules/browserify/node_modules/resolve/test/core.js +12 -0
  345. data/node_modules/browserify/node_modules/resolve/test/filter.js +15 -0
  346. data/node_modules/browserify/node_modules/resolve/test/mock.js +68 -0
  347. data/node_modules/browserify/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
  348. data/node_modules/browserify/node_modules/resolve/test/resolver/baz/doom.js +0 -0
  349. data/node_modules/browserify/node_modules/resolve/test/resolver/baz/package.json +3 -0
  350. data/node_modules/browserify/node_modules/resolve/test/resolver/baz/quux.js +1 -0
  351. data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
  352. data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
  353. data/node_modules/browserify/node_modules/resolve/test/resolver/cup.coffee +1 -0
  354. data/node_modules/browserify/node_modules/resolve/test/resolver/foo.js +1 -0
  355. data/node_modules/browserify/node_modules/resolve/test/resolver/mug.coffee +0 -0
  356. data/node_modules/browserify/node_modules/resolve/test/resolver/mug.js +0 -0
  357. data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
  358. data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/root.js +0 -0
  359. data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -0
  360. data/node_modules/browserify/node_modules/syntax-error/LICENSE +18 -0
  361. data/node_modules/browserify/node_modules/syntax-error/example/check.js +12 -0
  362. data/node_modules/browserify/node_modules/syntax-error/example/src.js +9 -0
  363. data/node_modules/browserify/node_modules/syntax-error/index.js +54 -0
  364. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/LICENSE.BSD +19 -0
  365. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/README.md +74 -0
  366. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
  367. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
  368. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/javascript.js +360 -0
  369. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/json2.js +487 -0
  370. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/style.css +164 -0
  371. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-min.js +12 -0
  372. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
  373. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview.css +7 -0
  374. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
  375. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/bin/esparse.js +42 -0
  376. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/changes +92 -0
  377. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/cm +696 -0
  378. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/checkenv.js +42 -0
  379. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.html +82 -0
  380. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.js +170 -0
  381. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.html +106 -0
  382. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.js +123 -0
  383. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.css +82 -0
  384. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.html +352 -0
  385. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/precedence.html +225 -0
  386. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.html +120 -0
  387. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.js +71 -0
  388. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/esprima.js +3577 -0
  389. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/index.html +103 -0
  390. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/package.json +39 -0
  391. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
  392. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
  393. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
  394. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
  395. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
  396. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
  397. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
  398. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
  399. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
  400. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
  401. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
  402. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
  403. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
  404. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jslex.js +588 -0
  405. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
  406. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
  407. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
  408. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
  409. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/platform.js +878 -0
  410. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
  411. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
  412. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
  413. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.html +58 -0
  414. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.js +328 -0
  415. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.html +140 -0
  416. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.js +270 -0
  417. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.html +40 -0
  418. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.js +239 -0
  419. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.footer.html +3 -0
  420. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.header.html +37 -0
  421. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.html +3617 -0
  422. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/index.html +36 -0
  423. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/reflect.js +403 -0
  424. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/run.js +66 -0
  425. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/test.js +16659 -0
  426. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
  427. data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/update-coverage.sh +28 -0
  428. data/node_modules/browserify/node_modules/syntax-error/package.json +46 -0
  429. data/node_modules/browserify/node_modules/syntax-error/readme.markdown +87 -0
  430. data/node_modules/browserify/node_modules/syntax-error/test/check.js +17 -0
  431. data/node_modules/browserify/node_modules/syntax-error/test/sources/check.js +9 -0
  432. data/node_modules/browserify/node_modules/vm-browserify/README.markdown +103 -0
  433. data/node_modules/browserify/node_modules/vm-browserify/example/run/bundle.js +473 -0
  434. data/node_modules/browserify/node_modules/vm-browserify/example/run/entry.js +6 -0
  435. data/node_modules/browserify/node_modules/vm-browserify/example/run/index.html +9 -0
  436. data/node_modules/browserify/node_modules/vm-browserify/example/run/server.js +6 -0
  437. data/node_modules/browserify/node_modules/vm-browserify/index.js +85 -0
  438. data/node_modules/browserify/node_modules/vm-browserify/package.json +39 -0
  439. data/node_modules/browserify/node_modules/vm-browserify/testling/run.js +22 -0
  440. data/node_modules/browserify/node_modules/vm-browserify/testling/test.sh +11 -0
  441. data/node_modules/browserify/package.json +71 -0
  442. data/node_modules/browserify/test/alias.js +58 -0
  443. data/node_modules/browserify/test/backbone.js +21 -0
  444. data/node_modules/browserify/test/bin.js +39 -0
  445. data/node_modules/browserify/test/buffer.js +99 -0
  446. data/node_modules/browserify/test/bundle.js +32 -0
  447. data/node_modules/browserify/test/cache.js +28 -0
  448. data/node_modules/browserify/test/coffee/bar.js +1 -0
  449. data/node_modules/browserify/test/coffee/baz.coffee +1 -0
  450. data/node_modules/browserify/test/coffee/entry.coffee +1 -0
  451. data/node_modules/browserify/test/coffee/foo.coffee +1 -0
  452. data/node_modules/browserify/test/coffee/index.coffee +5 -0
  453. data/node_modules/browserify/test/coffee/nested/nested.coffee +2 -0
  454. data/node_modules/browserify/test/coffee.js +39 -0
  455. data/node_modules/browserify/test/comment/main.js +2 -0
  456. data/node_modules/browserify/test/comment.js +17 -0
  457. data/node_modules/browserify/test/crypto.js +37 -0
  458. data/node_modules/browserify/test/dnode.js +27 -0
  459. data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
  460. data/node_modules/browserify/test/dollar.js +19 -0
  461. data/node_modules/browserify/test/entry/main.js +1 -0
  462. data/node_modules/browserify/test/entry/one.js +1 -0
  463. data/node_modules/browserify/test/entry/two.js +1 -0
  464. data/node_modules/browserify/test/entry.js +36 -0
  465. data/node_modules/browserify/test/error_code/src.js +2 -0
  466. data/node_modules/browserify/test/error_code.js +24 -0
  467. data/node_modules/browserify/test/export/entry.js +1 -0
  468. data/node_modules/browserify/test/export.js +52 -0
  469. data/node_modules/browserify/test/field/miss.js +1 -0
  470. data/node_modules/browserify/test/field/node_modules/z-miss/browser.js +1 -0
  471. data/node_modules/browserify/test/field/node_modules/z-miss/main.js +1 -0
  472. data/node_modules/browserify/test/field/node_modules/z-miss/package.json +4 -0
  473. data/node_modules/browserify/test/field/node_modules/z-object/browser.js +1 -0
  474. data/node_modules/browserify/test/field/node_modules/z-object/main.js +1 -0
  475. data/node_modules/browserify/test/field/node_modules/z-object/package.json +6 -0
  476. data/node_modules/browserify/test/field/node_modules/z-string/browser.js +1 -0
  477. data/node_modules/browserify/test/field/node_modules/z-string/main.js +1 -0
  478. data/node_modules/browserify/test/field/node_modules/z-string/package.json +4 -0
  479. data/node_modules/browserify/test/field/node_modules/z-sub/browser/a.js +1 -0
  480. data/node_modules/browserify/test/field/node_modules/z-sub/browser/b.js +1 -0
  481. data/node_modules/browserify/test/field/node_modules/z-sub/main.js +1 -0
  482. data/node_modules/browserify/test/field/node_modules/z-sub/package.json +4 -0
  483. data/node_modules/browserify/test/field/object.js +1 -0
  484. data/node_modules/browserify/test/field/string.js +1 -0
  485. data/node_modules/browserify/test/field/sub.js +1 -0
  486. data/node_modules/browserify/test/field.js +64 -0
  487. data/node_modules/browserify/test/global/main.js +2 -0
  488. data/node_modules/browserify/test/global.js +19 -0
  489. data/node_modules/browserify/test/jade.js +35 -0
  490. data/node_modules/browserify/test/json/beep.json +4 -0
  491. data/node_modules/browserify/test/json/main.js +1 -0
  492. data/node_modules/browserify/test/json.js +17 -0
  493. data/node_modules/browserify/test/maxlisteners.js +8 -0
  494. data/node_modules/browserify/test/module.js +22 -0
  495. data/node_modules/browserify/test/multi_entry/a.js +2 -0
  496. data/node_modules/browserify/test/multi_entry/b.js +2 -0
  497. data/node_modules/browserify/test/multi_entry/c.js +3 -0
  498. data/node_modules/browserify/test/multi_entry.js +20 -0
  499. data/node_modules/browserify/test/multi_ignore.js +23 -0
  500. data/node_modules/browserify/test/node_modules/beep/index.js +1 -0
  501. data/node_modules/browserify/test/require_cache.js +18 -0
  502. data/node_modules/browserify/test/retarget.js +27 -0
  503. data/node_modules/browserify/test/seq.js +47 -0
  504. data/node_modules/browserify/test/subdep/index.js +1 -0
  505. data/node_modules/browserify/test/subdep/node_modules/qq/b.js +1 -0
  506. data/node_modules/browserify/test/subdep/node_modules/qq/ignore_me.js +1 -0
  507. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/index.js +1 -0
  508. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/package.json +5 -0
  509. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/index.js +1 -0
  510. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/package.json +5 -0
  511. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/f/index.js +1 -0
  512. data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/z/index.js +1 -0
  513. data/node_modules/browserify/test/subdep/node_modules/qq/package.json +3 -0
  514. data/node_modules/browserify/test/subdep/package.json +6 -0
  515. data/node_modules/browserify/test/subdep.js +26 -0
  516. data/node_modules/browserify/test/util.js +48 -0
  517. data/node_modules/browserify/test/watch/a.js +1 -0
  518. data/node_modules/browserify/test/watch.js +91 -0
  519. data/node_modules/browserify/test/wrap/a.js +2 -0
  520. data/node_modules/browserify/test/wrap/c.js +1 -0
  521. data/node_modules/browserify/test/wrap/node_modules/b/main.js +1 -0
  522. data/node_modules/browserify/test/wrap/node_modules/b/package.json +3 -0
  523. data/node_modules/browserify/test/wrap/node_modules/skipmetoo/index.js +1 -0
  524. data/node_modules/browserify/test/wrap/skipme.js +1 -0
  525. data/node_modules/browserify/test/wrap/x.js +0 -0
  526. data/node_modules/browserify/test/wrap.js +43 -0
  527. data/node_modules/browserify/testling/README.markdown +29 -0
  528. data/node_modules/browserify/testling/test.sh +37 -0
  529. data/node_modules/browserify/testling/tick.js +9 -0
  530. data/node_modules/browserify/testling/timers.js +50 -0
  531. data/node_modules/browserify/testling/util.js +24 -0
  532. data/node_modules/browserify/v2.markdown +41 -0
  533. data/node_modules/browserify/wrappers/alias.js +1 -0
  534. data/node_modules/browserify/wrappers/body.js +2 -0
  535. data/node_modules/browserify/wrappers/body_debug.js +2 -0
  536. data/node_modules/browserify/wrappers/entry.js +3 -0
  537. data/node_modules/browserify/wrappers/entry_debug.js +3 -0
  538. data/node_modules/browserify/wrappers/package.js +3 -0
  539. data/node_modules/browserify/wrappers/prelude.js +196 -0
  540. data/node_modules/module-deps/LICENSE +18 -0
  541. data/node_modules/module-deps/cmd.js +8 -0
  542. data/node_modules/module-deps/example/deps.js +8 -0
  543. data/node_modules/module-deps/example/files/bar.js +3 -0
  544. data/node_modules/module-deps/example/files/foo.js +5 -0
  545. data/node_modules/module-deps/example/files/main.js +2 -0
  546. data/node_modules/module-deps/example/files/xyz.js +2 -0
  547. data/node_modules/module-deps/index.js +142 -0
  548. data/node_modules/module-deps/node_modules/browser-resolve/README.md +14 -0
  549. data/node_modules/module-deps/node_modules/browser-resolve/builtin/assert.js +314 -0
  550. data/node_modules/module-deps/node_modules/browser-resolve/builtin/child_process.js +2 -0
  551. data/node_modules/module-deps/node_modules/browser-resolve/builtin/events.js +183 -0
  552. data/node_modules/module-deps/node_modules/browser-resolve/builtin/fs.js +1 -0
  553. data/node_modules/module-deps/node_modules/browser-resolve/builtin/https.js +13 -0
  554. data/node_modules/module-deps/node_modules/browser-resolve/builtin/net.js +1 -0
  555. data/node_modules/module-deps/node_modules/browser-resolve/builtin/path.js +175 -0
  556. data/node_modules/module-deps/node_modules/browser-resolve/builtin/process.js +55 -0
  557. data/node_modules/module-deps/node_modules/browser-resolve/builtin/querystring.js +250 -0
  558. data/node_modules/module-deps/node_modules/browser-resolve/builtin/stream.js +119 -0
  559. data/node_modules/module-deps/node_modules/browser-resolve/builtin/string_decoder.js +161 -0
  560. data/node_modules/module-deps/node_modules/browser-resolve/builtin/sys.js +1 -0
  561. data/node_modules/module-deps/node_modules/browser-resolve/builtin/timers.js +39 -0
  562. data/node_modules/module-deps/node_modules/browser-resolve/builtin/tls.js +1 -0
  563. data/node_modules/module-deps/node_modules/browser-resolve/builtin/tty.js +2 -0
  564. data/node_modules/module-deps/node_modules/browser-resolve/builtin/url.js +604 -0
  565. data/node_modules/module-deps/node_modules/browser-resolve/builtin/util.js +351 -0
  566. data/node_modules/module-deps/node_modules/browser-resolve/index.js +144 -0
  567. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/README.md +11 -0
  568. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
  569. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/index.js +1282 -0
  570. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
  571. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
  572. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
  573. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
  574. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/package.json +42 -0
  575. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/test/buffer.js +121 -0
  576. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/LICENCE +19 -0
  577. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/README.md +32 -0
  578. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/index.js +85 -0
  579. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/package.json +76 -0
  580. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/index.js +67 -0
  581. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/index.html +12 -0
  582. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/test-adapter.js +53 -0
  583. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/bundle.js +637 -0
  584. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/index.html +12 -0
  585. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/test.js +4 -0
  586. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/index.js +74 -0
  587. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/md5.js +384 -0
  588. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/package.json +30 -0
  589. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/readme.markdown +20 -0
  590. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/rng.js +37 -0
  591. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/sha.js +210 -0
  592. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js +35 -0
  593. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/README.markdown +128 -0
  594. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/index.html +9 -0
  595. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/main.js +14 -0
  596. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/server.js +12 -0
  597. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/index.html +9 -0
  598. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/main.js +18 -0
  599. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/server.js +15 -0
  600. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/index.html +9 -0
  601. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/main.js +16 -0
  602. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/server.js +19 -0
  603. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/index.html +9 -0
  604. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/main.js +16 -0
  605. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/server.js +21 -0
  606. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/index.js +59 -0
  607. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/request.js +122 -0
  608. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/response.js +119 -0
  609. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
  610. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
  611. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
  612. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
  613. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/package.json +42 -0
  614. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/README.markdown +103 -0
  615. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/bundle.js +473 -0
  616. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/entry.js +6 -0
  617. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/index.html +9 -0
  618. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/server.js +6 -0
  619. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/index.js +85 -0
  620. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/package.json +39 -0
  621. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js +22 -0
  622. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/test.sh +11 -0
  623. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/index.js +43 -0
  624. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/package.json +33 -0
  625. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/readme.md +1 -0
  626. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/test/zlib.test.js +65 -0
  627. data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/zlib.js +55 -0
  628. data/node_modules/module-deps/node_modules/browser-resolve/package.json +38 -0
  629. data/node_modules/module-deps/node_modules/browser-resolve/test/core.js +20 -0
  630. data/node_modules/module-deps/node_modules/browser-resolve/test/fixtures/foo.js +1 -0
  631. data/node_modules/module-deps/node_modules/browser-resolve/test/local.js +15 -0
  632. data/node_modules/module-deps/node_modules/browser-resolve/test/mocha.opts +1 -0
  633. data/node_modules/module-deps/node_modules/browser-resolve/test/modules.js +99 -0
  634. data/node_modules/module-deps/node_modules/detective/LICENSE +18 -0
  635. data/node_modules/module-deps/node_modules/detective/example/strings.js +6 -0
  636. data/node_modules/module-deps/node_modules/detective/example/strings_src.js +3 -0
  637. data/node_modules/module-deps/node_modules/detective/index.js +62 -0
  638. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.BSD +19 -0
  639. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.source-map +27 -0
  640. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/README.md +99 -0
  641. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/escodegen.js +43 -0
  642. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/esgenerate.js +43 -0
  643. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/escodegen.js +2245 -0
  644. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/LICENSE +28 -0
  645. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/Makefile.dryice.js +165 -0
  646. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/README.md +268 -0
  647. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/assert-shim.js +56 -0
  648. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/mini-require.js +152 -0
  649. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  650. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-utils.jsm +18 -0
  651. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-browser.js +8 -0
  652. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  653. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-utils.jsm +20 -0
  654. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-prefix.js +8 -0
  655. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-suffix.js +3 -0
  656. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/array-set.js +107 -0
  657. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  658. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64.js +42 -0
  659. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  660. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-consumer.js +379 -0
  661. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-generator.js +202 -0
  662. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-node.js +199 -0
  663. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/util.js +40 -0
  664. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map.js +8 -0
  665. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  666. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/README.md +119 -0
  667. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  668. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/package.json +29 -0
  669. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/package.json +38 -0
  670. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/run-tests.js +72 -0
  671. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-api.js +26 -0
  672. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-array-set.js +71 -0
  673. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  674. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64.js +35 -0
  675. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  676. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  677. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-consumer.js +142 -0
  678. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js +187 -0
  679. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-node.js +163 -0
  680. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/util.js +78 -0
  681. data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/package.json +48 -0
  682. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/ChangeLog +18 -0
  683. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
  684. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/README.md +73 -0
  685. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esparse.js +117 -0
  686. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esvalidate.js +177 -0
  687. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/component.json +14 -0
  688. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/doc/index.html +473 -0
  689. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/esprima.js +3895 -0
  690. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/detectnestedternary.js +106 -0
  691. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/findbooleantrap.js +173 -0
  692. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js +33 -0
  693. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/index.html +102 -0
  694. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/package.json +40 -0
  695. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
  696. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.js +334 -0
  697. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.html +69 -0
  698. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.js +328 -0
  699. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
  700. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
  701. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
  702. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
  703. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.html +4676 -0
  704. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/index.html +37 -0
  705. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.html +36 -0
  706. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.js +129 -0
  707. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/reflect.js +422 -0
  708. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/run.js +66 -0
  709. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/runner.js +387 -0
  710. data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/test.js +19764 -0
  711. data/node_modules/module-deps/node_modules/detective/package.json +36 -0
  712. data/node_modules/module-deps/node_modules/detective/readme.markdown +70 -0
  713. data/node_modules/module-deps/node_modules/detective/test/both.js +11 -0
  714. data/node_modules/module-deps/node_modules/detective/test/chained.js +9 -0
  715. data/node_modules/module-deps/node_modules/detective/test/files/both.js +4 -0
  716. data/node_modules/module-deps/node_modules/detective/test/files/chained.js +5 -0
  717. data/node_modules/module-deps/node_modules/detective/test/files/nested.js +22 -0
  718. data/node_modules/module-deps/node_modules/detective/test/files/shebang.js +5 -0
  719. data/node_modules/module-deps/node_modules/detective/test/files/strings.js +13 -0
  720. data/node_modules/module-deps/node_modules/detective/test/files/word.js +13 -0
  721. data/node_modules/module-deps/node_modules/detective/test/nested.js +9 -0
  722. data/node_modules/module-deps/node_modules/detective/test/shebang.js +9 -0
  723. data/node_modules/module-deps/node_modules/detective/test/strings.js +9 -0
  724. data/node_modules/module-deps/node_modules/detective/test/word.js +12 -0
  725. data/node_modules/module-deps/node_modules/resolve/LICENSE +18 -0
  726. data/node_modules/module-deps/node_modules/resolve/example/async.js +5 -0
  727. data/node_modules/module-deps/node_modules/resolve/example/sync.js +3 -0
  728. data/node_modules/module-deps/node_modules/resolve/index.js +5 -0
  729. data/node_modules/module-deps/node_modules/resolve/lib/async.js +131 -0
  730. data/node_modules/module-deps/node_modules/resolve/lib/core.js +4 -0
  731. data/node_modules/module-deps/node_modules/resolve/lib/core.json +38 -0
  732. data/node_modules/module-deps/node_modules/resolve/lib/sync.js +98 -0
  733. data/node_modules/module-deps/node_modules/resolve/package.json +32 -0
  734. data/node_modules/module-deps/node_modules/resolve/readme.markdown +134 -0
  735. data/node_modules/module-deps/node_modules/resolve/test/core.js +12 -0
  736. data/node_modules/module-deps/node_modules/resolve/test/filter.js +17 -0
  737. data/node_modules/module-deps/node_modules/resolve/test/filter_sync.js +15 -0
  738. data/node_modules/module-deps/node_modules/resolve/test/mock.js +68 -0
  739. data/node_modules/module-deps/node_modules/resolve/test/mock_sync.js +68 -0
  740. data/node_modules/module-deps/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
  741. data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/doom.js +0 -0
  742. data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/package.json +3 -0
  743. data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/quux.js +1 -0
  744. data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
  745. data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
  746. data/node_modules/module-deps/node_modules/resolve/test/resolver/cup.coffee +1 -0
  747. data/node_modules/module-deps/node_modules/resolve/test/resolver/foo.js +1 -0
  748. data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.coffee +0 -0
  749. data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.js +0 -0
  750. data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
  751. data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/root.js +0 -0
  752. data/node_modules/module-deps/node_modules/resolve/test/resolver.js +144 -0
  753. data/node_modules/module-deps/node_modules/resolve/test/resolver_sync.js +157 -0
  754. data/node_modules/module-deps/package.json +47 -0
  755. data/node_modules/module-deps/readme.markdown +128 -0
  756. data/node_modules/module-deps/test/bundle.js +21 -0
  757. data/node_modules/module-deps/test/deps.js +42 -0
  758. data/node_modules/module-deps/test/files/bar.js +3 -0
  759. data/node_modules/module-deps/test/files/foo.js +5 -0
  760. data/node_modules/module-deps/test/files/main.js +2 -0
  761. data/node_modules/module-deps/test/files/tr_module/f.js +1 -0
  762. data/node_modules/module-deps/test/files/tr_module/main.js +7 -0
  763. data/node_modules/module-deps/test/files/tr_module/node_modules/g/index.js +1 -0
  764. data/node_modules/module-deps/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js +7 -0
  765. data/node_modules/module-deps/test/files/tr_module/node_modules/g/package.json +6 -0
  766. data/node_modules/module-deps/test/files/tr_module/node_modules/insert-aaa/index.js +7 -0
  767. data/node_modules/module-deps/test/files/tr_module/node_modules/insert-bbb/index.js +7 -0
  768. data/node_modules/module-deps/test/files/tr_module/node_modules/m/index.js +3 -0
  769. data/node_modules/module-deps/test/files/tr_sh/f.js +1 -0
  770. data/node_modules/module-deps/test/files/tr_sh/main.js +7 -0
  771. data/node_modules/module-deps/test/files/tr_sh/node_modules/g/index.js +1 -0
  772. data/node_modules/module-deps/test/files/tr_sh/node_modules/g/package.json +6 -0
  773. data/node_modules/module-deps/test/files/tr_sh/node_modules/g/tr_g.js +6 -0
  774. data/node_modules/module-deps/test/files/tr_sh/node_modules/m/index.js +3 -0
  775. data/node_modules/module-deps/test/files/tr_sh/tr_a.js +6 -0
  776. data/node_modules/module-deps/test/files/tr_sh/tr_b.js +6 -0
  777. data/node_modules/module-deps/test/files/xyz.js +2 -0
  778. data/node_modules/module-deps/test/tr_fn.js +29 -0
  779. data/node_modules/module-deps/test/tr_module.js +21 -0
  780. data/node_modules/module-deps/test/tr_sh.js +21 -0
  781. data/node_modules/through/LICENSE.APACHE2 +15 -0
  782. data/node_modules/through/LICENSE.MIT +24 -0
  783. data/node_modules/through/index.js +103 -0
  784. data/node_modules/through/package.json +35 -0
  785. data/node_modules/through/readme.markdown +43 -0
  786. data/node_modules/through/test/buffering.js +71 -0
  787. data/node_modules/through/test/end.js +27 -0
  788. data/node_modules/through/test/index.js +113 -0
  789. data/package.json +11 -0
  790. metadata +846 -0
@@ -0,0 +1,3261 @@
1
+ /*!
2
+ * Benchmark.js <http://benchmarkjs.com/>
3
+ * Copyright 2010-2011 Mathias Bynens <http://mths.be/>
4
+ * Based on JSLitmus.js, copyright Robert Kieffer <http://broofa.com/>
5
+ * Modified by John-David Dalton <http://allyoucanleet.com/>
6
+ * Available under MIT license <http://mths.be/mit>
7
+ */
8
+ ;(function(window, undefined) {
9
+
10
+ /** Detect free variable `define` */
11
+ var freeDefine = typeof define == 'function' &&
12
+ typeof define.amd == 'object' && define.amd && define,
13
+
14
+ /** Detect free variable `exports` */
15
+ freeExports = typeof exports == 'object' && exports &&
16
+ (typeof global == 'object' && global && global == global.global && (window = global), exports),
17
+
18
+ /** Detect free variable `require` */
19
+ freeRequire = typeof require == 'function' && require,
20
+
21
+ /** Used to assign each benchmark an incrimented id */
22
+ counter = 0,
23
+
24
+ /** Used to crawl all properties regardless of enumerability */
25
+ getAllKeys = Object.getOwnPropertyNames,
26
+
27
+ /** Used to get property descriptors */
28
+ getDescriptor = Object.getOwnPropertyDescriptor,
29
+
30
+ /** Used in case an object doesn't have its own method */
31
+ hasOwnProperty = {}.hasOwnProperty,
32
+
33
+ /** Used to check if an object is extensible */
34
+ isExtensible = Object.isExtensible || function() { return true; },
35
+
36
+ /** Used to check if an own property is enumerable */
37
+ propertyIsEnumerable = {}.propertyIsEnumerable,
38
+
39
+ /** Used to set property descriptors */
40
+ setDescriptor = Object.defineProperty,
41
+
42
+ /** Used to resolve a value's internal [[Class]] */
43
+ toString = {}.toString,
44
+
45
+ /** Used to integrity check compiled tests */
46
+ uid = 'uid' + (+new Date),
47
+
48
+ /** Used to avoid infinite recursion when methods call each other */
49
+ calledBy = {},
50
+
51
+ /** Used to avoid hz of Infinity */
52
+ divisors = {
53
+ '1': 4096,
54
+ '2': 512,
55
+ '3': 64,
56
+ '4': 8,
57
+ '5': 0
58
+ },
59
+
60
+ /**
61
+ * T-Distribution two-tailed critical values for 95% confidence
62
+ * http://www.itl.nist.gov/div898/handbook/eda/section3/eda3672.htm
63
+ */
64
+ distribution = {
65
+ '1': 12.706,'2': 4.303, '3': 3.182, '4': 2.776, '5': 2.571, '6': 2.447,
66
+ '7': 2.365, '8': 2.306, '9': 2.262, '10': 2.228, '11': 2.201, '12': 2.179,
67
+ '13': 2.16, '14': 2.145, '15': 2.131, '16': 2.12, '17': 2.11, '18': 2.101,
68
+ '19': 2.093, '20': 2.086, '21': 2.08, '22': 2.074, '23': 2.069, '24': 2.064,
69
+ '25': 2.06, '26': 2.056, '27': 2.052, '28': 2.048, '29': 2.045, '30': 2.042,
70
+ 'infinity': 1.96
71
+ },
72
+
73
+ /** Used to flag environments/features */
74
+ has = {
75
+
76
+ /** Detect Adobe AIR */
77
+ 'air': isClassOf(window.runtime, 'ScriptBridgingProxyObject'),
78
+
79
+ /** Detect if `arguments` objects have the correct internal [[Class]] value */
80
+ 'argumentsClass': isClassOf(arguments, 'Arguments'),
81
+
82
+ /** Detect if strings support accessing characters by index */
83
+ 'charByIndex':
84
+ // IE8 supports indexes on string literals but not string objects
85
+ Object('x')[0] == 'x',
86
+
87
+ /** Detect if strings have indexes as own properties */
88
+ 'charByOwnIndex':
89
+ // Narwhal, Rhino, RingoJS, and Opera < 10.52 support indexes on strings
90
+ // but don't detect them as own properties
91
+ hasKey('x', '0'),
92
+
93
+ /** Detect if functions support decompilation */
94
+ 'decompilation': !!(function() {
95
+ try{
96
+ // Safari 2.x removes commas in object literals
97
+ // from Function#toString results
98
+ // http://webk.it/11609
99
+ // Firefox 3.6 and Opera 9.25 strip grouping
100
+ // parentheses from Function#toString results
101
+ // http://bugzil.la/559438
102
+ return Function(
103
+ 'return (' + (function(x) { return { 'x': '' + (1 + x) + '', 'y': 0 }; }) + ')'
104
+ )()(0).x === '1';
105
+ } catch(e) { }
106
+ }()),
107
+
108
+ /** Detect ES5+ property descriptor API */
109
+ 'descriptors' : !!(function() {
110
+ try {
111
+ var o = {};
112
+ return (setDescriptor(o, o, o), 'value' in getDescriptor(o, o));
113
+ } catch(e) { }
114
+ }()),
115
+
116
+ /** Detect ES5+ Object.getOwnPropertyNames() */
117
+ 'getAllKeys': !!(function() {
118
+ try {
119
+ return /\bvalueOf\b/.test(getAllKeys(Object.prototype));
120
+ } catch(e) { }
121
+ }()),
122
+
123
+ /** Detect if Java is enabled/exposed */
124
+ 'java': isClassOf(window.java, 'JavaPackage'),
125
+
126
+ /** Detect if the Timers API exists */
127
+ 'timeout': isHostType(window, 'setTimeout') && isHostType(window, 'clearTimeout')
128
+ },
129
+
130
+ /**
131
+ * Timer utility object used by `clock()` and `Deferred#resolve`.
132
+ * @private
133
+ * @type Object
134
+ */
135
+ timer = {
136
+
137
+ /**
138
+ * The timer namespace object or constructor.
139
+ * @private
140
+ * @memberOf timer
141
+ * @type Function|Object
142
+ */
143
+ 'ns': Date,
144
+
145
+ /**
146
+ * Starts the deferred timer.
147
+ * @private
148
+ * @memberOf timer
149
+ * @param {Object} deferred The deferred instance.
150
+ */
151
+ 'start': null, // lazy defined in `clock()`
152
+
153
+ /**
154
+ * Stops the deferred timer.
155
+ * @private
156
+ * @memberOf timer
157
+ * @param {Object} deferred The deferred instance.
158
+ */
159
+ 'stop': null // lazy defined in `clock()`
160
+ },
161
+
162
+ /** Shortcut for inverse results */
163
+ noArgumentsClass = !has.argumentsClass,
164
+ noCharByIndex = !has.charByIndex,
165
+ noCharByOwnIndex = !has.charByOwnIndex,
166
+
167
+ /** Math shortcuts */
168
+ abs = Math.abs,
169
+ floor = Math.floor,
170
+ max = Math.max,
171
+ min = Math.min,
172
+ pow = Math.pow,
173
+ sqrt = Math.sqrt;
174
+
175
+ /*--------------------------------------------------------------------------*/
176
+
177
+ /**
178
+ * Benchmark constructor.
179
+ * @constructor
180
+ * @param {String} name A name to identify the benchmark.
181
+ * @param {Function|String} fn The test to benchmark.
182
+ * @param {Object} [options={}] Options object.
183
+ * @example
184
+ *
185
+ * // basic usage (the `new` operator is optional)
186
+ * var bench = new Benchmark(fn);
187
+ *
188
+ * // or using a name first
189
+ * var bench = new Benchmark('foo', fn);
190
+ *
191
+ * // or with options
192
+ * var bench = new Benchmark('foo', fn, {
193
+ *
194
+ * // displayed by Benchmark#toString if `name` is not available
195
+ * 'id': 'xyz',
196
+ *
197
+ * // called when the benchmark starts running
198
+ * 'onStart': onStart,
199
+ *
200
+ * // called after each run cycle
201
+ * 'onCycle': onCycle,
202
+ *
203
+ * // called when aborted
204
+ * 'onAbort': onAbort,
205
+ *
206
+ * // called when a test errors
207
+ * 'onError': onError,
208
+ *
209
+ * // called when reset
210
+ * 'onReset': onReset,
211
+ *
212
+ * // called when the benchmark completes running
213
+ * 'onComplete': onComplete,
214
+ *
215
+ * // compiled/called before the test loop
216
+ * 'setup': setup,
217
+ *
218
+ * // compiled/called after the test loop
219
+ * 'teardown': teardown
220
+ * });
221
+ *
222
+ * // or name and options
223
+ * var bench = new Benchmark('foo', {
224
+ *
225
+ * // a flag to indicate the benchmark is deferred
226
+ * 'deferred': true,
227
+ *
228
+ * // benchmark test function
229
+ * 'fn': function(deferred) {
230
+ * // call resolve() when the deferred test is finished
231
+ * deferred.resolve();
232
+ * }
233
+ * });
234
+ *
235
+ * // or options only
236
+ * var bench = new Benchmark({
237
+ *
238
+ * // benchmark name
239
+ * 'name': 'foo',
240
+ *
241
+ * // benchmark test as a string
242
+ * 'fn': '[1,2,3,4].sort()'
243
+ * });
244
+ *
245
+ * // a test's `this` binding is set to the benchmark instance
246
+ * var bench = new Benchmark('foo', function() {
247
+ * 'My name is '.concat(this.name); // My name is foo
248
+ * });
249
+ */
250
+ function Benchmark(name, fn, options) {
251
+ var me = this;
252
+
253
+ // allow instance creation without the `new` operator
254
+ if (me && me.constructor != Benchmark) {
255
+ return new Benchmark(name, fn, options);
256
+ }
257
+ // juggle arguments
258
+ if (isClassOf(name, 'Object')) {
259
+ // 1 argument (options)
260
+ options = name;
261
+ }
262
+ else if (isClassOf(name, 'Function')) {
263
+ // 2 arguments (fn, options)
264
+ options = fn;
265
+ fn = name;
266
+ }
267
+ else if (isClassOf(fn, 'Object')) {
268
+ // 2 arguments (name, options)
269
+ options = fn;
270
+ fn = null;
271
+ me.name = name;
272
+ }
273
+ else {
274
+ // 3 arguments (name, fn [, options])
275
+ me.name = name;
276
+ }
277
+ setOptions(me, options);
278
+ me.id || (me.id = ++counter);
279
+ me.fn == null && (me.fn = fn);
280
+ me.stats = extend({}, me.stats);
281
+ me.times = extend({}, me.times);
282
+ }
283
+
284
+ /**
285
+ * Deferred constructor.
286
+ * @constructor
287
+ * @memberOf Benchmark
288
+ * @param {Object} bench The benchmark instance.
289
+ */
290
+ function Deferred(bench) {
291
+ var me = this;
292
+ if (me && me.constructor != Deferred) {
293
+ return new Deferred(bench);
294
+ }
295
+ me.benchmark = bench;
296
+ clock(me);
297
+ }
298
+
299
+ /**
300
+ * Event constructor.
301
+ * @constructor
302
+ * @memberOf Benchmark
303
+ * @param {String|Object} type The event type.
304
+ */
305
+ function Event(type) {
306
+ var me = this;
307
+ return (me && me.constructor != Event)
308
+ ? new Event(type)
309
+ : (type instanceof Event)
310
+ ? type
311
+ : extend(me, typeof type == 'string' ? { 'type': type } : type);
312
+ }
313
+
314
+ /**
315
+ * Suite constructor.
316
+ * @constructor
317
+ * @memberOf Benchmark
318
+ * @param {String} name A name to identify the suite.
319
+ * @param {Object} [options={}] Options object.
320
+ * @example
321
+ *
322
+ * // basic usage (the `new` operator is optional)
323
+ * var suite = new Benchmark.Suite;
324
+ *
325
+ * // or using a name first
326
+ * var suite = new Benchmark.Suite('foo');
327
+ *
328
+ * // or with options
329
+ * var suite = new Benchmark.Suite('foo', {
330
+ *
331
+ * // called when the suite starts running
332
+ * 'onStart': onStart,
333
+ *
334
+ * // called between running benchmarks
335
+ * 'onCycle': onCycle,
336
+ *
337
+ * // called when aborted
338
+ * 'onAbort': onAbort,
339
+ *
340
+ * // called when a test errors
341
+ * 'onError': onError,
342
+ *
343
+ * // called when reset
344
+ * 'onReset': onReset,
345
+ *
346
+ * // called when the suite completes running
347
+ * 'onComplete': onComplete
348
+ * });
349
+ */
350
+ function Suite(name, options) {
351
+ var me = this;
352
+
353
+ // allow instance creation without the `new` operator
354
+ if (me && me.constructor != Suite) {
355
+ return new Suite(name, options);
356
+ }
357
+ // juggle arguments
358
+ if (isClassOf(name, 'Object')) {
359
+ // 1 argument (options)
360
+ options = name;
361
+ } else {
362
+ // 2 arguments (name [, options])
363
+ me.name = name;
364
+ }
365
+ setOptions(me, options);
366
+ }
367
+
368
+ /*--------------------------------------------------------------------------*/
369
+
370
+ /**
371
+ * Note: Some array methods have been implemented in plain JavaScript to avoid
372
+ * bugs in IE, Opera, Rhino, and Mobile Safari.
373
+ *
374
+ * IE compatibility mode and IE < 9 have buggy Array `shift()` and `splice()`
375
+ * functions that fail to remove the last element, `object[0]`, of
376
+ * array-like-objects even though the `length` property is set to `0`.
377
+ * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
378
+ * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
379
+ *
380
+ * In Opera < 9.50 and some older/beta Mobile Safari versions using `unshift()`
381
+ * generically to augment the `arguments` object will pave the value at index 0
382
+ * without incrimenting the other values's indexes.
383
+ * https://github.com/documentcloud/underscore/issues/9
384
+ *
385
+ * Rhino and environments it powers, like Narwhal and RingoJS, may have
386
+ * buggy Array `concat()`, `reverse()`, `shift()`, `slice()`, `splice()` and
387
+ * `unshift()` functions that make sparse arrays non-sparse by assigning the
388
+ * undefined indexes a value of undefined.
389
+ * https://github.com/mozilla/rhino/commit/702abfed3f8ca043b2636efd31c14ba7552603dd
390
+ */
391
+
392
+ /**
393
+ * Creates an array containing the elements of the host array followed by the
394
+ * elements of each argument in order.
395
+ * @memberOf Benchmark.Suite
396
+ * @returns {Array} The new array.
397
+ */
398
+ function concat() {
399
+ var value,
400
+ j = -1,
401
+ length = arguments.length,
402
+ result = slice.call(this),
403
+ index = result.length;
404
+
405
+ while (++j < length) {
406
+ value = arguments[j];
407
+ if (isClassOf(value, 'Array')) {
408
+ for (var k = 0, l = value.length; k < l; k++, index++) {
409
+ if (k in value) {
410
+ result[index] = value[k];
411
+ }
412
+ }
413
+ } else {
414
+ result[index] = value;
415
+ }
416
+ }
417
+ return result;
418
+ }
419
+
420
+ /**
421
+ * Utility function used by `shift()`, `splice()`, and `unshift()`.
422
+ * @private
423
+ * @param {Number} start The index to start inserting elements.
424
+ * @param {Number} deleteCount The number of elements to delete from the insert point.
425
+ * @param {Array} elements The elements to insert.
426
+ * @returns {Array} An array of deleted elements.
427
+ */
428
+ function insert(start, deleteCount, elements) {
429
+ var deleteEnd = start + deleteCount,
430
+ elementCount = elements ? elements.length : 0,
431
+ index = start - 1,
432
+ length = start + elementCount,
433
+ object = this,
434
+ result = [],
435
+ tail = slice.call(object, deleteEnd);
436
+
437
+ // delete elements from the array
438
+ while (++index < deleteEnd) {
439
+ if (index in object) {
440
+ result[index - start] = object[index];
441
+ delete object[index];
442
+ }
443
+ }
444
+ // insert elements
445
+ index = start - 1;
446
+ while (++index < length) {
447
+ object[index] = elements[index - start];
448
+ }
449
+ // append tail elements
450
+ start = index--;
451
+ length = (object.length >>> 0) - deleteCount + elementCount;
452
+ while (++index < length) {
453
+ if ((index - start) in tail) {
454
+ object[index] = tail[index - start];
455
+ } else {
456
+ delete object[index];
457
+ }
458
+ }
459
+ // delete excess elements
460
+ deleteCount = deleteCount > elementCount ? deleteCount - elementCount : 0;
461
+ while (deleteCount--) {
462
+ delete object[length + deleteCount];
463
+ }
464
+ object.length = length;
465
+ return result;
466
+ }
467
+
468
+ /**
469
+ * Rearrange the host array's elements in reverse order.
470
+ * @memberOf Benchmark.Suite
471
+ * @returns {Array} The reversed array.
472
+ */
473
+ function reverse() {
474
+ var upperIndex,
475
+ value,
476
+ index = -1,
477
+ object = Object(this),
478
+ length = object.length >>> 0,
479
+ middle = floor(length / 2);
480
+
481
+ if (length > 1) {
482
+ while (++index < middle) {
483
+ upperIndex = length - index - 1;
484
+ value = upperIndex in object ? object[upperIndex] : uid;
485
+ if (index in object) {
486
+ object[upperIndex] = object[index];
487
+ } else {
488
+ delete object[upperIndex];
489
+ }
490
+ if (value != uid) {
491
+ object[index] = value;
492
+ } else {
493
+ delete object[index];
494
+ }
495
+ }
496
+ }
497
+ return object;
498
+ }
499
+
500
+ /**
501
+ * Removes the first element of the host array and returns it.
502
+ * @memberOf Benchmark.Suite
503
+ * @returns {Mixed} The first element of the array.
504
+ */
505
+ function shift() {
506
+ return insert.call(this, 0, 1)[0];
507
+ }
508
+
509
+ /**
510
+ * Creates an array of the host array's elements from the start index up to,
511
+ * but not including, the end index.
512
+ * @memberOf Benchmark.Suite
513
+ * @returns {Array} The new array.
514
+ */
515
+ function slice(start, end) {
516
+ var index = -1,
517
+ object = Object(this),
518
+ length = object.length >>> 0,
519
+ result = [];
520
+
521
+ start = toInteger(start);
522
+ start = start < 0 ? max(length + start, 0) : min(start, length);
523
+ start--;
524
+ end = end == null ? length : toInteger(end);
525
+ end = end < 0 ? max(length + end, 0) : min(end, length);
526
+
527
+ while ((++index, ++start) < end) {
528
+ if (start in object) {
529
+ result[index] = object[start];
530
+ }
531
+ }
532
+ return result;
533
+ }
534
+
535
+ /**
536
+ * Allows removing a range of elements and/or inserting elements into the host array.
537
+ * @memberOf Benchmark.Suite
538
+ * @returns {Array} An array of removed elements.
539
+ */
540
+ function splice(start, deleteCount) {
541
+ var object = Object(this),
542
+ length = object.length >>> 0;
543
+
544
+ start = toInteger(start);
545
+ start = start < 0 ? max(length + start, 0) : min(start, length);
546
+ deleteCount = min(max(toInteger(deleteCount), 0), length - start);
547
+ return insert.call(object, start, deleteCount, slice.call(arguments, 2));
548
+ }
549
+
550
+ /**
551
+ * Converts the specified `value` to an integer.
552
+ * @private
553
+ * @param {Mixed} value The value to convert.
554
+ * @returns {Number} The resulting integer.
555
+ */
556
+ function toInteger(value) {
557
+ value = +value;
558
+ return value === 0 || !isFinite(value) ? value || 0 : value - (value % 1);
559
+ }
560
+
561
+ /**
562
+ * Appends arguments to the host array.
563
+ * @memberOf Benchmark.Suite
564
+ * @returns {Number} The new length.
565
+ */
566
+ function unshift() {
567
+ var object = Object(this);
568
+ insert.call(object, 0, 0, arguments);
569
+ return object.length;
570
+ }
571
+
572
+ /*--------------------------------------------------------------------------*/
573
+
574
+ /**
575
+ * Executes a function, associated with a benchmark, synchronously or asynchronously.
576
+ * @private
577
+ * @param {Object} options The options object.
578
+ */
579
+ function call(options) {
580
+ options || (options = {});
581
+ var fn = options.fn;
582
+
583
+ (!options.async && fn || function() {
584
+ var bench = options.benchmark,
585
+ ids = bench._timerIds || (bench._timerIds = []),
586
+ index = ids.length;
587
+
588
+ // under normal use there should only be one id at any time per benchmark
589
+ ids.push(setTimeout(function() {
590
+ ids.splice(index, 1);
591
+ ids.length || delete bench._timerIds;
592
+ fn();
593
+ }, bench.delay * 1e3));
594
+ })();
595
+ }
596
+
597
+ /**
598
+ * Creates a function from the given arguments string and body.
599
+ * @private
600
+ * @param {String} args The comma separated function arguments.
601
+ * @param {String} body The function body.
602
+ * @returns {Function} The new function.
603
+ */
604
+ function createFunction() {
605
+ // lazy defined to fork based on supported features
606
+ createFunction = function(args, body) {
607
+ var anchor = freeDefine ? define.amd : Benchmark,
608
+ prop = uid + 'createFunction';
609
+
610
+ runScript((freeDefine ? 'define.amd.' : 'Benchmark.') + prop + '=function(' + args + '){' + body + '}');
611
+ return [anchor[prop], delete anchor[prop]][0];
612
+ };
613
+ // fix JaegerMonkey bug
614
+ // http://bugzil.la/639720
615
+ createFunction = (createFunction('', 'return"' + uid + '"') || noop)() == uid ? createFunction : Function;
616
+ return createFunction.apply(null, arguments);
617
+ }
618
+
619
+ /**
620
+ * Iterates over an object's properties, executing the `callback` for each.
621
+ * Callbacks may terminate the loop by explicitly returning `false`.
622
+ * @private
623
+ * @param {Object} object The object to iterate over.
624
+ * @param {Function} callback The function executed per own property.
625
+ * @param {Object} options The options object.
626
+ * @returns {Object} Returns the object iterated over.
627
+ */
628
+ function forProps() {
629
+ var forShadowed,
630
+ skipSeen,
631
+ forArgs = true,
632
+ shadowed = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
633
+
634
+ (function(enumFlag, key) {
635
+ // must use a non-native constructor to catch the Safari 2 issue
636
+ function Klass() { this.valueOf = 0; };
637
+ Klass.prototype.valueOf = 0;
638
+ // check various for..in bugs
639
+ for (key in new Klass) {
640
+ enumFlag += key == 'valueOf' ? 1 : 0;
641
+ }
642
+ // check if `arguments` objects have non-enumerable indexes
643
+ for (key in arguments) {
644
+ key == '0' && (forArgs = false);
645
+ }
646
+ // Safari 2 iterates over shadowed properties twice
647
+ // http://replay.waybackmachine.org/20090428222941/http://tobielangel.com/2007/1/29/for-in-loop-broken-in-safari/
648
+ skipSeen = enumFlag == 2;
649
+ // IE < 9 incorrectly makes an object's properties non-enumerable if they have
650
+ // the same name as other non-enumerable properties in its prototype chain.
651
+ forShadowed = !enumFlag;
652
+ }(0));
653
+
654
+ // lazy define
655
+ forProps = function(object, callback, options) {
656
+ options || (options = {});
657
+
658
+ var ctor,
659
+ key,
660
+ keys,
661
+ skipCtor,
662
+ done = !object,
663
+ result = [object, object = Object(object)][0],
664
+ which = options.which,
665
+ allFlag = which == 'all',
666
+ fn = callback,
667
+ index = -1,
668
+ iteratee = object,
669
+ length = object.length,
670
+ ownFlag = allFlag || which == 'own',
671
+ seen = {},
672
+ skipProto = isClassOf(object, 'Function'),
673
+ thisArg = options.bind;
674
+
675
+ object = Object(object);
676
+
677
+ if (thisArg !== undefined) {
678
+ callback = function(value, key, object) {
679
+ return fn.call(thisArg, value, key, object);
680
+ };
681
+ }
682
+ // iterate all properties
683
+ if (allFlag && has.getAllKeys) {
684
+ for (index = 0, keys = getAllKeys(object), length = keys.length; index < length; index++) {
685
+ key = keys[index];
686
+ if (callback(object[key], key, object) === false) {
687
+ break;
688
+ }
689
+ }
690
+ }
691
+ // else iterate only enumerable properties
692
+ else {
693
+ for (key in object) {
694
+ // Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
695
+ // (if the prototype or a property on the prototype has been set)
696
+ // incorrectly set a function's `prototype` property [[Enumerable]] value
697
+ // to `true`. Because of this we standardize on skipping the `prototype`
698
+ // property of functions regardless of their [[Enumerable]] value.
699
+ if ((done =
700
+ !(skipProto && key == 'prototype') &&
701
+ !(skipSeen && (hasKey(seen, key) || !(seen[key] = true))) &&
702
+ (!ownFlag || ownFlag && hasKey(object, key)) &&
703
+ callback(object[key], key, object) === false)) {
704
+ break;
705
+ }
706
+ }
707
+ // in IE < 9 strings don't support accessing characters by index
708
+ if (!done && (
709
+ forArgs && isArguments(object) ||
710
+ (noCharByIndex || noCharByOwnIndex) && isClassOf(object, 'String'))) {
711
+ noCharByIndex && (iteratee = object.split(''));
712
+ while (++index < length) {
713
+ if ((done =
714
+ callback(iteratee[index], String(index), object) === false)) {
715
+ break;
716
+ }
717
+ }
718
+ }
719
+ if (!done && forShadowed) {
720
+ // Because IE < 9 can't set the `[[Enumerable]]` attribute of an existing
721
+ // property and the `constructor` property of a prototype defaults to
722
+ // non-enumerable, we manually skip the `constructor` property when we
723
+ // think we are iterating over a `prototype` object.
724
+ ctor = object.constructor;
725
+ skipCtor = ctor && ctor.prototype && ctor.prototype.constructor === ctor;
726
+ for (index = 0; index < 7; index++) {
727
+ key = shadowed[index];
728
+ if (!(skipCtor && key == 'constructor') &&
729
+ hasKey(object, key) &&
730
+ callback(object[key], key, object) === false) {
731
+ break;
732
+ }
733
+ }
734
+ }
735
+ }
736
+ return result;
737
+ };
738
+ return forProps.apply(null, arguments);
739
+ }
740
+
741
+ /**
742
+ * Gets the critical value for the specified degrees of freedom.
743
+ * @private
744
+ * @param {Number} df The degrees of freedom.
745
+ * @returns {Number} The critical value.
746
+ */
747
+ function getCriticalValue(df) {
748
+ return distribution[Math.round(df) || 1] || distribution.infinity;
749
+ }
750
+
751
+ /**
752
+ * Gets the name of the first argument from a function's source.
753
+ * @private
754
+ * @param {Function} fn The function.
755
+ * @param {String} altName A string used when the name of the first argument is unretrievable.
756
+ * @returns {String} The argument name.
757
+ */
758
+ function getFirstArgument(fn, altName) {
759
+ return (!hasKey(fn, 'toString') &&
760
+ (/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(fn) || 0)[1]) || altName || '';
761
+ }
762
+
763
+ /**
764
+ * Computes the arithmetic mean of a sample.
765
+ * @private
766
+ * @param {Array} sample The sample.
767
+ * @returns {Number} The mean.
768
+ */
769
+ function getMean(sample) {
770
+ return reduce(sample, function(sum, x) {
771
+ return sum + x;
772
+ }, 0) / sample.length || 0;
773
+ }
774
+
775
+ /**
776
+ * Gets the source code of a function.
777
+ * @private
778
+ * @param {Function} fn The function.
779
+ * @param {String} altSource A string used when a function's source code is unretrievable.
780
+ * @returns {String} The function's source code.
781
+ */
782
+ function getSource(fn, altSource) {
783
+ var result = altSource;
784
+ if (isStringable(fn)) {
785
+ result = String(fn);
786
+ } else if (has.decompilation) {
787
+ result = (/^[^{]+{([\s\S]*)}\s*$/.exec(fn) || 0)[1];
788
+ }
789
+ return (result || '').replace(/^\s+|\s+$/g, '');
790
+ }
791
+
792
+ /**
793
+ * Modify a string by replacing named tokens with matching object property values.
794
+ * @private
795
+ * @param {String} string The string to modify.
796
+ * @param {Object} object The template object.
797
+ * @returns {String} The modified string.
798
+ */
799
+ function interpolate(string, object) {
800
+ forOwn(object, function(value, key) {
801
+ string = string.replace(RegExp('#\\{' + key + '\\}', 'g'), value);
802
+ });
803
+ return string;
804
+ }
805
+
806
+ /**
807
+ * Checks if a value is an `arguments` object.
808
+ * @private
809
+ * @param {Mixed} value The value to check.
810
+ * @returns {Boolean} Returns `true` if the value is an `arguments` object, else `false`.
811
+ */
812
+ function isArguments() {
813
+ // lazy define
814
+ isArguments = function(value) {
815
+ return toString.call(value) == '[object Arguments]';
816
+ };
817
+ if (noArgumentsClass) {
818
+ isArguments = function(value) {
819
+ return hasKey(value, 'callee') &&
820
+ !(propertyIsEnumerable && propertyIsEnumerable.call(value, 'callee'));
821
+ };
822
+ }
823
+ return isArguments(arguments[0]);
824
+ }
825
+
826
+ /**
827
+ * Checks if an object is of the specified class.
828
+ * @private
829
+ * @param {Mixed} value The value to check.
830
+ * @param {String} name The name of the class.
831
+ * @returns {Boolean} Returns `true` if the value is of the specified class, else `false`.
832
+ */
833
+ function isClassOf(value, name) {
834
+ return value != null && toString.call(value) == '[object ' + name + ']';
835
+ }
836
+
837
+ /**
838
+ * Host objects can return type values that are different from their actual
839
+ * data type. The objects we are concerned with usually return non-primitive
840
+ * types of object, function, or unknown.
841
+ * @private
842
+ * @param {Mixed} object The owner of the property.
843
+ * @param {String} property The property to check.
844
+ * @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
845
+ */
846
+ function isHostType(object, property) {
847
+ var type = object != null ? typeof object[property] : 'number';
848
+ return !/^(?:boolean|number|string|undefined)$/.test(type) &&
849
+ (type == 'object' ? !!object[property] : true);
850
+ }
851
+
852
+ /**
853
+ * Checks if the specified `value` is an object created by the `Object` constructor.
854
+ * @private
855
+ * @param {Mixed} value The value to check.
856
+ * @returns {Boolean} Returns `true` if `value` is an object, else `false`.
857
+ */
858
+ function isObject(value) {
859
+ var ctor,
860
+ result = !!value && toString.call(value) == '[object Object]';
861
+
862
+ if (result && noArgumentsClass) {
863
+ // avoid false positives for `arguments` objects in IE < 9
864
+ result = !isArguments(value);
865
+ }
866
+ if (result) {
867
+ // IE < 9 presents nodes like `Object` objects:
868
+ // IE < 8 are missing the node's constructor property
869
+ // IE 8 node constructors are typeof "object"
870
+ ctor = value.constructor;
871
+ // check if the constructor is `Object` as `Object instanceof Object` is `true`
872
+ if ((result = isClassOf(ctor, 'Function') && ctor instanceof ctor)) {
873
+ // assume objects created by the `Object` constructor have no inherited enumerable properties
874
+ // (we assume there are no `Object.prototype` extensions)
875
+ forProps(value, function(subValue, subKey) {
876
+ result = subKey;
877
+ });
878
+ // An object's own properties are iterated before inherited properties.
879
+ // If the last iterated key belongs to an object's own property then
880
+ // there are no inherited enumerable properties.
881
+ result = result === true || hasKey(value, result);
882
+ }
883
+ }
884
+ return result;
885
+ }
886
+
887
+ /**
888
+ * Checks if a value can be safely coerced to a string.
889
+ * @private
890
+ * @param {Mixed} value The value to check.
891
+ * @returns {Boolean} Returns `true` if the value can be coerced, else `false`.
892
+ */
893
+ function isStringable(value) {
894
+ return hasKey(value, 'toString') || isClassOf(value, 'String');
895
+ }
896
+
897
+ /**
898
+ * Wraps a function and passes `this` to the original function as the first argument.
899
+ * @private
900
+ * @param {Function} fn The function to be wrapped.
901
+ * @returns {Function} The new function.
902
+ */
903
+ function methodize(fn) {
904
+ return function() {
905
+ var args = [this];
906
+ args.push.apply(args, arguments);
907
+ return fn.apply(null, args);
908
+ };
909
+ }
910
+
911
+ /**
912
+ * A no-operation function.
913
+ * @private
914
+ */
915
+ function noop() {
916
+ // no operation performed
917
+ }
918
+
919
+ /**
920
+ * A wrapper around require() to suppress `module missing` errors.
921
+ * @private
922
+ * @param {String} id The module id.
923
+ * @returns {Mixed} The exported module or `null`.
924
+ */
925
+ function req(id) {
926
+ try {
927
+ return freeExports && freeRequire(id);
928
+ } catch(e) { }
929
+ return null;
930
+ }
931
+
932
+ /**
933
+ * Runs a snippet of JavaScript via script injection.
934
+ * @private
935
+ * @param {String} code The code to run.
936
+ */
937
+ function runScript(code) {
938
+ var parent,
939
+ script,
940
+ sibling,
941
+ anchor = freeDefine ? define.amd : Benchmark,
942
+ prop = uid + 'runScript',
943
+ prefix = '(' + (freeDefine ? 'define.amd.' : 'Benchmark.') + prop + '||function(){})();';
944
+
945
+ // Non-browser environments, Firefox 2.0.0.2 (executes asynchronously),
946
+ // and IE < 9 will error here and that's OK.
947
+ // Script injection is only used to avoid the previously commented JaegerMonkey bug.
948
+ // We remove the inserted script *before* running the code to avoid differences
949
+ // in the expected script element count/order of the document.
950
+ try {
951
+ sibling = document.getElementsByTagName('script')[0];
952
+ parent = sibling.parentNode;
953
+ script = document.createElement('script');
954
+ anchor[prop] = function() { parent.removeChild(script); };
955
+ script.appendChild(document.createTextNode(prefix + code));
956
+ parent.insertBefore(script, sibling);
957
+ } catch(e) { }
958
+
959
+ delete anchor[prop];
960
+ }
961
+
962
+ /**
963
+ * A helper function for setting options/event handlers.
964
+ * @private
965
+ * @param {Object} bench The benchmark instance.
966
+ * @param {Object} [options={}] Options object.
967
+ */
968
+ function setOptions(bench, options) {
969
+ options = extend({}, bench.constructor.options, options);
970
+ bench.options = forOwn(options, function(value, key) {
971
+ if (value != null) {
972
+ // add event listeners
973
+ if (/^on[A-Z]/.test(key)) {
974
+ forEach(key.split(' '), function(key) {
975
+ bench.on(key.slice(2).toLowerCase(), value);
976
+ });
977
+ } else {
978
+ bench[key] = deepClone(value);
979
+ }
980
+ }
981
+ });
982
+ }
983
+
984
+ /*--------------------------------------------------------------------------*/
985
+
986
+ /**
987
+ * Handles cycling/completing the deferred benchmark.
988
+ * @memberOf Benchmark.Deferred
989
+ */
990
+ function resolve() {
991
+ var me = this,
992
+ bench = me.benchmark;
993
+
994
+ if (++me.cycles < bench.count) {
995
+ (bench._host || bench).compiled.call(me, timer.ns, timer);
996
+ } else {
997
+ timer.stop(me);
998
+ call({
999
+ 'async': true,
1000
+ 'benchmark': bench,
1001
+ 'fn': function() {
1002
+ cycle({ 'benchmark': bench, 'deferred': me });
1003
+ }
1004
+ });
1005
+ }
1006
+ }
1007
+
1008
+ /*--------------------------------------------------------------------------*/
1009
+
1010
+ /**
1011
+ * A deep clone utility.
1012
+ * @static
1013
+ * @memberOf Benchmark
1014
+ * @param {Mixed} value The value to clone.
1015
+ * @returns {Mixed} The cloned value.
1016
+ */
1017
+ function deepClone(value) {
1018
+ var accessor,
1019
+ circular,
1020
+ clone,
1021
+ ctor,
1022
+ data,
1023
+ descriptor,
1024
+ extensible,
1025
+ key,
1026
+ length,
1027
+ markerKey,
1028
+ parent,
1029
+ result,
1030
+ source,
1031
+ subIndex,
1032
+ index = -1,
1033
+ marked = [],
1034
+ unmarked = [],
1035
+ queue = { '0': { 'value': value }, 'length': 1 };
1036
+
1037
+ /**
1038
+ * An easily detectable decorator for cloned values.
1039
+ */
1040
+ function Marker(object) {
1041
+ this.raw = object;
1042
+ }
1043
+
1044
+ /**
1045
+ * Gets an available marker key for the given object.
1046
+ */
1047
+ function getMarkerKey(object) {
1048
+ // avoid collisions with existing keys
1049
+ var result = uid;
1050
+ while (object[result] && object[result].constructor != Marker) {
1051
+ result += 1;
1052
+ }
1053
+ return result;
1054
+ }
1055
+
1056
+ /**
1057
+ * The callback used by `forProps()`.
1058
+ */
1059
+ function propCallback(subValue, subKey) {
1060
+ // exit early to avoid cloning the marker
1061
+ if (subValue && subValue.constructor == Marker) {
1062
+ return;
1063
+ }
1064
+ // add objects to the queue
1065
+ if (subValue === Object(subValue)) {
1066
+ queue[queue.length++] = { 'key': subKey, 'parent': clone, 'source': value };
1067
+ }
1068
+ // assign non-objects
1069
+ else {
1070
+ clone[subKey] = subValue;
1071
+ }
1072
+ }
1073
+
1074
+ while ((data = queue[++index])) {
1075
+ key = data.key;
1076
+ parent = data.parent;
1077
+ source = data.source;
1078
+ clone = value = source ? source[key] : data.value;
1079
+ accessor = circular = descriptor = false;
1080
+ delete queue[index - 1];
1081
+
1082
+ // create a basic clone to filter out functions, DOM elements, and
1083
+ // other non `Object` objects
1084
+ if (value === Object(value)) {
1085
+ ctor = value.constructor;
1086
+ switch (toString.call(value)) {
1087
+ case '[object Array]':
1088
+ clone = new ctor(value.length);
1089
+ break;
1090
+
1091
+ case '[object Boolean]':
1092
+ clone = new ctor(value == true);
1093
+ break;
1094
+
1095
+ case '[object Date]':
1096
+ clone = new ctor(+value);
1097
+ break;
1098
+
1099
+ case '[object Object]':
1100
+ isObject(value) && (clone = new ctor);
1101
+ break;
1102
+
1103
+ case '[object Number]':
1104
+ case '[object String]':
1105
+ clone = new ctor(value);
1106
+ break;
1107
+
1108
+ case '[object RegExp]':
1109
+ clone = ctor(value.source,
1110
+ (value.global ? 'g' : '') +
1111
+ (value.ignoreCase ? 'i' : '') +
1112
+ (value.multiline ? 'm' : ''));
1113
+ }
1114
+ // continue clone if `value` doesn't have an accessor descriptor
1115
+ // http://es5.github.com/#x8.10.1
1116
+ if (clone != value &&
1117
+ !(descriptor = source && has.descriptors && getDescriptor(source, key),
1118
+ accessor = descriptor && (descriptor.get || descriptor.set))) {
1119
+ // use an existing clone (circular reference)
1120
+ if ((extensible = isExtensible(value))) {
1121
+ markerKey = getMarkerKey(value);
1122
+ if (value[markerKey]) {
1123
+ circular = clone = value[markerKey].raw;
1124
+ }
1125
+ } else {
1126
+ // for frozen/sealed objects
1127
+ for (subIndex = 0, length = unmarked.length; subIndex < length; subIndex++) {
1128
+ data = unmarked[subIndex];
1129
+ if (data.object === value) {
1130
+ circular = clone = data.clone;
1131
+ break;
1132
+ }
1133
+ }
1134
+ }
1135
+ if (!circular) {
1136
+ // mark object to allow quickly detecting circular references and tie it to its clone
1137
+ if (extensible) {
1138
+ value[markerKey] = new Marker(clone);
1139
+ marked.push({ 'key': markerKey, 'object': value });
1140
+ } else {
1141
+ // for frozen/sealed objects
1142
+ unmarked.push({ 'clone': clone, 'object': value });
1143
+ }
1144
+ // iterate over object properties
1145
+ forProps(value, propCallback, { 'which': 'all' });
1146
+ }
1147
+ }
1148
+ }
1149
+ if (parent) {
1150
+ // for custom property descriptors
1151
+ if (accessor || (descriptor &&
1152
+ !(descriptor.configurable && descriptor.enumerable && descriptor.writable))) {
1153
+ descriptor.value && (descriptor.value = clone);
1154
+ setDescriptor(parent, key, descriptor);
1155
+ }
1156
+ // for default property descriptors
1157
+ else {
1158
+ parent[key] = clone;
1159
+ }
1160
+ } else {
1161
+ result = clone;
1162
+ }
1163
+ }
1164
+ // remove markers
1165
+ for (index = 0, length = marked.length; index < length; index++) {
1166
+ data = marked[index];
1167
+ delete data.object[data.key];
1168
+ }
1169
+ return result;
1170
+ }
1171
+
1172
+ /**
1173
+ * An iteration utility for arrays and objects.
1174
+ * Callbacks may terminate the loop by explicitly returning `false`.
1175
+ * @static
1176
+ * @memberOf Benchmark
1177
+ * @param {Array|Object} object The object to iterate over.
1178
+ * @param {Function} callback The function called per iteration.
1179
+ * @param {Object} thisArg The `this` binding for the callback function.
1180
+ * @returns {Array|Object} Returns the object iterated over.
1181
+ */
1182
+ function each(object, callback, thisArg) {
1183
+ var fn = callback,
1184
+ index = -1,
1185
+ result = [object, object = Object(object)][0],
1186
+ origObject = object,
1187
+ length = object.length,
1188
+ isSnapshot = !!(object.snapshotItem && (length = object.snapshotLength)),
1189
+ isSplittable = (noCharByIndex || noCharByOwnIndex) && isClassOf(object, 'String'),
1190
+ isConvertable = isSnapshot || isSplittable || 'item' in object;
1191
+
1192
+ // in Opera < 10.5 `hasKey(object, 'length')` returns `false` for NodeLists
1193
+ if (length === length >>> 0) {
1194
+ if (isConvertable) {
1195
+ // the third argument of the callback is the original non-array object
1196
+ callback = function(value, index) {
1197
+ return fn.call(this, value, index, origObject);
1198
+ };
1199
+ // in IE < 9 strings don't support accessing characters by index
1200
+ if (isSplittable) {
1201
+ object = object.split('');
1202
+ } else {
1203
+ object = [];
1204
+ while (++index < length) {
1205
+ // in Safari 2 `index in object` is always `false` for NodeLists
1206
+ object[index] = isSnapshot ? result.snapshotItem(index) : result[index];
1207
+ }
1208
+ }
1209
+ }
1210
+ forEach(object, callback, thisArg);
1211
+ } else {
1212
+ forOwn(object, callback, thisArg);
1213
+ }
1214
+ return result;
1215
+ }
1216
+
1217
+ /**
1218
+ * Copies own/inherited properties of a source object to the destination object.
1219
+ * @static
1220
+ * @memberOf Benchmark
1221
+ * @param {Object} destination The destination object.
1222
+ * @param {Object} [source={}] The source object.
1223
+ * @returns {Object} The destination object.
1224
+ */
1225
+ function extend(destination, source) {
1226
+ // Chrome < 14 incorrectly sets `destination` to `undefined` when we `delete arguments[0]`
1227
+ // http://code.google.com/p/v8/issues/detail?id=839
1228
+ destination = [destination, delete arguments[0]][0];
1229
+ forEach(arguments, function(source) {
1230
+ forProps(source, function(value, key) {
1231
+ destination[key] = value;
1232
+ });
1233
+ });
1234
+ return destination;
1235
+ }
1236
+
1237
+ /**
1238
+ * A generic `Array#filter` like method.
1239
+ * @static
1240
+ * @memberOf Benchmark
1241
+ * @param {Array} array The array to iterate over.
1242
+ * @param {Function|String} callback The function/alias called per iteration.
1243
+ * @param {Object} thisArg The `this` binding for the callback function.
1244
+ * @returns {Array} A new array of values that passed callback filter.
1245
+ * @example
1246
+ *
1247
+ * // get odd numbers
1248
+ * Benchmark.filter([1, 2, 3, 4, 5], function(n) {
1249
+ * return n % 2;
1250
+ * }); // -> [1, 3, 5];
1251
+ *
1252
+ * // get fastest benchmarks
1253
+ * Benchmark.filter(benches, 'fastest');
1254
+ *
1255
+ * // get slowest benchmarks
1256
+ * Benchmark.filter(benches, 'slowest');
1257
+ *
1258
+ * // get benchmarks that completed without erroring
1259
+ * Benchmark.filter(benches, 'successful');
1260
+ */
1261
+ function filter(array, callback, thisArg) {
1262
+ var result;
1263
+
1264
+ if (callback == 'successful') {
1265
+ // callback to exclude errored or unrun benchmarks
1266
+ callback = function(bench) { return bench.cycles; };
1267
+ }
1268
+ else if (callback == 'fastest' || callback == 'slowest') {
1269
+ // get successful, sort by period + margin of error, and filter fastest/slowest
1270
+ result = filter(array, 'successful').sort(function(a, b) {
1271
+ a = a.stats; b = b.stats;
1272
+ return (a.mean + a.moe > b.mean + b.moe ? 1 : -1) * (callback == 'fastest' ? 1 : -1);
1273
+ });
1274
+ result = filter(result, function(bench) {
1275
+ return !result[0].compare(bench);
1276
+ });
1277
+ }
1278
+ return result || reduce(array, function(result, value, index) {
1279
+ return callback.call(thisArg, value, index, array) ? (result.push(value), result) : result;
1280
+ }, []);
1281
+ }
1282
+
1283
+ /**
1284
+ * A generic `Array#forEach` like method.
1285
+ * Callbacks may terminate the loop by explicitly returning `false`.
1286
+ * @static
1287
+ * @memberOf Benchmark
1288
+ * @param {Array} array The array to iterate over.
1289
+ * @param {Function} callback The function called per iteration.
1290
+ * @param {Object} thisArg The `this` binding for the callback function.
1291
+ * @returns {Array} Returns the array iterated over.
1292
+ */
1293
+ function forEach(array, callback, thisArg) {
1294
+ var fn = callback,
1295
+ index = -1,
1296
+ length = (array = Object(array)).length >>> 0;
1297
+
1298
+ if (thisArg !== undefined) {
1299
+ callback = function(value, index, array) {
1300
+ return fn.call(thisArg, value, index, array);
1301
+ };
1302
+ }
1303
+ while (++index < length) {
1304
+ if (index in array &&
1305
+ callback(array[index], index, array) === false) {
1306
+ break;
1307
+ }
1308
+ }
1309
+ return array;
1310
+ }
1311
+
1312
+ /**
1313
+ * Iterates over an object's own properties, executing the `callback` for each.
1314
+ * Callbacks may terminate the loop by explicitly returning `false`.
1315
+ * @static
1316
+ * @memberOf Benchmark
1317
+ * @param {Object} object The object to iterate over.
1318
+ * @param {Function} callback The function executed per own property.
1319
+ * @param {Object} thisArg The `this` binding for the callback function.
1320
+ * @returns {Object} Returns the object iterated over.
1321
+ */
1322
+ function forOwn(object, callback, thisArg) {
1323
+ return forProps(object, callback, { 'bind': thisArg, 'which': 'own' });
1324
+ }
1325
+
1326
+ /**
1327
+ * Converts a number to a more readable comma-separated string representation.
1328
+ * @static
1329
+ * @memberOf Benchmark
1330
+ * @param {Number} number The number to convert.
1331
+ * @returns {String} The more readable string representation.
1332
+ */
1333
+ function formatNumber(number) {
1334
+ number = String(number).split('.');
1335
+ return number[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ',') +
1336
+ (number[1] ? '.' + number[1] : '');
1337
+ }
1338
+
1339
+ /**
1340
+ * Checks if an object has the specified key as a direct property.
1341
+ * @static
1342
+ * @memberOf Benchmark
1343
+ * @param {Object} object The object to check.
1344
+ * @param {String} key The key to check for.
1345
+ * @returns {Boolean} Returns `true` if key is a direct property, else `false`.
1346
+ */
1347
+ function hasKey() {
1348
+ // lazy define for worst case fallback (not as accurate)
1349
+ hasKey = function(object, key) {
1350
+ var parent = object != null && (object.constructor || Object).prototype;
1351
+ return !!parent && key in Object(object) && !(key in parent && object[key] === parent[key]);
1352
+ };
1353
+ // for modern browsers
1354
+ if (isClassOf(hasOwnProperty, 'Function')) {
1355
+ hasKey = function(object, key) {
1356
+ return object != null && hasOwnProperty.call(object, key);
1357
+ };
1358
+ }
1359
+ // for Safari 2
1360
+ else if ({}.__proto__ == Object.prototype) {
1361
+ hasKey = function(object, key) {
1362
+ var result = false;
1363
+ if (object != null) {
1364
+ object = Object(object);
1365
+ object.__proto__ = [object.__proto__, object.__proto__ = null, result = key in object][0];
1366
+ }
1367
+ return result;
1368
+ };
1369
+ }
1370
+ return hasKey.apply(this, arguments);
1371
+ }
1372
+
1373
+ /**
1374
+ * A generic `Array#indexOf` like method.
1375
+ * @static
1376
+ * @memberOf Benchmark
1377
+ * @param {Array} array The array to iterate over.
1378
+ * @param {Mixed} value The value to search for.
1379
+ * @param {Number} [fromIndex=0] The index to start searching from.
1380
+ * @returns {Number} The index of the matched value or `-1`.
1381
+ */
1382
+ function indexOf(array, value, fromIndex) {
1383
+ var index = toInteger(fromIndex),
1384
+ length = (array = Object(array)).length >>> 0;
1385
+
1386
+ index = (index < 0 ? max(0, length + index) : index) - 1;
1387
+ while (++index < length) {
1388
+ if (index in array && value === array[index]) {
1389
+ return index;
1390
+ }
1391
+ }
1392
+ return -1;
1393
+ }
1394
+
1395
+ /**
1396
+ * Invokes a method on all items in an array.
1397
+ * @static
1398
+ * @memberOf Benchmark
1399
+ * @param {Array} benches Array of benchmarks to iterate over.
1400
+ * @param {String|Object} name The name of the method to invoke OR options object.
1401
+ * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with.
1402
+ * @returns {Array} A new array of values returned from each method invoked.
1403
+ * @example
1404
+ *
1405
+ * // invoke `reset` on all benchmarks
1406
+ * Benchmark.invoke(benches, 'reset');
1407
+ *
1408
+ * // invoke `emit` with arguments
1409
+ * Benchmark.invoke(benches, 'emit', 'complete', listener);
1410
+ *
1411
+ * // invoke `run(true)`, treat benchmarks as a queue, and register invoke callbacks
1412
+ * Benchmark.invoke(benches, {
1413
+ *
1414
+ * // invoke the `run` method
1415
+ * 'name': 'run',
1416
+ *
1417
+ * // pass a single argument
1418
+ * 'args': true,
1419
+ *
1420
+ * // treat as queue, removing benchmarks from front of `benches` until empty
1421
+ * 'queued': true,
1422
+ *
1423
+ * // called before any benchmarks have been invoked.
1424
+ * 'onStart': onStart,
1425
+ *
1426
+ * // called between invoking benchmarks
1427
+ * 'onCycle': onCycle,
1428
+ *
1429
+ * // called after all benchmarks have been invoked.
1430
+ * 'onComplete': onComplete
1431
+ * });
1432
+ */
1433
+ function invoke(benches, name) {
1434
+ var args,
1435
+ bench,
1436
+ queued,
1437
+ index = -1,
1438
+ options = { 'onStart': noop, 'onCycle': noop, 'onComplete': noop },
1439
+ result = map(benches, function(bench) { return bench; });
1440
+
1441
+ /**
1442
+ * Checks if invoking `run` with asynchronous cycles.
1443
+ */
1444
+ function isAsync(object) {
1445
+ var async = args[0] && args[0].async;
1446
+ return isRun(object) && (async == null ? object.options.async : async) && has.timeout;
1447
+ }
1448
+
1449
+ /**
1450
+ * Checks if invoking `run` on a benchmark instance.
1451
+ */
1452
+ function isRun(object) {
1453
+ // avoid using `instanceof` here because of IE memory leak issues with host objects
1454
+ return Object(object).constructor == Benchmark && name == 'run';
1455
+ }
1456
+
1457
+ /**
1458
+ * Checks if invoking `run` with synchronous cycles.
1459
+ */
1460
+ function isSync(object) {
1461
+ // if not asynchronous or deferred
1462
+ return !isAsync(object) && !(isRun(object) && object.defer);
1463
+ }
1464
+
1465
+ /**
1466
+ * Executes the method and if synchronous, fetches the next bench.
1467
+ */
1468
+ function execute() {
1469
+ var listeners,
1470
+ sync = isSync(bench);
1471
+
1472
+ if (!sync) {
1473
+ // use `getNext` as a listener
1474
+ bench.on('complete', getNext);
1475
+ listeners = bench.events.complete;
1476
+ listeners.splice(0, 0, listeners.pop());
1477
+ }
1478
+ // execute method
1479
+ result[index] = isClassOf(bench && bench[name], 'Function') ? bench[name].apply(bench, args) : undefined;
1480
+ // if synchronous return true until finished
1481
+ return sync && getNext();
1482
+ }
1483
+
1484
+ /**
1485
+ * Fetches the next bench or executes `onComplete` callback.
1486
+ */
1487
+ function getNext() {
1488
+ var last = bench,
1489
+ sync = isSync(last);
1490
+
1491
+ if (!sync) {
1492
+ last.removeListener('complete', getNext);
1493
+ last.emit('complete');
1494
+ }
1495
+ // choose next benchmark if not exiting early
1496
+ if (options.onCycle.call(benches, Event('cycle'), last) !== false && raiseIndex() !== false) {
1497
+ bench = queued ? benches[0] : result[index];
1498
+ if (!isSync(bench)) {
1499
+ call({ 'async': isAsync(bench), 'benchmark': bench, 'fn': execute });
1500
+ }
1501
+ else if (!sync) {
1502
+ // resume synchronous execution
1503
+ while (execute()) { }
1504
+ }
1505
+ else {
1506
+ // continue synchronous execution
1507
+ return true;
1508
+ }
1509
+ } else {
1510
+ options.onComplete.call(benches, Event('complete'), last);
1511
+ }
1512
+ // when async the `return false` will cancel the rest of the "complete"
1513
+ // listeners because they were called above and when synchronous it will
1514
+ // exit the while-loop
1515
+ return false;
1516
+ }
1517
+
1518
+ /**
1519
+ * Raises `index` to the next defined index or returns `false`.
1520
+ */
1521
+ function raiseIndex() {
1522
+ var length = result.length;
1523
+ // if queued then remove the previous bench and subsequent skipped non-entries
1524
+ if (queued) {
1525
+ do {
1526
+ ++index > 0 && shift.call(benches);
1527
+ } while ((length = benches.length) && !('0' in benches));
1528
+ }
1529
+ else {
1530
+ while (++index < length && !(index in result)) { }
1531
+ }
1532
+ // if we reached the last index then return `false`
1533
+ return (queued ? length : index < length) ? index : (index = false);
1534
+ }
1535
+
1536
+ // juggle arguments
1537
+ if (isClassOf(name, 'String')) {
1538
+ // 2 arguments (array, name)
1539
+ args = slice.call(arguments, 2);
1540
+ } else {
1541
+ // 2 arguments (array, options)
1542
+ options = extend(options, name);
1543
+ name = options.name;
1544
+ args = isClassOf(args = 'args' in options ? options.args : [], 'Array') ? args : [args];
1545
+ queued = options.queued;
1546
+ }
1547
+ // start iterating over the array
1548
+ if (raiseIndex() !== false) {
1549
+ bench = result[index];
1550
+ options.onStart.call(benches, Event('start'), bench);
1551
+
1552
+ // end early if the suite was aborted in an "onStart" listener
1553
+ if (benches.aborted && benches.constructor == Suite && name == 'run') {
1554
+ options.onCycle.call(benches, Event('cycle'), bench);
1555
+ options.onComplete.call(benches, Event('complete'), bench);
1556
+ }
1557
+ // else start
1558
+ else {
1559
+ if (isAsync(bench)) {
1560
+ call({ 'async': true, 'benchmark': bench, 'fn': execute });
1561
+ } else {
1562
+ while (execute()) { }
1563
+ }
1564
+ }
1565
+ }
1566
+ return result;
1567
+ }
1568
+
1569
+ /**
1570
+ * Creates a string of joined array values or object key-value pairs.
1571
+ * @static
1572
+ * @memberOf Benchmark
1573
+ * @param {Array|Object} object The object to operate on.
1574
+ * @param {String} [separator1=','] The separator used between key-value pairs.
1575
+ * @param {String} [separator2=': '] The separator used between keys and values.
1576
+ * @returns {String} The joined result.
1577
+ */
1578
+ function join(object, separator1, separator2) {
1579
+ var result = [],
1580
+ length = (object = Object(object)).length,
1581
+ arrayLike = length === length >>> 0;
1582
+
1583
+ separator2 || (separator2 = ': ');
1584
+ each(object, function(value, key) {
1585
+ result.push(arrayLike ? value : key + separator2 + value);
1586
+ });
1587
+ return result.join(separator1 || ',');
1588
+ }
1589
+
1590
+ /**
1591
+ * A generic `Array#map` like method.
1592
+ * @static
1593
+ * @memberOf Benchmark
1594
+ * @param {Array} array The array to iterate over.
1595
+ * @param {Function} callback The function called per iteration.
1596
+ * @param {Object} thisArg The `this` binding for the callback function.
1597
+ * @returns {Array} A new array of values returned by the callback.
1598
+ */
1599
+ function map(array, callback, thisArg) {
1600
+ return reduce(array, function(result, value, index) {
1601
+ result[index] = callback.call(thisArg, value, index, array);
1602
+ return result;
1603
+ }, Array(Object(array).length >>> 0));
1604
+ }
1605
+
1606
+ /**
1607
+ * Retrieves the value of a specified property from all items in an array.
1608
+ * @static
1609
+ * @memberOf Benchmark
1610
+ * @param {Array} array The array to iterate over.
1611
+ * @param {String} property The property to pluck.
1612
+ * @returns {Array} A new array of property values.
1613
+ */
1614
+ function pluck(array, property) {
1615
+ return map(array, function(object) {
1616
+ return object == null ? undefined : object[property];
1617
+ });
1618
+ }
1619
+
1620
+ /**
1621
+ * A generic `Array#reduce` like method.
1622
+ * @static
1623
+ * @memberOf Benchmark
1624
+ * @param {Array} array The array to iterate over.
1625
+ * @param {Function} callback The function called per iteration.
1626
+ * @param {Mixed} accumulator Initial value of the accumulator.
1627
+ * @returns {Mixed} The accumulator.
1628
+ */
1629
+ function reduce(array, callback, accumulator) {
1630
+ var noaccum = arguments.length < 3;
1631
+ forEach(array, function(value, index) {
1632
+ accumulator = noaccum ? (noaccum = 0, value) : callback(accumulator, value, index, array);
1633
+ });
1634
+ return accumulator;
1635
+ }
1636
+
1637
+ /*--------------------------------------------------------------------------*/
1638
+
1639
+ /**
1640
+ * Aborts all benchmarks in the suite.
1641
+ * @name abort
1642
+ * @memberOf Benchmark.Suite
1643
+ * @returns {Object} The suite instance.
1644
+ */
1645
+ function abortSuite() {
1646
+ var me = this;
1647
+
1648
+ if (me.running) {
1649
+ calledBy.abortSuite = true;
1650
+ me.reset();
1651
+ delete calledBy.abortSuite;
1652
+
1653
+ me.aborted = true;
1654
+ !calledBy.resetSuite && invoke(me, 'abort');
1655
+ me.emit('abort');
1656
+ }
1657
+ return me;
1658
+ }
1659
+
1660
+ /**
1661
+ * Adds a test to the benchmark suite.
1662
+ * @memberOf Benchmark.Suite
1663
+ * @param {String} name A name to identify the benchmark.
1664
+ * @param {Function|String} fn The test to benchmark.
1665
+ * @param {Object} [options={}] Options object.
1666
+ * @returns {Object} The benchmark instance.
1667
+ * @example
1668
+ *
1669
+ * // basic usage
1670
+ * suite.add(fn);
1671
+ *
1672
+ * // or using a name first
1673
+ * suite.add('foo', fn);
1674
+ *
1675
+ * // or with options
1676
+ * suite.add('foo', fn, {
1677
+ * 'onCycle': onCycle,
1678
+ * 'onComplete': onComplete
1679
+ * });
1680
+ */
1681
+ function add(name, fn, options) {
1682
+ var me = this,
1683
+ bench = Benchmark(name, fn, options);
1684
+
1685
+ me.push(bench);
1686
+ me.emit('add', bench);
1687
+ return me;
1688
+ }
1689
+
1690
+ /**
1691
+ * Creates a new suite with cloned benchmarks.
1692
+ * @name clone
1693
+ * @memberOf Benchmark.Suite
1694
+ * @param {Object} options Options object to overwrite cloned options.
1695
+ * @returns {Object} The new suite instance.
1696
+ */
1697
+ function cloneSuite(options) {
1698
+ var me = this,
1699
+ result = new me.constructor(extend({}, me.options, options));
1700
+
1701
+ // copy own properties
1702
+ forOwn(me, function(value, key) {
1703
+ if (!hasKey(result, key)) {
1704
+ result[key] = value && isClassOf(value.clone, 'Function') ? value.clone() : deepClone(value);
1705
+ }
1706
+ });
1707
+ return result;
1708
+ }
1709
+
1710
+ /**
1711
+ * An `Array#filter` like method.
1712
+ * @name filter
1713
+ * @memberOf Benchmark.Suite
1714
+ * @param {Function|String} callback The function/alias called per iteration.
1715
+ * @returns {Object} A new suite of benchmarks that passed callback filter.
1716
+ */
1717
+ function filterSuite(callback) {
1718
+ var me = this,
1719
+ result = new me.constructor;
1720
+
1721
+ result.push.apply(result, filter(me, callback));
1722
+ return result;
1723
+ }
1724
+
1725
+ /**
1726
+ * Resets all benchmarks in the suite.
1727
+ * @name reset
1728
+ * @memberOf Benchmark.Suite
1729
+ * @returns {Object} The suite instance.
1730
+ */
1731
+ function resetSuite() {
1732
+ var me = this,
1733
+ notAborting = !calledBy.abortSuite;
1734
+
1735
+ if (me.running && notAborting) {
1736
+ calledBy.resetSuite = true;
1737
+ me.abort();
1738
+ delete calledBy.resetSuite;
1739
+ me.aborted = false;
1740
+ }
1741
+ else if (me.aborted !== false || me.running !== false) {
1742
+ me.aborted = me.running = false;
1743
+ notAborting && invoke(me, 'reset');
1744
+ me.emit('reset');
1745
+ }
1746
+ return me;
1747
+ }
1748
+
1749
+ /**
1750
+ * Runs the suite.
1751
+ * @name run
1752
+ * @memberOf Benchmark.Suite
1753
+ * @param {Object} [options={}] Options object.
1754
+ * @returns {Object} The suite instance.
1755
+ * @example
1756
+ *
1757
+ * // basic usage
1758
+ * suite.run();
1759
+ *
1760
+ * // or with options
1761
+ * suite.run({ 'async': true, 'queued': true });
1762
+ */
1763
+ function runSuite(options) {
1764
+ var me = this,
1765
+ benches = [];
1766
+
1767
+ me.reset();
1768
+ me.running = true;
1769
+ options || (options = {});
1770
+
1771
+ invoke(me, {
1772
+ 'name': 'run',
1773
+ 'args': options,
1774
+ 'queued': options.queued,
1775
+ 'onStart': function(event, bench) {
1776
+ me.emit('start', bench);
1777
+ },
1778
+ 'onCycle': function(event, bench) {
1779
+ if (bench.error) {
1780
+ me.emit('error', bench);
1781
+ } else if (bench.cycles) {
1782
+ benches.push(bench);
1783
+ }
1784
+ return !me.aborted && me.emit('cycle', bench);
1785
+ },
1786
+ 'onComplete': function(event, bench) {
1787
+ me.running = false;
1788
+ me.emit('complete', bench);
1789
+ }
1790
+ });
1791
+ return me;
1792
+ }
1793
+
1794
+ /*--------------------------------------------------------------------------*/
1795
+
1796
+ /**
1797
+ * Registers a single listener for the specified event type(s).
1798
+ * @memberOf Benchmark, Benchmark.Suite
1799
+ * @param {String} type The event type.
1800
+ * @param {Function} listener The function called when the event occurs.
1801
+ * @returns {Object} The benchmark instance.
1802
+ * @example
1803
+ *
1804
+ * // register a listener for an event type
1805
+ * bench.addListener('cycle', listener);
1806
+ *
1807
+ * // register a listener for multiple event types
1808
+ * bench.addListener('start cycle', listener);
1809
+ */
1810
+ function addListener(type, listener) {
1811
+ var me = this,
1812
+ events = me.events || (me.events = {});
1813
+
1814
+ forEach(type.split(' '), function(type) {
1815
+ (events[type] || (events[type] = [])).push(listener);
1816
+ });
1817
+ return me;
1818
+ }
1819
+
1820
+ /**
1821
+ * Executes all registered listeners of the specified event type.
1822
+ * @memberOf Benchmark, Benchmark.Suite
1823
+ * @param {String|Object} type The event type or object.
1824
+ * @returns {Boolean} Returns `true` if all listeners were executed, else `false`.
1825
+ */
1826
+ function emit(type) {
1827
+ var me = this,
1828
+ event = Event(type),
1829
+ args = (arguments[0] = event, arguments),
1830
+ events = me.events,
1831
+ listeners = events && events[event.type] || [],
1832
+ result = true;
1833
+
1834
+ forEach(listeners.slice(), function(listener) {
1835
+ return (result = listener.apply(me, args) !== false);
1836
+ });
1837
+ return result;
1838
+ }
1839
+
1840
+ /**
1841
+ * Unregisters a single listener for the specified event type(s).
1842
+ * @memberOf Benchmark, Benchmark.Suite
1843
+ * @param {String} type The event type.
1844
+ * @param {Function} listener The function to unregister.
1845
+ * @returns {Object} The benchmark instance.
1846
+ * @example
1847
+ *
1848
+ * // unregister a listener for an event type
1849
+ * bench.removeListener('cycle', listener);
1850
+ *
1851
+ * // unregister a listener for multiple event types
1852
+ * bench.removeListener('start cycle', listener);
1853
+ */
1854
+ function removeListener(type, listener) {
1855
+ var me = this,
1856
+ events = me.events;
1857
+
1858
+ forEach(type.split(' '), function(type) {
1859
+ var listeners = events && events[type] || [],
1860
+ index = indexOf(listeners, listener);
1861
+ if (index > -1) {
1862
+ listeners.splice(index, 1);
1863
+ }
1864
+ });
1865
+ return me;
1866
+ }
1867
+
1868
+ /**
1869
+ * Unregisters all listeners or those for the specified event type(s).
1870
+ * @memberOf Benchmark, Benchmark.Suite
1871
+ * @param {String} type The event type.
1872
+ * @returns {Object} The benchmark instance.
1873
+ * @example
1874
+ *
1875
+ * // unregister all listeners
1876
+ * bench.removeAllListeners();
1877
+ *
1878
+ * // unregister all listeners for an event type
1879
+ * bench.removeAllListeners('cycle');
1880
+ *
1881
+ * // unregister all listeners for multiple event types
1882
+ * bench.removeAllListeners('start cycle complete');
1883
+ */
1884
+ function removeAllListeners(type) {
1885
+ var me = this,
1886
+ events = me.events;
1887
+
1888
+ forEach(type ? type.split(' ') : events, function(type) {
1889
+ (events && events[type] || []).length = 0;
1890
+ });
1891
+ return me;
1892
+ }
1893
+
1894
+ /*--------------------------------------------------------------------------*/
1895
+
1896
+ /**
1897
+ * Aborts the benchmark without recording times.
1898
+ * @memberOf Benchmark
1899
+ * @returns {Object} The benchmark instance.
1900
+ */
1901
+ function abort() {
1902
+ var me = this;
1903
+
1904
+ if (me.running) {
1905
+ if (has.timeout) {
1906
+ forEach(me._timerIds || [], clearTimeout);
1907
+ delete me._timerIds;
1908
+ }
1909
+ // avoid infinite recursion
1910
+ calledBy.abort = true;
1911
+ me.reset();
1912
+ delete calledBy.abort;
1913
+
1914
+ me.aborted = true;
1915
+ me.emit('abort');
1916
+ }
1917
+ return me;
1918
+ }
1919
+
1920
+ /**
1921
+ * Creates a new benchmark using the same test and options.
1922
+ * @memberOf Benchmark
1923
+ * @param {Object} options Options object to overwrite cloned options.
1924
+ * @returns {Object} The new benchmark instance.
1925
+ * @example
1926
+ *
1927
+ * var bizarro = bench.clone({
1928
+ * 'name': 'doppelganger'
1929
+ * });
1930
+ */
1931
+ function clone(options) {
1932
+ var me = this,
1933
+ result = new me.constructor(extend({}, me, options));
1934
+
1935
+ // correct the `options` object
1936
+ result.options = extend({}, me.options, options);
1937
+
1938
+ // copy own custom properties
1939
+ forOwn(me, function(value, key) {
1940
+ if (!hasKey(result, key)) {
1941
+ result[key] = deepClone(value);
1942
+ }
1943
+ });
1944
+ return result;
1945
+ }
1946
+
1947
+ /**
1948
+ * Determines if a benchmark is faster than another.
1949
+ * @memberOf Benchmark
1950
+ * @param {Object} other The benchmark to compare.
1951
+ * @returns {Number} Returns `-1` if slower, `1` if faster, and `0` if indeterminate.
1952
+ */
1953
+ function compare(other) {
1954
+ // unpaired two-sample t-test assuming equal variance
1955
+ // http://en.wikipedia.org/wiki/Student's_t-test
1956
+ // http://www.chem.utoronto.ca/coursenotes/analsci/StatsTutorial/12tailed.html
1957
+ var a = this.stats,
1958
+ b = other.stats,
1959
+ df = a.size + b.size - 2,
1960
+ pooled = (((a.size - 1) * a.variance) + ((b.size - 1) * b.variance)) / df,
1961
+ tstat = (a.mean - b.mean) / sqrt(pooled * (1 / a.size + 1 / b.size)),
1962
+ near = abs(1 - a.mean / b.mean) < 0.055 && a.rme < 3 && b.rme < 3;
1963
+
1964
+ // check if the means aren't close and the t-statistic is significant
1965
+ // (a larger `mean` indicates a slower benchmark)
1966
+ return !near && abs(tstat) > getCriticalValue(df) ? (tstat > 0 ? -1 : 1) : 0;
1967
+ }
1968
+
1969
+ /**
1970
+ * Reset properties and abort if running.
1971
+ * @memberOf Benchmark
1972
+ * @returns {Object} The benchmark instance.
1973
+ */
1974
+ function reset() {
1975
+ var changed,
1976
+ pair,
1977
+ me = this,
1978
+ source = extend({}, me.constructor.prototype, me.options),
1979
+ pairs = [[source, me]];
1980
+
1981
+ if (me.running && !calledBy.abort) {
1982
+ // no worries, `reset()` is called within `abort()`
1983
+ me.abort();
1984
+ me.aborted = source.aborted;
1985
+ }
1986
+ else {
1987
+ // a non-recursive solution to check if properties have changed
1988
+ // http://www.jslab.dk/articles/non.recursive.preorder.traversal.part4
1989
+ while ((pair = pairs.pop())) {
1990
+ forOwn(pair[0], function(value, key) {
1991
+ var other = pair[1][key];
1992
+ if (value && isClassOf(value, 'Object')) {
1993
+ pairs.push([value, other]);
1994
+ }
1995
+ else if (value !== other && !(value == null || isClassOf(value, 'Function'))) {
1996
+ pair[1][key] = value;
1997
+ changed = true;
1998
+ }
1999
+ });
2000
+ }
2001
+ if (changed) {
2002
+ me.emit('reset');
2003
+ }
2004
+ }
2005
+ return me;
2006
+ }
2007
+
2008
+ /**
2009
+ * Displays relevant benchmark information when coerced to a string.
2010
+ * @name toString
2011
+ * @memberOf Benchmark
2012
+ * @returns {String} A string representation of the benchmark instance.
2013
+ */
2014
+ function toStringBench() {
2015
+ var me = this,
2016
+ error = me.error,
2017
+ hz = me.hz,
2018
+ id = me.id,
2019
+ stats = me.stats,
2020
+ size = stats.size,
2021
+ pm = has.java ? '+/-' : '\xb1',
2022
+ result = me.name || (typeof id == 'number' ? '<Test #' + id + '>' : id);
2023
+
2024
+ if (error) {
2025
+ result += ': ' + join(error);
2026
+ } else {
2027
+ result += ' x ' + formatNumber(hz.toFixed(hz < 100 ? 2 : 0)) + ' ops/sec ' + pm +
2028
+ stats.rme.toFixed(2) + '% (' + size + ' run' + (size == 1 ? '' : 's') + ' sampled)';
2029
+ }
2030
+ return result;
2031
+ }
2032
+
2033
+ /*--------------------------------------------------------------------------*/
2034
+
2035
+ /**
2036
+ * Clocks the time taken to execute a test per cycle (secs).
2037
+ * @private
2038
+ * @param {Object} bench The benchmark instance.
2039
+ * @returns {Number} The time taken.
2040
+ */
2041
+ function clock() {
2042
+ var applet,
2043
+ options = Benchmark.options,
2044
+ template = { 'begin': 's$=new n$', 'end': 'r$=(new n$-s$)/1e3', 'uid': uid },
2045
+ timers = [{ 'ns': timer.ns, 'res': max(0.0015, getRes('ms')), 'unit': 'ms' }];
2046
+
2047
+ // lazy defined for hi-res timers
2048
+ clock = function(bench) {
2049
+ var deferred = bench instanceof Deferred && [bench, bench = bench.benchmark][0],
2050
+ host = bench._host || bench,
2051
+ fn = host.fn,
2052
+ fnArg = deferred ? getFirstArgument(fn, 'deferred') : '',
2053
+ stringable = isStringable(fn),
2054
+ decompilable = has.decompilation || stringable,
2055
+ source = {
2056
+ 'setup': getSource(host.setup, preprocess('m$.setup()')),
2057
+ 'fn': getSource(fn, preprocess('f$(' + fnArg + ')')),
2058
+ 'fnArg': fnArg,
2059
+ 'teardown': getSource(host.teardown, preprocess('m$.teardown()'))
2060
+ },
2061
+ compiled = fn.compiled,
2062
+ count = host.count = bench.count,
2063
+ id = host.id,
2064
+ isEmpty = !(source.fn || stringable),
2065
+ name = host.name || (typeof id == 'number' ? '<Test #' + id + '>' : id),
2066
+ ns = timer.ns,
2067
+ result = 0;
2068
+
2069
+ // init `minTime` if needed
2070
+ bench.minTime = host.minTime || (host.minTime = host.options.minTime = options.minTime);
2071
+
2072
+ // repair nanosecond timer
2073
+ // (some Chrome builds erase the `ns` variable after millions of executions)
2074
+ if (applet) {
2075
+ try {
2076
+ ns.nanoTime();
2077
+ } catch(e) {
2078
+ // use non-element to avoid issues with libs that augment them
2079
+ ns = timer.ns = new applet.Packages.nano;
2080
+ }
2081
+ }
2082
+
2083
+ if(!compiled) {
2084
+ // compile in setup/teardown functions and the test loop
2085
+ compiled = host.compiled = createFunction(preprocess('n$,t$'), interpolate(
2086
+ preprocess(deferred
2087
+ ? 'var d$=this,#{fnArg}=d$,r$=d$.resolve,m$=(m$=d$.benchmark)._host||m$,f$=m$.fn;' +
2088
+ 'if(!d$.cycles){d$.resolve=function(){d$.resolve=r$;r$.call(d$);' +
2089
+ 'if(d$.cycles==m$.count){#{teardown}\n}};#{setup}\nt$.start(d$);}#{fn}\nreturn{}'
2090
+ : 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count;#{setup}\n#{begin};' +
2091
+ 'while(i$--){#{fn}\n}#{end};#{teardown}\nreturn{time:r$,uid:"#{uid}"}'),
2092
+ source
2093
+ ));
2094
+
2095
+ try {
2096
+ if (isEmpty) {
2097
+ // Firefox may remove dead code from Function#toString results
2098
+ // http://bugzil.la/536085
2099
+ throw new Error('The test, ' + name + ', is empty. This may be the result of dead code removal.');
2100
+ }
2101
+ else if (!deferred) {
2102
+ // pretest to determine if compiled code is exits early, usually by a
2103
+ // rogue `return` statement, by checking for a return object with the uid
2104
+ host.count = 1;
2105
+ compiled = (compiled.call(host, ns) || {}).uid == uid && compiled;
2106
+ host.count = count;
2107
+ }
2108
+ } catch(e) {
2109
+ compiled = false;
2110
+ bench.error = e || new Error(String(e));
2111
+ host.count = count;
2112
+ }
2113
+ // fallback when a test exits early or errors during pretest
2114
+ if (decompilable && !compiled && !deferred && !isEmpty) {
2115
+ compiled = createFunction(preprocess('n$'), interpolate(
2116
+ preprocess((bench.error && !stringable
2117
+ ? 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count;'
2118
+ : 'function f$(){#{fn}\n}var r$,s$,i$=this.count;'
2119
+ ) + '#{setup}\n#{begin};while(i$--){f$()}#{end};#{teardown}\nreturn{time:r$}'),
2120
+ source
2121
+ ));
2122
+
2123
+ try {
2124
+ // pretest one more time to check for errors
2125
+ host.count = 1;
2126
+ compiled.call(host, ns);
2127
+ host.compiled = compiled;
2128
+ host.count = count;
2129
+ delete bench.error;
2130
+ }
2131
+ catch(e) {
2132
+ host.count = count;
2133
+ if (!bench.error) {
2134
+ host.compiled = compiled;
2135
+ bench.error = e || new Error(String(e));
2136
+ }
2137
+ }
2138
+ }
2139
+ }
2140
+ // if no errors run the full test loop
2141
+ if (!bench.error) {
2142
+ result = compiled.call(deferred || host, ns, timer).time;
2143
+ }
2144
+ return result;
2145
+ };
2146
+
2147
+ /*------------------------------------------------------------------------*/
2148
+
2149
+ /**
2150
+ * Gets the current timer's minimum resolution (secs).
2151
+ */
2152
+ function getRes(unit) {
2153
+ var measured,
2154
+ begin,
2155
+ count = 30,
2156
+ divisor = 1e3,
2157
+ ns = timer.ns,
2158
+ sample = [];
2159
+
2160
+ // get average smallest measurable time
2161
+ while (count--) {
2162
+ if (unit == 'us') {
2163
+ divisor = 1e6;
2164
+ if (ns.stop) {
2165
+ ns.start();
2166
+ while (!(measured = ns.microseconds())) { }
2167
+ } else {
2168
+ begin = timer.ns();
2169
+ while (!(measured = ns() - begin)) { }
2170
+ }
2171
+ }
2172
+ else if (unit == 'ns') {
2173
+ divisor = 1e9;
2174
+ begin = ns.nanoTime();
2175
+ while (!(measured = ns.nanoTime() - begin)) { }
2176
+ }
2177
+ else {
2178
+ begin = new ns;
2179
+ while (!(measured = new ns - begin)) { }
2180
+ }
2181
+ // check for broken timers (nanoTime may have issues)
2182
+ // http://alivebutsleepy.srnet.cz/unreliable-system-nanotime/
2183
+ if (measured > 0) {
2184
+ sample.push(measured);
2185
+ } else {
2186
+ sample.push(Infinity);
2187
+ break;
2188
+ }
2189
+ }
2190
+ // convert to seconds
2191
+ return getMean(sample) / divisor;
2192
+ }
2193
+
2194
+ /**
2195
+ * Replaces all occurrences of `$` with a unique number and
2196
+ * template tokens with content.
2197
+ */
2198
+ function preprocess(code) {
2199
+ return interpolate(code, template).replace(/\$/g, /\d+/.exec(uid));
2200
+ }
2201
+
2202
+ /*------------------------------------------------------------------------*/
2203
+
2204
+ // detect nanosecond support from a Java applet
2205
+ each(window.document && document.applets || [], function(element) {
2206
+ return !(timer.ns = applet = 'nanoTime' in element && element);
2207
+ });
2208
+
2209
+ // check type in case Safari returns an object instead of a number
2210
+ try {
2211
+ if (typeof timer.ns.nanoTime() == 'number') {
2212
+ timers.push({ 'ns': timer.ns, 'res': getRes('ns'), 'unit': 'ns' });
2213
+ }
2214
+ } catch(e) { }
2215
+
2216
+ // detect Chrome's microsecond timer:
2217
+ // enable benchmarking via the --enable-benchmarking command
2218
+ // line switch in at least Chrome 7 to use chrome.Interval
2219
+ try {
2220
+ if ((timer.ns = new (window.chrome || window.chromium).Interval)) {
2221
+ timers.push({ 'ns': timer.ns, 'res': getRes('us'), 'unit': 'us' });
2222
+ }
2223
+ } catch(e) { }
2224
+
2225
+ // detect Node's microtime module:
2226
+ // npm install microtime
2227
+ if ((timer.ns = (req('microtime') || { 'now': 0 }).now)) {
2228
+ timers.push({ 'ns': timer.ns, 'res': getRes('us'), 'unit': 'us' });
2229
+ }
2230
+
2231
+ // pick timer with highest resolution
2232
+ timer = reduce(timers, function(timer, other) {
2233
+ return other.res < timer.res ? other : timer;
2234
+ });
2235
+
2236
+ // remove unused applet
2237
+ if (timer.unit != 'ns' && applet) {
2238
+ applet = (applet.parentNode.removeChild(applet), null);
2239
+ }
2240
+ // error if there are no working timers
2241
+ if (timer.res == Infinity) {
2242
+ throw new Error('Benchmark.js was unable to find a working timer.');
2243
+ }
2244
+ // use API of chosen timer
2245
+ if (timer.unit == 'ns') {
2246
+ extend(template, {
2247
+ 'begin': 's$=n$.nanoTime()',
2248
+ 'end': 'r$=(n$.nanoTime()-s$)/1e9'
2249
+ });
2250
+ }
2251
+ else if (timer.unit == 'us') {
2252
+ extend(template, timer.ns.stop ? {
2253
+ 'begin': 's$=n$.start()',
2254
+ 'end': 'r$=n$.microseconds()/1e6'
2255
+ } : {
2256
+ 'begin': 's$=n$()',
2257
+ 'end': 'r$=(n$()-s$)/1e6'
2258
+ });
2259
+ }
2260
+
2261
+ // define `timer` methods
2262
+ timer.start = createFunction(preprocess('d$'),
2263
+ preprocess('var n$=this.ns,#{begin};d$.timeStamp=s$'));
2264
+
2265
+ timer.stop = createFunction(preprocess('d$'),
2266
+ preprocess('var n$=this.ns,s$=d$.timeStamp,#{end};d$.elapsed=r$'));
2267
+
2268
+ // resolve time span required to achieve a percent uncertainty of at most 1%
2269
+ // http://spiff.rit.edu/classes/phys273/uncert/uncert.html
2270
+ options.minTime || (options.minTime = max(timer.res / 2 / 0.01, 0.05));
2271
+ return clock.apply(null, arguments);
2272
+ }
2273
+
2274
+ /**
2275
+ * Computes stats on benchmark results.
2276
+ * @private
2277
+ * @param {Object} options The options object.
2278
+ */
2279
+ function compute(options) {
2280
+ options || (options = {});
2281
+
2282
+ var async = options.async,
2283
+ bench = options.benchmark,
2284
+ elapsed = 0,
2285
+ queue = [],
2286
+ sample = [],
2287
+ initCount = bench.initCount;
2288
+
2289
+ /**
2290
+ * Adds a number of clones to the queue.
2291
+ */
2292
+ function enqueue(count) {
2293
+ while (count--) {
2294
+ queue.push(bench.clone({
2295
+ '_host': bench,
2296
+ 'events': { 'start': [update], 'cycle': [update] }
2297
+ }));
2298
+ }
2299
+ }
2300
+
2301
+ /**
2302
+ * Updates the clone/host benchmarks to keep their data in sync.
2303
+ */
2304
+ function update(event) {
2305
+ var clone = this,
2306
+ cycles = clone.cycles,
2307
+ type = event.type;
2308
+
2309
+ if (bench.running) {
2310
+ if (type == 'cycle') {
2311
+ if (clone.error) {
2312
+ bench.abort();
2313
+ bench.error = clone.error;
2314
+ bench.emit('error');
2315
+ }
2316
+ else {
2317
+ // Note: the host's bench.count prop is updated in `clock()`
2318
+ bench.hz = clone.hz;
2319
+ bench.initCount = clone.initCount;
2320
+ bench.times.period = clone.times.period;
2321
+ if (cycles > bench.cycles) {
2322
+ bench.cycles = cycles;
2323
+ }
2324
+ }
2325
+ bench.emit(type);
2326
+ }
2327
+ else {
2328
+ // reached in clone's onStart
2329
+ // Note: clone.minTime prop is inited in `clock()`
2330
+ clone.count = bench.initCount;
2331
+ }
2332
+ } else if (bench.aborted) {
2333
+ clone.abort();
2334
+ }
2335
+ }
2336
+
2337
+ /**
2338
+ * Determines if more clones should be queued or if cycling should stop.
2339
+ */
2340
+ function evaluate(event, clone) {
2341
+ var mean,
2342
+ moe,
2343
+ rme,
2344
+ sd,
2345
+ sem,
2346
+ variance,
2347
+ now = +new Date,
2348
+ times = bench.times,
2349
+ done = bench.aborted,
2350
+ maxedOut = (elapsed += now - clone.times.timeStamp) / 1e3 > bench.maxTime,
2351
+ size = sample.push(clone.times.period),
2352
+ varOf = function(sum, x) { return sum + pow(x - mean, 2); };
2353
+
2354
+ // exit early for aborted or unclockable tests
2355
+ if (done || clone.hz == Infinity) {
2356
+ maxedOut = !(size = sample.length = queue.length = 0);
2357
+ }
2358
+ // set host values
2359
+ if (!done) {
2360
+ // sample mean (estimate of the population mean)
2361
+ mean = getMean(sample);
2362
+ // sample variance (estimate of the population variance)
2363
+ variance = reduce(sample, varOf, 0) / (size - 1) || 0;
2364
+ // sample standard deviation (estimate of the population standard deviation)
2365
+ sd = sqrt(variance);
2366
+ // standard error of the mean (aka the standard deviation of the sampling distribution of the sample mean)
2367
+ sem = sd / sqrt(size);
2368
+ // margin of error
2369
+ moe = sem * getCriticalValue(size - 1);
2370
+ // relative margin of error
2371
+ rme = (moe / mean) * 100 || 0;
2372
+
2373
+ extend(bench.stats, {
2374
+ 'moe': moe,
2375
+ 'rme': rme,
2376
+ 'sem': sem,
2377
+ 'deviation': sd,
2378
+ 'mean': mean,
2379
+ 'size': size,
2380
+ 'variance': variance
2381
+ });
2382
+
2383
+ // We exit early when the elapsed time exceeds the maximum time allowed
2384
+ // per benchmark. To prevent massive wait times, we do this even if the
2385
+ // minimum sample size has not been reached. We don't count cycle delays
2386
+ // toward the max time because delays may be increased by browsers that
2387
+ // clamp timeouts in inactive tabs.
2388
+ // https://developer.mozilla.org/en/window.setTimeout#Inactive_tabs
2389
+ if (maxedOut) {
2390
+ done = true;
2391
+ bench.running = false;
2392
+ bench.initCount = initCount;
2393
+ times.elapsed = (now - times.timeStamp) / 1e3;
2394
+ }
2395
+ if (bench.hz != Infinity) {
2396
+ times.period = mean;
2397
+ times.cycle = mean * bench.count;
2398
+ bench.hz = 1 / mean;
2399
+ }
2400
+ }
2401
+ // if time permits, increase sample size to reduce the margin of error
2402
+ if (queue.length < 2 && !maxedOut) {
2403
+ enqueue(1);
2404
+ }
2405
+ // stop the invoke cycle when done
2406
+ return !done;
2407
+ }
2408
+
2409
+ // init queue and begin
2410
+ enqueue(bench.minSamples);
2411
+ invoke(queue, {
2412
+ 'name': 'run',
2413
+ 'args': { 'async': async },
2414
+ 'queued': true,
2415
+ 'onCycle': evaluate,
2416
+ 'onComplete': function() {
2417
+ bench.emit('complete');
2418
+ }
2419
+ });
2420
+ }
2421
+
2422
+ /**
2423
+ * Cycles a benchmark until a run `count` can be established.
2424
+ * @private
2425
+ * @param {Object} options The options object.
2426
+ */
2427
+ function cycle(options) {
2428
+ options || (options = {});
2429
+
2430
+ var clocked,
2431
+ divisor,
2432
+ minTime,
2433
+ period,
2434
+ async = options.async,
2435
+ bench = options.benchmark,
2436
+ count = bench.count,
2437
+ deferred = options.deferred,
2438
+ times = bench.times;
2439
+
2440
+ // continue, if not aborted between cycles
2441
+ if (bench.running) {
2442
+ // host `minTime` is set to `Benchmark.options.minTime` in `clock()`
2443
+ bench.cycles++;
2444
+ clocked = deferred ? deferred.elapsed : clock(bench);
2445
+ minTime = bench.minTime;
2446
+
2447
+ if (bench.error) {
2448
+ bench.abort();
2449
+ bench.emit('error');
2450
+ }
2451
+ }
2452
+ // continue, if not errored
2453
+ if (bench.running) {
2454
+ // time taken to complete last test cycle
2455
+ times.cycle = clocked;
2456
+ // seconds per operation
2457
+ period = times.period = clocked / count;
2458
+ // ops per second
2459
+ bench.hz = 1 / period;
2460
+ // do we need to do another cycle?
2461
+ bench.running = clocked < minTime;
2462
+ // avoid working our way up to this next time
2463
+ bench.initCount = count;
2464
+
2465
+ if (bench.running) {
2466
+ // tests may clock at `0` when `initCount` is a small number,
2467
+ // to avoid that we set its count to something a bit higher
2468
+ if (!clocked && (divisor = divisors[bench.cycles]) != null) {
2469
+ count = floor(4e6 / divisor);
2470
+ }
2471
+ // calculate how many more iterations it will take to achive the `minTime`
2472
+ if (count <= bench.count) {
2473
+ count += Math.ceil((minTime - clocked) / period);
2474
+ }
2475
+ bench.running = count != Infinity;
2476
+ }
2477
+ }
2478
+ // should we exit early?
2479
+ if (bench.emit('cycle') === false) {
2480
+ bench.abort();
2481
+ }
2482
+ // figure out what to do next
2483
+ if (bench.running) {
2484
+ bench.count = count;
2485
+ if (deferred) {
2486
+ (bench._host || bench).compiled.call(deferred, timer.ns, timer);
2487
+ } else {
2488
+ call({
2489
+ 'async': async,
2490
+ 'benchmark': bench,
2491
+ 'fn': function() {
2492
+ cycle({ 'async': async, 'benchmark': bench });
2493
+ }
2494
+ });
2495
+ }
2496
+ } else {
2497
+ // fix TraceMonkey bug associated with clock fallbacks
2498
+ // http://bugzil.la/509069
2499
+ runScript('try{' + uid + '=1;delete ' + uid + '}catch(e){}');
2500
+ // done
2501
+ bench.emit('complete');
2502
+ }
2503
+ }
2504
+
2505
+ /**
2506
+ * Runs the benchmark.
2507
+ * @memberOf Benchmark
2508
+ * @param {Object} [options={}] Options object.
2509
+ * @returns {Object} The benchmark instance.
2510
+ * @example
2511
+ *
2512
+ * // basic usage
2513
+ * bench.run();
2514
+ *
2515
+ * // or with options
2516
+ * bench.run({ 'async': true });
2517
+ */
2518
+ function run(options) {
2519
+ var me = this,
2520
+ async = ((async = options && options.async) == null ? me.async : async) && has.timeout;
2521
+
2522
+ // set running to false so reset() won't call abort()
2523
+ me.running = false;
2524
+ me.reset();
2525
+ me.running = true;
2526
+
2527
+ me.count = me.initCount;
2528
+ me.times.timeStamp = +new Date;
2529
+ me.emit('start');
2530
+
2531
+ if (me._host) {
2532
+ if (me.defer) {
2533
+ Deferred(me);
2534
+ } else {
2535
+ cycle({ 'async': async, 'benchmark': me });
2536
+ }
2537
+ } else {
2538
+ compute({ 'async': async, 'benchmark': me });
2539
+ }
2540
+ return me;
2541
+ }
2542
+
2543
+ /*--------------------------------------------------------------------------*/
2544
+
2545
+ extend(Benchmark, {
2546
+
2547
+ /**
2548
+ * The version number.
2549
+ * @static
2550
+ * @memberOf Benchmark
2551
+ * @type String
2552
+ */
2553
+ 'version': '0.3.0',
2554
+
2555
+ /**
2556
+ * The default options copied by benchmark instances.
2557
+ * @static
2558
+ * @memberOf Benchmark
2559
+ * @type Object
2560
+ */
2561
+ 'options': {
2562
+
2563
+ /**
2564
+ * A flag to indicate that benchmark cycles will execute asynchronously by default.
2565
+ * @memberOf Benchmark.options
2566
+ * @type Boolean
2567
+ */
2568
+ 'async': false,
2569
+
2570
+ /**
2571
+ * A flag to indicate that the benchmark clock is deferred.
2572
+ * @memberOf Benchmark.options
2573
+ * @type Boolean
2574
+ */
2575
+ 'defer': false,
2576
+
2577
+ /**
2578
+ * The delay between test cycles (secs).
2579
+ * @memberOf Benchmark.options
2580
+ * @type Number
2581
+ */
2582
+ 'delay': 0.005,
2583
+
2584
+ /**
2585
+ * Displayed by Benchmark#toString when a `name` is not available (auto-generated if `null`).
2586
+ * @memberOf Benchmark.options
2587
+ * @type String|Null
2588
+ */
2589
+ 'id': null,
2590
+
2591
+ /**
2592
+ * The default number of times to execute a test on a benchmark's first cycle.
2593
+ * @memberOf Benchmark.options
2594
+ * @type Number
2595
+ */
2596
+ 'initCount': 1,
2597
+
2598
+ /**
2599
+ * The maximum time a benchmark is allowed to run before finishing (secs).
2600
+ * Note: Cycle delays aren't counted toward the maximum time.
2601
+ * @memberOf Benchmark.options
2602
+ * @type Number
2603
+ */
2604
+ 'maxTime': 5,
2605
+
2606
+ /**
2607
+ * The minimum sample size required to perform statistical analysis.
2608
+ * @memberOf Benchmark.options
2609
+ * @type Number
2610
+ */
2611
+ 'minSamples': 5,
2612
+
2613
+ /**
2614
+ * The time needed to reduce the percent uncertainty of measurement to 1% (secs).
2615
+ * @memberOf Benchmark.options
2616
+ * @type Number
2617
+ */
2618
+ 'minTime': 0,
2619
+
2620
+ /**
2621
+ * The name of the benchmark.
2622
+ * @memberOf Benchmark.options
2623
+ * @type String|Null
2624
+ */
2625
+ 'name': null
2626
+ },
2627
+
2628
+ /**
2629
+ * Platform object with properties describing things like browser name,
2630
+ * version, and operating system.
2631
+ * @static
2632
+ * @memberOf Benchmark
2633
+ * @type Object
2634
+ */
2635
+ 'platform': req('platform') || window.platform || {
2636
+
2637
+ /**
2638
+ * The platform description.
2639
+ * @memberOf Benchmark.platform
2640
+ * @type String
2641
+ */
2642
+ 'description': window.navigator && navigator.userAgent || null,
2643
+
2644
+ /**
2645
+ * The name of the browser layout engine.
2646
+ * @memberOf Benchmark.platform
2647
+ * @type String|Null
2648
+ */
2649
+ 'layout': null,
2650
+
2651
+ /**
2652
+ * The name of the product hosting the browser.
2653
+ * @memberOf Benchmark.platform
2654
+ * @type String|Null
2655
+ */
2656
+ 'product': null,
2657
+
2658
+ /**
2659
+ * The name of the browser/environment.
2660
+ * @memberOf Benchmark.platform
2661
+ * @type String|Null
2662
+ */
2663
+ 'name': null,
2664
+
2665
+ /**
2666
+ * The name of the product's manufacturer.
2667
+ * @memberOf Benchmark.platform
2668
+ * @type String|Null
2669
+ */
2670
+ 'manufacturer': null,
2671
+
2672
+ /**
2673
+ * The name of the operating system.
2674
+ * @memberOf Benchmark.platform
2675
+ * @type String|Null
2676
+ */
2677
+ 'os': null,
2678
+
2679
+ /**
2680
+ * The alpha/beta release indicator.
2681
+ * @memberOf Benchmark.platform
2682
+ * @type String|Null
2683
+ */
2684
+ 'prerelease': null,
2685
+
2686
+ /**
2687
+ * The browser/environment version.
2688
+ * @memberOf Benchmark.platform
2689
+ * @type String|Null
2690
+ */
2691
+ 'version': null,
2692
+
2693
+ /**
2694
+ * Return platform description when the platform object is coerced to a string.
2695
+ * @memberOf Benchmark.platform
2696
+ * @type Function
2697
+ * @returns {String} The platform description.
2698
+ */
2699
+ 'toString': function() {
2700
+ return this.description || '';
2701
+ }
2702
+ },
2703
+
2704
+ // clone objects
2705
+ 'deepClone': deepClone,
2706
+
2707
+ // iteration utility
2708
+ 'each': each,
2709
+
2710
+ // augment objects
2711
+ 'extend': extend,
2712
+
2713
+ // generic Array#filter
2714
+ 'filter': filter,
2715
+
2716
+ // generic Array#forEach
2717
+ 'forEach': forEach,
2718
+
2719
+ // generic own property iteration utility
2720
+ 'forOwn': forOwn,
2721
+
2722
+ // converts a number to a comma-separated string
2723
+ 'formatNumber': formatNumber,
2724
+
2725
+ // generic Object#hasOwnProperty
2726
+ // (trigger hasKey's lazy define before assigning it to Benchmark)
2727
+ 'hasKey': (hasKey(Benchmark, ''), hasKey),
2728
+
2729
+ // generic Array#indexOf
2730
+ 'indexOf': indexOf,
2731
+
2732
+ // invokes a method on each item in an array
2733
+ 'invoke': invoke,
2734
+
2735
+ // generic Array#join for arrays and objects
2736
+ 'join': join,
2737
+
2738
+ // generic Array#map
2739
+ 'map': map,
2740
+
2741
+ // retrieves a property value from each item in an array
2742
+ 'pluck': pluck,
2743
+
2744
+ // generic Array#reduce
2745
+ 'reduce': reduce
2746
+ });
2747
+
2748
+ /*--------------------------------------------------------------------------*/
2749
+
2750
+ extend(Benchmark.prototype, {
2751
+
2752
+ /**
2753
+ * The number of times a test was executed.
2754
+ * @memberOf Benchmark
2755
+ * @type Number
2756
+ */
2757
+ 'count': 0,
2758
+
2759
+ /**
2760
+ * The number of cycles performed while benchmarking.
2761
+ * @memberOf Benchmark
2762
+ * @type Number
2763
+ */
2764
+ 'cycles': 0,
2765
+
2766
+ /**
2767
+ * The number of executions per second.
2768
+ * @memberOf Benchmark
2769
+ * @type Number
2770
+ */
2771
+ 'hz': 0,
2772
+
2773
+ /**
2774
+ * The compiled test function.
2775
+ * @memberOf Benchmark
2776
+ * @type Function|String
2777
+ */
2778
+ 'compiled': null,
2779
+
2780
+ /**
2781
+ * The error object if the test failed.
2782
+ * @memberOf Benchmark
2783
+ * @type Object|Null
2784
+ */
2785
+ 'error': null,
2786
+
2787
+ /**
2788
+ * The test to benchmark.
2789
+ * @memberOf Benchmark
2790
+ * @type Function|String
2791
+ */
2792
+ 'fn': null,
2793
+
2794
+ /**
2795
+ * A flag to indicate if the benchmark is aborted.
2796
+ * @memberOf Benchmark
2797
+ * @type Boolean
2798
+ */
2799
+ 'aborted': false,
2800
+
2801
+ /**
2802
+ * A flag to indicate if the benchmark is running.
2803
+ * @memberOf Benchmark
2804
+ * @type Boolean
2805
+ */
2806
+ 'running': false,
2807
+
2808
+ /**
2809
+ * Alias of [`Benchmark#addListener`](#Benchmark:addListener).
2810
+ * @memberOf Benchmark, Benchmark.Suite
2811
+ * @type Function
2812
+ */
2813
+ 'on': addListener,
2814
+
2815
+ /**
2816
+ * Compiled into the test and executed immediately **before** the test loop.
2817
+ * @memberOf Benchmark
2818
+ * @type Function|String
2819
+ * @example
2820
+ *
2821
+ * // basic usage
2822
+ * var bench = Benchmark({
2823
+ * 'setup': function() {
2824
+ * var c = this.count,
2825
+ * element = document.getElementById('container');
2826
+ * while (c--) {
2827
+ * element.appendChild(document.createElement('div'));
2828
+ * }
2829
+ * },
2830
+ * 'fn': function() {
2831
+ * element.removeChild(element.lastChild);
2832
+ * }
2833
+ * });
2834
+ *
2835
+ * // compiles to something like:
2836
+ * var c = this.count,
2837
+ * element = document.getElementById('container');
2838
+ * while (c--) {
2839
+ * element.appendChild(document.createElement('div'));
2840
+ * }
2841
+ * var start = new Date;
2842
+ * while (count--) {
2843
+ * element.removeChild(element.lastChild);
2844
+ * }
2845
+ * var end = new Date - start;
2846
+ *
2847
+ * // or using strings
2848
+ * var bench = Benchmark({
2849
+ * 'setup': '\
2850
+ * var a = 0;\n\
2851
+ * (function() {\n\
2852
+ * (function() {\n\
2853
+ * (function() {',
2854
+ * 'fn': 'a += 1;',
2855
+ * 'teardown': '\
2856
+ * }())\n\
2857
+ * }())\n\
2858
+ * }())'
2859
+ * });
2860
+ *
2861
+ * // compiles to something like:
2862
+ * var a = 0;
2863
+ * (function() {
2864
+ * (function() {
2865
+ * (function() {
2866
+ * var start = new Date;
2867
+ * while (count--) {
2868
+ * a += 1;
2869
+ * }
2870
+ * var end = new Date - start;
2871
+ * }())
2872
+ * }())
2873
+ * }())
2874
+ */
2875
+ 'setup': noop,
2876
+
2877
+ /**
2878
+ * Compiled into the test and executed immediately **after** the test loop.
2879
+ * @memberOf Benchmark
2880
+ * @type Function|String
2881
+ */
2882
+ 'teardown': noop,
2883
+
2884
+ /**
2885
+ * An object of stats including mean, margin or error, and standard deviation.
2886
+ * @memberOf Benchmark
2887
+ * @type Object
2888
+ */
2889
+ 'stats': {
2890
+
2891
+ /**
2892
+ * The margin of error.
2893
+ * @memberOf Benchmark#stats
2894
+ * @type Number
2895
+ */
2896
+ 'moe': 0,
2897
+
2898
+ /**
2899
+ * The relative margin of error (expressed as a percentage of the mean).
2900
+ * @memberOf Benchmark#stats
2901
+ * @type Number
2902
+ */
2903
+ 'rme': 0,
2904
+
2905
+ /**
2906
+ * The standard error of the mean.
2907
+ * @memberOf Benchmark#stats
2908
+ * @type Number
2909
+ */
2910
+ 'sem': 0,
2911
+
2912
+ /**
2913
+ * The sample standard deviation.
2914
+ * @memberOf Benchmark#stats
2915
+ * @type Number
2916
+ */
2917
+ 'deviation': 0,
2918
+
2919
+ /**
2920
+ * The sample arithmetic mean.
2921
+ * @memberOf Benchmark#stats
2922
+ * @type Number
2923
+ */
2924
+ 'mean': 0,
2925
+
2926
+ /**
2927
+ * The sample size.
2928
+ * @memberOf Benchmark#stats
2929
+ * @type Number
2930
+ */
2931
+ 'size': 0,
2932
+
2933
+ /**
2934
+ * The sample variance.
2935
+ * @memberOf Benchmark#stats
2936
+ * @type Number
2937
+ */
2938
+ 'variance': 0
2939
+ },
2940
+
2941
+ /**
2942
+ * An object of timing data including cycle, elapsed, period, start, and stop.
2943
+ * @memberOf Benchmark
2944
+ * @type Object
2945
+ */
2946
+ 'times': {
2947
+
2948
+ /**
2949
+ * The time taken to complete the last cycle (secs).
2950
+ * @memberOf Benchmark#times
2951
+ * @type Number
2952
+ */
2953
+ 'cycle': 0,
2954
+
2955
+ /**
2956
+ * The time taken to complete the benchmark (secs).
2957
+ * @memberOf Benchmark#times
2958
+ * @type Number
2959
+ */
2960
+ 'elapsed': 0,
2961
+
2962
+ /**
2963
+ * The time taken to execute the test once (secs).
2964
+ * @memberOf Benchmark#times
2965
+ * @type Number
2966
+ */
2967
+ 'period': 0,
2968
+
2969
+ /**
2970
+ * A timestamp of when the benchmark started (ms).
2971
+ * @memberOf Benchmark#times
2972
+ * @type Number
2973
+ */
2974
+ 'timeStamp': 0
2975
+ },
2976
+
2977
+ // aborts benchmark (does not record times)
2978
+ 'abort': abort,
2979
+
2980
+ // registers a single listener
2981
+ 'addListener': addListener,
2982
+
2983
+ // creates a new benchmark using the same test and options
2984
+ 'clone': clone,
2985
+
2986
+ // compares benchmark's hertz with another
2987
+ 'compare': compare,
2988
+
2989
+ // executes listeners of a specified type
2990
+ 'emit': emit,
2991
+
2992
+ // removes all listeners of a specified type
2993
+ 'removeAllListeners': removeAllListeners,
2994
+
2995
+ // removes a single listener
2996
+ 'removeListener': removeListener,
2997
+
2998
+ // reset benchmark properties
2999
+ 'reset': reset,
3000
+
3001
+ // runs the benchmark
3002
+ 'run': run,
3003
+
3004
+ // pretty print benchmark info
3005
+ 'toString': toStringBench
3006
+ });
3007
+
3008
+ /*--------------------------------------------------------------------------*/
3009
+
3010
+ /**
3011
+ * The default options copied by suite instances.
3012
+ * @static
3013
+ * @memberOf Benchmark.Suite
3014
+ * @type Object
3015
+ */
3016
+ Suite.options = {
3017
+
3018
+ /**
3019
+ * The name of the suite.
3020
+ * @memberOf Benchmark.Suite.options
3021
+ * @type String|Null
3022
+ */
3023
+ 'name': null
3024
+ };
3025
+
3026
+ /*--------------------------------------------------------------------------*/
3027
+
3028
+ extend(Suite.prototype, {
3029
+
3030
+ /**
3031
+ * The number of benchmarks in the suite.
3032
+ * @memberOf Benchmark.Suite
3033
+ * @type Number
3034
+ */
3035
+ 'length': 0,
3036
+
3037
+ /**
3038
+ * A flag to indicate if the suite is aborted.
3039
+ * @memberOf Benchmark.Suite
3040
+ * @type Boolean
3041
+ */
3042
+ 'aborted': false,
3043
+
3044
+ /**
3045
+ * A flag to indicate if the suite is running.
3046
+ * @memberOf Benchmark.Suite
3047
+ * @type Boolean
3048
+ */
3049
+ 'running': false,
3050
+
3051
+ /**
3052
+ * An `Array#forEach` like method.
3053
+ * Callbacks may terminate the loop by explicitly returning `false`.
3054
+ * @memberOf Benchmark.Suite
3055
+ * @param {Function} callback The function called per iteration.
3056
+ * @returns {Object} The suite iterated over.
3057
+ */
3058
+ 'forEach': methodize(forEach),
3059
+
3060
+ /**
3061
+ * An `Array#indexOf` like method.
3062
+ * @memberOf Benchmark.Suite
3063
+ * @param {Mixed} value The value to search for.
3064
+ * @returns {Number} The index of the matched value or `-1`.
3065
+ */
3066
+ 'indexOf': methodize(indexOf),
3067
+
3068
+ /**
3069
+ * Invokes a method on all benchmarks in the suite.
3070
+ * @memberOf Benchmark.Suite
3071
+ * @param {String|Object} name The name of the method to invoke OR options object.
3072
+ * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with.
3073
+ * @returns {Array} A new array of values returned from each method invoked.
3074
+ */
3075
+ 'invoke': methodize(invoke),
3076
+
3077
+ /**
3078
+ * Converts the array to a string.
3079
+ * @memberOf Benchmark.Suite
3080
+ * @param {String} [separator=','] A string to separate each element of the array.
3081
+ * @returns {String} The removed element.
3082
+ */
3083
+ 'join': [].join,
3084
+
3085
+ /**
3086
+ * An `Array#map` like method.
3087
+ * @memberOf Benchmark.Suite
3088
+ * @param {Function} callback The function called per iteration.
3089
+ * @returns {Array} A new array of values returned by the callback.
3090
+ */
3091
+ 'map': methodize(map),
3092
+
3093
+ /**
3094
+ * Retrieves the value of a specified property from all benchmarks in the suite.
3095
+ * @memberOf Benchmark.Suite
3096
+ * @param {String} property The property to pluck.
3097
+ * @returns {Array} A new array of property values.
3098
+ */
3099
+ 'pluck': methodize(pluck),
3100
+
3101
+ /**
3102
+ * Removes the last element of the host array and returns it.
3103
+ * @memberOf Benchmark.Suite
3104
+ * @returns {Mixed} The removed element.
3105
+ */
3106
+ 'pop': [].pop,
3107
+
3108
+ /**
3109
+ * Appends arguments to the end of the array.
3110
+ * @memberOf Benchmark.Suite
3111
+ * @returns {Number} The array length.
3112
+ */
3113
+ 'push': [].push,
3114
+
3115
+ /**
3116
+ * Sorts the elements of the host array.
3117
+ * @memberOf Benchmark.Suite
3118
+ * @param {Function} [compareFn=null] A function that defines the sort order.
3119
+ * @returns {Array} The sorted host array.
3120
+ */
3121
+ 'sort': [].sort,
3122
+
3123
+ /**
3124
+ * An `Array#reduce` like method.
3125
+ * @memberOf Benchmark.Suite
3126
+ * @param {Function} callback The function called per iteration.
3127
+ * @param {Mixed} accumulator Initial value of the accumulator.
3128
+ * @returns {Mixed} The accumulator.
3129
+ */
3130
+ 'reduce': methodize(reduce),
3131
+
3132
+ // aborts all benchmarks in the suite
3133
+ 'abort': abortSuite,
3134
+
3135
+ // adds a benchmark to the suite
3136
+ 'add': add,
3137
+
3138
+ // registers a single listener
3139
+ 'addListener': addListener,
3140
+
3141
+ // creates a new suite with cloned benchmarks
3142
+ 'clone': cloneSuite,
3143
+
3144
+ // executes listeners of a specified type
3145
+ 'emit': emit,
3146
+
3147
+ // creates a new suite of filtered benchmarks
3148
+ 'filter': filterSuite,
3149
+
3150
+ // alias of addListener
3151
+ 'on': addListener,
3152
+
3153
+ // removes all listeners of a specified type
3154
+ 'removeAllListeners': removeAllListeners,
3155
+
3156
+ // removes a single listener
3157
+ 'removeListener': removeListener,
3158
+
3159
+ // resets all benchmarks in the suite
3160
+ 'reset': resetSuite,
3161
+
3162
+ // runs all benchmarks in the suite
3163
+ 'run': runSuite,
3164
+
3165
+ // array methods
3166
+ 'concat': concat,
3167
+
3168
+ 'reverse': reverse,
3169
+
3170
+ 'shift': shift,
3171
+
3172
+ 'slice': slice,
3173
+
3174
+ 'splice': splice,
3175
+
3176
+ 'unshift': unshift
3177
+ });
3178
+
3179
+ /*--------------------------------------------------------------------------*/
3180
+
3181
+ extend(Deferred.prototype, {
3182
+
3183
+ /**
3184
+ * The deferred benchmark instance.
3185
+ * @memberOf Benchmark.Deferred
3186
+ * @type Object
3187
+ */
3188
+ 'benchmark': null,
3189
+
3190
+ /**
3191
+ * The number of deferred cycles performed while benchmarking.
3192
+ * @memberOf Benchmark.Deferred
3193
+ * @type Number
3194
+ */
3195
+ 'cycles': 0,
3196
+
3197
+ /**
3198
+ * The time taken to complete the deferred benchmark (secs).
3199
+ * @memberOf Benchmark.Deferred
3200
+ * @type Number
3201
+ */
3202
+ 'elapsed': 0,
3203
+
3204
+ /**
3205
+ * A timestamp of when the deferred benchmark started (ms).
3206
+ * @memberOf Benchmark.Deferred
3207
+ * @type Number
3208
+ */
3209
+ 'timeStamp': 0,
3210
+
3211
+ // cycles/completes the deferred benchmark
3212
+ 'resolve': resolve
3213
+ });
3214
+
3215
+ /*--------------------------------------------------------------------------*/
3216
+
3217
+ /**
3218
+ * The event type.
3219
+ * @memberOf Benchmark.Event
3220
+ * @type String
3221
+ */
3222
+ Event.prototype.type = '';
3223
+
3224
+ /*--------------------------------------------------------------------------*/
3225
+
3226
+ // expose Deferred, Event and Suite
3227
+ extend(Benchmark, {
3228
+ 'Deferred': Deferred,
3229
+ 'Event': Event,
3230
+ 'Suite': Suite
3231
+ });
3232
+
3233
+ // expose Benchmark
3234
+ if (freeExports) {
3235
+ // in Node.js or RingoJS v0.8.0+
3236
+ if (typeof module == 'object' && module && module.exports == freeExports) {
3237
+ (module.exports = Benchmark).Benchmark = Benchmark;
3238
+ }
3239
+ // in Narwhal or RingoJS v0.7.0-
3240
+ else {
3241
+ freeExports.Benchmark = Benchmark;
3242
+ }
3243
+ }
3244
+ // via curl.js or RequireJS
3245
+ else if (freeDefine) {
3246
+ define('benchmark', function() {
3247
+ return Benchmark;
3248
+ });
3249
+ }
3250
+ // in a browser or Rhino
3251
+ else {
3252
+ // use square bracket notation so Closure Compiler won't munge `Benchmark`
3253
+ // http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
3254
+ window['Benchmark'] = Benchmark;
3255
+ }
3256
+
3257
+ // trigger clock's lazy define early to avoid a security error
3258
+ if (has.air) {
3259
+ clock({ 'fn': noop, 'count': 1, 'options': {} });
3260
+ }
3261
+ }(this));