ende 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/build/build.css +112 -0
- data/build/build.js +36465 -0
- data/component.json +11 -15
- data/components/chaijs/assertion-error/1.0.0/component.json +18 -0
- data/components/chaijs/chai/1.9.1/.gitignore +22 -0
- data/components/chaijs/chai/1.9.1/.mailmap +1 -0
- data/components/chaijs/chai/1.9.1/.npmignore +14 -0
- data/components/chaijs/chai/1.9.1/.travis.yml +14 -0
- data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +173 -0
- data/components/chaijs/chai/1.9.1/History.md +895 -0
- data/components/chaijs/chai/1.9.1/Makefile +93 -0
- data/components/chaijs/chai/1.9.1/README.md +99 -0
- data/components/chaijs/chai/1.9.1/ReleaseNotes.md +482 -0
- data/components/chaijs/chai/1.9.1/bower.json +27 -0
- data/components/chaijs/chai/1.9.1/chai.js +4782 -0
- data/components/chaijs/chai/1.9.1/component.json +50 -0
- data/components/chaijs/chai/1.9.1/karma.conf.js +28 -0
- data/components/chaijs/chai/1.9.1/karma.sauce.js +41 -0
- data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +130 -0
- data/components/chaijs/chai/1.9.1/lib/chai/config.js +50 -0
- data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +1314 -0
- data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +1056 -0
- data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +12 -0
- data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +78 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +111 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +43 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +40 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +32 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +18 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +49 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +20 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +102 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +35 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +114 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +49 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +53 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +51 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +54 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +26 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +44 -0
- data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +45 -0
- data/components/chaijs/chai/1.9.1/lib/chai.js +87 -0
- data/components/chaijs/chai/1.9.1/package.json +42 -0
- data/components/chaijs/chai/1.9.1/sauce.browsers.js +128 -0
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +7 -0
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +53 -0
- data/components/chaijs/chai/1.9.1/test/assert.js +638 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +22 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +22 -0
- data/components/chaijs/chai/1.9.1/test/configuration.js +133 -0
- data/components/chaijs/chai/1.9.1/test/display/errors.js +14 -0
- data/components/chaijs/chai/1.9.1/test/display/message.js +47 -0
- data/components/chaijs/chai/1.9.1/test/expect.js +814 -0
- data/components/chaijs/chai/1.9.1/test/globalShould.js +15 -0
- data/components/chaijs/chai/1.9.1/test/plugins.js +24 -0
- data/components/chaijs/chai/1.9.1/test/should.js +744 -0
- data/components/chaijs/chai/1.9.1/test/utilities.js +309 -0
- data/components/chaijs/deep-eql/0.1.3/component.json +20 -0
- data/components/chaijs/deep-eql/0.1.3/lib/eql.js +257 -0
- data/components/chaijs/type-detect/0.1.1/component.json +18 -0
- data/components/chaijs/type-detect/0.1.1/lib/type.js +142 -0
- data/{vendor/components/indefinido-indemma/components/component-bind → components/component/bind/0.0.1}/component.json +1 -1
- data/{vendor/components/component-classes → components/component/classes/1.1.2}/component.json +1 -1
- data/components/component/classes/1.2.1/component.json +19 -0
- data/components/component/classes/1.2.1/index.js +184 -0
- data/{vendor/components/component-css → components/component/css/0.0.2}/component.json +2 -2
- data/{vendor/components/component-delegate → components/component/delegate/0.1.0}/component.json +2 -2
- data/components/component/dialog/0.2.0/component.json +35 -0
- data/{vendor/components/component-dialog → components/component/dialog/0.2.0}/index.js +74 -40
- data/components/component/dialog/0.2.0/template.html +9 -0
- data/{vendor/components/component-dom → components/component/dom/0.7.1}/component.json +6 -4
- data/{vendor/components/component-domify → components/component/domify/1.0.0}/component.json +6 -4
- data/components/component/domify/1.2.2/component.json +22 -0
- data/components/component/domify/1.2.2/index.js +87 -0
- data/{vendor/components/component-emitter → components/component/emitter/1.0.0}/component.json +1 -1
- data/{vendor/components/component-event → components/component/event/0.1.0}/component.json +3 -3
- data/components/component/event/0.1.0/index.js +40 -0
- data/components/component/event/0.1.3/component.json +13 -0
- data/{vendor/components/component-event → components/component/event/0.1.3}/index.js +3 -5
- data/{vendor/components/component-indexof → components/component/indexof/0.0.1}/component.json +1 -1
- data/{vendor/components/indefinido-indemma/components/component-jquery → components/component/jquery/1.9.1}/component.json +1 -1
- data/{vendor/components/component-matches-selector → components/component/matches-selector/0.1.2}/component.json +6 -4
- data/{vendor/components/component-overlay → components/component/overlay/0.1.1}/component.json +1 -1
- data/{vendor/components/component-query → components/component/query/0.0.1}/component.json +6 -4
- data/components/component/query/0.0.3/component.json +23 -0
- data/components/component/query/0.0.3/index.js +21 -0
- data/{vendor/components/component-querystring → components/component/querystring/1.3.0}/component.json +4 -3
- data/{vendor/components/component-querystring → components/component/querystring/1.3.0}/index.js +26 -2
- data/{vendor/components/component-sort → components/component/sort/0.0.3}/component.json +2 -2
- data/{vendor/components/component-trim → components/component/trim/0.0.1}/component.json +1 -1
- data/{vendor/components/indefinido-indemma/components/component-type → components/component/type/1.0.0}/component.json +4 -2
- data/{vendor/components/component-value → components/component/value/1.1.0}/component.json +6 -4
- data/{vendor/components/components-modernizr → components/components/modernizr/2.6.2}/component.json +2 -3
- data/{vendor/components/indefinido-indemma/components/indefinido-advisable → components/indefinido/advisable/master}/component.json +2 -2
- data/components/indefinido/indemma/master/History.md +0 -0
- data/components/indefinido/indemma/master/build/build.js +26288 -0
- data/components/indefinido/indemma/master/build/development.js +22200 -0
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/build/release.js +264 -273
- data/components/indefinido/indemma/master/build/test.js +22200 -0
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/component.json +6 -6
- data/components/indefinido/indemma/master/components/chaijs-assertion-error/index.js +110 -0
- data/components/indefinido/indemma/master/components/chaijs-chai/index.js +1 -0
- data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/associable.js +2 -14
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/rest.js +2 -7
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/restfulable.js +9 -33
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/scopable.js +45 -16
- data/components/indefinido/indemma/master/lib/record/validatable.js +1100 -0
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/associable_spec.js +2 -3
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/scopable_spec.js +53 -83
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/cpf_spec.js +6 -5
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/associable.coffee +0 -6
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/persistable.coffee +0 -2
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/queryable.coffee +2 -1
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/resource.coffee +2 -3
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/rest.coffee +1 -7
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/restfulable.coffee +8 -34
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/scopable.coffee +31 -32
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validatable.coffee +1 -12
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/associable_spec.coffee +2 -3
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/scopable_spec.coffee +43 -76
- data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/cpf_spec.coffee +4 -3
- data/{vendor/components/mikeric-rivets → components/mikeric/rivets/v0.5.12}/component.json +2 -2
- data/{vendor/components/paulmillr-es6-shim → components/paulmillr/es6-shim/0.10.1}/component.json +11 -4
- data/components/paulmillr/es6-shim/0.10.1/es6-shim.js +1833 -0
- data/{vendor/components/pluma-assimilate → components/pluma/assimilate/0.3.0}/component.json +3 -3
- data/{vendor/components/segmentio-extend → components/segmentio/extend/1.0.0}/component.json +3 -3
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +14 -14
- data/lib/assets/javascripts/aura/extensions/rivets/accounting.js.coffee +1 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +3 -3
- data/lib/assets/javascripts/aura/extensions/stamps/stampit.js +568 -242
- data/lib/assets/javascripts/aura/extensions/widget/#composable.js.coffee# +135 -0
- data/lib/assets/javascripts/aura/extensions/widget/composable.js.coffee +2 -2
- data/lib/assets/javascripts/config/load_components.js.coffee +10 -10
- data/lib/assets/javascripts/ende.js.coffee +21 -18
- data/lib/assets/javascripts/widgets/support/adapters/olark.js +1 -4
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +8 -4
- data/lib/assets/javascripts/widgets/viewer/plugins/scopable.js.coffee +6 -7
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/build.css +4 -3
- data/vendor/assets/components/ende_build.js +29772 -21943
- metadata +284 -217
- data/vendor/components/KapIT-observe-utils/component.json +0 -16
- data/vendor/components/KapIT-observe-utils/lib/observe-utils.js +0 -780
- data/vendor/components/component-dialog/component.json +0 -23
- data/vendor/components/component-dialog/template.js +0 -1
- data/vendor/components/indefinido-indemma/build/development.js +0 -343
- data/vendor/components/indefinido-indemma/build/test.js +0 -343
- data/vendor/components/indefinido-indemma/lib/record/validatable.js +0 -224
- data/vendor/components/indefinido-observable/component.json +0 -24
- data/vendor/components/indefinido-observable/index.js +0 -1
- data/vendor/components/indefinido-observable/lib/adapters/rivets.js +0 -28
- data/vendor/components/indefinido-observable/lib/observable.js +0 -390
- data/vendor/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
- data/vendor/components/indefinido-observable/vendor/shims/accessors.js +0 -248
- data/vendor/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
- data/vendor/components/indefinido-observable/vendor/shims/object.create.js +0 -77
- data/vendor/components/paulmillr-es6-shim/es6-shim.js +0 -996
- /data/{vendor/components/indefinido-indemma/components/chaijs-assertion-error → components/chaijs/assertion-error/1.0.0}/index.js +0 -0
- /data/{vendor/components/indefinido-indemma/components/chaijs-chai → components/chaijs/chai/1.9.1}/index.js +0 -0
- /data/{vendor/components/indefinido-indemma/components/chaijs-chai → components/chaijs/chai/1.9.1}/lib/chai/utils/inspect.js +0 -0
- /data/{vendor/components/indefinido-indemma/History.md → components/chaijs/chai/1.9.1/test/auth/.gitkeep} +0 -0
- /data/{vendor/components/component-bind → components/component/bind/0.0.1}/index.js +0 -0
- /data/{vendor/components/component-classes → components/component/classes/1.1.2}/index.js +0 -0
- /data/{vendor/components/component-css → components/component/css/0.0.2}/index.js +0 -0
- /data/{vendor/components/component-delegate → components/component/delegate/0.1.0}/index.js +0 -0
- /data/{vendor/components/component-dialog → components/component/dialog/0.2.0}/dialog.css +0 -0
- /data/{vendor/components/component-dom → components/component/dom/0.7.1}/index.js +0 -0
- /data/{vendor/components/component-domify → components/component/domify/1.0.0}/index.js +0 -0
- /data/{vendor/components/component-emitter → components/component/emitter/1.0.0}/index.js +0 -0
- /data/{vendor/components/component-indexof → components/component/indexof/0.0.1}/index.js +0 -0
- /data/{vendor/components/component-jquery → components/component/jquery/1.9.1}/index.js +0 -0
- /data/{vendor/components/component-matches-selector → components/component/matches-selector/0.1.2}/index.js +0 -0
- /data/{vendor/components/component-overlay → components/component/overlay/0.1.1}/index.js +0 -0
- /data/{vendor/components/component-overlay → components/component/overlay/0.1.1}/overlay.css +0 -0
- /data/{vendor/components/component-overlay → components/component/overlay/0.1.1}/template.js +0 -0
- /data/{vendor/components/component-query → components/component/query/0.0.1}/index.js +0 -0
- /data/{vendor/components/component-sort → components/component/sort/0.0.3}/index.js +0 -0
- /data/{vendor/components/component-trim → components/component/trim/0.0.1}/index.js +0 -0
- /data/{vendor/components/component-type → components/component/type/1.0.0}/index.js +0 -0
- /data/{vendor/components/component-value → components/component/value/1.1.0}/index.js +0 -0
- /data/{vendor/components/components-modernizr → components/components/modernizr/2.6.2}/modernizr.js +0 -0
- /data/{vendor/components/indefinido-advisable → components/indefinido/advisable/master}/index.js +0 -0
- /data/{vendor/components/indefinido-advisable → components/indefinido/advisable/master}/lib/advisable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/.gitignore +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/.ruby-gemset +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/.ruby-version +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/Gemfile +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/Guardfile +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/Readme.md +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-assertion-error/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/assertion.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/core/assertions.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/interface/assert.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/interface/expect.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/interface/should.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/eql.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/flag.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getActual.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getName.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/index.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/test.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai/utils/type.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/chaijs-chai/lib/chai.js +0 -0
- /data/{vendor → components/indefinido/indemma/master}/components/component-bind/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/component-bind/index.js +0 -0
- /data/{vendor → components/indefinido/indemma/master}/components/component-jquery/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/component-jquery/index.js +0 -0
- /data/{vendor → components/indefinido/indemma/master}/components/component-type/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/component-type/index.js +0 -0
- /data/{vendor → components/indefinido/indemma/master}/components/indefinido-advisable/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-advisable/index.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-advisable/lib/advisable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/index.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/lib/adapters/rivets.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/lib/observable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/vendor/shims/accessors.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/indefinido-observable/vendor/shims/object.create.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/kapit-observe-utils/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/paulmillr-es6-shim/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/paulmillr-es6-shim/es6-shim.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/pluma-assimilate/component.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/components/pluma-assimilate/dist/assimilate.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/index.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/karma.conf.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/extensions/rivets.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/errors.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/maid.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/persistable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/queryable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/resource.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/storable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/translationable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/associated.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/confirmation.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/cpf.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/presence.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/remote.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/type.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record/validations/validatorable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/lib/record.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/package.json +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/persistable_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/queryable_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/resource_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/rest_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/restfulable_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/storable_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/translationable.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validatable_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/associated_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/confirmation_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/presence_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/remote_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record/validations/type_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/record_spec.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/spec_helper.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/spec/support/value_objects/phone.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/extensions/rivets.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/errors.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/maid.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/storable.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/translationable.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/associated.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/confirmation.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/cpf.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/presence.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/remote.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/type.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record/validations/validatorable.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/lib/record.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/persistable_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/queryable_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/resource_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/rest_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/restfulable_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/storable_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/translationable.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validatable_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/associated_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/confirmation_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/presence_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/remote_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record/validations/type_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/record_spec.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/spec_helper.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/src/spec/support/value_objects/phone.coffee +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/vendor/object/mixin.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/vendor/owl/pluralize.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/vendor/sinon.js +0 -0
- /data/{vendor/components/indefinido-indemma → components/indefinido/indemma/master}/vendor/stampit.js +0 -0
- /data/{vendor/components/mikeric-rivets → components/mikeric/rivets/v0.5.12}/dist/rivets.js +0 -0
- /data/{vendor/components/pluma-assimilate → components/pluma/assimilate/0.3.0}/dist/assimilate.js +0 -0
- /data/{vendor/components/segmentio-extend → components/segmentio/extend/1.0.0}/index.js +0 -0
@@ -0,0 +1,1833 @@
|
|
1
|
+
// ES6-shim 0.10.1 (c) 2013-2014 Paul Miller (http://paulmillr.com)
|
2
|
+
// ES6-shim may be freely distributed under the MIT license.
|
3
|
+
// For more details and documentation:
|
4
|
+
// https://github.com/paulmillr/es6-shim/
|
5
|
+
|
6
|
+
(function(undefined) {
|
7
|
+
'use strict';
|
8
|
+
|
9
|
+
var isCallableWithoutNew = function(func) {
|
10
|
+
try { func(); }
|
11
|
+
catch (e) { return false; }
|
12
|
+
return true;
|
13
|
+
};
|
14
|
+
|
15
|
+
var supportsSubclassing = function(C, f) {
|
16
|
+
/* jshint proto:true */
|
17
|
+
try {
|
18
|
+
var Sub = function() { C.apply(this, arguments); };
|
19
|
+
if (!Sub.__proto__) { return false; /* skip test on IE < 11 */ }
|
20
|
+
Object.setPrototypeOf(Sub, C);
|
21
|
+
Sub.prototype = Object.create(C.prototype, {
|
22
|
+
constructor: { value: C }
|
23
|
+
});
|
24
|
+
return f(Sub);
|
25
|
+
} catch (e) {
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
var arePropertyDescriptorsSupported = function() {
|
31
|
+
try {
|
32
|
+
Object.defineProperty({}, 'x', {});
|
33
|
+
return true;
|
34
|
+
} catch (e) { /* this is IE 8. */
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
var startsWithRejectsRegex = function() {
|
40
|
+
var rejectsRegex = false;
|
41
|
+
if (String.prototype.startsWith) {
|
42
|
+
try {
|
43
|
+
'/a/'.startsWith(/a/);
|
44
|
+
} catch (e) { /* this is spec compliant */
|
45
|
+
rejectsRegex = true;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return rejectsRegex;
|
49
|
+
};
|
50
|
+
|
51
|
+
var main = function() {
|
52
|
+
var globals = (typeof global === 'undefined') ? window : global;
|
53
|
+
var global_isFinite = globals.isFinite;
|
54
|
+
var supportsDescriptors = !!Object.defineProperty && arePropertyDescriptorsSupported();
|
55
|
+
var startsWithIsCompliant = startsWithRejectsRegex();
|
56
|
+
var _slice = Array.prototype.slice;
|
57
|
+
var _indexOf = String.prototype.indexOf;
|
58
|
+
var _toString = Object.prototype.toString;
|
59
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
60
|
+
|
61
|
+
// Define configurable, writable and non-enumerable props
|
62
|
+
// if they don’t exist.
|
63
|
+
var defineProperties = function(object, map) {
|
64
|
+
Object.keys(map).forEach(function(name) {
|
65
|
+
var method = map[name];
|
66
|
+
if (name in object) return;
|
67
|
+
if (supportsDescriptors) {
|
68
|
+
Object.defineProperty(object, name, {
|
69
|
+
configurable: true,
|
70
|
+
enumerable: false,
|
71
|
+
writable: true,
|
72
|
+
value: method
|
73
|
+
});
|
74
|
+
} else {
|
75
|
+
object[name] = method;
|
76
|
+
}
|
77
|
+
});
|
78
|
+
};
|
79
|
+
|
80
|
+
// This is a private name in the es6 spec, equal to '[Symbol.iterator]'
|
81
|
+
// we're going to use an arbitrary _-prefixed name to make our shims
|
82
|
+
// work properly with each other, even though we don't have full Iterator
|
83
|
+
// support. That is, `Array.from(map.keys())` will work, but we don't
|
84
|
+
// pretend to export a "real" Iterator interface.
|
85
|
+
var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
|
86
|
+
'_es6shim_iterator_';
|
87
|
+
// Firefox ships a partial implementation using the name @@iterator.
|
88
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
|
89
|
+
// So use that name if we detect it.
|
90
|
+
if (globals.Set && typeof new globals.Set()['@@iterator'] === 'function') {
|
91
|
+
$iterator$ = '@@iterator';
|
92
|
+
}
|
93
|
+
var addIterator = function(prototype, impl) {
|
94
|
+
if (!impl) { impl = function iterator() { return this; }; }
|
95
|
+
var o = {};
|
96
|
+
o[$iterator$] = impl;
|
97
|
+
defineProperties(prototype, o);
|
98
|
+
};
|
99
|
+
|
100
|
+
// taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js
|
101
|
+
// can be replaced with require('is-arguments') if we ever use a build process instead
|
102
|
+
var isArguments = function isArguments(value) {
|
103
|
+
var str = _toString.call(value);
|
104
|
+
var result = str === '[object Arguments]';
|
105
|
+
if (!result) {
|
106
|
+
result = str !== '[object Array]' &&
|
107
|
+
value !== null &&
|
108
|
+
typeof value === 'object' &&
|
109
|
+
typeof value.length === 'number' &&
|
110
|
+
value.length >= 0 &&
|
111
|
+
_toString.call(value.callee) === '[object Function]';
|
112
|
+
}
|
113
|
+
return result;
|
114
|
+
};
|
115
|
+
|
116
|
+
var emulateES6construct = function(o) {
|
117
|
+
if (!ES.TypeIsObject(o)) throw new TypeError('bad object');
|
118
|
+
// es5 approximation to es6 subclass semantics: in es6, 'new Foo'
|
119
|
+
// would invoke Foo.@@create to allocation/initialize the new object.
|
120
|
+
// In es5 we just get the plain object. So if we detect an
|
121
|
+
// uninitialized object, invoke o.constructor.@@create
|
122
|
+
if (!o._es6construct) {
|
123
|
+
if (o.constructor && ES.IsCallable(o.constructor['@@create'])) {
|
124
|
+
o = o.constructor['@@create'](o);
|
125
|
+
}
|
126
|
+
defineProperties(o, { _es6construct: true });
|
127
|
+
}
|
128
|
+
return o;
|
129
|
+
};
|
130
|
+
|
131
|
+
var ES = {
|
132
|
+
CheckObjectCoercible: function(x, optMessage) {
|
133
|
+
/* jshint eqnull:true */
|
134
|
+
if (x == null)
|
135
|
+
throw new TypeError(optMessage || ('Cannot call method on ' + x));
|
136
|
+
return x;
|
137
|
+
},
|
138
|
+
|
139
|
+
TypeIsObject: function(x) {
|
140
|
+
/* jshint eqnull:true */
|
141
|
+
// this is expensive when it returns false; use this function
|
142
|
+
// when you expect it to return true in the common case.
|
143
|
+
return x != null && Object(x) === x;
|
144
|
+
},
|
145
|
+
|
146
|
+
ToObject: function(o, optMessage) {
|
147
|
+
return Object(ES.CheckObjectCoercible(o, optMessage));
|
148
|
+
},
|
149
|
+
|
150
|
+
IsCallable: function(x) {
|
151
|
+
return typeof x === 'function' &&
|
152
|
+
// some versions of IE say that typeof /abc/ === 'function'
|
153
|
+
_toString.call(x) === '[object Function]';
|
154
|
+
},
|
155
|
+
|
156
|
+
ToInt32: function(x) {
|
157
|
+
return x >> 0;
|
158
|
+
},
|
159
|
+
|
160
|
+
ToUint32: function(x) {
|
161
|
+
return x >>> 0;
|
162
|
+
},
|
163
|
+
|
164
|
+
ToInteger: function(value) {
|
165
|
+
var number = +value;
|
166
|
+
if (Number.isNaN(number)) return 0;
|
167
|
+
if (number === 0 || !Number.isFinite(number)) return number;
|
168
|
+
return Math.sign(number) * Math.floor(Math.abs(number));
|
169
|
+
},
|
170
|
+
|
171
|
+
ToLength: function(value) {
|
172
|
+
var len = ES.ToInteger(value);
|
173
|
+
if (len <= 0) return 0; // includes converting -0 to +0
|
174
|
+
if (len > Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
|
175
|
+
return len;
|
176
|
+
},
|
177
|
+
|
178
|
+
SameValue: function(a, b) {
|
179
|
+
if (a === b) {
|
180
|
+
// 0 === -0, but they are not identical.
|
181
|
+
if (a === 0) return 1 / a === 1 / b;
|
182
|
+
return true;
|
183
|
+
}
|
184
|
+
return Number.isNaN(a) && Number.isNaN(b);
|
185
|
+
},
|
186
|
+
|
187
|
+
SameValueZero: function(a, b) {
|
188
|
+
// same as SameValue except for SameValueZero(+0, -0) == true
|
189
|
+
return (a === b) || (Number.isNaN(a) && Number.isNaN(b));
|
190
|
+
},
|
191
|
+
|
192
|
+
IsIterable: function(o) {
|
193
|
+
return ES.TypeIsObject(o) &&
|
194
|
+
(o[$iterator$] !== undefined || isArguments(o));
|
195
|
+
},
|
196
|
+
|
197
|
+
GetIterator: function(o) {
|
198
|
+
if (isArguments(o)) {
|
199
|
+
// special case support for `arguments`
|
200
|
+
return new ArrayIterator(o, "value");
|
201
|
+
}
|
202
|
+
var it = o[$iterator$]();
|
203
|
+
if (!ES.TypeIsObject(it)) {
|
204
|
+
throw new TypeError('bad iterator');
|
205
|
+
}
|
206
|
+
return it;
|
207
|
+
},
|
208
|
+
|
209
|
+
IteratorNext: function(it) {
|
210
|
+
var result = (arguments.length > 1) ? it.next(arguments[1]) : it.next();
|
211
|
+
if (!ES.TypeIsObject(result)) {
|
212
|
+
throw new TypeError('bad iterator');
|
213
|
+
}
|
214
|
+
return result;
|
215
|
+
},
|
216
|
+
|
217
|
+
Construct: function(C, args) {
|
218
|
+
// CreateFromConstructor
|
219
|
+
var obj;
|
220
|
+
if (ES.IsCallable(C['@@create'])) {
|
221
|
+
obj = C['@@create']();
|
222
|
+
} else {
|
223
|
+
// OrdinaryCreateFromConstructor
|
224
|
+
obj = Object.create(C.prototype || null);
|
225
|
+
}
|
226
|
+
// Mark that we've used the es6 construct path
|
227
|
+
// (see emulateES6construct)
|
228
|
+
defineProperties(obj, { _es6construct: true });
|
229
|
+
// Call the constructor.
|
230
|
+
var result = C.apply(obj, args);
|
231
|
+
return ES.TypeIsObject(result) ? result : obj;
|
232
|
+
}
|
233
|
+
};
|
234
|
+
|
235
|
+
var numberConversion = (function () {
|
236
|
+
// from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js#L176-L266
|
237
|
+
// with permission and license, per https://twitter.com/inexorabletash/status/372206509540659200
|
238
|
+
|
239
|
+
function roundToEven(n) {
|
240
|
+
var w = Math.floor(n), f = n - w;
|
241
|
+
if (f < 0.5) {
|
242
|
+
return w;
|
243
|
+
}
|
244
|
+
if (f > 0.5) {
|
245
|
+
return w + 1;
|
246
|
+
}
|
247
|
+
return w % 2 ? w + 1 : w;
|
248
|
+
}
|
249
|
+
|
250
|
+
function packIEEE754(v, ebits, fbits) {
|
251
|
+
var bias = (1 << (ebits - 1)) - 1,
|
252
|
+
s, e, f, ln,
|
253
|
+
i, bits, str, bytes;
|
254
|
+
|
255
|
+
// Compute sign, exponent, fraction
|
256
|
+
if (v !== v) {
|
257
|
+
// NaN
|
258
|
+
// http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping
|
259
|
+
e = (1 << ebits) - 1;
|
260
|
+
f = Math.pow(2, fbits - 1);
|
261
|
+
s = 0;
|
262
|
+
} else if (v === Infinity || v === -Infinity) {
|
263
|
+
e = (1 << ebits) - 1;
|
264
|
+
f = 0;
|
265
|
+
s = (v < 0) ? 1 : 0;
|
266
|
+
} else if (v === 0) {
|
267
|
+
e = 0;
|
268
|
+
f = 0;
|
269
|
+
s = (1 / v === -Infinity) ? 1 : 0;
|
270
|
+
} else {
|
271
|
+
s = v < 0;
|
272
|
+
v = Math.abs(v);
|
273
|
+
|
274
|
+
if (v >= Math.pow(2, 1 - bias)) {
|
275
|
+
e = Math.min(Math.floor(Math.log(v) / Math.LN2), 1023);
|
276
|
+
f = roundToEven(v / Math.pow(2, e) * Math.pow(2, fbits));
|
277
|
+
if (f / Math.pow(2, fbits) >= 2) {
|
278
|
+
e = e + 1;
|
279
|
+
f = 1;
|
280
|
+
}
|
281
|
+
if (e > bias) {
|
282
|
+
// Overflow
|
283
|
+
e = (1 << ebits) - 1;
|
284
|
+
f = 0;
|
285
|
+
} else {
|
286
|
+
// Normal
|
287
|
+
e = e + bias;
|
288
|
+
f = f - Math.pow(2, fbits);
|
289
|
+
}
|
290
|
+
} else {
|
291
|
+
// Subnormal
|
292
|
+
e = 0;
|
293
|
+
f = roundToEven(v / Math.pow(2, 1 - bias - fbits));
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
// Pack sign, exponent, fraction
|
298
|
+
bits = [];
|
299
|
+
for (i = fbits; i; i -= 1) {
|
300
|
+
bits.push(f % 2 ? 1 : 0);
|
301
|
+
f = Math.floor(f / 2);
|
302
|
+
}
|
303
|
+
for (i = ebits; i; i -= 1) {
|
304
|
+
bits.push(e % 2 ? 1 : 0);
|
305
|
+
e = Math.floor(e / 2);
|
306
|
+
}
|
307
|
+
bits.push(s ? 1 : 0);
|
308
|
+
bits.reverse();
|
309
|
+
str = bits.join('');
|
310
|
+
|
311
|
+
// Bits to bytes
|
312
|
+
bytes = [];
|
313
|
+
while (str.length) {
|
314
|
+
bytes.push(parseInt(str.substring(0, 8), 2));
|
315
|
+
str = str.substring(8);
|
316
|
+
}
|
317
|
+
return bytes;
|
318
|
+
}
|
319
|
+
|
320
|
+
function unpackIEEE754(bytes, ebits, fbits) {
|
321
|
+
// Bytes to bits
|
322
|
+
var bits = [], i, j, b, str,
|
323
|
+
bias, s, e, f;
|
324
|
+
|
325
|
+
for (i = bytes.length; i; i -= 1) {
|
326
|
+
b = bytes[i - 1];
|
327
|
+
for (j = 8; j; j -= 1) {
|
328
|
+
bits.push(b % 2 ? 1 : 0);
|
329
|
+
b = b >> 1;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
bits.reverse();
|
333
|
+
str = bits.join('');
|
334
|
+
|
335
|
+
// Unpack sign, exponent, fraction
|
336
|
+
bias = (1 << (ebits - 1)) - 1;
|
337
|
+
s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
|
338
|
+
e = parseInt(str.substring(1, 1 + ebits), 2);
|
339
|
+
f = parseInt(str.substring(1 + ebits), 2);
|
340
|
+
|
341
|
+
// Produce number
|
342
|
+
if (e === (1 << ebits) - 1) {
|
343
|
+
return f !== 0 ? NaN : s * Infinity;
|
344
|
+
} else if (e > 0) {
|
345
|
+
// Normalized
|
346
|
+
return s * Math.pow(2, e - bias) * (1 + f / Math.pow(2, fbits));
|
347
|
+
} else if (f !== 0) {
|
348
|
+
// Denormalized
|
349
|
+
return s * Math.pow(2, -(bias - 1)) * (f / Math.pow(2, fbits));
|
350
|
+
} else {
|
351
|
+
return s < 0 ? -0 : 0;
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
function unpackFloat64(b) { return unpackIEEE754(b, 11, 52); }
|
356
|
+
function packFloat64(v) { return packIEEE754(v, 11, 52); }
|
357
|
+
function unpackFloat32(b) { return unpackIEEE754(b, 8, 23); }
|
358
|
+
function packFloat32(v) { return packIEEE754(v, 8, 23); }
|
359
|
+
|
360
|
+
var conversions = {
|
361
|
+
toFloat32: function (num) { return unpackFloat32(packFloat32(num)); }
|
362
|
+
};
|
363
|
+
if (typeof Float32Array !== 'undefined') {
|
364
|
+
var float32array = new Float32Array(1);
|
365
|
+
conversions.toFloat32 = function (num) {
|
366
|
+
float32array[0] = num;
|
367
|
+
return float32array[0];
|
368
|
+
};
|
369
|
+
}
|
370
|
+
return conversions;
|
371
|
+
}());
|
372
|
+
|
373
|
+
defineProperties(String, {
|
374
|
+
fromCodePoint: function() {
|
375
|
+
var points = _slice.call(arguments, 0, arguments.length);
|
376
|
+
var result = [];
|
377
|
+
var next;
|
378
|
+
for (var i = 0, length = points.length; i < length; i++) {
|
379
|
+
next = Number(points[i]);
|
380
|
+
if (!ES.SameValue(next, ES.ToInteger(next)) ||
|
381
|
+
next < 0 || next > 0x10FFFF) {
|
382
|
+
throw new RangeError('Invalid code point ' + next);
|
383
|
+
}
|
384
|
+
|
385
|
+
if (next < 0x10000) {
|
386
|
+
result.push(String.fromCharCode(next));
|
387
|
+
} else {
|
388
|
+
next -= 0x10000;
|
389
|
+
result.push(String.fromCharCode((next >> 10) + 0xD800));
|
390
|
+
result.push(String.fromCharCode((next % 0x400) + 0xDC00));
|
391
|
+
}
|
392
|
+
}
|
393
|
+
return result.join('');
|
394
|
+
},
|
395
|
+
|
396
|
+
raw: function(callSite) { // raw.length===1
|
397
|
+
var substitutions = _slice.call(arguments, 1, arguments.length);
|
398
|
+
var cooked = ES.ToObject(callSite, 'bad callSite');
|
399
|
+
var rawValue = cooked.raw;
|
400
|
+
var raw = ES.ToObject(rawValue, 'bad raw value');
|
401
|
+
var len = Object.keys(raw).length;
|
402
|
+
var literalsegments = ES.ToLength(len);
|
403
|
+
if (literalsegments === 0) {
|
404
|
+
return '';
|
405
|
+
}
|
406
|
+
|
407
|
+
var stringElements = [];
|
408
|
+
var nextIndex = 0;
|
409
|
+
var nextKey, next, nextSeg, nextSub;
|
410
|
+
while (nextIndex < literalsegments) {
|
411
|
+
nextKey = String(nextIndex);
|
412
|
+
next = raw[nextKey];
|
413
|
+
nextSeg = String(next);
|
414
|
+
stringElements.push(nextSeg);
|
415
|
+
if (nextIndex + 1 >= literalsegments) {
|
416
|
+
break;
|
417
|
+
}
|
418
|
+
next = substitutions[nextKey];
|
419
|
+
if (next === undefined) {
|
420
|
+
break;
|
421
|
+
}
|
422
|
+
nextSub = String(next);
|
423
|
+
stringElements.push(nextSub);
|
424
|
+
nextIndex++;
|
425
|
+
}
|
426
|
+
return stringElements.join('');
|
427
|
+
}
|
428
|
+
});
|
429
|
+
|
430
|
+
var StringShims = {
|
431
|
+
// Fast repeat, uses the `Exponentiation by squaring` algorithm.
|
432
|
+
// Perf: http://jsperf.com/string-repeat2/2
|
433
|
+
repeat: (function() {
|
434
|
+
var repeat = function(s, times) {
|
435
|
+
if (times < 1) return '';
|
436
|
+
if (times % 2) return repeat(s, times - 1) + s;
|
437
|
+
var half = repeat(s, times / 2);
|
438
|
+
return half + half;
|
439
|
+
};
|
440
|
+
|
441
|
+
return function(times) {
|
442
|
+
var thisStr = String(ES.CheckObjectCoercible(this));
|
443
|
+
times = ES.ToInteger(times);
|
444
|
+
if (times < 0 || times === Infinity) {
|
445
|
+
throw new RangeError('Invalid String#repeat value');
|
446
|
+
}
|
447
|
+
return repeat(thisStr, times);
|
448
|
+
};
|
449
|
+
})(),
|
450
|
+
|
451
|
+
startsWith: function(searchStr) {
|
452
|
+
var thisStr = String(ES.CheckObjectCoercible(this));
|
453
|
+
if (_toString.call(searchStr) === '[object RegExp]') throw new TypeError('Cannot call method "startsWith" with a regex');
|
454
|
+
searchStr = String(searchStr);
|
455
|
+
var startArg = arguments.length > 1 ? arguments[1] : undefined;
|
456
|
+
var start = Math.max(ES.ToInteger(startArg), 0);
|
457
|
+
return thisStr.slice(start, start + searchStr.length) === searchStr;
|
458
|
+
},
|
459
|
+
|
460
|
+
endsWith: function(searchStr) {
|
461
|
+
var thisStr = String(ES.CheckObjectCoercible(this));
|
462
|
+
if (_toString.call(searchStr) === '[object RegExp]') throw new TypeError('Cannot call method "endsWith" with a regex');
|
463
|
+
searchStr = String(searchStr);
|
464
|
+
var thisLen = thisStr.length;
|
465
|
+
var posArg = arguments.length > 1 ? arguments[1] : undefined;
|
466
|
+
var pos = posArg === undefined ? thisLen : ES.ToInteger(posArg);
|
467
|
+
var end = Math.min(Math.max(pos, 0), thisLen);
|
468
|
+
return thisStr.slice(end - searchStr.length, end) === searchStr;
|
469
|
+
},
|
470
|
+
|
471
|
+
contains: function(searchString) {
|
472
|
+
var position = arguments.length > 1 ? arguments[1] : undefined;
|
473
|
+
// Somehow this trick makes method 100% compat with the spec.
|
474
|
+
return _indexOf.call(this, searchString, position) !== -1;
|
475
|
+
},
|
476
|
+
|
477
|
+
codePointAt: function(pos) {
|
478
|
+
var thisStr = String(ES.CheckObjectCoercible(this));
|
479
|
+
var position = ES.ToInteger(pos);
|
480
|
+
var length = thisStr.length;
|
481
|
+
if (position < 0 || position >= length) return undefined;
|
482
|
+
var first = thisStr.charCodeAt(position);
|
483
|
+
var isEnd = (position + 1 === length);
|
484
|
+
if (first < 0xD800 || first > 0xDBFF || isEnd) return first;
|
485
|
+
var second = thisStr.charCodeAt(position + 1);
|
486
|
+
if (second < 0xDC00 || second > 0xDFFF) return first;
|
487
|
+
return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000;
|
488
|
+
}
|
489
|
+
};
|
490
|
+
defineProperties(String.prototype, StringShims);
|
491
|
+
|
492
|
+
// see https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator
|
493
|
+
var StringIterator = function(s) {
|
494
|
+
this._s = String(ES.CheckObjectCoercible(s));
|
495
|
+
this._i = 0;
|
496
|
+
};
|
497
|
+
StringIterator.prototype.next = function() {
|
498
|
+
var s = this._s, i = this._i;
|
499
|
+
if (s===undefined || i >= s.length) {
|
500
|
+
this._s = undefined;
|
501
|
+
return { value: undefined, done: true };
|
502
|
+
}
|
503
|
+
var first = s.charCodeAt(i), second, len;
|
504
|
+
if (first < 0xD800 || first > 0xDBFF || (i+1) == s.length) {
|
505
|
+
len = 1;
|
506
|
+
} else {
|
507
|
+
second = s.charCodeAt(i+1);
|
508
|
+
len = (second < 0xDC00 || second > 0xDFFF) ? 1 : 2;
|
509
|
+
}
|
510
|
+
this._i = i + len;
|
511
|
+
return { value: s.substr(i, len), done: false };
|
512
|
+
};
|
513
|
+
addIterator(StringIterator.prototype);
|
514
|
+
addIterator(String.prototype, function() {
|
515
|
+
return new StringIterator(this);
|
516
|
+
});
|
517
|
+
|
518
|
+
if (!startsWithIsCompliant) {
|
519
|
+
// Firefox has a noncompliant startsWith implementation
|
520
|
+
String.prototype.startsWith = StringShims.startsWith;
|
521
|
+
String.prototype.endsWith = StringShims.endsWith;
|
522
|
+
}
|
523
|
+
|
524
|
+
defineProperties(Array, {
|
525
|
+
from: function(iterable) {
|
526
|
+
var mapFn = arguments.length > 1 ? arguments[1] : undefined;
|
527
|
+
var thisArg = arguments.length > 2 ? arguments[2] : undefined;
|
528
|
+
|
529
|
+
var list = ES.ToObject(iterable, 'bad iterable');
|
530
|
+
if (mapFn !== undefined && !ES.IsCallable(mapFn)) {
|
531
|
+
throw new TypeError('Array.from: when provided, the second argument must be a function');
|
532
|
+
}
|
533
|
+
|
534
|
+
var usingIterator = ES.IsIterable(list);
|
535
|
+
// does the spec really mean that Arrays should use ArrayIterator?
|
536
|
+
// https://bugs.ecmascript.org/show_bug.cgi?id=2416
|
537
|
+
//if (Array.isArray(list)) { usingIterator=false; }
|
538
|
+
var length = usingIterator ? 0 : ES.ToLength(list.length);
|
539
|
+
var result = ES.IsCallable(this) ? Object(usingIterator ? new this() : new this(length)) : new Array(length);
|
540
|
+
var it = usingIterator ? ES.GetIterator(list) : null;
|
541
|
+
var value;
|
542
|
+
|
543
|
+
for (var i = 0; usingIterator || (i < length); i++) {
|
544
|
+
if (usingIterator) {
|
545
|
+
value = ES.IteratorNext(it);
|
546
|
+
if (value.done) {
|
547
|
+
length = i;
|
548
|
+
break;
|
549
|
+
}
|
550
|
+
value = value.value;
|
551
|
+
} else {
|
552
|
+
value = list[i];
|
553
|
+
}
|
554
|
+
if (mapFn !== undefined) {
|
555
|
+
result[i] = thisArg ? mapFn.call(thisArg, value) : mapFn(value);
|
556
|
+
} else {
|
557
|
+
result[i] = value;
|
558
|
+
}
|
559
|
+
}
|
560
|
+
|
561
|
+
result.length = length;
|
562
|
+
return result;
|
563
|
+
},
|
564
|
+
|
565
|
+
of: function() {
|
566
|
+
return Array.from(arguments);
|
567
|
+
}
|
568
|
+
});
|
569
|
+
|
570
|
+
defineProperties(globals, {
|
571
|
+
ArrayIterator: function(array, kind) {
|
572
|
+
this.i = 0;
|
573
|
+
this.array = array;
|
574
|
+
this.kind = kind;
|
575
|
+
}
|
576
|
+
});
|
577
|
+
|
578
|
+
defineProperties(ArrayIterator.prototype, {
|
579
|
+
next: function() {
|
580
|
+
var i = this.i, array = this.array;
|
581
|
+
if (i===undefined || this.kind===undefined) {
|
582
|
+
throw new TypeError('Not an ArrayIterator');
|
583
|
+
}
|
584
|
+
if (array!==undefined) {
|
585
|
+
var len = ES.ToLength(array.length);
|
586
|
+
for (; i < len; i++) {
|
587
|
+
var kind = this.kind;
|
588
|
+
var retval;
|
589
|
+
if (kind === "key") {
|
590
|
+
retval = i;
|
591
|
+
}
|
592
|
+
if (kind === "value") {
|
593
|
+
retval = array[i];
|
594
|
+
}
|
595
|
+
if (kind === "entry") {
|
596
|
+
retval = [i, array[i]];
|
597
|
+
}
|
598
|
+
this.i = i + 1;
|
599
|
+
return { value: retval, done: false };
|
600
|
+
}
|
601
|
+
}
|
602
|
+
this.array = undefined;
|
603
|
+
return { value: undefined, done: true };
|
604
|
+
}
|
605
|
+
});
|
606
|
+
addIterator(ArrayIterator.prototype);
|
607
|
+
|
608
|
+
defineProperties(Array.prototype, {
|
609
|
+
copyWithin: function(target, start) {
|
610
|
+
var end = arguments[2]; // copyWithin.length must be 2
|
611
|
+
var o = ES.ToObject(this);
|
612
|
+
var len = ES.ToLength(o.length);
|
613
|
+
target = ES.ToInteger(target);
|
614
|
+
start = ES.ToInteger(start);
|
615
|
+
var to = target < 0 ? Math.max(len + target, 0) : Math.min(target, len);
|
616
|
+
var from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
617
|
+
end = (end===undefined) ? len : ES.ToInteger(end);
|
618
|
+
var fin = end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
619
|
+
var count = Math.min(fin - from, len - to);
|
620
|
+
var direction = 1;
|
621
|
+
if (from < to && to < (from + count)) {
|
622
|
+
direction = -1;
|
623
|
+
from += count - 1;
|
624
|
+
to += count - 1;
|
625
|
+
}
|
626
|
+
while (count > 0) {
|
627
|
+
if (_hasOwnProperty.call(o, from)) {
|
628
|
+
o[to] = o[from];
|
629
|
+
} else {
|
630
|
+
delete o[from];
|
631
|
+
}
|
632
|
+
from += direction;
|
633
|
+
to += direction;
|
634
|
+
count -= 1;
|
635
|
+
}
|
636
|
+
return o;
|
637
|
+
},
|
638
|
+
fill: function(value) {
|
639
|
+
var start = arguments[1], end = arguments[2]; // fill.length===1
|
640
|
+
var O = ES.ToObject(this);
|
641
|
+
var len = ES.ToLength(O.length);
|
642
|
+
start = ES.ToInteger(start===undefined ? 0 : start);
|
643
|
+
end = ES.ToInteger(end===undefined ? len : end);
|
644
|
+
|
645
|
+
var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
646
|
+
|
647
|
+
for (var i = relativeStart; i < len && i < end; ++i) {
|
648
|
+
O[i] = value;
|
649
|
+
}
|
650
|
+
return O;
|
651
|
+
},
|
652
|
+
|
653
|
+
find: function(predicate) {
|
654
|
+
var list = ES.ToObject(this);
|
655
|
+
var length = ES.ToLength(list.length);
|
656
|
+
if (!ES.IsCallable(predicate)) {
|
657
|
+
throw new TypeError('Array#find: predicate must be a function');
|
658
|
+
}
|
659
|
+
var thisArg = arguments[1];
|
660
|
+
for (var i = 0, value; i < length; i++) {
|
661
|
+
if (i in list) {
|
662
|
+
value = list[i];
|
663
|
+
if (predicate.call(thisArg, value, i, list)) return value;
|
664
|
+
}
|
665
|
+
}
|
666
|
+
return undefined;
|
667
|
+
},
|
668
|
+
|
669
|
+
findIndex: function(predicate) {
|
670
|
+
var list = ES.ToObject(this);
|
671
|
+
var length = ES.ToLength(list.length);
|
672
|
+
if (!ES.IsCallable(predicate)) {
|
673
|
+
throw new TypeError('Array#findIndex: predicate must be a function');
|
674
|
+
}
|
675
|
+
var thisArg = arguments[1];
|
676
|
+
for (var i = 0; i < length; i++) {
|
677
|
+
if (i in list) {
|
678
|
+
if (predicate.call(thisArg, list[i], i, list)) return i;
|
679
|
+
}
|
680
|
+
}
|
681
|
+
return -1;
|
682
|
+
},
|
683
|
+
|
684
|
+
keys: function() {
|
685
|
+
return new ArrayIterator(this, "key");
|
686
|
+
},
|
687
|
+
|
688
|
+
values: function() {
|
689
|
+
return new ArrayIterator(this, "value");
|
690
|
+
},
|
691
|
+
|
692
|
+
entries: function() {
|
693
|
+
return new ArrayIterator(this, "entry");
|
694
|
+
}
|
695
|
+
});
|
696
|
+
addIterator(Array.prototype, function() { return this.values(); });
|
697
|
+
// Chrome defines keys/values/entries on Array, but doesn't give us
|
698
|
+
// any way to identify its iterator. So add our own shimmed field.
|
699
|
+
addIterator(Object.getPrototypeOf([].values()));
|
700
|
+
|
701
|
+
var maxSafeInteger = Math.pow(2, 53) - 1;
|
702
|
+
defineProperties(Number, {
|
703
|
+
MAX_SAFE_INTEGER: maxSafeInteger,
|
704
|
+
MIN_SAFE_INTEGER: -maxSafeInteger,
|
705
|
+
EPSILON: 2.220446049250313e-16,
|
706
|
+
|
707
|
+
parseInt: globals.parseInt,
|
708
|
+
parseFloat: globals.parseFloat,
|
709
|
+
|
710
|
+
isFinite: function(value) {
|
711
|
+
return typeof value === 'number' && global_isFinite(value);
|
712
|
+
},
|
713
|
+
|
714
|
+
isInteger: function(value) {
|
715
|
+
return typeof value === 'number' &&
|
716
|
+
!Number.isNaN(value) &&
|
717
|
+
Number.isFinite(value) &&
|
718
|
+
ES.ToInteger(value) === value;
|
719
|
+
},
|
720
|
+
|
721
|
+
isSafeInteger: function(value) {
|
722
|
+
return Number.isInteger(value) &&
|
723
|
+
Math.abs(value) <= Number.MAX_SAFE_INTEGER;
|
724
|
+
},
|
725
|
+
|
726
|
+
isNaN: function(value) {
|
727
|
+
// NaN !== NaN, but they are identical.
|
728
|
+
// NaNs are the only non-reflexive value, i.e., if x !== x,
|
729
|
+
// then x is NaN.
|
730
|
+
// isNaN is broken: it converts its argument to number, so
|
731
|
+
// isNaN('foo') => true
|
732
|
+
return value !== value;
|
733
|
+
}
|
734
|
+
|
735
|
+
});
|
736
|
+
|
737
|
+
defineProperties(Number.prototype, {
|
738
|
+
});
|
739
|
+
|
740
|
+
if (supportsDescriptors) {
|
741
|
+
defineProperties(Object, {
|
742
|
+
getOwnPropertyDescriptors: function(subject) {
|
743
|
+
var descs = {};
|
744
|
+
Object.getOwnPropertyNames(subject).forEach(function(propName) {
|
745
|
+
descs[propName] = Object.getOwnPropertyDescriptor(subject, propName);
|
746
|
+
});
|
747
|
+
return descs;
|
748
|
+
},
|
749
|
+
|
750
|
+
getPropertyDescriptor: function(subject, name) {
|
751
|
+
var pd = Object.getOwnPropertyDescriptor(subject, name);
|
752
|
+
var proto = Object.getPrototypeOf(subject);
|
753
|
+
while (pd === undefined && proto !== null) {
|
754
|
+
pd = Object.getOwnPropertyDescriptor(proto, name);
|
755
|
+
proto = Object.getPrototypeOf(proto);
|
756
|
+
}
|
757
|
+
return pd;
|
758
|
+
},
|
759
|
+
|
760
|
+
getPropertyNames: function(subject) {
|
761
|
+
var result = Object.getOwnPropertyNames(subject);
|
762
|
+
var proto = Object.getPrototypeOf(subject);
|
763
|
+
|
764
|
+
var addProperty = function(property) {
|
765
|
+
if (result.indexOf(property) === -1) {
|
766
|
+
result.push(property);
|
767
|
+
}
|
768
|
+
};
|
769
|
+
|
770
|
+
while (proto !== null) {
|
771
|
+
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
772
|
+
proto = Object.getPrototypeOf(proto);
|
773
|
+
}
|
774
|
+
return result;
|
775
|
+
},
|
776
|
+
|
777
|
+
// 19.1.3.1
|
778
|
+
assign: function(target, source) {
|
779
|
+
return Object.keys(source).reduce(function(target, key) {
|
780
|
+
target[key] = source[key];
|
781
|
+
return target;
|
782
|
+
}, target);
|
783
|
+
}
|
784
|
+
});
|
785
|
+
|
786
|
+
// 19.1.3.9
|
787
|
+
// shim from https://gist.github.com/WebReflection/5593554
|
788
|
+
defineProperties(Object, {
|
789
|
+
setPrototypeOf: (function(Object, magic) {
|
790
|
+
var set;
|
791
|
+
|
792
|
+
var checkArgs = function(O, proto) {
|
793
|
+
if (!ES.TypeIsObject(O)) {
|
794
|
+
throw new TypeError('cannot set prototype on a non-object');
|
795
|
+
}
|
796
|
+
if (!(proto===null || ES.TypeIsObject(proto))) {
|
797
|
+
throw new TypeError('can only set prototype to an object or null'+proto);
|
798
|
+
}
|
799
|
+
};
|
800
|
+
|
801
|
+
var setPrototypeOf = function(O, proto) {
|
802
|
+
checkArgs(O, proto);
|
803
|
+
set.call(O, proto);
|
804
|
+
return O;
|
805
|
+
};
|
806
|
+
|
807
|
+
try {
|
808
|
+
// this works already in Firefox and Safari
|
809
|
+
set = Object.getOwnPropertyDescriptor(Object.prototype, magic).set;
|
810
|
+
set.call({}, null);
|
811
|
+
} catch (e) {
|
812
|
+
if (Object.prototype !== {}[magic]) {
|
813
|
+
// IE < 11 cannot be shimmed
|
814
|
+
return;
|
815
|
+
}
|
816
|
+
// probably Chrome or some old Mobile stock browser
|
817
|
+
set = function(proto) {
|
818
|
+
this[magic] = proto;
|
819
|
+
};
|
820
|
+
// please note that this will **not** work
|
821
|
+
// in those browsers that do not inherit
|
822
|
+
// __proto__ by mistake from Object.prototype
|
823
|
+
// in these cases we should probably throw an error
|
824
|
+
// or at least be informed about the issue
|
825
|
+
setPrototypeOf.polyfill = setPrototypeOf(
|
826
|
+
setPrototypeOf({}, null),
|
827
|
+
Object.prototype
|
828
|
+
) instanceof Object;
|
829
|
+
// setPrototypeOf.polyfill === true means it works as meant
|
830
|
+
// setPrototypeOf.polyfill === false means it's not 100% reliable
|
831
|
+
// setPrototypeOf.polyfill === undefined
|
832
|
+
// or
|
833
|
+
// setPrototypeOf.polyfill == null means it's not a polyfill
|
834
|
+
// which means it works as expected
|
835
|
+
// we can even delete Object.prototype.__proto__;
|
836
|
+
}
|
837
|
+
return setPrototypeOf;
|
838
|
+
})(Object, '__proto__')
|
839
|
+
});
|
840
|
+
}
|
841
|
+
|
842
|
+
// Workaround bug in Opera 12 where setPrototypeOf(x, null) doesn't work,
|
843
|
+
// but Object.create(null) does.
|
844
|
+
if (Object.setPrototypeOf && Object.getPrototypeOf &&
|
845
|
+
Object.getPrototypeOf(Object.setPrototypeOf({}, null)) !== null &&
|
846
|
+
Object.getPrototypeOf(Object.create(null)) === null) {
|
847
|
+
(function() {
|
848
|
+
var FAKENULL = Object.create(null);
|
849
|
+
var gpo = Object.getPrototypeOf, spo = Object.setPrototypeOf;
|
850
|
+
Object.getPrototypeOf = function(o) {
|
851
|
+
var result = gpo(o);
|
852
|
+
return result === FAKENULL ? null : result;
|
853
|
+
};
|
854
|
+
Object.setPrototypeOf = function(o, p) {
|
855
|
+
if (p === null) { p = FAKENULL; }
|
856
|
+
return spo(o, p);
|
857
|
+
};
|
858
|
+
Object.setPrototypeOf.polyfill = false;
|
859
|
+
})();
|
860
|
+
}
|
861
|
+
|
862
|
+
defineProperties(Object, {
|
863
|
+
getOwnPropertyKeys: function(subject) {
|
864
|
+
return Object.keys(subject);
|
865
|
+
},
|
866
|
+
|
867
|
+
is: function(a, b) {
|
868
|
+
return ES.SameValue(a, b);
|
869
|
+
}
|
870
|
+
});
|
871
|
+
|
872
|
+
try {
|
873
|
+
Object.keys('foo');
|
874
|
+
} catch (e) {
|
875
|
+
var originalObjectKeys = Object.keys;
|
876
|
+
Object.keys = function (obj) {
|
877
|
+
return originalObjectKeys(ES.ToObject(obj));
|
878
|
+
};
|
879
|
+
}
|
880
|
+
|
881
|
+
var MathShims = {
|
882
|
+
acosh: function(value) {
|
883
|
+
value = Number(value);
|
884
|
+
if (Number.isNaN(value) || value < 1) return NaN;
|
885
|
+
if (value === 1) return 0;
|
886
|
+
if (value === Infinity) return value;
|
887
|
+
return Math.log(value + Math.sqrt(value * value - 1));
|
888
|
+
},
|
889
|
+
|
890
|
+
asinh: function(value) {
|
891
|
+
value = Number(value);
|
892
|
+
if (value === 0 || !global_isFinite(value)) {
|
893
|
+
return value;
|
894
|
+
}
|
895
|
+
return value < 0 ? -Math.asinh(-value) : Math.log(value + Math.sqrt(value * value + 1));
|
896
|
+
},
|
897
|
+
|
898
|
+
atanh: function(value) {
|
899
|
+
value = Number(value);
|
900
|
+
if (Number.isNaN(value) || value < -1 || value > 1) {
|
901
|
+
return NaN;
|
902
|
+
}
|
903
|
+
if (value === -1) return -Infinity;
|
904
|
+
if (value === 1) return Infinity;
|
905
|
+
if (value === 0) return value;
|
906
|
+
return 0.5 * Math.log((1 + value) / (1 - value));
|
907
|
+
},
|
908
|
+
|
909
|
+
cbrt: function(value) {
|
910
|
+
value = Number(value);
|
911
|
+
if (value === 0) return value;
|
912
|
+
var negate = value < 0, result;
|
913
|
+
if (negate) value = -value;
|
914
|
+
result = Math.pow(value, 1/3);
|
915
|
+
return negate ? -result : result;
|
916
|
+
},
|
917
|
+
|
918
|
+
clz32: function(value) {
|
919
|
+
// See https://bugs.ecmascript.org/show_bug.cgi?id=2465
|
920
|
+
value = Number(value);
|
921
|
+
if (Number.isNaN(value)) return NaN;
|
922
|
+
var number = ES.ToUint32(value);
|
923
|
+
if (number === 0) {
|
924
|
+
return 32;
|
925
|
+
}
|
926
|
+
return 32 - (number).toString(2).length;
|
927
|
+
},
|
928
|
+
|
929
|
+
cosh: function(value) {
|
930
|
+
value = Number(value);
|
931
|
+
if (value === 0) return 1; // +0 or -0
|
932
|
+
if (Number.isNaN(value)) return NaN;
|
933
|
+
if (!global_isFinite(value)) return Infinity;
|
934
|
+
if (value < 0) value = -value;
|
935
|
+
if (value > 21) return Math.exp(value) / 2;
|
936
|
+
return (Math.exp(value) + Math.exp(-value)) / 2;
|
937
|
+
},
|
938
|
+
|
939
|
+
expm1: function(value) {
|
940
|
+
value = Number(value);
|
941
|
+
if (value === -Infinity) return -1;
|
942
|
+
if (!global_isFinite(value) || value === 0) return value;
|
943
|
+
var result = 0;
|
944
|
+
var n = 50;
|
945
|
+
for (var i = 1; i < n; i++) {
|
946
|
+
for (var j = 2, factorial = 1; j <= i; j++) {
|
947
|
+
factorial *= j;
|
948
|
+
}
|
949
|
+
result += Math.pow(value, i) / factorial;
|
950
|
+
}
|
951
|
+
return result;
|
952
|
+
},
|
953
|
+
|
954
|
+
hypot: function(x, y) {
|
955
|
+
var anyNaN = false;
|
956
|
+
var allZero = true;
|
957
|
+
var anyInfinity = false;
|
958
|
+
var numbers = [];
|
959
|
+
Array.prototype.every.call(arguments, function(arg) {
|
960
|
+
var num = Number(arg);
|
961
|
+
if (Number.isNaN(num)) anyNaN = true;
|
962
|
+
else if (num === Infinity || num === -Infinity) anyInfinity = true;
|
963
|
+
else if (num !== 0) allZero = false;
|
964
|
+
if (anyInfinity) {
|
965
|
+
return false;
|
966
|
+
} else if (!anyNaN) {
|
967
|
+
numbers.push(Math.abs(num));
|
968
|
+
}
|
969
|
+
return true;
|
970
|
+
});
|
971
|
+
if (anyInfinity) return Infinity;
|
972
|
+
if (anyNaN) return NaN;
|
973
|
+
if (allZero) return 0;
|
974
|
+
|
975
|
+
numbers.sort(function (a, b) { return b - a; });
|
976
|
+
var largest = numbers[0];
|
977
|
+
var divided = numbers.map(function (number) { return number / largest; });
|
978
|
+
var sum = divided.reduce(function (sum, number) { return sum += number * number; }, 0);
|
979
|
+
return largest * Math.sqrt(sum);
|
980
|
+
},
|
981
|
+
|
982
|
+
log2: function(value) {
|
983
|
+
return Math.log(value) * Math.LOG2E;
|
984
|
+
},
|
985
|
+
|
986
|
+
log10: function(value) {
|
987
|
+
return Math.log(value) * Math.LOG10E;
|
988
|
+
},
|
989
|
+
|
990
|
+
log1p: function(value) {
|
991
|
+
value = Number(value);
|
992
|
+
if (value < -1 || Number.isNaN(value)) return NaN;
|
993
|
+
if (value === 0 || value === Infinity) return value;
|
994
|
+
if (value === -1) return -Infinity;
|
995
|
+
var result = 0;
|
996
|
+
var n = 50;
|
997
|
+
|
998
|
+
if (value < 0 || value > 1) return Math.log(1 + value);
|
999
|
+
for (var i = 1; i < n; i++) {
|
1000
|
+
if ((i % 2) === 0) {
|
1001
|
+
result -= Math.pow(value, i) / i;
|
1002
|
+
} else {
|
1003
|
+
result += Math.pow(value, i) / i;
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
return result;
|
1008
|
+
},
|
1009
|
+
|
1010
|
+
sign: function(value) {
|
1011
|
+
var number = +value;
|
1012
|
+
if (number === 0) return number;
|
1013
|
+
if (Number.isNaN(number)) return number;
|
1014
|
+
return number < 0 ? -1 : 1;
|
1015
|
+
},
|
1016
|
+
|
1017
|
+
sinh: function(value) {
|
1018
|
+
value = Number(value);
|
1019
|
+
if (!global_isFinite(value) || value === 0) return value;
|
1020
|
+
return (Math.exp(value) - Math.exp(-value)) / 2;
|
1021
|
+
},
|
1022
|
+
|
1023
|
+
tanh: function(value) {
|
1024
|
+
value = Number(value);
|
1025
|
+
if (Number.isNaN(value) || value === 0) return value;
|
1026
|
+
if (value === Infinity) return 1;
|
1027
|
+
if (value === -Infinity) return -1;
|
1028
|
+
return (Math.exp(value) - Math.exp(-value)) / (Math.exp(value) + Math.exp(-value));
|
1029
|
+
},
|
1030
|
+
|
1031
|
+
trunc: function(value) {
|
1032
|
+
var number = Number(value);
|
1033
|
+
return number < 0 ? -Math.floor(-number) : Math.floor(number);
|
1034
|
+
},
|
1035
|
+
|
1036
|
+
imul: function(x, y) {
|
1037
|
+
// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
|
1038
|
+
var ah = (x >>> 16) & 0xffff;
|
1039
|
+
var al = x & 0xffff;
|
1040
|
+
var bh = (y >>> 16) & 0xffff;
|
1041
|
+
var bl = y & 0xffff;
|
1042
|
+
// the shift by 0 fixes the sign on the high part
|
1043
|
+
// the final |0 converts the unsigned value into a signed value
|
1044
|
+
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
|
1045
|
+
},
|
1046
|
+
|
1047
|
+
fround: function(x) {
|
1048
|
+
if (x === 0 || x === Infinity || x === -Infinity || Number.isNaN(x)) {
|
1049
|
+
return x;
|
1050
|
+
}
|
1051
|
+
var num = Number(x);
|
1052
|
+
return numberConversion.toFloat32(num);
|
1053
|
+
}
|
1054
|
+
};
|
1055
|
+
defineProperties(Math, MathShims);
|
1056
|
+
|
1057
|
+
if (Math.imul(0xffffffff, 5) !== -5) {
|
1058
|
+
// Safari 6.1, at least, reports "0" for this value
|
1059
|
+
Math.imul = MathShims.imul;
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
// Promises
|
1063
|
+
// Simplest possible implementation; use a 3rd-party library if you
|
1064
|
+
// want the best possible speed and/or long stack traces.
|
1065
|
+
var PromiseShim = (function() {
|
1066
|
+
|
1067
|
+
var Promise, Promise$prototype;
|
1068
|
+
|
1069
|
+
ES.IsPromise = function(promise) {
|
1070
|
+
if (!ES.TypeIsObject(promise)) {
|
1071
|
+
return false;
|
1072
|
+
}
|
1073
|
+
if (!promise._promiseConstructor) {
|
1074
|
+
// _promiseConstructor is a bit more unique than _status, so we'll
|
1075
|
+
// check that instead of the [[PromiseStatus]] internal field.
|
1076
|
+
return false;
|
1077
|
+
}
|
1078
|
+
if (promise._status === undefined) {
|
1079
|
+
return false; // uninitialized
|
1080
|
+
}
|
1081
|
+
return true;
|
1082
|
+
};
|
1083
|
+
|
1084
|
+
// "PromiseCapability" in the spec is what most promise implementations
|
1085
|
+
// call a "deferred".
|
1086
|
+
var PromiseCapability = function(C) {
|
1087
|
+
if (!ES.IsCallable(C)) {
|
1088
|
+
throw new TypeError('bad promise constructor');
|
1089
|
+
}
|
1090
|
+
var capability = this;
|
1091
|
+
var resolver = function(resolve, reject) {
|
1092
|
+
capability.resolve = resolve;
|
1093
|
+
capability.reject = reject;
|
1094
|
+
};
|
1095
|
+
capability.promise = ES.Construct(C, [resolver]);
|
1096
|
+
// see https://bugs.ecmascript.org/show_bug.cgi?id=2478
|
1097
|
+
if (!capability.promise._es6construct) {
|
1098
|
+
throw new TypeError('bad promise constructor');
|
1099
|
+
}
|
1100
|
+
if (!(ES.IsCallable(capability.resolve) &&
|
1101
|
+
ES.IsCallable(capability.reject))) {
|
1102
|
+
throw new TypeError('bad promise constructor');
|
1103
|
+
}
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
// find an appropriate setImmediate-alike
|
1107
|
+
var setTimeout = globals.setTimeout;
|
1108
|
+
var makeZeroTimeout = function() {
|
1109
|
+
// from http://dbaron.org/log/20100309-faster-timeouts
|
1110
|
+
var timeouts = [];
|
1111
|
+
var messageName = "zero-timeout-message";
|
1112
|
+
var setZeroTimeout = function(fn) {
|
1113
|
+
timeouts.push(fn);
|
1114
|
+
window.postMessage(messageName, "*");
|
1115
|
+
};
|
1116
|
+
var handleMessage = function(event) {
|
1117
|
+
if (event.source == window && event.data == messageName) {
|
1118
|
+
event.stopPropagation();
|
1119
|
+
if (timeouts.length === 0) { return; }
|
1120
|
+
var fn = timeouts.shift();
|
1121
|
+
fn();
|
1122
|
+
}
|
1123
|
+
};
|
1124
|
+
window.addEventListener("message", handleMessage, true);
|
1125
|
+
return setZeroTimeout;
|
1126
|
+
};
|
1127
|
+
var enqueue = ES.IsCallable(globals.setImmediate) ?
|
1128
|
+
globals.setImmediate.bind(globals) :
|
1129
|
+
typeof process === 'object' && process.nextTick ? process.nextTick :
|
1130
|
+
ES.IsCallable(window.postMessage) ? makeZeroTimeout() :
|
1131
|
+
function(task) { setTimeout(task, 0); }; // fallback
|
1132
|
+
|
1133
|
+
var triggerPromiseReactions = function(reactions, x) {
|
1134
|
+
reactions.forEach(function(reaction) {
|
1135
|
+
enqueue(function() {
|
1136
|
+
// PromiseReactionTask
|
1137
|
+
var handler = reaction.handler;
|
1138
|
+
var capability = reaction.capability;
|
1139
|
+
var resolve = capability.resolve;
|
1140
|
+
var reject = capability.reject;
|
1141
|
+
try {
|
1142
|
+
var result = handler(x);
|
1143
|
+
if (result === capability.promise) {
|
1144
|
+
throw new TypeError('self resolution');
|
1145
|
+
}
|
1146
|
+
var updateResult =
|
1147
|
+
updatePromiseFromPotentialThenable(result, capability);
|
1148
|
+
if (!updateResult) {
|
1149
|
+
resolve(result);
|
1150
|
+
}
|
1151
|
+
} catch (e) {
|
1152
|
+
reject(e);
|
1153
|
+
}
|
1154
|
+
});
|
1155
|
+
});
|
1156
|
+
};
|
1157
|
+
|
1158
|
+
var updatePromiseFromPotentialThenable = function(x, capability) {
|
1159
|
+
if (!ES.TypeIsObject(x)) {
|
1160
|
+
return false;
|
1161
|
+
}
|
1162
|
+
var resolve = capability.resolve;
|
1163
|
+
var reject = capability.reject;
|
1164
|
+
try {
|
1165
|
+
var then = x.then; // only one invocation of accessor
|
1166
|
+
if (!ES.IsCallable(then)) { return false; }
|
1167
|
+
then.call(x, resolve, reject);
|
1168
|
+
} catch(e) {
|
1169
|
+
reject(e);
|
1170
|
+
}
|
1171
|
+
return true;
|
1172
|
+
};
|
1173
|
+
|
1174
|
+
var promiseResolutionHandler = function(promise, onFulfilled, onRejected){
|
1175
|
+
return function(x) {
|
1176
|
+
if (x === promise) {
|
1177
|
+
return onRejected(new TypeError('self resolution'));
|
1178
|
+
}
|
1179
|
+
var C = promise._promiseConstructor;
|
1180
|
+
var capability = new PromiseCapability(C);
|
1181
|
+
var updateResult = updatePromiseFromPotentialThenable(x, capability);
|
1182
|
+
if (updateResult) {
|
1183
|
+
return capability.promise.then(onFulfilled, onRejected);
|
1184
|
+
} else {
|
1185
|
+
return onFulfilled(x);
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
Promise = function(resolver) {
|
1191
|
+
var promise = this;
|
1192
|
+
promise = emulateES6construct(promise);
|
1193
|
+
if (!promise._promiseConstructor) {
|
1194
|
+
// we use _promiseConstructor as a stand-in for the internal
|
1195
|
+
// [[PromiseStatus]] field; it's a little more unique.
|
1196
|
+
throw new TypeError('bad promise');
|
1197
|
+
}
|
1198
|
+
if (promise._status !== undefined) {
|
1199
|
+
throw new TypeError('promise already initialized');
|
1200
|
+
}
|
1201
|
+
// see https://bugs.ecmascript.org/show_bug.cgi?id=2482
|
1202
|
+
if (!ES.IsCallable(resolver)) {
|
1203
|
+
throw new TypeError('not a valid resolver');
|
1204
|
+
}
|
1205
|
+
promise._status = 'unresolved';
|
1206
|
+
promise._resolveReactions = [];
|
1207
|
+
promise._rejectReactions = [];
|
1208
|
+
|
1209
|
+
var resolve = function(resolution) {
|
1210
|
+
if (promise._status !== 'unresolved') { return; }
|
1211
|
+
var reactions = promise._resolveReactions;
|
1212
|
+
promise._result = resolution;
|
1213
|
+
promise._resolveReactions = undefined;
|
1214
|
+
promise._rejectReactions = undefined;
|
1215
|
+
promise._status = 'has-resolution';
|
1216
|
+
triggerPromiseReactions(reactions, resolution);
|
1217
|
+
};
|
1218
|
+
var reject = function(reason) {
|
1219
|
+
if (promise._status !== 'unresolved') { return; }
|
1220
|
+
var reactions = promise._rejectReactions;
|
1221
|
+
promise._result = reason;
|
1222
|
+
promise._resolveReactions = undefined;
|
1223
|
+
promise._rejectReactions = undefined;
|
1224
|
+
promise._status = 'has-rejection';
|
1225
|
+
triggerPromiseReactions(reactions, reason);
|
1226
|
+
};
|
1227
|
+
try {
|
1228
|
+
resolver(resolve, reject);
|
1229
|
+
} catch (e) {
|
1230
|
+
reject(e);
|
1231
|
+
}
|
1232
|
+
return promise;
|
1233
|
+
};
|
1234
|
+
Promise$prototype = Promise.prototype;
|
1235
|
+
defineProperties(Promise, {
|
1236
|
+
'@@create': function(obj) {
|
1237
|
+
var constructor = this;
|
1238
|
+
// AllocatePromise
|
1239
|
+
// The `obj` parameter is a hack we use for es5
|
1240
|
+
// compatibility.
|
1241
|
+
var prototype = constructor.prototype || Promise$prototype;
|
1242
|
+
obj = obj || Object.create(prototype);
|
1243
|
+
defineProperties(obj, {
|
1244
|
+
_status: undefined,
|
1245
|
+
_result: undefined,
|
1246
|
+
_resolveReactions: undefined,
|
1247
|
+
_rejectReactions: undefined,
|
1248
|
+
_promiseConstructor: undefined
|
1249
|
+
});
|
1250
|
+
obj._promiseConstructor = constructor;
|
1251
|
+
return obj;
|
1252
|
+
}
|
1253
|
+
});
|
1254
|
+
|
1255
|
+
var _promiseAllResolver = function(index, values, capability, remaining) {
|
1256
|
+
var done = false;
|
1257
|
+
return function(x) {
|
1258
|
+
if (done) { return; } // protect against being called multiple times
|
1259
|
+
done = true;
|
1260
|
+
values[index] = x;
|
1261
|
+
if ((--remaining.count) === 0) {
|
1262
|
+
var resolve = capability.resolve;
|
1263
|
+
resolve(values); // call w/ this===undefined
|
1264
|
+
}
|
1265
|
+
};
|
1266
|
+
};
|
1267
|
+
|
1268
|
+
Promise.all = function(iterable) {
|
1269
|
+
var C = this;
|
1270
|
+
var capability = new PromiseCapability(C);
|
1271
|
+
var resolve = capability.resolve;
|
1272
|
+
var reject = capability.reject;
|
1273
|
+
try {
|
1274
|
+
if (!ES.IsIterable(iterable)) {
|
1275
|
+
throw new TypeError('bad iterable');
|
1276
|
+
}
|
1277
|
+
var it = ES.GetIterator(iterable);
|
1278
|
+
var values = [], remaining = { count: 1 };
|
1279
|
+
for (var index = 0; ; index++) {
|
1280
|
+
var next = ES.IteratorNext(it);
|
1281
|
+
if (next.done) {
|
1282
|
+
break;
|
1283
|
+
}
|
1284
|
+
var nextPromise = C.resolve(next.value);
|
1285
|
+
var resolveElement = _promiseAllResolver(
|
1286
|
+
index, values, capability, remaining
|
1287
|
+
);
|
1288
|
+
remaining.count++;
|
1289
|
+
nextPromise.then(resolveElement, capability.reject);
|
1290
|
+
}
|
1291
|
+
if ((--remaining.count) === 0) {
|
1292
|
+
resolve(values); // call w/ this===undefined
|
1293
|
+
}
|
1294
|
+
} catch (e) {
|
1295
|
+
reject(e);
|
1296
|
+
}
|
1297
|
+
return capability.promise;
|
1298
|
+
};
|
1299
|
+
|
1300
|
+
Promise.race = function(iterable) {
|
1301
|
+
var C = this;
|
1302
|
+
var capability = new PromiseCapability(C);
|
1303
|
+
var resolve = capability.resolve;
|
1304
|
+
var reject = capability.reject;
|
1305
|
+
try {
|
1306
|
+
if (!ES.IsIterable(iterable)) {
|
1307
|
+
throw new TypeError('bad iterable');
|
1308
|
+
}
|
1309
|
+
var it = ES.GetIterator(iterable);
|
1310
|
+
while (true) {
|
1311
|
+
var next = ES.IteratorNext(it);
|
1312
|
+
if (next.done) {
|
1313
|
+
// If iterable has no items, resulting promise will never
|
1314
|
+
// resolve; see:
|
1315
|
+
// https://github.com/domenic/promises-unwrapping/issues/75
|
1316
|
+
// https://bugs.ecmascript.org/show_bug.cgi?id=2515
|
1317
|
+
break;
|
1318
|
+
}
|
1319
|
+
var nextPromise = C.resolve(next.value);
|
1320
|
+
nextPromise.then(resolve, reject);
|
1321
|
+
}
|
1322
|
+
} catch (e) {
|
1323
|
+
reject(e);
|
1324
|
+
}
|
1325
|
+
return capability.promise;
|
1326
|
+
};
|
1327
|
+
|
1328
|
+
Promise.reject = function(reason) {
|
1329
|
+
var C = this;
|
1330
|
+
var capability = new PromiseCapability(C);
|
1331
|
+
var reject = capability.reject;
|
1332
|
+
reject(reason); // call with this===undefined
|
1333
|
+
return capability.promise;
|
1334
|
+
};
|
1335
|
+
|
1336
|
+
Promise.resolve = function(v) {
|
1337
|
+
var C = this;
|
1338
|
+
if (ES.IsPromise(v)) {
|
1339
|
+
var constructor = v._promiseConstructor;
|
1340
|
+
if (constructor === C) { return v; }
|
1341
|
+
}
|
1342
|
+
var capability = new PromiseCapability(C);
|
1343
|
+
var resolve = capability.resolve;
|
1344
|
+
resolve(v); // call with this===undefined
|
1345
|
+
return capability.promise;
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
Promise.prototype['catch'] = function( onRejected ) {
|
1349
|
+
return this.then(undefined, onRejected);
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
Promise.prototype.then = function( onFulfilled, onRejected ) {
|
1353
|
+
var promise = this;
|
1354
|
+
if (!ES.IsPromise(promise)) { throw new TypeError('not a promise'); }
|
1355
|
+
// this.constructor not this._promiseConstructor; see
|
1356
|
+
// https://bugs.ecmascript.org/show_bug.cgi?id=2513
|
1357
|
+
var C = this.constructor;
|
1358
|
+
var capability = new PromiseCapability(C);
|
1359
|
+
if (!ES.IsCallable(onRejected)) {
|
1360
|
+
onRejected = function(e) { throw e; };
|
1361
|
+
}
|
1362
|
+
if (!ES.IsCallable(onFulfilled)) {
|
1363
|
+
onFulfilled = function(x) { return x; };
|
1364
|
+
}
|
1365
|
+
var resolutionHandler =
|
1366
|
+
promiseResolutionHandler(promise, onFulfilled, onRejected);
|
1367
|
+
var resolveReaction =
|
1368
|
+
{ capability: capability, handler: resolutionHandler };
|
1369
|
+
var rejectReaction =
|
1370
|
+
{ capability: capability, handler: onRejected };
|
1371
|
+
switch (promise._status) {
|
1372
|
+
case 'unresolved':
|
1373
|
+
promise._resolveReactions.push(resolveReaction);
|
1374
|
+
promise._rejectReactions.push(rejectReaction);
|
1375
|
+
break;
|
1376
|
+
case 'has-resolution':
|
1377
|
+
triggerPromiseReactions([resolveReaction], promise._result);
|
1378
|
+
break;
|
1379
|
+
case 'has-rejection':
|
1380
|
+
triggerPromiseReactions([rejectReaction], promise._result);
|
1381
|
+
break;
|
1382
|
+
default:
|
1383
|
+
throw new TypeError('unexpected');
|
1384
|
+
}
|
1385
|
+
return capability.promise;
|
1386
|
+
};
|
1387
|
+
|
1388
|
+
return Promise;
|
1389
|
+
})();
|
1390
|
+
// export the Promise constructor.
|
1391
|
+
defineProperties(globals, { Promise: PromiseShim });
|
1392
|
+
// In Chrome 33 (and thereabouts) Promise is defined, but the
|
1393
|
+
// implementation is buggy in a number of ways. Let's check subclassing
|
1394
|
+
// support to see if we have a buggy implementation.
|
1395
|
+
if (!supportsSubclassing(globals.Promise, function(S) {
|
1396
|
+
return S.resolve(42) instanceof S;
|
1397
|
+
})) {
|
1398
|
+
globals.Promise = PromiseShim;
|
1399
|
+
}
|
1400
|
+
|
1401
|
+
// Map and Set require a true ES5 environment
|
1402
|
+
if (supportsDescriptors) {
|
1403
|
+
|
1404
|
+
var fastkey = function fastkey(key) {
|
1405
|
+
var type = typeof key;
|
1406
|
+
if (type === 'string') {
|
1407
|
+
return '$' + key;
|
1408
|
+
} else if (type === 'number') {
|
1409
|
+
// note that -0 will get coerced to "0" when used as a property key
|
1410
|
+
return key;
|
1411
|
+
}
|
1412
|
+
return null;
|
1413
|
+
};
|
1414
|
+
|
1415
|
+
var emptyObject = function emptyObject() {
|
1416
|
+
// accomodate some older not-quite-ES5 browsers
|
1417
|
+
return Object.create ? Object.create(null) : {};
|
1418
|
+
};
|
1419
|
+
|
1420
|
+
var collectionShims = {
|
1421
|
+
Map: (function() {
|
1422
|
+
|
1423
|
+
var empty = {};
|
1424
|
+
|
1425
|
+
function MapEntry(key, value) {
|
1426
|
+
this.key = key;
|
1427
|
+
this.value = value;
|
1428
|
+
this.next = null;
|
1429
|
+
this.prev = null;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
MapEntry.prototype.isRemoved = function() {
|
1433
|
+
return this.key === empty;
|
1434
|
+
};
|
1435
|
+
|
1436
|
+
function MapIterator(map, kind) {
|
1437
|
+
this.head = map._head;
|
1438
|
+
this.i = this.head;
|
1439
|
+
this.kind = kind;
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
MapIterator.prototype = {
|
1443
|
+
next: function() {
|
1444
|
+
var i = this.i, kind = this.kind, head = this.head, result;
|
1445
|
+
if (this.i === undefined) {
|
1446
|
+
return { value: undefined, done: true };
|
1447
|
+
}
|
1448
|
+
while (i.isRemoved() && i !== head) {
|
1449
|
+
// back up off of removed entries
|
1450
|
+
i = i.prev;
|
1451
|
+
}
|
1452
|
+
// advance to next unreturned element.
|
1453
|
+
while (i.next !== head) {
|
1454
|
+
i = i.next;
|
1455
|
+
if (!i.isRemoved()) {
|
1456
|
+
if (kind === "key") {
|
1457
|
+
result = i.key;
|
1458
|
+
} else if (kind === "value") {
|
1459
|
+
result = i.value;
|
1460
|
+
} else {
|
1461
|
+
result = [i.key, i.value];
|
1462
|
+
}
|
1463
|
+
this.i = i;
|
1464
|
+
return { value: result, done: false };
|
1465
|
+
}
|
1466
|
+
}
|
1467
|
+
// once the iterator is done, it is done forever.
|
1468
|
+
this.i = undefined;
|
1469
|
+
return { value: undefined, done: true };
|
1470
|
+
}
|
1471
|
+
};
|
1472
|
+
addIterator(MapIterator.prototype);
|
1473
|
+
|
1474
|
+
function Map() {
|
1475
|
+
var map = this;
|
1476
|
+
map = emulateES6construct(map);
|
1477
|
+
if (!map._es6map) {
|
1478
|
+
throw new TypeError('bad map');
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
var head = new MapEntry(null, null);
|
1482
|
+
// circular doubly-linked list.
|
1483
|
+
head.next = head.prev = head;
|
1484
|
+
|
1485
|
+
defineProperties(map, {
|
1486
|
+
'_head': head,
|
1487
|
+
'_storage': emptyObject(),
|
1488
|
+
'_size': 0
|
1489
|
+
});
|
1490
|
+
|
1491
|
+
// Optionally initialize map from iterable
|
1492
|
+
var iterable = arguments[0];
|
1493
|
+
if (iterable !== undefined && iterable !== null) {
|
1494
|
+
var it = ES.GetIterator(iterable);
|
1495
|
+
var adder = map.set;
|
1496
|
+
if (!ES.IsCallable(adder)) { throw new TypeError('bad map'); }
|
1497
|
+
while (true) {
|
1498
|
+
var next = ES.IteratorNext(it);
|
1499
|
+
if (next.done) { break; }
|
1500
|
+
var nextItem = next.value;
|
1501
|
+
if (!ES.TypeIsObject(nextItem)) {
|
1502
|
+
throw new TypeError('expected iterable of pairs');
|
1503
|
+
}
|
1504
|
+
adder.call(map, nextItem[0], nextItem[1]);
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
return map;
|
1508
|
+
}
|
1509
|
+
var Map$prototype = Map.prototype;
|
1510
|
+
defineProperties(Map, {
|
1511
|
+
'@@create': function(obj) {
|
1512
|
+
var constructor = this;
|
1513
|
+
var prototype = constructor.prototype || Map$prototype;
|
1514
|
+
obj = obj || Object.create(prototype);
|
1515
|
+
defineProperties(obj, { _es6map: true });
|
1516
|
+
return obj;
|
1517
|
+
}
|
1518
|
+
});
|
1519
|
+
|
1520
|
+
Object.defineProperty(Map.prototype, 'size', {
|
1521
|
+
configurable: true,
|
1522
|
+
enumerable: false,
|
1523
|
+
get: function() {
|
1524
|
+
if (typeof this._size === 'undefined') {
|
1525
|
+
throw new TypeError('size method called on incompatible Map');
|
1526
|
+
}
|
1527
|
+
return this._size;
|
1528
|
+
}
|
1529
|
+
});
|
1530
|
+
|
1531
|
+
defineProperties(Map.prototype, {
|
1532
|
+
get: function(key) {
|
1533
|
+
var fkey = fastkey(key);
|
1534
|
+
if (fkey !== null) {
|
1535
|
+
// fast O(1) path
|
1536
|
+
var entry = this._storage[fkey];
|
1537
|
+
return entry ? entry.value : undefined;
|
1538
|
+
}
|
1539
|
+
var head = this._head, i = head;
|
1540
|
+
while ((i = i.next) !== head) {
|
1541
|
+
if (ES.SameValueZero(i.key, key)) {
|
1542
|
+
return i.value;
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
return undefined;
|
1546
|
+
},
|
1547
|
+
|
1548
|
+
has: function(key) {
|
1549
|
+
var fkey = fastkey(key);
|
1550
|
+
if (fkey !== null) {
|
1551
|
+
// fast O(1) path
|
1552
|
+
return typeof this._storage[fkey] !== 'undefined';
|
1553
|
+
}
|
1554
|
+
var head = this._head, i = head;
|
1555
|
+
while ((i = i.next) !== head) {
|
1556
|
+
if (ES.SameValueZero(i.key, key)) {
|
1557
|
+
return true;
|
1558
|
+
}
|
1559
|
+
}
|
1560
|
+
return false;
|
1561
|
+
},
|
1562
|
+
|
1563
|
+
set: function(key, value) {
|
1564
|
+
var head = this._head, i = head, entry;
|
1565
|
+
var fkey = fastkey(key);
|
1566
|
+
if (fkey !== null) {
|
1567
|
+
// fast O(1) path
|
1568
|
+
if (typeof this._storage[fkey] !== 'undefined') {
|
1569
|
+
this._storage[fkey].value = value;
|
1570
|
+
return;
|
1571
|
+
} else {
|
1572
|
+
entry = this._storage[fkey] = new MapEntry(key, value);
|
1573
|
+
i = head.prev;
|
1574
|
+
// fall through
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
while ((i = i.next) !== head) {
|
1578
|
+
if (ES.SameValueZero(i.key, key)) {
|
1579
|
+
i.value = value;
|
1580
|
+
return;
|
1581
|
+
}
|
1582
|
+
}
|
1583
|
+
entry = entry || new MapEntry(key, value);
|
1584
|
+
if (ES.SameValue(-0, key)) {
|
1585
|
+
entry.key = +0; // coerce -0 to +0 in entry
|
1586
|
+
}
|
1587
|
+
entry.next = this._head;
|
1588
|
+
entry.prev = this._head.prev;
|
1589
|
+
entry.prev.next = entry;
|
1590
|
+
entry.next.prev = entry;
|
1591
|
+
this._size += 1;
|
1592
|
+
},
|
1593
|
+
|
1594
|
+
'delete': function(key) {
|
1595
|
+
var head = this._head, i = head;
|
1596
|
+
var fkey = fastkey(key);
|
1597
|
+
if (fkey !== null) {
|
1598
|
+
// fast O(1) path
|
1599
|
+
if (typeof this._storage[fkey] === 'undefined') {
|
1600
|
+
return false;
|
1601
|
+
}
|
1602
|
+
i = this._storage[fkey].prev;
|
1603
|
+
delete this._storage[fkey];
|
1604
|
+
// fall through
|
1605
|
+
}
|
1606
|
+
while ((i = i.next) !== head) {
|
1607
|
+
if (ES.SameValueZero(i.key, key)) {
|
1608
|
+
i.key = i.value = empty;
|
1609
|
+
i.prev.next = i.next;
|
1610
|
+
i.next.prev = i.prev;
|
1611
|
+
this._size -= 1;
|
1612
|
+
return true;
|
1613
|
+
}
|
1614
|
+
}
|
1615
|
+
return false;
|
1616
|
+
},
|
1617
|
+
|
1618
|
+
clear: function() {
|
1619
|
+
this._size = 0;
|
1620
|
+
this._storage = emptyObject();
|
1621
|
+
var head = this._head, i = head, p = i.next;
|
1622
|
+
while ((i = p) !== head) {
|
1623
|
+
i.key = i.value = empty;
|
1624
|
+
p = i.next;
|
1625
|
+
i.next = i.prev = head;
|
1626
|
+
}
|
1627
|
+
head.next = head.prev = head;
|
1628
|
+
},
|
1629
|
+
|
1630
|
+
keys: function() {
|
1631
|
+
return new MapIterator(this, "key");
|
1632
|
+
},
|
1633
|
+
|
1634
|
+
values: function() {
|
1635
|
+
return new MapIterator(this, "value");
|
1636
|
+
},
|
1637
|
+
|
1638
|
+
entries: function() {
|
1639
|
+
return new MapIterator(this, "key+value");
|
1640
|
+
},
|
1641
|
+
|
1642
|
+
forEach: function(callback) {
|
1643
|
+
var context = arguments.length > 1 ? arguments[1] : null;
|
1644
|
+
var it = this.entries();
|
1645
|
+
for (var entry = it.next(); !entry.done; entry = it.next()) {
|
1646
|
+
callback.call(context, entry.value[1], entry.value[0], this);
|
1647
|
+
}
|
1648
|
+
}
|
1649
|
+
});
|
1650
|
+
addIterator(Map.prototype, function() { return this.entries(); });
|
1651
|
+
|
1652
|
+
return Map;
|
1653
|
+
})(),
|
1654
|
+
|
1655
|
+
Set: (function() {
|
1656
|
+
// Creating a Map is expensive. To speed up the common case of
|
1657
|
+
// Sets containing only string or numeric keys, we use an object
|
1658
|
+
// as backing storage and lazily create a full Map only when
|
1659
|
+
// required.
|
1660
|
+
var SetShim = function Set() {
|
1661
|
+
var set = this;
|
1662
|
+
set = emulateES6construct(set);
|
1663
|
+
if (!set._es6set) {
|
1664
|
+
throw new TypeError('bad set');
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
defineProperties(set, {
|
1668
|
+
'[[SetData]]': null,
|
1669
|
+
'_storage': emptyObject()
|
1670
|
+
});
|
1671
|
+
|
1672
|
+
// Optionally initialize map from iterable
|
1673
|
+
var iterable = arguments[0];
|
1674
|
+
if (iterable !== undefined && iterable !== null) {
|
1675
|
+
var it = ES.GetIterator(iterable);
|
1676
|
+
var adder = set.add;
|
1677
|
+
if (!ES.IsCallable(adder)) { throw new TypeError('bad set'); }
|
1678
|
+
while (true) {
|
1679
|
+
var next = ES.IteratorNext(it);
|
1680
|
+
if (next.done) { break; }
|
1681
|
+
var nextItem = next.value;
|
1682
|
+
adder.call(set, nextItem);
|
1683
|
+
}
|
1684
|
+
}
|
1685
|
+
return set;
|
1686
|
+
};
|
1687
|
+
var Set$prototype = SetShim.prototype;
|
1688
|
+
defineProperties(SetShim, {
|
1689
|
+
'@@create': function(obj) {
|
1690
|
+
var constructor = this;
|
1691
|
+
var prototype = constructor.prototype || Set$prototype;
|
1692
|
+
obj = obj || Object.create(prototype);
|
1693
|
+
defineProperties(obj, { _es6set: true });
|
1694
|
+
return obj;
|
1695
|
+
}
|
1696
|
+
});
|
1697
|
+
|
1698
|
+
// Switch from the object backing storage to a full Map.
|
1699
|
+
var ensureMap = function ensureMap(set) {
|
1700
|
+
if (!set['[[SetData]]']) {
|
1701
|
+
var m = set['[[SetData]]'] = new collectionShims.Map();
|
1702
|
+
Object.keys(set._storage).forEach(function(k) {
|
1703
|
+
// fast check for leading '$'
|
1704
|
+
if (k.charCodeAt(0) === 36) {
|
1705
|
+
k = k.substring(1);
|
1706
|
+
} else {
|
1707
|
+
k = +k;
|
1708
|
+
}
|
1709
|
+
m.set(k, k);
|
1710
|
+
});
|
1711
|
+
set._storage = null; // free old backing storage
|
1712
|
+
}
|
1713
|
+
};
|
1714
|
+
|
1715
|
+
Object.defineProperty(SetShim.prototype, 'size', {
|
1716
|
+
configurable: true,
|
1717
|
+
enumerable: false,
|
1718
|
+
get: function() {
|
1719
|
+
if (typeof this._storage === 'undefined') {
|
1720
|
+
// https://github.com/paulmillr/es6-shim/issues/176
|
1721
|
+
throw new TypeError('size method called on incompatible Set');
|
1722
|
+
}
|
1723
|
+
ensureMap(this);
|
1724
|
+
return this['[[SetData]]'].size;
|
1725
|
+
}
|
1726
|
+
});
|
1727
|
+
|
1728
|
+
defineProperties(SetShim.prototype, {
|
1729
|
+
has: function(key) {
|
1730
|
+
var fkey;
|
1731
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
1732
|
+
return !!this._storage[fkey];
|
1733
|
+
}
|
1734
|
+
ensureMap(this);
|
1735
|
+
return this['[[SetData]]'].has(key);
|
1736
|
+
},
|
1737
|
+
|
1738
|
+
add: function(key) {
|
1739
|
+
var fkey;
|
1740
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
1741
|
+
this._storage[fkey]=true;
|
1742
|
+
return;
|
1743
|
+
}
|
1744
|
+
ensureMap(this);
|
1745
|
+
return this['[[SetData]]'].set(key, key);
|
1746
|
+
},
|
1747
|
+
|
1748
|
+
'delete': function(key) {
|
1749
|
+
var fkey;
|
1750
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
1751
|
+
delete this._storage[fkey];
|
1752
|
+
return;
|
1753
|
+
}
|
1754
|
+
ensureMap(this);
|
1755
|
+
return this['[[SetData]]']['delete'](key);
|
1756
|
+
},
|
1757
|
+
|
1758
|
+
clear: function() {
|
1759
|
+
if (this._storage) {
|
1760
|
+
this._storage = emptyObject();
|
1761
|
+
return;
|
1762
|
+
}
|
1763
|
+
return this['[[SetData]]'].clear();
|
1764
|
+
},
|
1765
|
+
|
1766
|
+
keys: function() {
|
1767
|
+
ensureMap(this);
|
1768
|
+
return this['[[SetData]]'].keys();
|
1769
|
+
},
|
1770
|
+
|
1771
|
+
values: function() {
|
1772
|
+
ensureMap(this);
|
1773
|
+
return this['[[SetData]]'].values();
|
1774
|
+
},
|
1775
|
+
|
1776
|
+
entries: function() {
|
1777
|
+
ensureMap(this);
|
1778
|
+
return this['[[SetData]]'].entries();
|
1779
|
+
},
|
1780
|
+
|
1781
|
+
forEach: function(callback) {
|
1782
|
+
var context = arguments.length > 1 ? arguments[1] : null;
|
1783
|
+
var entireSet = this;
|
1784
|
+
ensureMap(this);
|
1785
|
+
this['[[SetData]]'].forEach(function(value, key) {
|
1786
|
+
callback.call(context, key, key, entireSet);
|
1787
|
+
});
|
1788
|
+
}
|
1789
|
+
});
|
1790
|
+
addIterator(SetShim.prototype, function() { return this.values(); });
|
1791
|
+
|
1792
|
+
return SetShim;
|
1793
|
+
})()
|
1794
|
+
};
|
1795
|
+
defineProperties(globals, collectionShims);
|
1796
|
+
|
1797
|
+
if (globals.Map || globals.Set) {
|
1798
|
+
/*
|
1799
|
+
- In Firefox < 23, Map#size is a function.
|
1800
|
+
- In all current Firefox, Set#entries/keys/values & Map#clear do not exist
|
1801
|
+
- https://bugzilla.mozilla.org/show_bug.cgi?id=869996
|
1802
|
+
- In Firefox 24, Map and Set do not implement forEach
|
1803
|
+
- In Firefox 25 at least, Map and Set are callable without "new"
|
1804
|
+
*/
|
1805
|
+
if (
|
1806
|
+
typeof globals.Map.prototype.clear !== 'function' ||
|
1807
|
+
new globals.Set().size !== 0 ||
|
1808
|
+
new globals.Map().size !== 0 ||
|
1809
|
+
typeof globals.Set.prototype.keys !== 'function' ||
|
1810
|
+
typeof globals.Map.prototype.forEach !== 'function' ||
|
1811
|
+
typeof globals.Set.prototype.forEach !== 'function' ||
|
1812
|
+
isCallableWithoutNew(globals.Map) ||
|
1813
|
+
isCallableWithoutNew(globals.Set) ||
|
1814
|
+
!supportsSubclassing(globals.Map, function(M) {
|
1815
|
+
return (new M([])) instanceof M;
|
1816
|
+
})
|
1817
|
+
) {
|
1818
|
+
globals.Map = collectionShims.Map;
|
1819
|
+
globals.Set = collectionShims.Set;
|
1820
|
+
}
|
1821
|
+
}
|
1822
|
+
// Shim incomplete iterator implementations.
|
1823
|
+
addIterator(Object.getPrototypeOf((new globals.Map()).keys()));
|
1824
|
+
addIterator(Object.getPrototypeOf((new globals.Set()).keys()));
|
1825
|
+
}
|
1826
|
+
};
|
1827
|
+
|
1828
|
+
if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
|
1829
|
+
define(main); // RequireJS
|
1830
|
+
} else {
|
1831
|
+
main(); // CommonJS and <script>
|
1832
|
+
}
|
1833
|
+
})();
|