traceur-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/js/compile.js +7 -15
- data/lib/traceur.rb +2 -1
- data/lib/traceur/compilation_error.rb +27 -0
- data/lib/traceur/compiler.rb +4 -1
- data/lib/traceur/configuration.rb +1 -1
- data/lib/traceur/node/runner.rb +1 -1
- data/lib/traceur/version.rb +1 -1
- data/spec/examples/syntax_error.js +3 -0
- data/spec/integration/examples_spec.rb +6 -0
- data/vendor/node_modules/traceur/LICENSE +202 -0
- data/vendor/node_modules/traceur/README.md +5 -5
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
- data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
- data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
- data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
- data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
- data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
- data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
- data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
- data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
- data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
- data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
- data/vendor/node_modules/traceur/package.json +234 -20
- data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
- data/vendor/node_modules/traceur/src/node/System.js +32 -5
- data/vendor/node_modules/traceur/src/node/api.js +28 -93
- data/vendor/node_modules/traceur/src/node/command.js +84 -19
- data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
- data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
- data/vendor/node_modules/traceur/src/node/require.js +7 -21
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
- data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
- data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
- metadata +196 -190
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
- data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
- data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -1,371 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
module.exports = Iterator;
|
4
|
-
|
5
|
-
var Object = require("./shim-object");
|
6
|
-
var GenericCollection = require("./generic-collection");
|
7
|
-
|
8
|
-
// upgrades an iterable to a Iterator
|
9
|
-
function Iterator(iterable) {
|
10
|
-
|
11
|
-
if (!(this instanceof Iterator)) {
|
12
|
-
return new Iterator(iterable);
|
13
|
-
}
|
14
|
-
|
15
|
-
if (Array.isArray(iterable) || typeof iterable === "string")
|
16
|
-
return Iterator.iterate(iterable);
|
17
|
-
|
18
|
-
iterable = Object(iterable);
|
19
|
-
|
20
|
-
if (iterable instanceof Iterator) {
|
21
|
-
return iterable;
|
22
|
-
} else if (iterable.next) {
|
23
|
-
this.next = function () {
|
24
|
-
return iterable.next();
|
25
|
-
};
|
26
|
-
} else if (iterable.iterate) {
|
27
|
-
var iterator = iterable.iterate();
|
28
|
-
this.next = function () {
|
29
|
-
return iterator.next();
|
30
|
-
};
|
31
|
-
} else if (Object.prototype.toString.call(iterable) === "[object Function]") {
|
32
|
-
this.next = iterable;
|
33
|
-
} else {
|
34
|
-
throw new TypeError("Can't iterate " + iterable);
|
35
|
-
}
|
36
|
-
|
37
|
-
}
|
38
|
-
|
39
|
-
Iterator.prototype.forEach = GenericCollection.prototype.forEach;
|
40
|
-
Iterator.prototype.map = GenericCollection.prototype.map;
|
41
|
-
Iterator.prototype.filter = GenericCollection.prototype.filter;
|
42
|
-
Iterator.prototype.every = GenericCollection.prototype.every;
|
43
|
-
Iterator.prototype.some = GenericCollection.prototype.some;
|
44
|
-
Iterator.prototype.any = GenericCollection.prototype.any;
|
45
|
-
Iterator.prototype.all = GenericCollection.prototype.all;
|
46
|
-
Iterator.prototype.min = GenericCollection.prototype.min;
|
47
|
-
Iterator.prototype.max = GenericCollection.prototype.max;
|
48
|
-
Iterator.prototype.sum = GenericCollection.prototype.sum;
|
49
|
-
Iterator.prototype.average = GenericCollection.prototype.average;
|
50
|
-
Iterator.prototype.flatten = GenericCollection.prototype.flatten;
|
51
|
-
Iterator.prototype.zip = GenericCollection.prototype.zip;
|
52
|
-
Iterator.prototype.enumerate = GenericCollection.prototype.enumerate;
|
53
|
-
Iterator.prototype.sorted = GenericCollection.prototype.sorted;
|
54
|
-
Iterator.prototype.group = GenericCollection.prototype.group;
|
55
|
-
Iterator.prototype.reversed = GenericCollection.prototype.reversed;
|
56
|
-
Iterator.prototype.toArray = GenericCollection.prototype.toArray;
|
57
|
-
Iterator.prototype.toObject = GenericCollection.prototype.toObject;
|
58
|
-
Iterator.prototype.iterator = GenericCollection.prototype.iterator;
|
59
|
-
|
60
|
-
// this is a bit of a cheat so flatten and such work with the generic
|
61
|
-
// reducible
|
62
|
-
Iterator.prototype.constructClone = function (values) {
|
63
|
-
var clone = [];
|
64
|
-
clone.addEach(values);
|
65
|
-
return clone;
|
66
|
-
};
|
67
|
-
|
68
|
-
Iterator.prototype.mapIterator = function (callback /*, thisp*/) {
|
69
|
-
var self = Iterator(this),
|
70
|
-
thisp = arguments[1],
|
71
|
-
i = 0;
|
72
|
-
|
73
|
-
if (Object.prototype.toString.call(callback) != "[object Function]")
|
74
|
-
throw new TypeError();
|
75
|
-
|
76
|
-
return new self.constructor(function () {
|
77
|
-
return callback.call(thisp, self.next(), i++, self);
|
78
|
-
});
|
79
|
-
};
|
80
|
-
|
81
|
-
Iterator.prototype.filterIterator = function (callback /*, thisp*/) {
|
82
|
-
var self = Iterator(this),
|
83
|
-
thisp = arguments[1],
|
84
|
-
i = 0;
|
85
|
-
|
86
|
-
if (Object.prototype.toString.call(callback) != "[object Function]")
|
87
|
-
throw new TypeError();
|
88
|
-
|
89
|
-
return new self.constructor(function () {
|
90
|
-
var value;
|
91
|
-
while (true) {
|
92
|
-
value = self.next();
|
93
|
-
if (callback.call(thisp, value, i++, self))
|
94
|
-
return value;
|
95
|
-
}
|
96
|
-
});
|
97
|
-
};
|
98
|
-
|
99
|
-
Iterator.prototype.reduce = function (callback /*, initial, thisp*/) {
|
100
|
-
var self = Iterator(this),
|
101
|
-
result = arguments[1],
|
102
|
-
thisp = arguments[2],
|
103
|
-
i = 0,
|
104
|
-
value;
|
105
|
-
|
106
|
-
if (Object.prototype.toString.call(callback) != "[object Function]")
|
107
|
-
throw new TypeError();
|
108
|
-
|
109
|
-
// first iteration unrolled
|
110
|
-
try {
|
111
|
-
value = self.next();
|
112
|
-
if (arguments.length > 1) {
|
113
|
-
result = callback.call(thisp, result, value, i, self);
|
114
|
-
} else {
|
115
|
-
result = value;
|
116
|
-
}
|
117
|
-
i++;
|
118
|
-
} catch (exception) {
|
119
|
-
if (isStopIteration(exception)) {
|
120
|
-
if (arguments.length > 1) {
|
121
|
-
return arguments[1]; // initial
|
122
|
-
} else {
|
123
|
-
throw TypeError("cannot reduce a value from an empty iterator with no initial value");
|
124
|
-
}
|
125
|
-
} else {
|
126
|
-
throw exception;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
// remaining entries
|
131
|
-
try {
|
132
|
-
while (true) {
|
133
|
-
value = self.next();
|
134
|
-
result = callback.call(thisp, result, value, i, self);
|
135
|
-
i++;
|
136
|
-
}
|
137
|
-
} catch (exception) {
|
138
|
-
if (isStopIteration(exception)) {
|
139
|
-
return result;
|
140
|
-
} else {
|
141
|
-
throw exception;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
};
|
146
|
-
|
147
|
-
Iterator.prototype.concat = function () {
|
148
|
-
return Iterator.concat(
|
149
|
-
Array.prototype.concat.apply(this, arguments)
|
150
|
-
);
|
151
|
-
};
|
152
|
-
|
153
|
-
Iterator.prototype.dropWhile = function (callback /*, thisp */) {
|
154
|
-
var self = Iterator(this),
|
155
|
-
thisp = arguments[1],
|
156
|
-
stopped = false,
|
157
|
-
stopValue;
|
158
|
-
|
159
|
-
if (Object.prototype.toString.call(callback) != "[object Function]")
|
160
|
-
throw new TypeError();
|
161
|
-
|
162
|
-
self.forEach(function (value, i) {
|
163
|
-
if (!callback.call(thisp, value, i, self)) {
|
164
|
-
stopped = true;
|
165
|
-
stopValue = value;
|
166
|
-
throw StopIteration;
|
167
|
-
}
|
168
|
-
});
|
169
|
-
|
170
|
-
if (stopped) {
|
171
|
-
return self.constructor([stopValue]).concat(self);
|
172
|
-
} else {
|
173
|
-
return self.constructor([]);
|
174
|
-
}
|
175
|
-
};
|
176
|
-
|
177
|
-
Iterator.prototype.takeWhile = function (callback /*, thisp*/) {
|
178
|
-
var self = Iterator(this),
|
179
|
-
thisp = arguments[1];
|
180
|
-
|
181
|
-
if (Object.prototype.toString.call(callback) != "[object Function]")
|
182
|
-
throw new TypeError();
|
183
|
-
|
184
|
-
return self.mapIterator(function (value, i) {
|
185
|
-
if (!callback.call(thisp, value, i, self))
|
186
|
-
throw StopIteration;
|
187
|
-
return value;
|
188
|
-
});
|
189
|
-
};
|
190
|
-
|
191
|
-
Iterator.prototype.zipIterator = function () {
|
192
|
-
return Iterator.unzip(
|
193
|
-
Array.prototype.concat.apply(this, arguments)
|
194
|
-
);
|
195
|
-
};
|
196
|
-
|
197
|
-
Iterator.prototype.enumerateIterator = function (start) {
|
198
|
-
return Iterator.count(start).zipIterator(this);
|
199
|
-
};
|
200
|
-
|
201
|
-
// creates an iterator for Array and String
|
202
|
-
Iterator.iterate = function (iterable) {
|
203
|
-
var start;
|
204
|
-
start = 0;
|
205
|
-
return new Iterator(function () {
|
206
|
-
// advance to next owned entry
|
207
|
-
if (typeof iterable === "object") {
|
208
|
-
while (!(start in iterable)) {
|
209
|
-
// deliberately late bound
|
210
|
-
if (start >= iterable.length)
|
211
|
-
throw StopIteration;
|
212
|
-
start += 1;
|
213
|
-
}
|
214
|
-
} else if (start >= iterable.length) {
|
215
|
-
throw StopIteration;
|
216
|
-
}
|
217
|
-
var result = iterable[start];
|
218
|
-
start += 1;
|
219
|
-
return result;
|
220
|
-
});
|
221
|
-
};
|
222
|
-
|
223
|
-
Iterator.cycle = function (cycle, times) {
|
224
|
-
if (arguments.length < 2)
|
225
|
-
times = Infinity;
|
226
|
-
//cycle = Iterator(cycle).toArray();
|
227
|
-
var next = function () {
|
228
|
-
throw StopIteration;
|
229
|
-
};
|
230
|
-
return new Iterator(function () {
|
231
|
-
var iteration;
|
232
|
-
try {
|
233
|
-
return next();
|
234
|
-
} catch (exception) {
|
235
|
-
if (isStopIteration(exception)) {
|
236
|
-
if (times <= 0)
|
237
|
-
throw exception;
|
238
|
-
times--;
|
239
|
-
iteration = Iterator.iterate(cycle);
|
240
|
-
next = iteration.next.bind(iteration);
|
241
|
-
return next();
|
242
|
-
} else {
|
243
|
-
throw exception;
|
244
|
-
}
|
245
|
-
}
|
246
|
-
});
|
247
|
-
};
|
248
|
-
|
249
|
-
Iterator.concat = function (iterators) {
|
250
|
-
iterators = Iterator(iterators);
|
251
|
-
var next = function () {
|
252
|
-
throw StopIteration;
|
253
|
-
};
|
254
|
-
return new Iterator(function (){
|
255
|
-
var iteration;
|
256
|
-
try {
|
257
|
-
return next();
|
258
|
-
} catch (exception) {
|
259
|
-
if (isStopIteration(exception)) {
|
260
|
-
iteration = Iterator(iterators.next());
|
261
|
-
next = iteration.next.bind(iteration);
|
262
|
-
return next();
|
263
|
-
} else {
|
264
|
-
throw exception;
|
265
|
-
}
|
266
|
-
}
|
267
|
-
});
|
268
|
-
};
|
269
|
-
|
270
|
-
Iterator.unzip = function (iterators) {
|
271
|
-
iterators = Iterator(iterators).map(Iterator);
|
272
|
-
if (iterators.length === 0)
|
273
|
-
return new Iterator([]);
|
274
|
-
return new Iterator(function () {
|
275
|
-
var stopped;
|
276
|
-
var result = iterators.map(function (iterator) {
|
277
|
-
try {
|
278
|
-
return iterator.next();
|
279
|
-
} catch (exception) {
|
280
|
-
if (isStopIteration(exception)) {
|
281
|
-
stopped = true;
|
282
|
-
} else {
|
283
|
-
throw exception;
|
284
|
-
}
|
285
|
-
}
|
286
|
-
});
|
287
|
-
if (stopped) {
|
288
|
-
throw StopIteration;
|
289
|
-
}
|
290
|
-
return result;
|
291
|
-
});
|
292
|
-
};
|
293
|
-
|
294
|
-
Iterator.zip = function () {
|
295
|
-
return Iterator.unzip(
|
296
|
-
Array.prototype.slice.call(arguments)
|
297
|
-
);
|
298
|
-
};
|
299
|
-
|
300
|
-
Iterator.chain = function () {
|
301
|
-
return Iterator.concat(
|
302
|
-
Array.prototype.slice.call(arguments)
|
303
|
-
);
|
304
|
-
};
|
305
|
-
|
306
|
-
Iterator.range = function (start, stop, step) {
|
307
|
-
if (arguments.length < 3) {
|
308
|
-
step = 1;
|
309
|
-
}
|
310
|
-
if (arguments.length < 2) {
|
311
|
-
stop = start;
|
312
|
-
start = 0;
|
313
|
-
}
|
314
|
-
start = start || 0;
|
315
|
-
step = step || 1;
|
316
|
-
return new Iterator(function () {
|
317
|
-
if (start >= stop)
|
318
|
-
throw StopIteration;
|
319
|
-
var result = start;
|
320
|
-
start += step;
|
321
|
-
return result;
|
322
|
-
});
|
323
|
-
};
|
324
|
-
|
325
|
-
Iterator.count = function (start, step) {
|
326
|
-
return Iterator.range(start, Infinity, step);
|
327
|
-
};
|
328
|
-
|
329
|
-
Iterator.repeat = function (value, times) {
|
330
|
-
return new Iterator.range(times).mapIterator(function () {
|
331
|
-
return value;
|
332
|
-
});
|
333
|
-
};
|
334
|
-
|
335
|
-
// shim isStopIteration
|
336
|
-
if (typeof isStopIteration === "undefined") {
|
337
|
-
global.isStopIteration = function (exception) {
|
338
|
-
return Object.prototype.toString.call(exception) === "[object StopIteration]";
|
339
|
-
};
|
340
|
-
}
|
341
|
-
|
342
|
-
// shim StopIteration
|
343
|
-
if (typeof StopIteration === "undefined") {
|
344
|
-
global.StopIteration = {};
|
345
|
-
Object.prototype.toString = (function (toString) {
|
346
|
-
return function () {
|
347
|
-
if (
|
348
|
-
this === global.StopIteration ||
|
349
|
-
this instanceof global.ReturnValue
|
350
|
-
)
|
351
|
-
return "[object StopIteration]";
|
352
|
-
else
|
353
|
-
return toString.call(this, arguments);
|
354
|
-
};
|
355
|
-
})(Object.prototype.toString);
|
356
|
-
}
|
357
|
-
|
358
|
-
// shim ReturnValue
|
359
|
-
if (typeof ReturnValue === "undefined") {
|
360
|
-
global.ReturnValue = function ReturnValue(value) {
|
361
|
-
this.message = "Iteration stopped with " + value;
|
362
|
-
if (Error.captureStackTrace) {
|
363
|
-
Error.captureStackTrace(this, ReturnValue);
|
364
|
-
}
|
365
|
-
if (!(this instanceof global.ReturnValue))
|
366
|
-
return new global.ReturnValue(value);
|
367
|
-
this.value = value;
|
368
|
-
};
|
369
|
-
ReturnValue.prototype = Error.prototype;
|
370
|
-
}
|
371
|
-
|
@@ -1,435 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
module.exports = List;
|
4
|
-
|
5
|
-
var Shim = require("./shim");
|
6
|
-
var GenericCollection = require("./generic-collection");
|
7
|
-
var GenericOrder = require("./generic-order");
|
8
|
-
var PropertyChanges = require("./listen/property-changes");
|
9
|
-
var RangeChanges = require("./listen/range-changes");
|
10
|
-
|
11
|
-
function List(values, equals, getDefault) {
|
12
|
-
if (!(this instanceof List)) {
|
13
|
-
return new List(values, equals, getDefault);
|
14
|
-
}
|
15
|
-
var head = this.head = new this.Node();
|
16
|
-
head.next = head;
|
17
|
-
head.prev = head;
|
18
|
-
this.contentEquals = equals || Object.equals;
|
19
|
-
this.getDefault = getDefault || Function.noop;
|
20
|
-
this.length = 0;
|
21
|
-
this.addEach(values);
|
22
|
-
}
|
23
|
-
|
24
|
-
List.List = List; // hack so require("list").List will work in MontageJS
|
25
|
-
|
26
|
-
Object.addEach(List.prototype, GenericCollection.prototype);
|
27
|
-
Object.addEach(List.prototype, GenericOrder.prototype);
|
28
|
-
Object.addEach(List.prototype, PropertyChanges.prototype);
|
29
|
-
Object.addEach(List.prototype, RangeChanges.prototype);
|
30
|
-
|
31
|
-
List.prototype.constructClone = function (values) {
|
32
|
-
return new this.constructor(values, this.contentEquals, this.getDefault);
|
33
|
-
};
|
34
|
-
|
35
|
-
List.prototype.find = function (value, equals) {
|
36
|
-
equals = equals || this.contentEquals;
|
37
|
-
var head = this.head;
|
38
|
-
var at = head.next;
|
39
|
-
while (at !== head) {
|
40
|
-
if (equals(at.value, value)) {
|
41
|
-
return at;
|
42
|
-
}
|
43
|
-
at = at.next;
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
List.prototype.findLast = function (value, equals) {
|
48
|
-
equals = equals || this.contentEquals;
|
49
|
-
var head = this.head;
|
50
|
-
var at = head.prev;
|
51
|
-
while (at !== head) {
|
52
|
-
if (equals(at.value, value)) {
|
53
|
-
return at;
|
54
|
-
}
|
55
|
-
at = at.prev;
|
56
|
-
}
|
57
|
-
};
|
58
|
-
|
59
|
-
List.prototype.has = function (value, equals) {
|
60
|
-
return !!this.find(value, equals);
|
61
|
-
};
|
62
|
-
|
63
|
-
List.prototype.get = function (value, equals) {
|
64
|
-
var found = this.find(value, equals);
|
65
|
-
if (found) {
|
66
|
-
return found.value;
|
67
|
-
}
|
68
|
-
return this.getDefault(value);
|
69
|
-
};
|
70
|
-
|
71
|
-
// LIFO (delete removes the most recently added equivalent value)
|
72
|
-
List.prototype['delete'] = function (value, equals) {
|
73
|
-
var found = this.findLast(value, equals);
|
74
|
-
if (found) {
|
75
|
-
if (this.dispatchesRangeChanges) {
|
76
|
-
var plus = [];
|
77
|
-
var minus = [value];
|
78
|
-
this.dispatchBeforeRangeChange(plus, minus, found.index);
|
79
|
-
}
|
80
|
-
found['delete']();
|
81
|
-
this.length--;
|
82
|
-
if (this.dispatchesRangeChanges) {
|
83
|
-
this.updateIndexes(found.next, found.index);
|
84
|
-
this.dispatchRangeChange(plus, minus, found.index);
|
85
|
-
}
|
86
|
-
return true;
|
87
|
-
}
|
88
|
-
return false;
|
89
|
-
};
|
90
|
-
|
91
|
-
List.prototype.clear = function () {
|
92
|
-
var plus, minus;
|
93
|
-
if (this.dispatchesRangeChanges) {
|
94
|
-
minus = this.toArray();
|
95
|
-
plus = [];
|
96
|
-
this.dispatchBeforeRangeChange(plus, minus, 0);
|
97
|
-
}
|
98
|
-
this.head.next = this.head.prev = this.head;
|
99
|
-
this.length = 0;
|
100
|
-
if (this.dispatchesRangeChanges) {
|
101
|
-
this.dispatchRangeChange(plus, minus, 0);
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
|
-
List.prototype.add = function (value) {
|
106
|
-
var node = new this.Node(value)
|
107
|
-
if (this.dispatchesRangeChanges) {
|
108
|
-
node.index = this.length;
|
109
|
-
this.dispatchBeforeRangeChange([value], [], node.index);
|
110
|
-
}
|
111
|
-
this.head.addBefore(node);
|
112
|
-
this.length++;
|
113
|
-
if (this.dispatchesRangeChanges) {
|
114
|
-
this.dispatchRangeChange([value], [], node.index);
|
115
|
-
}
|
116
|
-
return true;
|
117
|
-
};
|
118
|
-
|
119
|
-
List.prototype.push = function () {
|
120
|
-
var head = this.head;
|
121
|
-
if (this.dispatchesRangeChanges) {
|
122
|
-
var plus = Array.prototype.slice.call(arguments);
|
123
|
-
var minus = []
|
124
|
-
var index = this.length;
|
125
|
-
this.dispatchBeforeRangeChange(plus, minus, index);
|
126
|
-
var start = this.head.prev;
|
127
|
-
}
|
128
|
-
for (var i = 0; i < arguments.length; i++) {
|
129
|
-
var value = arguments[i];
|
130
|
-
var node = new this.Node(value);
|
131
|
-
head.addBefore(node);
|
132
|
-
}
|
133
|
-
this.length += arguments.length;
|
134
|
-
if (this.dispatchesRangeChanges) {
|
135
|
-
this.updateIndexes(start.next, start.index === undefined ? 0 : start.index + 1);
|
136
|
-
this.dispatchRangeChange(plus, minus, index);
|
137
|
-
}
|
138
|
-
};
|
139
|
-
|
140
|
-
List.prototype.unshift = function () {
|
141
|
-
if (this.dispatchesRangeChanges) {
|
142
|
-
var plus = Array.prototype.slice.call(arguments);
|
143
|
-
var minus = [];
|
144
|
-
this.dispatchBeforeRangeChange(plus, minus, 0);
|
145
|
-
}
|
146
|
-
var at = this.head;
|
147
|
-
for (var i = 0; i < arguments.length; i++) {
|
148
|
-
var value = arguments[i];
|
149
|
-
var node = new this.Node(value);
|
150
|
-
at.addAfter(node);
|
151
|
-
at = node;
|
152
|
-
}
|
153
|
-
this.length += arguments.length;
|
154
|
-
if (this.dispatchesRangeChanges) {
|
155
|
-
this.updateIndexes(this.head.next, 0);
|
156
|
-
this.dispatchRangeChange(plus, minus, 0);
|
157
|
-
}
|
158
|
-
};
|
159
|
-
|
160
|
-
List.prototype.pop = function () {
|
161
|
-
var value;
|
162
|
-
var head = this.head;
|
163
|
-
if (head.prev !== head) {
|
164
|
-
value = head.prev.value;
|
165
|
-
if (this.dispatchesRangeChanges) {
|
166
|
-
var plus = [];
|
167
|
-
var minus = [value];
|
168
|
-
var index = this.length - 1;
|
169
|
-
this.dispatchBeforeRangeChange(plus, minus, index);
|
170
|
-
}
|
171
|
-
head.prev['delete']();
|
172
|
-
this.length--;
|
173
|
-
if (this.dispatchesRangeChanges) {
|
174
|
-
this.dispatchRangeChange(plus, minus, index);
|
175
|
-
}
|
176
|
-
}
|
177
|
-
return value;
|
178
|
-
};
|
179
|
-
|
180
|
-
List.prototype.shift = function () {
|
181
|
-
var value;
|
182
|
-
var head = this.head;
|
183
|
-
if (head.prev !== head) {
|
184
|
-
value = head.next.value;
|
185
|
-
if (this.dispatchesRangeChanges) {
|
186
|
-
var plus = [];
|
187
|
-
var minus = [value];
|
188
|
-
this.dispatchBeforeRangeChange(plus, minus, 0);
|
189
|
-
}
|
190
|
-
head.next['delete']();
|
191
|
-
this.length--;
|
192
|
-
if (this.dispatchesRangeChanges) {
|
193
|
-
this.updateIndexes(this.head.next, 0);
|
194
|
-
this.dispatchRangeChange(plus, minus, 0);
|
195
|
-
}
|
196
|
-
}
|
197
|
-
return value;
|
198
|
-
};
|
199
|
-
|
200
|
-
List.prototype.peek = function () {
|
201
|
-
if (this.head !== this.head.next) {
|
202
|
-
return this.head.next.value;
|
203
|
-
}
|
204
|
-
};
|
205
|
-
|
206
|
-
List.prototype.poke = function (value) {
|
207
|
-
if (this.head !== this.head.next) {
|
208
|
-
this.head.next.value = value;
|
209
|
-
} else {
|
210
|
-
this.push(value);
|
211
|
-
}
|
212
|
-
};
|
213
|
-
|
214
|
-
List.prototype.one = function () {
|
215
|
-
return this.peek();
|
216
|
-
};
|
217
|
-
|
218
|
-
// an internal utility for coercing index offsets to nodes
|
219
|
-
List.prototype.scan = function (at, fallback) {
|
220
|
-
var head = this.head;
|
221
|
-
if (typeof at === "number") {
|
222
|
-
var count = at;
|
223
|
-
if (count >= 0) {
|
224
|
-
at = head.next;
|
225
|
-
while (count) {
|
226
|
-
count--;
|
227
|
-
at = at.next;
|
228
|
-
if (at == head) {
|
229
|
-
break;
|
230
|
-
}
|
231
|
-
}
|
232
|
-
} else {
|
233
|
-
at = head;
|
234
|
-
while (count < 0) {
|
235
|
-
count++;
|
236
|
-
at = at.prev;
|
237
|
-
if (at == head) {
|
238
|
-
break;
|
239
|
-
}
|
240
|
-
}
|
241
|
-
}
|
242
|
-
return at;
|
243
|
-
} else {
|
244
|
-
return at || fallback;
|
245
|
-
}
|
246
|
-
};
|
247
|
-
|
248
|
-
// at and end may both be positive or negative numbers (in which cases they
|
249
|
-
// correspond to numeric indicies, or nodes)
|
250
|
-
List.prototype.slice = function (at, end) {
|
251
|
-
var sliced = [];
|
252
|
-
var head = this.head;
|
253
|
-
at = this.scan(at, head.next);
|
254
|
-
end = this.scan(end, head);
|
255
|
-
|
256
|
-
while (at !== end && at !== head) {
|
257
|
-
sliced.push(at.value);
|
258
|
-
at = at.next;
|
259
|
-
}
|
260
|
-
|
261
|
-
return sliced;
|
262
|
-
};
|
263
|
-
|
264
|
-
List.prototype.splice = function (at, length /*...plus*/) {
|
265
|
-
return this.swap(at, length, Array.prototype.slice.call(arguments, 2));
|
266
|
-
};
|
267
|
-
|
268
|
-
List.prototype.swap = function (start, length, plus) {
|
269
|
-
var initial = start;
|
270
|
-
// start will be head if start is null or -1 (meaning from the end), but
|
271
|
-
// will be head.next if start is 0 (meaning from the beginning)
|
272
|
-
start = this.scan(start, this.head);
|
273
|
-
if (length == null) {
|
274
|
-
length = Infinity;
|
275
|
-
}
|
276
|
-
plus = Array.from(plus);
|
277
|
-
|
278
|
-
// collect the minus array
|
279
|
-
var minus = [];
|
280
|
-
var at = start;
|
281
|
-
while (length-- && length >= 0 && at !== this.head) {
|
282
|
-
minus.push(at.value);
|
283
|
-
at = at.next;
|
284
|
-
}
|
285
|
-
|
286
|
-
// before range change
|
287
|
-
var index, startNode;
|
288
|
-
if (this.dispatchesRangeChanges) {
|
289
|
-
if (start === this.head) {
|
290
|
-
index = this.length;
|
291
|
-
} else if (start.prev === this.head) {
|
292
|
-
index = 0;
|
293
|
-
} else {
|
294
|
-
index = start.index;
|
295
|
-
}
|
296
|
-
startNode = start.prev;
|
297
|
-
this.dispatchBeforeRangeChange(plus, minus, index);
|
298
|
-
}
|
299
|
-
|
300
|
-
// delete minus
|
301
|
-
var at = start;
|
302
|
-
for (var i = 0, at = start; i < minus.length; i++, at = at.next) {
|
303
|
-
at["delete"]();
|
304
|
-
}
|
305
|
-
// add plus
|
306
|
-
if (initial == null && at === this.head) {
|
307
|
-
at = this.head.next;
|
308
|
-
}
|
309
|
-
for (var i = 0; i < plus.length; i++) {
|
310
|
-
var node = new this.Node(plus[i]);
|
311
|
-
at.addBefore(node);
|
312
|
-
}
|
313
|
-
// adjust length
|
314
|
-
this.length += plus.length - minus.length;
|
315
|
-
|
316
|
-
// after range change
|
317
|
-
if (this.dispatchesRangeChanges) {
|
318
|
-
if (start === this.head) {
|
319
|
-
this.updateIndexes(this.head.next, 0);
|
320
|
-
} else {
|
321
|
-
this.updateIndexes(startNode.next, startNode.index + 1);
|
322
|
-
}
|
323
|
-
this.dispatchRangeChange(plus, minus, index);
|
324
|
-
}
|
325
|
-
|
326
|
-
return minus;
|
327
|
-
};
|
328
|
-
|
329
|
-
List.prototype.reverse = function () {
|
330
|
-
if (this.dispatchesRangeChanges) {
|
331
|
-
var minus = this.toArray();
|
332
|
-
var plus = minus.reversed();
|
333
|
-
this.dispatchBeforeRangeChange(plus, minus, 0);
|
334
|
-
}
|
335
|
-
var at = this.head;
|
336
|
-
do {
|
337
|
-
var temp = at.next;
|
338
|
-
at.next = at.prev;
|
339
|
-
at.prev = temp;
|
340
|
-
at = at.next;
|
341
|
-
} while (at !== this.head);
|
342
|
-
if (this.dispatchesRangeChanges) {
|
343
|
-
this.dispatchRangeChange(plus, minus, 0);
|
344
|
-
}
|
345
|
-
return this;
|
346
|
-
};
|
347
|
-
|
348
|
-
List.prototype.sort = function () {
|
349
|
-
this.swap(0, this.length, this.sorted());
|
350
|
-
};
|
351
|
-
|
352
|
-
// TODO account for missing basis argument
|
353
|
-
List.prototype.reduce = function (callback, basis /*, thisp*/) {
|
354
|
-
var thisp = arguments[2];
|
355
|
-
var head = this.head;
|
356
|
-
var at = head.next;
|
357
|
-
while (at !== head) {
|
358
|
-
basis = callback.call(thisp, basis, at.value, at, this);
|
359
|
-
at = at.next;
|
360
|
-
}
|
361
|
-
return basis;
|
362
|
-
};
|
363
|
-
|
364
|
-
List.prototype.reduceRight = function (callback, basis /*, thisp*/) {
|
365
|
-
var thisp = arguments[2];
|
366
|
-
var head = this.head;
|
367
|
-
var at = head.prev;
|
368
|
-
while (at !== head) {
|
369
|
-
basis = callback.call(thisp, basis, at.value, at, this);
|
370
|
-
at = at.prev;
|
371
|
-
}
|
372
|
-
return basis;
|
373
|
-
};
|
374
|
-
|
375
|
-
List.prototype.updateIndexes = function (node, index) {
|
376
|
-
while (node !== this.head) {
|
377
|
-
node.index = index++;
|
378
|
-
node = node.next;
|
379
|
-
}
|
380
|
-
};
|
381
|
-
|
382
|
-
List.prototype.makeObservable = function () {
|
383
|
-
this.head.index = -1;
|
384
|
-
this.updateIndexes(this.head.next, 0);
|
385
|
-
this.dispatchesRangeChanges = true;
|
386
|
-
};
|
387
|
-
|
388
|
-
List.prototype.iterate = function () {
|
389
|
-
return new ListIterator(this.head);
|
390
|
-
};
|
391
|
-
|
392
|
-
function ListIterator(head) {
|
393
|
-
this.head = head;
|
394
|
-
this.at = head.next;
|
395
|
-
};
|
396
|
-
|
397
|
-
ListIterator.prototype.next = function () {
|
398
|
-
if (this.at === this.head) {
|
399
|
-
throw StopIteration;
|
400
|
-
} else {
|
401
|
-
var value = this.at.value;
|
402
|
-
this.at = this.at.next;
|
403
|
-
return value;
|
404
|
-
}
|
405
|
-
};
|
406
|
-
|
407
|
-
List.prototype.Node = Node;
|
408
|
-
|
409
|
-
function Node(value) {
|
410
|
-
this.value = value;
|
411
|
-
this.prev = null;
|
412
|
-
this.next = null;
|
413
|
-
};
|
414
|
-
|
415
|
-
Node.prototype['delete'] = function () {
|
416
|
-
this.prev.next = this.next;
|
417
|
-
this.next.prev = this.prev;
|
418
|
-
};
|
419
|
-
|
420
|
-
Node.prototype.addBefore = function (node) {
|
421
|
-
var prev = this.prev;
|
422
|
-
this.prev = node;
|
423
|
-
node.prev = prev;
|
424
|
-
prev.next = node;
|
425
|
-
node.next = this;
|
426
|
-
};
|
427
|
-
|
428
|
-
Node.prototype.addAfter = function (node) {
|
429
|
-
var next = this.next;
|
430
|
-
this.next = node;
|
431
|
-
node.next = next;
|
432
|
-
next.prev = node;
|
433
|
-
node.prev = this;
|
434
|
-
};
|
435
|
-
|