├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .npmignore ├── ACKNOWLEDGEMENTS.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── bower.json ├── build ├── args.js ├── babel-options.js ├── paths.js ├── reports │ └── coverage │ │ └── Chrome 43.0.2357 (Mac OS X 10.10.3) │ │ ├── base.css │ │ ├── index.html │ │ ├── prettify.css │ │ ├── prettify.js │ │ ├── sort-arrow-sprite.png │ │ ├── sorter.js │ │ └── src │ │ ├── index.html │ │ └── index.js.html ├── tasks │ ├── build.js │ ├── clean.js │ ├── dev.js │ ├── doc.js │ ├── lint.js │ ├── prepare-release.js │ └── test.js └── typescript-options.js ├── circle.yml ├── config.js ├── dist ├── amd │ ├── aurelia-polyfills.js │ └── index.js ├── aurelia-polyfills.d.ts ├── aurelia-polyfills.js ├── commonjs │ ├── aurelia-polyfills.js │ └── index.js ├── es2015 │ ├── aurelia-polyfills.js │ └── index.js ├── index.d.ts ├── native-modules │ ├── aurelia-polyfills.js │ └── index.js └── system │ ├── aurelia-polyfills.js │ └── index.js ├── doc ├── CHANGELOG.md └── api.json ├── gulpfile.js ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── array.js ├── collections.js ├── number.js ├── object.js ├── reflect.js ├── string.js └── symbol.js ├── test └── polyfill.spec.js ├── tsconfig.json └── typings.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | map-1: &filter_only_develop 4 | filters: 5 | branches: 6 | only: develop 7 | 8 | map-2: &filter_only_tag 9 | filters: 10 | branches: 11 | ignore: /.*/ 12 | tags: 13 | only: /^v?[0-9]+(\.[0-9]+)*$/ 14 | 15 | orbs: 16 | v1: aurelia/v1@volatile 17 | 18 | workflows: 19 | main: 20 | jobs: 21 | - v1/build_test 22 | - v1/build_merge: 23 | <<: *filter_only_develop 24 | requires: 25 | - v1/build_test 26 | - v1/npm_publish: 27 | <<: *filter_only_tag 28 | name: npm_publish_dry 29 | args: "--dry-run" 30 | - request_publish_latest: 31 | <<: *filter_only_tag 32 | type: approval 33 | requires: 34 | - npm_publish_dry 35 | - v1/npm_publish: 36 | <<: *filter_only_tag 37 | name: npm_publish 38 | context: Aurelia 39 | requires: 40 | - request_publish_latest 41 | - v1/merge_back: 42 | <<: *filter_only_tag 43 | requires: 44 | - npm_publish 45 | 46 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | [**.*] 13 | indent_style = space 14 | indent_size = 2 -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/aurelia-tools/.eslintrc.json" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jspm_packages 3 | bower_components 4 | .idea 5 | .DS_STORE 6 | build/reports 7 | dist 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | jspm_packages 2 | bower_components 3 | .idea 4 | build/reports 5 | -------------------------------------------------------------------------------- /ACKNOWLEDGEMENTS.md: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | 3 | The String, Number and Array polyfills come from the MDN documentation. The collections, Symbol and Object.assign polyfills come from https://github.com/WebReflection. The Reflect.construct polyfill is based on the CoreJS implementation. Many thanks to the individuals who worked so hard on these implementations. Licenses are included below. 4 | 5 | ==== 6 | 7 | WebReflection License 8 | 9 | Copyright (C) 2011 by Andrea Giammarchi, @WebReflection 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | 29 | ==== 30 | 31 | CoreJS License 32 | 33 | Copyright (c) 2014-2016 Denis Pushkarev 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in 43 | all copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 51 | THE SOFTWARE. 52 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We'd love for you to contribute and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accept a Pull Request from you. More information on the process is included in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). 4 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 19 | **I'm submitting a bug report** 20 | **I'm submitting a feature request** 21 | 22 | * **Library Version:** 23 | major.minor.patch-pre 24 | 25 | 26 | **Please tell us about your environment:** 27 | * **Operating System:** 28 | OSX 10.x|Linux (distro)|Windows [7|8|8.1|10] 29 | 30 | * **Node Version:** 31 | 6.2.0 32 | 36 | 37 | * **NPM Version:** 38 | 3.8.9 39 | 43 | 44 | * **JSPM OR Webpack AND Version** 45 | JSPM 0.16.32 | webpack 2.1.0-beta.17 46 | 52 | 53 | * **Browser:** 54 | all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView 55 | 56 | * **Language:** 57 | all | TypeScript X.X | ESNext 58 | 59 | 60 | **Current behavior:** 61 | 62 | 63 | **Expected/desired behavior:** 64 | 71 | 72 | 73 | * **What is the expected behavior?** 74 | 75 | 76 | * **What is the motivation / use case for changing the behavior?** 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010 - 2018 Blue Spire Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aurelia-polyfills 2 | 3 | [![npm Version](https://img.shields.io/npm/v/aurelia-polyfills.svg)](https://www.npmjs.com/package/aurelia-polyfills) 4 | [![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) 5 | [![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 6 | [![CircleCI](https://circleci.com/gh/aurelia/polyfills.svg?style=shield)](https://circleci.com/gh/aurelia/polyfills) 7 | 8 | This library is part of the [Aurelia](http://www.aurelia.io/) platform and provides the minimal set of polyfills the platform needs to run on evergreen browsers. 9 | 10 | > To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. 11 | 12 | ## Polyfills included: 13 | - `Array.from` 14 | - `Array.prototype.find` 15 | - `Array.prototype.findIndex` 16 | - `Array.prototype.includes` 17 | - `Map` 18 | - `Number.isFinite` 19 | - `Number.isNaN` 20 | - `Object.assign` 21 | - `Object.is` 22 | - `Object.getOwnPropertySymbols` 23 | - `Reflect.construct` 24 | - `Reflect.defineMetadata` 25 | - `Reflect.defineProperty` 26 | - `Reflect.getOwnMetadata` 27 | - `Reflect.metadata` 28 | - `Reflect.ownKeys` 29 | - `Set` 30 | - `String.prototype.endsWith` 31 | - `String.prototype.startsWith` 32 | - `Symbol` 33 | - `WeakMap` 34 | - `WeakSet` 35 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-polyfills", 3 | "version": "1.3.5", 4 | "description": "The minimal set of polyfills that the Aurelia platform needs to run on ES5 browsers.", 5 | "keywords": [ 6 | "aurelia", 7 | "polyfill" 8 | ], 9 | "homepage": "http://aurelia.io", 10 | "main": "dist/commonjs/aurelia-polyfills.js", 11 | "moduleType": "node", 12 | "bugs": { 13 | "url": "https://github.com/aurelia/polyfills/issues" 14 | }, 15 | "license": "MIT", 16 | "author": "Rob Eisenberg (http://robeisenberg.com/)", 17 | "repository": { 18 | "type": "git", 19 | "url": "http://github.com/aurelia/polyfills" 20 | }, 21 | "dependencies": { 22 | "aurelia-pal": "^1.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /build/args.js: -------------------------------------------------------------------------------- 1 | var yargs = require('yargs'); 2 | 3 | var argv = yargs.argv, 4 | validBumpTypes = "major|minor|patch|prerelease".split("|"), 5 | bump = (argv.bump || 'patch').toLowerCase(); 6 | 7 | if(validBumpTypes.indexOf(bump) === -1) { 8 | throw new Error('Unrecognized bump "' + bump + '".'); 9 | } 10 | 11 | module.exports = { 12 | bump: bump 13 | }; 14 | -------------------------------------------------------------------------------- /build/babel-options.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var paths = require('./paths'); 3 | 4 | exports.base = function() { 5 | var config = { 6 | filename: '', 7 | filenameRelative: '', 8 | sourceMap: true, 9 | sourceRoot: '', 10 | moduleRoot: path.resolve('src').replace(/\\/g, '/'), 11 | moduleIds: false, 12 | comments: false, 13 | compact: false, 14 | code: true, 15 | presets: [ 'es2015-loose', 'stage-1' ], 16 | plugins: [ 17 | 'syntax-flow', 18 | 'transform-decorators-legacy', 19 | ] 20 | }; 21 | if (!paths.useTypeScriptForDTS) { 22 | config.plugins.push( 23 | ['babel-dts-generator', { 24 | packageName: paths.packageName, 25 | typings: '', 26 | suppressModulePath: true, 27 | suppressComments: false, 28 | memberOutputFilter: /^_.*/, 29 | suppressAmbientDeclaration: true 30 | }] 31 | ); 32 | }; 33 | config.plugins.push('transform-flow-strip-types'); 34 | return config; 35 | } 36 | 37 | exports.commonjs = function() { 38 | var options = exports.base(); 39 | options.plugins.push('transform-es2015-modules-commonjs'); 40 | return options; 41 | }; 42 | 43 | exports.amd = function() { 44 | var options = exports.base(); 45 | options.plugins.push('transform-es2015-modules-amd'); 46 | return options; 47 | }; 48 | 49 | exports.system = function() { 50 | var options = exports.base(); 51 | options.plugins.push('transform-es2015-modules-systemjs'); 52 | return options; 53 | }; 54 | 55 | exports.es2015 = function() { 56 | var options = exports.base(); 57 | options.presets = ['stage-1'] 58 | return options; 59 | }; 60 | 61 | exports['native-modules'] = function() { 62 | var options = exports.base(); 63 | options.presets[0] = 'es2015-loose-native-modules'; 64 | return options; 65 | } 66 | -------------------------------------------------------------------------------- /build/paths.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | // hide warning // 5 | var emitter = require('events'); 6 | emitter.defaultMaxListeners = 20; 7 | 8 | var appRoot = 'src/'; 9 | var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); 10 | 11 | var paths = { 12 | root: appRoot, 13 | source: appRoot + '**/*.js', 14 | html: appRoot + '**/*.html', 15 | style: 'styles/**/*.css', 16 | output: 'dist/', 17 | doc:'./doc', 18 | e2eSpecsSrc: 'test/e2e/src/*.js', 19 | e2eSpecsDist: 'test/e2e/dist/', 20 | packageName: pkg.name, 21 | ignore: [], 22 | useTypeScriptForDTS: false, 23 | importsToAdd: [], 24 | sort: false 25 | }; 26 | 27 | paths.files = [ 28 | 'symbol.js', 29 | 'number.js', 30 | 'string.js', 31 | 'array.js', 32 | 'object.js', 33 | 'collections.js', 34 | 'reflect.js' 35 | ].map(function(file){ 36 | return paths.root + file; 37 | }); 38 | 39 | module.exports = paths; 40 | -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | } 4 | body { 5 | font-family: Helvetica Neue, Helvetica,Arial; 6 | font-size: 10pt; 7 | } 8 | div.header, div.footer { 9 | background: #eee; 10 | padding: 1em; 11 | } 12 | div.header { 13 | z-index: 100; 14 | position: fixed; 15 | top: 0; 16 | border-bottom: 1px solid #666; 17 | width: 100%; 18 | } 19 | div.footer { 20 | border-top: 1px solid #666; 21 | } 22 | div.body { 23 | margin-top: 10em; 24 | } 25 | div.meta { 26 | font-size: 90%; 27 | text-align: center; 28 | } 29 | h1, h2, h3 { 30 | font-weight: normal; 31 | } 32 | h1 { 33 | font-size: 12pt; 34 | } 35 | h2 { 36 | font-size: 10pt; 37 | } 38 | pre { 39 | font-family: Consolas, Menlo, Monaco, monospace; 40 | margin: 0; 41 | padding: 0; 42 | line-height: 14px; 43 | font-size: 14px; 44 | -moz-tab-size: 2; 45 | -o-tab-size: 2; 46 | tab-size: 2; 47 | } 48 | 49 | div.path { font-size: 110%; } 50 | div.path a:link, div.path a:visited { color: #000; } 51 | table.coverage { border-collapse: collapse; margin:0; padding: 0 } 52 | 53 | table.coverage td { 54 | margin: 0; 55 | padding: 0; 56 | color: #111; 57 | vertical-align: top; 58 | } 59 | table.coverage td.line-count { 60 | width: 50px; 61 | text-align: right; 62 | padding-right: 5px; 63 | } 64 | table.coverage td.line-coverage { 65 | color: #777 !important; 66 | text-align: right; 67 | border-left: 1px solid #666; 68 | border-right: 1px solid #666; 69 | } 70 | 71 | table.coverage td.text { 72 | } 73 | 74 | table.coverage td span.cline-any { 75 | display: inline-block; 76 | padding: 0 5px; 77 | width: 40px; 78 | } 79 | table.coverage td span.cline-neutral { 80 | background: #eee; 81 | } 82 | table.coverage td span.cline-yes { 83 | background: #b5d592; 84 | color: #999; 85 | } 86 | table.coverage td span.cline-no { 87 | background: #fc8c84; 88 | } 89 | 90 | .cstat-yes { color: #111; } 91 | .cstat-no { background: #fc8c84; color: #111; } 92 | .fstat-no { background: #ffc520; color: #111 !important; } 93 | .cbranch-no { background: yellow !important; color: #111; } 94 | 95 | .cstat-skip { background: #ddd; color: #111; } 96 | .fstat-skip { background: #ddd; color: #111 !important; } 97 | .cbranch-skip { background: #ddd !important; color: #111; } 98 | 99 | .missing-if-branch { 100 | display: inline-block; 101 | margin-right: 10px; 102 | position: relative; 103 | padding: 0 4px; 104 | background: black; 105 | color: yellow; 106 | } 107 | 108 | .skip-if-branch { 109 | display: none; 110 | margin-right: 10px; 111 | position: relative; 112 | padding: 0 4px; 113 | background: #ccc; 114 | color: white; 115 | } 116 | 117 | .missing-if-branch .typ, .skip-if-branch .typ { 118 | color: inherit !important; 119 | } 120 | 121 | .entity, .metric { font-weight: bold; } 122 | .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } 123 | .metric small { font-size: 80%; font-weight: normal; color: #666; } 124 | 125 | div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } 126 | div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } 127 | div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } 128 | div.coverage-summary th.file { border-right: none !important; } 129 | div.coverage-summary th.pic { border-left: none !important; text-align: right; } 130 | div.coverage-summary th.pct { border-right: none !important; } 131 | div.coverage-summary th.abs { border-left: none !important; text-align: right; } 132 | div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } 133 | div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } 134 | div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } 135 | div.coverage-summary td.pic { min-width: 120px !important; } 136 | div.coverage-summary a:link { text-decoration: none; color: #000; } 137 | div.coverage-summary a:visited { text-decoration: none; color: #333; } 138 | div.coverage-summary a:hover { text-decoration: underline; } 139 | div.coverage-summary tfoot td { border-top: 1px solid #666; } 140 | 141 | div.coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | div.coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | div.coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | 155 | .high { background: #b5d592 !important; } 156 | .medium { background: #ffe87c !important; } 157 | .low { background: #fc8c84 !important; } 158 | 159 | span.cover-fill, span.cover-empty { 160 | display:inline-block; 161 | border:1px solid #444; 162 | background: white; 163 | height: 12px; 164 | } 165 | span.cover-fill { 166 | background: #ccc; 167 | border-right: 1px solid #444; 168 | } 169 | span.cover-empty { 170 | background: white; 171 | border-left: none; 172 | } 173 | span.cover-full { 174 | border-right: none !important; 175 | } 176 | pre.prettyprint { 177 | border: none !important; 178 | padding: 0 !important; 179 | margin: 0 !important; 180 | } 181 | .com { color: #999 !important; } 182 | .ignore-none { color: #999; font-weight: normal; } -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for All files 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for All files

17 |

18 | Statements: 73.42% (58 / 79)      19 | Branches: 56.25% (36 / 64)      20 | Functions: 54.55% (6 / 11)      21 | Lines: 73.42% (58 / 79)      22 | Ignored: none      23 |

24 |
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
FileStatementsBranchesFunctionsLines
src/73.42%(58 / 79)56.25%(36 / 64)54.55%(6 / 11)73.42%(58 / 79)
58 |
59 |
60 | 63 | 64 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/prettify.js: -------------------------------------------------------------------------------- 1 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); 2 | -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurelia/polyfills/bebda2a8b350cc2597f2f00a9662843af16aab2f/build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/sort-arrow-sprite.png -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/sorter.js: -------------------------------------------------------------------------------- 1 | var addSorting = (function () { 2 | "use strict"; 3 | var cols, 4 | currentSort = { 5 | index: 0, 6 | desc: false 7 | }; 8 | 9 | // returns the summary table element 10 | function getTable() { return document.querySelector('.coverage-summary table'); } 11 | // returns the thead element of the summary table 12 | function getTableHeader() { return getTable().querySelector('thead tr'); } 13 | // returns the tbody element of the summary table 14 | function getTableBody() { return getTable().querySelector('tbody'); } 15 | // returns the th element for nth column 16 | function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } 17 | 18 | // loads all columns 19 | function loadColumns() { 20 | var colNodes = getTableHeader().querySelectorAll('th'), 21 | colNode, 22 | cols = [], 23 | col, 24 | i; 25 | 26 | for (i = 0; i < colNodes.length; i += 1) { 27 | colNode = colNodes[i]; 28 | col = { 29 | key: colNode.getAttribute('data-col'), 30 | sortable: !colNode.getAttribute('data-nosort'), 31 | type: colNode.getAttribute('data-type') || 'string' 32 | }; 33 | cols.push(col); 34 | if (col.sortable) { 35 | col.defaultDescSort = col.type === 'number'; 36 | colNode.innerHTML = colNode.innerHTML + ''; 37 | } 38 | } 39 | return cols; 40 | } 41 | // attaches a data attribute to every tr element with an object 42 | // of data values keyed by column name 43 | function loadRowData(tableRow) { 44 | var tableCols = tableRow.querySelectorAll('td'), 45 | colNode, 46 | col, 47 | data = {}, 48 | i, 49 | val; 50 | for (i = 0; i < tableCols.length; i += 1) { 51 | colNode = tableCols[i]; 52 | col = cols[i]; 53 | val = colNode.getAttribute('data-value'); 54 | if (col.type === 'number') { 55 | val = Number(val); 56 | } 57 | data[col.key] = val; 58 | } 59 | return data; 60 | } 61 | // loads all row data 62 | function loadData() { 63 | var rows = getTableBody().querySelectorAll('tr'), 64 | i; 65 | 66 | for (i = 0; i < rows.length; i += 1) { 67 | rows[i].data = loadRowData(rows[i]); 68 | } 69 | } 70 | // sorts the table using the data for the ith column 71 | function sortByIndex(index, desc) { 72 | var key = cols[index].key, 73 | sorter = function (a, b) { 74 | a = a.data[key]; 75 | b = b.data[key]; 76 | return a < b ? -1 : a > b ? 1 : 0; 77 | }, 78 | finalSorter = sorter, 79 | tableBody = document.querySelector('.coverage-summary tbody'), 80 | rowNodes = tableBody.querySelectorAll('tr'), 81 | rows = [], 82 | i; 83 | 84 | if (desc) { 85 | finalSorter = function (a, b) { 86 | return -1 * sorter(a, b); 87 | }; 88 | } 89 | 90 | for (i = 0; i < rowNodes.length; i += 1) { 91 | rows.push(rowNodes[i]); 92 | tableBody.removeChild(rowNodes[i]); 93 | } 94 | 95 | rows.sort(finalSorter); 96 | 97 | for (i = 0; i < rows.length; i += 1) { 98 | tableBody.appendChild(rows[i]); 99 | } 100 | } 101 | // removes sort indicators for current column being sorted 102 | function removeSortIndicators() { 103 | var col = getNthColumn(currentSort.index), 104 | cls = col.className; 105 | 106 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 107 | col.className = cls; 108 | } 109 | // adds sort indicators for current column being sorted 110 | function addSortIndicators() { 111 | getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; 112 | } 113 | // adds event listeners for all sorter widgets 114 | function enableUI() { 115 | var i, 116 | el, 117 | ithSorter = function ithSorter(i) { 118 | var col = cols[i]; 119 | 120 | return function () { 121 | var desc = col.defaultDescSort; 122 | 123 | if (currentSort.index === i) { 124 | desc = !currentSort.desc; 125 | } 126 | sortByIndex(i, desc); 127 | removeSortIndicators(); 128 | currentSort.index = i; 129 | currentSort.desc = desc; 130 | addSortIndicators(); 131 | }; 132 | }; 133 | for (i =0 ; i < cols.length; i += 1) { 134 | if (cols[i].sortable) { 135 | el = getNthColumn(i).querySelector('.sorter'); 136 | if (el.addEventListener) { 137 | el.addEventListener('click', ithSorter(i)); 138 | } else { 139 | el.attachEvent('onclick', ithSorter(i)); 140 | } 141 | } 142 | } 143 | } 144 | // adds sorting functionality to the UI 145 | return function () { 146 | if (!getTable()) { 147 | return; 148 | } 149 | cols = loadColumns(); 150 | loadData(cols); 151 | addSortIndicators(); 152 | enableUI(); 153 | }; 154 | })(); 155 | 156 | window.addEventListener('load', addSorting); 157 | -------------------------------------------------------------------------------- /build/reports/coverage/Chrome 43.0.2357 (Mac OS X 10.10.3)/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for src/ 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for src/

17 |

18 | Statements: 73.42% (58 / 79)      19 | Branches: 56.25% (36 / 64)      20 | Functions: 54.55% (6 / 11)      21 | Lines: 73.42% (58 / 79)      22 | Ignored: none      23 |

24 |
All files » src/
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
FileStatementsBranchesFunctionsLines
index.js73.42%(58 / 79)56.25%(36 / 64)54.55%(6 / 11)73.42%(58 / 79)
58 |
59 |
60 | 63 | 64 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /build/tasks/build.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var to5 = require('gulp-babel'); 4 | var paths = require('../paths'); 5 | var compilerOptions = require('../babel-options'); 6 | var compilerTsOptions = require('../typescript-options'); 7 | var assign = Object.assign || require('object.assign'); 8 | var through2 = require('through2'); 9 | var concat = require('gulp-concat'); 10 | var insert = require('gulp-insert'); 11 | var rename = require('gulp-rename'); 12 | var tools = require('aurelia-tools'); 13 | var ts = require('gulp-typescript'); 14 | var gutil = require('gulp-util'); 15 | var gulpIgnore = require('gulp-ignore'); 16 | var merge = require('merge2'); 17 | var jsName = paths.packageName + '.js'; 18 | var compileToModules = ['es2015', 'commonjs', 'amd', 'system', 'native-modules']; 19 | 20 | function cleanGeneratedCode() { 21 | return through2.obj(function(file, enc, callback) { 22 | file.contents = new Buffer(tools.cleanGeneratedCode(file.contents.toString('utf8'))); 23 | this.push(file); 24 | return callback(); 25 | }); 26 | } 27 | 28 | gulp.task('build-index', function() { 29 | var importsToAdd = paths.importsToAdd.slice(); 30 | 31 | var src = gulp.src(paths.files); 32 | 33 | if (paths.sort) { 34 | src = src.pipe(tools.sortFiles()); 35 | } 36 | 37 | if (paths.ignore) { 38 | paths.ignore.forEach(function(filename){ 39 | src = src.pipe(gulpIgnore.exclude(filename)); 40 | }); 41 | } 42 | 43 | return src.pipe(through2.obj(function(file, enc, callback) { 44 | file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd)); 45 | this.push(file); 46 | return callback(); 47 | })) 48 | .pipe(concat(jsName)) 49 | .pipe(insert.transform(function(contents) { 50 | return tools.createImportBlock(importsToAdd) + contents; 51 | })) 52 | .pipe(gulp.dest(paths.output)); 53 | }); 54 | 55 | function gulpFileFromString(filename, string) { 56 | var src = require('stream').Readable({ objectMode: true }); 57 | src._read = function() { 58 | this.push(new gutil.File({ cwd: paths.appRoot, base: paths.output, path: filename, contents: new Buffer(string) })) 59 | this.push(null) 60 | } 61 | return src; 62 | } 63 | 64 | function srcForBabel() { 65 | return merge( 66 | gulp.src(paths.output + jsName), 67 | gulpFileFromString(paths.output + 'index.js', "export * from './" + paths.packageName + "';") 68 | ); 69 | } 70 | 71 | function srcForTypeScript() { 72 | return gulp 73 | .src(paths.output + paths.packageName + '.js') 74 | .pipe(rename(function (path) { 75 | if (path.extname == '.js') { 76 | path.extname = '.ts'; 77 | } 78 | })); 79 | } 80 | 81 | compileToModules.forEach(function(moduleType){ 82 | gulp.task('build-babel-' + moduleType, function () { 83 | return srcForBabel() 84 | .pipe(to5(assign({}, compilerOptions[moduleType]()))) 85 | .pipe(cleanGeneratedCode()) 86 | .pipe(gulp.dest(paths.output + moduleType)); 87 | }); 88 | 89 | if (moduleType === 'native-modules') return; // typescript doesn't support the combination of: es5 + native modules 90 | 91 | gulp.task('build-ts-' + moduleType, function () { 92 | var tsProject = ts.createProject( 93 | compilerTsOptions({ module: moduleType, target: moduleType == 'es2015' ? 'es2015' : 'es5' }), ts.reporter.defaultReporter()); 94 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 95 | return tsResult.js 96 | .pipe(gulp.dest(paths.output + moduleType)); 97 | }); 98 | }); 99 | 100 | gulp.task('build-dts', function() { 101 | var tsProject = ts.createProject( 102 | compilerTsOptions({ removeComments: false, target: "es2015", module: "es2015" }), ts.reporter.defaultReporter()); 103 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 104 | return tsResult.dts 105 | .pipe(gulp.dest(paths.output)); 106 | }); 107 | 108 | gulp.task('build', function(callback) { 109 | return runSequence( 110 | 'clean', 111 | 'build-index', 112 | compileToModules 113 | .map(function(moduleType) { return 'build-babel-' + moduleType }) 114 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 115 | callback 116 | ); 117 | }); 118 | 119 | gulp.task('build-ts', function(callback) { 120 | return runSequence( 121 | 'clean', 122 | 'build-index', 123 | 'build-babel-native-modules', 124 | compileToModules 125 | .filter(function(moduleType) { return moduleType !== 'native-modules' }) 126 | .map(function(moduleType) { return 'build-ts-' + moduleType }) 127 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 128 | callback 129 | ); 130 | }); 131 | -------------------------------------------------------------------------------- /build/tasks/clean.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var del = require('del'); 4 | var vinylPaths = require('vinyl-paths'); 5 | 6 | gulp.task('clean', function() { 7 | return gulp.src([paths.output]) 8 | .pipe(vinylPaths(del)); 9 | }); 10 | -------------------------------------------------------------------------------- /build/tasks/dev.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var tools = require('aurelia-tools'); 3 | 4 | gulp.task('update-own-deps', function(){ 5 | tools.updateOwnDependenciesFromLocalRepositories(); 6 | }); 7 | 8 | gulp.task('build-dev-env', function () { 9 | tools.buildDevEnv(); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/doc.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var typedoc = require('gulp-typedoc'); 4 | var runSequence = require('run-sequence'); 5 | var through2 = require('through2'); 6 | 7 | gulp.task('doc-generate', function(){ 8 | return gulp.src([paths.output + paths.packageName + '.d.ts']) 9 | .pipe(typedoc({ 10 | target: 'es6', 11 | includeDeclarations: true, 12 | moduleResolution: 'node', 13 | json: paths.doc + '/api.json', 14 | name: paths.packageName + '-docs',  15 | mode: 'modules', 16 | excludeExternals: true, 17 | ignoreCompilerErrors: false, 18 | version: true 19 | })); 20 | }); 21 | 22 | gulp.task('doc-shape', function(){ 23 | return gulp.src([paths.doc + '/api.json']) 24 | .pipe(through2.obj(function(file, enc, callback) { 25 | var json = JSON.parse(file.contents.toString('utf8')).children[0]; 26 | 27 | json = { 28 | name: paths.packageName, 29 | children: json.children, 30 | groups: json.groups 31 | }; 32 | 33 | file.contents = new Buffer(JSON.stringify(json)); 34 | this.push(file); 35 | return callback(); 36 | })) 37 | .pipe(gulp.dest(paths.doc)); 38 | }); 39 | 40 | gulp.task('doc', function(callback){ 41 | return runSequence( 42 | 'doc-generate', 43 | 'doc-shape', 44 | callback 45 | ); 46 | }); 47 | -------------------------------------------------------------------------------- /build/tasks/lint.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var eslint = require('gulp-eslint'); 4 | 5 | gulp.task('lint', function() { 6 | return gulp.src(paths.source) 7 | .pipe(eslint()) 8 | .pipe(eslint.format()) 9 | .pipe(eslint.failOnError()); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/prepare-release.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var paths = require('../paths'); 4 | var fs = require('fs'); 5 | var bump = require('gulp-bump'); 6 | var args = require('../args'); 7 | var conventionalChangelog = require('gulp-conventional-changelog'); 8 | 9 | gulp.task('changelog', function () { 10 | return gulp.src(paths.doc + '/CHANGELOG.md', { 11 | buffer: false 12 | }).pipe(conventionalChangelog({ 13 | preset: 'angular' 14 | })) 15 | .pipe(gulp.dest(paths.doc)); 16 | }); 17 | 18 | gulp.task('bump-version', function(){ 19 | return gulp.src(['./package.json', './bower.json']) 20 | .pipe(bump({type:args.bump })) //major|minor|patch|prerelease 21 | .pipe(gulp.dest('./')); 22 | }); 23 | 24 | gulp.task('prepare-release', function(callback){ 25 | return runSequence( 26 | 'build', 27 | //'lint', 28 | 'bump-version', 29 | //'doc', 30 | 'changelog', 31 | callback 32 | ); 33 | }); 34 | -------------------------------------------------------------------------------- /build/tasks/test.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var Karma = require('karma').Server; 3 | 4 | /** 5 | * Run test once and exit 6 | */ 7 | gulp.task('test', function (done) { 8 | new Karma({ 9 | configFile: __dirname + '/../../karma.conf.js', 10 | singleRun: true 11 | }, done).start(); 12 | }); 13 | 14 | /** 15 | * Watch for file changes and re-run tests on each change 16 | */ 17 | gulp.task('tdd', function (done) { 18 | new Karma({ 19 | configFile: __dirname + '/../../karma.conf.js' 20 | }, done).start(); 21 | }); 22 | 23 | /** 24 | * Run test once with code coverage and exit 25 | */ 26 | gulp.task('cover', function (done) { 27 | new Karma({ 28 | configFile: __dirname + '/../../karma.conf.js', 29 | singleRun: true, 30 | reporters: ['coverage'], 31 | preprocessors: { 32 | 'test/**/*.js': ['babel'], 33 | 'src/**/*.js': ['babel', 'coverage'] 34 | }, 35 | coverageReporter: { 36 | type: 'html', 37 | dir: 'build/reports/coverage' 38 | } 39 | }, done).start(); 40 | }); 41 | -------------------------------------------------------------------------------- /build/typescript-options.js: -------------------------------------------------------------------------------- 1 | var tsconfig = require('../tsconfig.json'); 2 | var assign = Object.assign || require('object.assign'); 3 | 4 | module.exports = function(override) { 5 | return assign(tsconfig.compilerOptions, { 6 | "target": override && override.target || "es5", 7 | "typescript": require('typescript') 8 | }, override || {}); 9 | } 10 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | ##### 2 | # Circle CI 3 | # 4 | # For running docker images on circle ci, see: https://circleci.com/docs/docker 5 | # For circle.yml explanation, see: https://circleci.com/docs/manually 6 | ##### 7 | 8 | machine: 9 | node: 10 | version: 4.2.6 11 | 12 | dependencies: 13 | pre: 14 | - npm install -g gulp 15 | - npm install -g jspm 16 | override: 17 | - npm install 18 | - jspm install 19 | 20 | test: 21 | override: 22 | - gulp build 23 | - gulp test 24 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | defaultJSExtensions: true, 3 | transpiler: "babel", 4 | babelOptions: { 5 | "optional": [ 6 | "runtime", 7 | "optimisation.modules.system" 8 | ] 9 | }, 10 | paths: { 11 | "github:*": "jspm_packages/github/*", 12 | "npm:*": "jspm_packages/npm/*" 13 | }, 14 | 15 | map: { 16 | "aurelia-pal": "npm:aurelia-pal@1.0.0", 17 | "babel": "npm:babel-core@5.8.38", 18 | "babel-runtime": "npm:babel-runtime@5.8.38", 19 | "core-js": "npm:core-js@2.4.1", 20 | "github:jspm/nodelibs-assert@0.1.0": { 21 | "assert": "npm:assert@1.4.1" 22 | }, 23 | "github:jspm/nodelibs-buffer@0.1.0": { 24 | "buffer": "npm:buffer@3.6.0" 25 | }, 26 | "github:jspm/nodelibs-path@0.1.0": { 27 | "path-browserify": "npm:path-browserify@0.0.0" 28 | }, 29 | "github:jspm/nodelibs-process@0.1.2": { 30 | "process": "npm:process@0.11.6" 31 | }, 32 | "github:jspm/nodelibs-util@0.1.0": { 33 | "util": "npm:util@0.10.3" 34 | }, 35 | "github:jspm/nodelibs-vm@0.1.0": { 36 | "vm-browserify": "npm:vm-browserify@0.0.4" 37 | }, 38 | "npm:assert@1.4.1": { 39 | "assert": "github:jspm/nodelibs-assert@0.1.0", 40 | "buffer": "github:jspm/nodelibs-buffer@0.1.0", 41 | "process": "github:jspm/nodelibs-process@0.1.2", 42 | "util": "npm:util@0.10.3" 43 | }, 44 | "npm:babel-runtime@5.8.38": { 45 | "process": "github:jspm/nodelibs-process@0.1.2" 46 | }, 47 | "npm:buffer@3.6.0": { 48 | "base64-js": "npm:base64-js@0.0.8", 49 | "child_process": "github:jspm/nodelibs-child_process@0.1.0", 50 | "fs": "github:jspm/nodelibs-fs@0.1.2", 51 | "ieee754": "npm:ieee754@1.1.6", 52 | "isarray": "npm:isarray@1.0.0", 53 | "process": "github:jspm/nodelibs-process@0.1.2" 54 | }, 55 | "npm:core-js@2.4.1": { 56 | "fs": "github:jspm/nodelibs-fs@0.1.2", 57 | "path": "github:jspm/nodelibs-path@0.1.0", 58 | "process": "github:jspm/nodelibs-process@0.1.2", 59 | "systemjs-json": "github:systemjs/plugin-json@0.1.2" 60 | }, 61 | "npm:inherits@2.0.1": { 62 | "util": "github:jspm/nodelibs-util@0.1.0" 63 | }, 64 | "npm:path-browserify@0.0.0": { 65 | "process": "github:jspm/nodelibs-process@0.1.2" 66 | }, 67 | "npm:process@0.11.6": { 68 | "assert": "github:jspm/nodelibs-assert@0.1.0", 69 | "fs": "github:jspm/nodelibs-fs@0.1.2", 70 | "vm": "github:jspm/nodelibs-vm@0.1.0" 71 | }, 72 | "npm:util@0.10.3": { 73 | "inherits": "npm:inherits@2.0.1", 74 | "process": "github:jspm/nodelibs-process@0.1.2" 75 | }, 76 | "npm:vm-browserify@0.0.4": { 77 | "indexof": "npm:indexof@0.0.1" 78 | } 79 | } 80 | }); 81 | -------------------------------------------------------------------------------- /dist/amd/aurelia-polyfills.js: -------------------------------------------------------------------------------- 1 | define(['aurelia-pal'], function (_aureliaPal) { 2 | 'use strict'; 3 | 4 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 5 | return typeof obj; 6 | } : function (obj) { 7 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 8 | }; 9 | 10 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 11 | 12 | (function (Object, GOPS) { 13 | 'use strict'; 14 | 15 | if (GOPS in Object) return; 16 | 17 | var setDescriptor, 18 | G = _aureliaPal.PLATFORM.global, 19 | id = 0, 20 | random = '' + Math.random(), 21 | prefix = '__\x01symbol:', 22 | prefixLength = prefix.length, 23 | internalSymbol = '__\x01symbol@@' + random, 24 | DP = 'defineProperty', 25 | DPies = 'defineProperties', 26 | GOPN = 'getOwnPropertyNames', 27 | GOPD = 'getOwnPropertyDescriptor', 28 | PIE = 'propertyIsEnumerable', 29 | gOPN = Object[GOPN], 30 | gOPD = Object[GOPD], 31 | create = Object.create, 32 | keys = Object.keys, 33 | defineProperty = Object[DP], 34 | $defineProperties = Object[DPies], 35 | descriptor = gOPD(Object, GOPN), 36 | ObjectProto = Object.prototype, 37 | hOP = ObjectProto.hasOwnProperty, 38 | pIE = ObjectProto[PIE], 39 | toString = ObjectProto.toString, 40 | indexOf = Array.prototype.indexOf || function (v) { 41 | for (var i = this.length; i-- && this[i] !== v;) {} 42 | return i; 43 | }, 44 | addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) { 45 | if (!hOP.call(o, internalSymbol)) { 46 | defineProperty(o, internalSymbol, { 47 | enumerable: false, 48 | configurable: false, 49 | writable: false, 50 | value: {} 51 | }); 52 | } 53 | o[internalSymbol]['@@' + uid] = enumerable; 54 | }, 55 | createWithSymbols = function createWithSymbols(proto, descriptors) { 56 | var self = create(proto); 57 | if (descriptors !== null && (typeof descriptors === 'undefined' ? 'undefined' : _typeof(descriptors)) === 'object') { 58 | gOPN(descriptors).forEach(function (key) { 59 | if (propertyIsEnumerable.call(descriptors, key)) { 60 | $defineProperty(self, key, descriptors[key]); 61 | } 62 | }); 63 | } 64 | return self; 65 | }, 66 | copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) { 67 | var newDescriptor = create(descriptor); 68 | newDescriptor.enumerable = false; 69 | return newDescriptor; 70 | }, 71 | get = function get() {}, 72 | onlyNonSymbols = function onlyNonSymbols(name) { 73 | return name != internalSymbol && !hOP.call(source, name); 74 | }, 75 | onlySymbols = function onlySymbols(name) { 76 | return name != internalSymbol && hOP.call(source, name); 77 | }, 78 | propertyIsEnumerable = function propertyIsEnumerable(key) { 79 | var uid = '' + key; 80 | return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol] && this[internalSymbol]['@@' + uid] : pIE.call(this, key); 81 | }, 82 | setAndGetSymbol = function setAndGetSymbol(uid) { 83 | var descriptor = { 84 | enumerable: false, 85 | configurable: true, 86 | get: get, 87 | set: function set(value) { 88 | setDescriptor(this, uid, { 89 | enumerable: false, 90 | configurable: true, 91 | writable: true, 92 | value: value 93 | }); 94 | addInternalIfNeeded(this, uid, true); 95 | } 96 | }; 97 | defineProperty(ObjectProto, uid, descriptor); 98 | return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor); 99 | }, 100 | _Symbol = function _Symbol2(description) { 101 | if (this && this !== G) { 102 | throw new TypeError('Symbol is not a constructor'); 103 | } 104 | return setAndGetSymbol(prefix.concat(description || '', random, ++id)); 105 | }, 106 | source = create(null), 107 | sourceConstructor = { value: _Symbol }, 108 | sourceMap = function sourceMap(uid) { 109 | return source[uid]; 110 | }, 111 | $defineProperty = function defineProp(o, key, descriptor) { 112 | var uid = '' + key; 113 | if (onlySymbols(uid)) { 114 | setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor); 115 | addInternalIfNeeded(o, uid, !!descriptor.enumerable); 116 | } else { 117 | defineProperty(o, key, descriptor); 118 | } 119 | return o; 120 | }, 121 | $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 122 | var cof = toString.call(o); 123 | o = cof === '[object String]' ? o.split('') : Object(o); 124 | return gOPN(o).filter(onlySymbols).map(sourceMap); 125 | }; 126 | 127 | descriptor.value = $defineProperty; 128 | defineProperty(Object, DP, descriptor); 129 | 130 | descriptor.value = $getOwnPropertySymbols; 131 | defineProperty(Object, GOPS, descriptor); 132 | 133 | var cachedWindowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' ? Object.getOwnPropertyNames(window) : []; 134 | var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames; 135 | descriptor.value = function getOwnPropertyNames(o) { 136 | if (toString.call(o) === '[object Window]') { 137 | try { 138 | return originalObjectGetOwnPropertyNames(o); 139 | } catch (e) { 140 | return [].concat([], cachedWindowNames); 141 | } 142 | } 143 | return gOPN(o).filter(onlyNonSymbols); 144 | }; 145 | defineProperty(Object, GOPN, descriptor); 146 | 147 | descriptor.value = function defineProperties(o, descriptors) { 148 | var symbols = $getOwnPropertySymbols(descriptors); 149 | if (symbols.length) { 150 | keys(descriptors).concat(symbols).forEach(function (uid) { 151 | if (propertyIsEnumerable.call(descriptors, uid)) { 152 | $defineProperty(o, uid, descriptors[uid]); 153 | } 154 | }); 155 | } else { 156 | $defineProperties(o, descriptors); 157 | } 158 | return o; 159 | }; 160 | defineProperty(Object, DPies, descriptor); 161 | 162 | descriptor.value = propertyIsEnumerable; 163 | defineProperty(ObjectProto, PIE, descriptor); 164 | 165 | descriptor.value = _Symbol; 166 | defineProperty(G, 'Symbol', descriptor); 167 | 168 | descriptor.value = function (key) { 169 | var uid = prefix.concat(prefix, key, random); 170 | return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 171 | }; 172 | defineProperty(_Symbol, 'for', descriptor); 173 | 174 | descriptor.value = function (symbol) { 175 | return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0; 176 | }; 177 | defineProperty(_Symbol, 'keyFor', descriptor); 178 | 179 | descriptor.value = function getOwnPropertyDescriptor(o, key) { 180 | var descriptor = gOPD(o, key); 181 | if (descriptor && onlySymbols(key)) { 182 | descriptor.enumerable = propertyIsEnumerable.call(o, key); 183 | } 184 | return descriptor; 185 | }; 186 | defineProperty(Object, GOPD, descriptor); 187 | 188 | descriptor.value = function (proto, descriptors) { 189 | return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors); 190 | }; 191 | defineProperty(Object, 'create', descriptor); 192 | 193 | descriptor.value = function () { 194 | var str = toString.call(this); 195 | return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str; 196 | }; 197 | defineProperty(ObjectProto, 'toString', descriptor); 198 | 199 | try { 200 | setDescriptor = create(defineProperty({}, prefix, { 201 | get: function get() { 202 | return defineProperty(this, prefix, { value: false })[prefix]; 203 | } 204 | }))[prefix] || defineProperty; 205 | } catch (o_O) { 206 | setDescriptor = function setDescriptor(o, key, descriptor) { 207 | var protoDescriptor = gOPD(ObjectProto, key); 208 | delete ObjectProto[key]; 209 | defineProperty(o, key, descriptor); 210 | defineProperty(ObjectProto, key, protoDescriptor); 211 | }; 212 | } 213 | })(Object, 'getOwnPropertySymbols'); 214 | 215 | (function (O, S) { 216 | var dP = O.defineProperty, 217 | ObjectProto = O.prototype, 218 | toString = ObjectProto.toString, 219 | toStringTag = 'toStringTag', 220 | descriptor; 221 | ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) { 222 | if (!(name in Symbol)) { 223 | dP(Symbol, name, { value: Symbol(name) }); 224 | switch (name) { 225 | case toStringTag: 226 | descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString'); 227 | descriptor.value = function () { 228 | var str = toString.call(this), 229 | tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag]; 230 | return typeof tst === 'undefined' ? str : '[object ' + tst + ']'; 231 | }; 232 | dP(ObjectProto, 'toString', descriptor); 233 | break; 234 | } 235 | } 236 | }); 237 | })(Object, Symbol); 238 | 239 | (function (Si, AP, SP) { 240 | 241 | function returnThis() { 242 | return this; 243 | } 244 | 245 | if (!AP[Si]) AP[Si] = function () { 246 | var i = 0, 247 | self = this, 248 | iterator = { 249 | next: function next() { 250 | var done = self.length <= i; 251 | return done ? { done: done } : { done: done, value: self[i++] }; 252 | } 253 | }; 254 | iterator[Si] = returnThis; 255 | return iterator; 256 | }; 257 | 258 | if (!SP[Si]) SP[Si] = function () { 259 | var fromCodePoint = String.fromCodePoint, 260 | self = this, 261 | i = 0, 262 | length = self.length, 263 | iterator = { 264 | next: function next() { 265 | var done = length <= i, 266 | c = done ? '' : fromCodePoint(self.codePointAt(i)); 267 | i += c.length; 268 | return done ? { done: done } : { done: done, value: c }; 269 | } 270 | }; 271 | iterator[Si] = returnThis; 272 | return iterator; 273 | }; 274 | })(Symbol.iterator, Array.prototype, String.prototype); 275 | } 276 | 277 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 278 | 279 | Number.isNaN = Number.isNaN || function (value) { 280 | return value !== value; 281 | }; 282 | 283 | Number.isFinite = Number.isFinite || function (value) { 284 | return typeof value === "number" && isFinite(value); 285 | }; 286 | } 287 | 288 | if (!String.prototype.endsWith || function () { 289 | try { 290 | return !"ab".endsWith("a", 1); 291 | } catch (e) { 292 | return true; 293 | } 294 | }()) { 295 | String.prototype.endsWith = function (searchString, position) { 296 | var subjectString = this.toString(); 297 | if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 298 | position = subjectString.length; 299 | } 300 | position -= searchString.length; 301 | var lastIndex = subjectString.indexOf(searchString, position); 302 | return lastIndex !== -1 && lastIndex === position; 303 | }; 304 | } 305 | 306 | if (!String.prototype.startsWith || function () { 307 | try { 308 | return !"ab".startsWith("b", 1); 309 | } catch (e) { 310 | return true; 311 | } 312 | }()) { 313 | String.prototype.startsWith = function (searchString, position) { 314 | position = position || 0; 315 | return this.substr(position, searchString.length) === searchString; 316 | }; 317 | } 318 | 319 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 320 | 321 | if (!Array.from) { 322 | Array.from = function () { 323 | var toInteger = function toInteger(it) { 324 | return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it); 325 | }; 326 | var toLength = function toLength(it) { 327 | return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0; 328 | }; 329 | var iterCall = function iterCall(iter, fn, val, index) { 330 | try { 331 | return fn(val, index); 332 | } catch (E) { 333 | if (typeof iter.return == 'function') iter.return(); 334 | throw E; 335 | } 336 | }; 337 | 338 | return function from(arrayLike) { 339 | var O = Object(arrayLike), 340 | C = typeof this == 'function' ? this : Array, 341 | aLen = arguments.length, 342 | mapfn = aLen > 1 ? arguments[1] : undefined, 343 | mapping = mapfn !== undefined, 344 | index = 0, 345 | iterFn = O[Symbol.iterator], 346 | length, 347 | result, 348 | step, 349 | iterator; 350 | if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined); 351 | if (iterFn != undefined && !Array.isArray(arrayLike)) { 352 | for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { 353 | result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value; 354 | } 355 | } else { 356 | length = toLength(O.length); 357 | for (result = new C(length); length > index; index++) { 358 | result[index] = mapping ? mapfn(O[index], index) : O[index]; 359 | } 360 | } 361 | result.length = index; 362 | return result; 363 | }; 364 | }(); 365 | } 366 | 367 | if (!Array.prototype.find) { 368 | Object.defineProperty(Array.prototype, 'find', { 369 | configurable: true, 370 | writable: true, 371 | enumerable: false, 372 | value: function value(predicate) { 373 | if (this === null) { 374 | throw new TypeError('Array.prototype.find called on null or undefined'); 375 | } 376 | if (typeof predicate !== 'function') { 377 | throw new TypeError('predicate must be a function'); 378 | } 379 | var list = Object(this); 380 | var length = list.length >>> 0; 381 | var thisArg = arguments[1]; 382 | var value; 383 | 384 | for (var i = 0; i < length; i++) { 385 | value = list[i]; 386 | if (predicate.call(thisArg, value, i, list)) { 387 | return value; 388 | } 389 | } 390 | return undefined; 391 | } 392 | }); 393 | } 394 | 395 | if (!Array.prototype.findIndex) { 396 | Object.defineProperty(Array.prototype, 'findIndex', { 397 | configurable: true, 398 | writable: true, 399 | enumerable: false, 400 | value: function value(predicate) { 401 | if (this === null) { 402 | throw new TypeError('Array.prototype.findIndex called on null or undefined'); 403 | } 404 | if (typeof predicate !== 'function') { 405 | throw new TypeError('predicate must be a function'); 406 | } 407 | var list = Object(this); 408 | var length = list.length >>> 0; 409 | var thisArg = arguments[1]; 410 | var value; 411 | 412 | for (var i = 0; i < length; i++) { 413 | value = list[i]; 414 | if (predicate.call(thisArg, value, i, list)) { 415 | return i; 416 | } 417 | } 418 | return -1; 419 | } 420 | }); 421 | } 422 | } 423 | 424 | if (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) { 425 | Object.defineProperty(Array.prototype, 'includes', { 426 | configurable: true, 427 | writable: true, 428 | enumerable: false, 429 | value: function value(searchElement) { 430 | var O = Object(this); 431 | var len = parseInt(O.length) || 0; 432 | if (len === 0) { 433 | return false; 434 | } 435 | var n = parseInt(arguments[1]) || 0; 436 | var k; 437 | if (n >= 0) { 438 | k = n; 439 | } else { 440 | k = len + n; 441 | if (k < 0) { 442 | k = 0; 443 | } 444 | } 445 | var currentElement; 446 | while (k < len) { 447 | currentElement = O[k]; 448 | if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { 449 | return true; 450 | } 451 | k++; 452 | } 453 | return false; 454 | } 455 | }); 456 | } 457 | 458 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 459 | 460 | (function () { 461 | var needsFix = false; 462 | 463 | try { 464 | var s = Object.keys('a'); 465 | needsFix = s.length !== 1 || s[0] !== '0'; 466 | } catch (e) { 467 | needsFix = true; 468 | } 469 | 470 | if (needsFix) { 471 | Object.keys = function () { 472 | var hasOwnProperty = Object.prototype.hasOwnProperty, 473 | hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), 474 | dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], 475 | dontEnumsLength = dontEnums.length; 476 | 477 | return function (obj) { 478 | if (obj === undefined || obj === null) { 479 | throw TypeError('Cannot convert undefined or null to object'); 480 | } 481 | 482 | obj = Object(obj); 483 | 484 | var result = [], 485 | prop, 486 | i; 487 | 488 | for (prop in obj) { 489 | if (hasOwnProperty.call(obj, prop)) { 490 | result.push(prop); 491 | } 492 | } 493 | 494 | if (hasDontEnumBug) { 495 | for (i = 0; i < dontEnumsLength; i++) { 496 | if (hasOwnProperty.call(obj, dontEnums[i])) { 497 | result.push(dontEnums[i]); 498 | } 499 | } 500 | } 501 | 502 | return result; 503 | }; 504 | }(); 505 | } 506 | })(); 507 | 508 | (function (O) { 509 | if ('assign' in O) { 510 | return; 511 | } 512 | 513 | O.defineProperty(O, 'assign', { 514 | configurable: true, 515 | writable: true, 516 | value: function () { 517 | var gOPS = O.getOwnPropertySymbols, 518 | pIE = O.propertyIsEnumerable, 519 | filterOS = gOPS ? function (self) { 520 | return gOPS(self).filter(pIE, self); 521 | } : function () { 522 | return Array.prototype; 523 | }; 524 | 525 | return function assign(where) { 526 | if (gOPS && !(where instanceof O)) { 527 | console.warn('problematic Symbols', where); 528 | } 529 | 530 | function set(keyOrSymbol) { 531 | where[keyOrSymbol] = arg[keyOrSymbol]; 532 | } 533 | 534 | for (var i = 1, ii = arguments.length; i < ii; ++i) { 535 | var arg = arguments[i]; 536 | 537 | if (arg === null || arg === undefined) { 538 | continue; 539 | } 540 | 541 | O.keys(arg).concat(filterOS(arg)).forEach(set); 542 | } 543 | 544 | return where; 545 | }; 546 | }() 547 | }); 548 | })(Object); 549 | 550 | if (!Object.is) { 551 | Object.is = function (x, y) { 552 | if (x === y) { 553 | return x !== 0 || 1 / x === 1 / y; 554 | } else { 555 | return x !== x && y !== y; 556 | } 557 | }; 558 | } 559 | } 560 | 561 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 562 | 563 | (function (global) { 564 | var i; 565 | 566 | var defineProperty = Object.defineProperty, 567 | is = function is(a, b) { 568 | return a === b || a !== a && b !== b; 569 | }; 570 | 571 | if (typeof WeakMap == 'undefined') { 572 | global.WeakMap = createCollection({ 573 | 'delete': sharedDelete, 574 | 575 | clear: sharedClear, 576 | 577 | get: sharedGet, 578 | 579 | has: mapHas, 580 | 581 | set: sharedSet 582 | }, true); 583 | } 584 | 585 | if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) { 586 | var _createCollection; 587 | 588 | global.Map = createCollection((_createCollection = { 589 | 'delete': sharedDelete, 590 | 591 | has: mapHas, 592 | 593 | get: sharedGet, 594 | 595 | set: sharedSet, 596 | 597 | keys: sharedKeys, 598 | 599 | values: sharedValues, 600 | 601 | entries: mapEntries, 602 | 603 | forEach: sharedForEach, 604 | 605 | clear: sharedClear 606 | }, _createCollection[Symbol.iterator] = mapEntries, _createCollection)); 607 | } 608 | 609 | if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) { 610 | var _createCollection2; 611 | 612 | global.Set = createCollection((_createCollection2 = { 613 | has: setHas, 614 | 615 | add: sharedAdd, 616 | 617 | 'delete': sharedDelete, 618 | 619 | clear: sharedClear, 620 | 621 | keys: sharedValues, 622 | values: sharedValues, 623 | 624 | entries: setEntries, 625 | 626 | forEach: sharedForEach 627 | }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2)); 628 | } 629 | 630 | if (typeof WeakSet == 'undefined') { 631 | global.WeakSet = createCollection({ 632 | 'delete': sharedDelete, 633 | 634 | add: sharedAdd, 635 | 636 | clear: sharedClear, 637 | 638 | has: setHas 639 | }, true); 640 | } 641 | 642 | function createCollection(proto, objectOnly) { 643 | function Collection(a) { 644 | if (!this || this.constructor !== Collection) return new Collection(a); 645 | this._keys = []; 646 | this._values = []; 647 | this._itp = []; 648 | this.objectOnly = objectOnly; 649 | 650 | if (a) init.call(this, a); 651 | } 652 | 653 | if (!objectOnly) { 654 | defineProperty(proto, 'size', { 655 | get: sharedSize 656 | }); 657 | } 658 | 659 | proto.constructor = Collection; 660 | Collection.prototype = proto; 661 | 662 | return Collection; 663 | } 664 | 665 | function init(a) { 666 | var i; 667 | 668 | if (this.add) a.forEach(this.add, this);else a.forEach(function (a) { 669 | this.set(a[0], a[1]); 670 | }, this); 671 | } 672 | 673 | function sharedDelete(key) { 674 | if (this.has(key)) { 675 | this._keys.splice(i, 1); 676 | this._values.splice(i, 1); 677 | 678 | this._itp.forEach(function (p) { 679 | if (i < p[0]) p[0]--; 680 | }); 681 | } 682 | 683 | return -1 < i; 684 | }; 685 | 686 | function sharedGet(key) { 687 | return this.has(key) ? this._values[i] : undefined; 688 | } 689 | 690 | function has(list, key) { 691 | if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key"); 692 | 693 | if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key); 694 | return -1 < i; 695 | } 696 | 697 | function setHas(value) { 698 | return has.call(this, this._values, value); 699 | } 700 | 701 | function mapHas(value) { 702 | return has.call(this, this._keys, value); 703 | } 704 | 705 | function sharedSet(key, value) { 706 | this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value; 707 | return this; 708 | } 709 | 710 | function sharedAdd(value) { 711 | if (!this.has(value)) this._values.push(value); 712 | return this; 713 | } 714 | 715 | function sharedClear() { 716 | (this._keys || 0).length = this._values.length = 0; 717 | } 718 | 719 | function sharedKeys() { 720 | return sharedIterator(this._itp, this._keys); 721 | } 722 | 723 | function sharedValues() { 724 | return sharedIterator(this._itp, this._values); 725 | } 726 | 727 | function mapEntries() { 728 | return sharedIterator(this._itp, this._keys, this._values); 729 | } 730 | 731 | function setEntries() { 732 | return sharedIterator(this._itp, this._values, this._values); 733 | } 734 | 735 | function sharedIterator(itp, array, array2) { 736 | var _ref; 737 | 738 | var p = [0], 739 | done = false; 740 | itp.push(p); 741 | return _ref = {}, _ref[Symbol.iterator] = function () { 742 | return this; 743 | }, _ref.next = function next() { 744 | var v, 745 | k = p[0]; 746 | if (!done && k < array.length) { 747 | v = array2 ? [array[k], array2[k]] : array[k]; 748 | p[0]++; 749 | } else { 750 | done = true; 751 | itp.splice(itp.indexOf(p), 1); 752 | } 753 | return { done: done, value: v }; 754 | }, _ref; 755 | } 756 | 757 | function sharedSize() { 758 | return this._values.length; 759 | } 760 | 761 | function sharedForEach(callback, context) { 762 | var it = this.entries(); 763 | for (;;) { 764 | var r = it.next(); 765 | if (r.done) break; 766 | callback.call(context, r.value[1], r.value[0], this); 767 | } 768 | } 769 | })(_aureliaPal.PLATFORM.global); 770 | } 771 | 772 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 773 | 774 | var bind = Function.prototype.bind; 775 | 776 | if (typeof _aureliaPal.PLATFORM.global.Reflect === 'undefined') { 777 | _aureliaPal.PLATFORM.global.Reflect = {}; 778 | } 779 | 780 | if (typeof Reflect.defineProperty !== 'function') { 781 | Reflect.defineProperty = function (target, propertyKey, descriptor) { 782 | if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') { 783 | throw new TypeError('Reflect.defineProperty called on non-object'); 784 | } 785 | try { 786 | Object.defineProperty(target, propertyKey, descriptor); 787 | return true; 788 | } catch (e) { 789 | return false; 790 | } 791 | }; 792 | } 793 | 794 | if (typeof Reflect.construct !== 'function') { 795 | Reflect.construct = function (Target, args) { 796 | if (args) { 797 | switch (args.length) { 798 | case 0: 799 | return new Target(); 800 | case 1: 801 | return new Target(args[0]); 802 | case 2: 803 | return new Target(args[0], args[1]); 804 | case 3: 805 | return new Target(args[0], args[1], args[2]); 806 | case 4: 807 | return new Target(args[0], args[1], args[2], args[3]); 808 | } 809 | } 810 | 811 | var a = [null]; 812 | a.push.apply(a, args); 813 | return new (bind.apply(Target, a))(); 814 | }; 815 | } 816 | 817 | if (typeof Reflect.ownKeys !== 'function') { 818 | Reflect.ownKeys = function (o) { 819 | return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)); 820 | }; 821 | } 822 | } 823 | 824 | if (typeof FEATURE_NO_ESNEXT === 'undefined') { 825 | 826 | var emptyMetadata = Object.freeze({}); 827 | var metadataContainerKey = '__metadata__'; 828 | 829 | if (typeof Reflect.getOwnMetadata !== 'function') { 830 | Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { 831 | if (target.hasOwnProperty(metadataContainerKey)) { 832 | return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey]; 833 | } 834 | }; 835 | } 836 | 837 | if (typeof Reflect.defineMetadata !== 'function') { 838 | Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { 839 | var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; 840 | var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); 841 | targetContainer[metadataKey] = metadataValue; 842 | }; 843 | } 844 | 845 | if (typeof Reflect.metadata !== 'function') { 846 | Reflect.metadata = function (metadataKey, metadataValue) { 847 | return function (target, targetKey) { 848 | Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); 849 | }; 850 | }; 851 | } 852 | } 853 | }); -------------------------------------------------------------------------------- /dist/amd/index.js: -------------------------------------------------------------------------------- 1 | define(['exports', './aurelia-polyfills'], function (exports, _aureliaPolyfills) { 2 | 'use strict'; 3 | 4 | Object.defineProperty(exports, "__esModule", { 5 | value: true 6 | }); 7 | Object.keys(_aureliaPolyfills).forEach(function (key) { 8 | if (key === "default" || key === "__esModule") return; 9 | Object.defineProperty(exports, key, { 10 | enumerable: true, 11 | get: function () { 12 | return _aureliaPolyfills[key]; 13 | } 14 | }); 15 | }); 16 | }); -------------------------------------------------------------------------------- /dist/aurelia-polyfills.d.ts: -------------------------------------------------------------------------------- 1 | import { 2 | PLATFORM 3 | } from 'aurelia-pal'; -------------------------------------------------------------------------------- /dist/commonjs/aurelia-polyfills.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 4 | 5 | var _aureliaPal = require('aurelia-pal'); 6 | 7 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 8 | 9 | (function (Object, GOPS) { 10 | 'use strict'; 11 | 12 | if (GOPS in Object) return; 13 | 14 | var setDescriptor, 15 | G = _aureliaPal.PLATFORM.global, 16 | id = 0, 17 | random = '' + Math.random(), 18 | prefix = '__\x01symbol:', 19 | prefixLength = prefix.length, 20 | internalSymbol = '__\x01symbol@@' + random, 21 | DP = 'defineProperty', 22 | DPies = 'defineProperties', 23 | GOPN = 'getOwnPropertyNames', 24 | GOPD = 'getOwnPropertyDescriptor', 25 | PIE = 'propertyIsEnumerable', 26 | gOPN = Object[GOPN], 27 | gOPD = Object[GOPD], 28 | create = Object.create, 29 | keys = Object.keys, 30 | defineProperty = Object[DP], 31 | $defineProperties = Object[DPies], 32 | descriptor = gOPD(Object, GOPN), 33 | ObjectProto = Object.prototype, 34 | hOP = ObjectProto.hasOwnProperty, 35 | pIE = ObjectProto[PIE], 36 | toString = ObjectProto.toString, 37 | indexOf = Array.prototype.indexOf || function (v) { 38 | for (var i = this.length; i-- && this[i] !== v;) {} 39 | return i; 40 | }, 41 | addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) { 42 | if (!hOP.call(o, internalSymbol)) { 43 | defineProperty(o, internalSymbol, { 44 | enumerable: false, 45 | configurable: false, 46 | writable: false, 47 | value: {} 48 | }); 49 | } 50 | o[internalSymbol]['@@' + uid] = enumerable; 51 | }, 52 | createWithSymbols = function createWithSymbols(proto, descriptors) { 53 | var self = create(proto); 54 | if (descriptors !== null && (typeof descriptors === 'undefined' ? 'undefined' : _typeof(descriptors)) === 'object') { 55 | gOPN(descriptors).forEach(function (key) { 56 | if (propertyIsEnumerable.call(descriptors, key)) { 57 | $defineProperty(self, key, descriptors[key]); 58 | } 59 | }); 60 | } 61 | return self; 62 | }, 63 | copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) { 64 | var newDescriptor = create(descriptor); 65 | newDescriptor.enumerable = false; 66 | return newDescriptor; 67 | }, 68 | get = function get() {}, 69 | onlyNonSymbols = function onlyNonSymbols(name) { 70 | return name != internalSymbol && !hOP.call(source, name); 71 | }, 72 | onlySymbols = function onlySymbols(name) { 73 | return name != internalSymbol && hOP.call(source, name); 74 | }, 75 | propertyIsEnumerable = function propertyIsEnumerable(key) { 76 | var uid = '' + key; 77 | return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol] && this[internalSymbol]['@@' + uid] : pIE.call(this, key); 78 | }, 79 | setAndGetSymbol = function setAndGetSymbol(uid) { 80 | var descriptor = { 81 | enumerable: false, 82 | configurable: true, 83 | get: get, 84 | set: function set(value) { 85 | setDescriptor(this, uid, { 86 | enumerable: false, 87 | configurable: true, 88 | writable: true, 89 | value: value 90 | }); 91 | addInternalIfNeeded(this, uid, true); 92 | } 93 | }; 94 | defineProperty(ObjectProto, uid, descriptor); 95 | return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor); 96 | }, 97 | _Symbol = function _Symbol2(description) { 98 | if (this && this !== G) { 99 | throw new TypeError('Symbol is not a constructor'); 100 | } 101 | return setAndGetSymbol(prefix.concat(description || '', random, ++id)); 102 | }, 103 | source = create(null), 104 | sourceConstructor = { value: _Symbol }, 105 | sourceMap = function sourceMap(uid) { 106 | return source[uid]; 107 | }, 108 | $defineProperty = function defineProp(o, key, descriptor) { 109 | var uid = '' + key; 110 | if (onlySymbols(uid)) { 111 | setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor); 112 | addInternalIfNeeded(o, uid, !!descriptor.enumerable); 113 | } else { 114 | defineProperty(o, key, descriptor); 115 | } 116 | return o; 117 | }, 118 | $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 119 | var cof = toString.call(o); 120 | o = cof === '[object String]' ? o.split('') : Object(o); 121 | return gOPN(o).filter(onlySymbols).map(sourceMap); 122 | }; 123 | 124 | descriptor.value = $defineProperty; 125 | defineProperty(Object, DP, descriptor); 126 | 127 | descriptor.value = $getOwnPropertySymbols; 128 | defineProperty(Object, GOPS, descriptor); 129 | 130 | var cachedWindowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' ? Object.getOwnPropertyNames(window) : []; 131 | var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames; 132 | descriptor.value = function getOwnPropertyNames(o) { 133 | if (toString.call(o) === '[object Window]') { 134 | try { 135 | return originalObjectGetOwnPropertyNames(o); 136 | } catch (e) { 137 | return [].concat([], cachedWindowNames); 138 | } 139 | } 140 | return gOPN(o).filter(onlyNonSymbols); 141 | }; 142 | defineProperty(Object, GOPN, descriptor); 143 | 144 | descriptor.value = function defineProperties(o, descriptors) { 145 | var symbols = $getOwnPropertySymbols(descriptors); 146 | if (symbols.length) { 147 | keys(descriptors).concat(symbols).forEach(function (uid) { 148 | if (propertyIsEnumerable.call(descriptors, uid)) { 149 | $defineProperty(o, uid, descriptors[uid]); 150 | } 151 | }); 152 | } else { 153 | $defineProperties(o, descriptors); 154 | } 155 | return o; 156 | }; 157 | defineProperty(Object, DPies, descriptor); 158 | 159 | descriptor.value = propertyIsEnumerable; 160 | defineProperty(ObjectProto, PIE, descriptor); 161 | 162 | descriptor.value = _Symbol; 163 | defineProperty(G, 'Symbol', descriptor); 164 | 165 | descriptor.value = function (key) { 166 | var uid = prefix.concat(prefix, key, random); 167 | return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 168 | }; 169 | defineProperty(_Symbol, 'for', descriptor); 170 | 171 | descriptor.value = function (symbol) { 172 | return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0; 173 | }; 174 | defineProperty(_Symbol, 'keyFor', descriptor); 175 | 176 | descriptor.value = function getOwnPropertyDescriptor(o, key) { 177 | var descriptor = gOPD(o, key); 178 | if (descriptor && onlySymbols(key)) { 179 | descriptor.enumerable = propertyIsEnumerable.call(o, key); 180 | } 181 | return descriptor; 182 | }; 183 | defineProperty(Object, GOPD, descriptor); 184 | 185 | descriptor.value = function (proto, descriptors) { 186 | return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors); 187 | }; 188 | defineProperty(Object, 'create', descriptor); 189 | 190 | descriptor.value = function () { 191 | var str = toString.call(this); 192 | return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str; 193 | }; 194 | defineProperty(ObjectProto, 'toString', descriptor); 195 | 196 | try { 197 | setDescriptor = create(defineProperty({}, prefix, { 198 | get: function get() { 199 | return defineProperty(this, prefix, { value: false })[prefix]; 200 | } 201 | }))[prefix] || defineProperty; 202 | } catch (o_O) { 203 | setDescriptor = function setDescriptor(o, key, descriptor) { 204 | var protoDescriptor = gOPD(ObjectProto, key); 205 | delete ObjectProto[key]; 206 | defineProperty(o, key, descriptor); 207 | defineProperty(ObjectProto, key, protoDescriptor); 208 | }; 209 | } 210 | })(Object, 'getOwnPropertySymbols'); 211 | 212 | (function (O, S) { 213 | var dP = O.defineProperty, 214 | ObjectProto = O.prototype, 215 | toString = ObjectProto.toString, 216 | toStringTag = 'toStringTag', 217 | descriptor; 218 | ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) { 219 | if (!(name in Symbol)) { 220 | dP(Symbol, name, { value: Symbol(name) }); 221 | switch (name) { 222 | case toStringTag: 223 | descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString'); 224 | descriptor.value = function () { 225 | var str = toString.call(this), 226 | tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag]; 227 | return typeof tst === 'undefined' ? str : '[object ' + tst + ']'; 228 | }; 229 | dP(ObjectProto, 'toString', descriptor); 230 | break; 231 | } 232 | } 233 | }); 234 | })(Object, Symbol); 235 | 236 | (function (Si, AP, SP) { 237 | 238 | function returnThis() { 239 | return this; 240 | } 241 | 242 | if (!AP[Si]) AP[Si] = function () { 243 | var i = 0, 244 | self = this, 245 | iterator = { 246 | next: function next() { 247 | var done = self.length <= i; 248 | return done ? { done: done } : { done: done, value: self[i++] }; 249 | } 250 | }; 251 | iterator[Si] = returnThis; 252 | return iterator; 253 | }; 254 | 255 | if (!SP[Si]) SP[Si] = function () { 256 | var fromCodePoint = String.fromCodePoint, 257 | self = this, 258 | i = 0, 259 | length = self.length, 260 | iterator = { 261 | next: function next() { 262 | var done = length <= i, 263 | c = done ? '' : fromCodePoint(self.codePointAt(i)); 264 | i += c.length; 265 | return done ? { done: done } : { done: done, value: c }; 266 | } 267 | }; 268 | iterator[Si] = returnThis; 269 | return iterator; 270 | }; 271 | })(Symbol.iterator, Array.prototype, String.prototype); 272 | } 273 | 274 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 275 | 276 | Number.isNaN = Number.isNaN || function (value) { 277 | return value !== value; 278 | }; 279 | 280 | Number.isFinite = Number.isFinite || function (value) { 281 | return typeof value === "number" && isFinite(value); 282 | }; 283 | } 284 | 285 | if (!String.prototype.endsWith || function () { 286 | try { 287 | return !"ab".endsWith("a", 1); 288 | } catch (e) { 289 | return true; 290 | } 291 | }()) { 292 | String.prototype.endsWith = function (searchString, position) { 293 | var subjectString = this.toString(); 294 | if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 295 | position = subjectString.length; 296 | } 297 | position -= searchString.length; 298 | var lastIndex = subjectString.indexOf(searchString, position); 299 | return lastIndex !== -1 && lastIndex === position; 300 | }; 301 | } 302 | 303 | if (!String.prototype.startsWith || function () { 304 | try { 305 | return !"ab".startsWith("b", 1); 306 | } catch (e) { 307 | return true; 308 | } 309 | }()) { 310 | String.prototype.startsWith = function (searchString, position) { 311 | position = position || 0; 312 | return this.substr(position, searchString.length) === searchString; 313 | }; 314 | } 315 | 316 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 317 | 318 | if (!Array.from) { 319 | Array.from = function () { 320 | var toInteger = function toInteger(it) { 321 | return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it); 322 | }; 323 | var toLength = function toLength(it) { 324 | return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0; 325 | }; 326 | var iterCall = function iterCall(iter, fn, val, index) { 327 | try { 328 | return fn(val, index); 329 | } catch (E) { 330 | if (typeof iter.return == 'function') iter.return(); 331 | throw E; 332 | } 333 | }; 334 | 335 | return function from(arrayLike) { 336 | var O = Object(arrayLike), 337 | C = typeof this == 'function' ? this : Array, 338 | aLen = arguments.length, 339 | mapfn = aLen > 1 ? arguments[1] : undefined, 340 | mapping = mapfn !== undefined, 341 | index = 0, 342 | iterFn = O[Symbol.iterator], 343 | length, 344 | result, 345 | step, 346 | iterator; 347 | if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined); 348 | if (iterFn != undefined && !Array.isArray(arrayLike)) { 349 | for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { 350 | result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value; 351 | } 352 | } else { 353 | length = toLength(O.length); 354 | for (result = new C(length); length > index; index++) { 355 | result[index] = mapping ? mapfn(O[index], index) : O[index]; 356 | } 357 | } 358 | result.length = index; 359 | return result; 360 | }; 361 | }(); 362 | } 363 | 364 | if (!Array.prototype.find) { 365 | Object.defineProperty(Array.prototype, 'find', { 366 | configurable: true, 367 | writable: true, 368 | enumerable: false, 369 | value: function value(predicate) { 370 | if (this === null) { 371 | throw new TypeError('Array.prototype.find called on null or undefined'); 372 | } 373 | if (typeof predicate !== 'function') { 374 | throw new TypeError('predicate must be a function'); 375 | } 376 | var list = Object(this); 377 | var length = list.length >>> 0; 378 | var thisArg = arguments[1]; 379 | var value; 380 | 381 | for (var i = 0; i < length; i++) { 382 | value = list[i]; 383 | if (predicate.call(thisArg, value, i, list)) { 384 | return value; 385 | } 386 | } 387 | return undefined; 388 | } 389 | }); 390 | } 391 | 392 | if (!Array.prototype.findIndex) { 393 | Object.defineProperty(Array.prototype, 'findIndex', { 394 | configurable: true, 395 | writable: true, 396 | enumerable: false, 397 | value: function value(predicate) { 398 | if (this === null) { 399 | throw new TypeError('Array.prototype.findIndex called on null or undefined'); 400 | } 401 | if (typeof predicate !== 'function') { 402 | throw new TypeError('predicate must be a function'); 403 | } 404 | var list = Object(this); 405 | var length = list.length >>> 0; 406 | var thisArg = arguments[1]; 407 | var value; 408 | 409 | for (var i = 0; i < length; i++) { 410 | value = list[i]; 411 | if (predicate.call(thisArg, value, i, list)) { 412 | return i; 413 | } 414 | } 415 | return -1; 416 | } 417 | }); 418 | } 419 | } 420 | 421 | if (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) { 422 | Object.defineProperty(Array.prototype, 'includes', { 423 | configurable: true, 424 | writable: true, 425 | enumerable: false, 426 | value: function value(searchElement) { 427 | var O = Object(this); 428 | var len = parseInt(O.length) || 0; 429 | if (len === 0) { 430 | return false; 431 | } 432 | var n = parseInt(arguments[1]) || 0; 433 | var k; 434 | if (n >= 0) { 435 | k = n; 436 | } else { 437 | k = len + n; 438 | if (k < 0) { 439 | k = 0; 440 | } 441 | } 442 | var currentElement; 443 | while (k < len) { 444 | currentElement = O[k]; 445 | if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { 446 | return true; 447 | } 448 | k++; 449 | } 450 | return false; 451 | } 452 | }); 453 | } 454 | 455 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 456 | 457 | (function () { 458 | var needsFix = false; 459 | 460 | try { 461 | var s = Object.keys('a'); 462 | needsFix = s.length !== 1 || s[0] !== '0'; 463 | } catch (e) { 464 | needsFix = true; 465 | } 466 | 467 | if (needsFix) { 468 | Object.keys = function () { 469 | var hasOwnProperty = Object.prototype.hasOwnProperty, 470 | hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), 471 | dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], 472 | dontEnumsLength = dontEnums.length; 473 | 474 | return function (obj) { 475 | if (obj === undefined || obj === null) { 476 | throw TypeError('Cannot convert undefined or null to object'); 477 | } 478 | 479 | obj = Object(obj); 480 | 481 | var result = [], 482 | prop, 483 | i; 484 | 485 | for (prop in obj) { 486 | if (hasOwnProperty.call(obj, prop)) { 487 | result.push(prop); 488 | } 489 | } 490 | 491 | if (hasDontEnumBug) { 492 | for (i = 0; i < dontEnumsLength; i++) { 493 | if (hasOwnProperty.call(obj, dontEnums[i])) { 494 | result.push(dontEnums[i]); 495 | } 496 | } 497 | } 498 | 499 | return result; 500 | }; 501 | }(); 502 | } 503 | })(); 504 | 505 | (function (O) { 506 | if ('assign' in O) { 507 | return; 508 | } 509 | 510 | O.defineProperty(O, 'assign', { 511 | configurable: true, 512 | writable: true, 513 | value: function () { 514 | var gOPS = O.getOwnPropertySymbols, 515 | pIE = O.propertyIsEnumerable, 516 | filterOS = gOPS ? function (self) { 517 | return gOPS(self).filter(pIE, self); 518 | } : function () { 519 | return Array.prototype; 520 | }; 521 | 522 | return function assign(where) { 523 | if (gOPS && !(where instanceof O)) { 524 | console.warn('problematic Symbols', where); 525 | } 526 | 527 | function set(keyOrSymbol) { 528 | where[keyOrSymbol] = arg[keyOrSymbol]; 529 | } 530 | 531 | for (var i = 1, ii = arguments.length; i < ii; ++i) { 532 | var arg = arguments[i]; 533 | 534 | if (arg === null || arg === undefined) { 535 | continue; 536 | } 537 | 538 | O.keys(arg).concat(filterOS(arg)).forEach(set); 539 | } 540 | 541 | return where; 542 | }; 543 | }() 544 | }); 545 | })(Object); 546 | 547 | if (!Object.is) { 548 | Object.is = function (x, y) { 549 | if (x === y) { 550 | return x !== 0 || 1 / x === 1 / y; 551 | } else { 552 | return x !== x && y !== y; 553 | } 554 | }; 555 | } 556 | } 557 | 558 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 559 | 560 | (function (global) { 561 | var i; 562 | 563 | var defineProperty = Object.defineProperty, 564 | is = function is(a, b) { 565 | return a === b || a !== a && b !== b; 566 | }; 567 | 568 | if (typeof WeakMap == 'undefined') { 569 | global.WeakMap = createCollection({ 570 | 'delete': sharedDelete, 571 | 572 | clear: sharedClear, 573 | 574 | get: sharedGet, 575 | 576 | has: mapHas, 577 | 578 | set: sharedSet 579 | }, true); 580 | } 581 | 582 | if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) { 583 | var _createCollection; 584 | 585 | global.Map = createCollection((_createCollection = { 586 | 'delete': sharedDelete, 587 | 588 | has: mapHas, 589 | 590 | get: sharedGet, 591 | 592 | set: sharedSet, 593 | 594 | keys: sharedKeys, 595 | 596 | values: sharedValues, 597 | 598 | entries: mapEntries, 599 | 600 | forEach: sharedForEach, 601 | 602 | clear: sharedClear 603 | }, _createCollection[Symbol.iterator] = mapEntries, _createCollection)); 604 | } 605 | 606 | if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) { 607 | var _createCollection2; 608 | 609 | global.Set = createCollection((_createCollection2 = { 610 | has: setHas, 611 | 612 | add: sharedAdd, 613 | 614 | 'delete': sharedDelete, 615 | 616 | clear: sharedClear, 617 | 618 | keys: sharedValues, 619 | values: sharedValues, 620 | 621 | entries: setEntries, 622 | 623 | forEach: sharedForEach 624 | }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2)); 625 | } 626 | 627 | if (typeof WeakSet == 'undefined') { 628 | global.WeakSet = createCollection({ 629 | 'delete': sharedDelete, 630 | 631 | add: sharedAdd, 632 | 633 | clear: sharedClear, 634 | 635 | has: setHas 636 | }, true); 637 | } 638 | 639 | function createCollection(proto, objectOnly) { 640 | function Collection(a) { 641 | if (!this || this.constructor !== Collection) return new Collection(a); 642 | this._keys = []; 643 | this._values = []; 644 | this._itp = []; 645 | this.objectOnly = objectOnly; 646 | 647 | if (a) init.call(this, a); 648 | } 649 | 650 | if (!objectOnly) { 651 | defineProperty(proto, 'size', { 652 | get: sharedSize 653 | }); 654 | } 655 | 656 | proto.constructor = Collection; 657 | Collection.prototype = proto; 658 | 659 | return Collection; 660 | } 661 | 662 | function init(a) { 663 | var i; 664 | 665 | if (this.add) a.forEach(this.add, this);else a.forEach(function (a) { 666 | this.set(a[0], a[1]); 667 | }, this); 668 | } 669 | 670 | function sharedDelete(key) { 671 | if (this.has(key)) { 672 | this._keys.splice(i, 1); 673 | this._values.splice(i, 1); 674 | 675 | this._itp.forEach(function (p) { 676 | if (i < p[0]) p[0]--; 677 | }); 678 | } 679 | 680 | return -1 < i; 681 | }; 682 | 683 | function sharedGet(key) { 684 | return this.has(key) ? this._values[i] : undefined; 685 | } 686 | 687 | function has(list, key) { 688 | if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key"); 689 | 690 | if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key); 691 | return -1 < i; 692 | } 693 | 694 | function setHas(value) { 695 | return has.call(this, this._values, value); 696 | } 697 | 698 | function mapHas(value) { 699 | return has.call(this, this._keys, value); 700 | } 701 | 702 | function sharedSet(key, value) { 703 | this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value; 704 | return this; 705 | } 706 | 707 | function sharedAdd(value) { 708 | if (!this.has(value)) this._values.push(value); 709 | return this; 710 | } 711 | 712 | function sharedClear() { 713 | (this._keys || 0).length = this._values.length = 0; 714 | } 715 | 716 | function sharedKeys() { 717 | return sharedIterator(this._itp, this._keys); 718 | } 719 | 720 | function sharedValues() { 721 | return sharedIterator(this._itp, this._values); 722 | } 723 | 724 | function mapEntries() { 725 | return sharedIterator(this._itp, this._keys, this._values); 726 | } 727 | 728 | function setEntries() { 729 | return sharedIterator(this._itp, this._values, this._values); 730 | } 731 | 732 | function sharedIterator(itp, array, array2) { 733 | var _ref; 734 | 735 | var p = [0], 736 | done = false; 737 | itp.push(p); 738 | return _ref = {}, _ref[Symbol.iterator] = function () { 739 | return this; 740 | }, _ref.next = function next() { 741 | var v, 742 | k = p[0]; 743 | if (!done && k < array.length) { 744 | v = array2 ? [array[k], array2[k]] : array[k]; 745 | p[0]++; 746 | } else { 747 | done = true; 748 | itp.splice(itp.indexOf(p), 1); 749 | } 750 | return { done: done, value: v }; 751 | }, _ref; 752 | } 753 | 754 | function sharedSize() { 755 | return this._values.length; 756 | } 757 | 758 | function sharedForEach(callback, context) { 759 | var it = this.entries(); 760 | for (;;) { 761 | var r = it.next(); 762 | if (r.done) break; 763 | callback.call(context, r.value[1], r.value[0], this); 764 | } 765 | } 766 | })(_aureliaPal.PLATFORM.global); 767 | } 768 | 769 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 770 | 771 | var bind = Function.prototype.bind; 772 | 773 | if (typeof _aureliaPal.PLATFORM.global.Reflect === 'undefined') { 774 | _aureliaPal.PLATFORM.global.Reflect = {}; 775 | } 776 | 777 | if (typeof Reflect.defineProperty !== 'function') { 778 | Reflect.defineProperty = function (target, propertyKey, descriptor) { 779 | if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') { 780 | throw new TypeError('Reflect.defineProperty called on non-object'); 781 | } 782 | try { 783 | Object.defineProperty(target, propertyKey, descriptor); 784 | return true; 785 | } catch (e) { 786 | return false; 787 | } 788 | }; 789 | } 790 | 791 | if (typeof Reflect.construct !== 'function') { 792 | Reflect.construct = function (Target, args) { 793 | if (args) { 794 | switch (args.length) { 795 | case 0: 796 | return new Target(); 797 | case 1: 798 | return new Target(args[0]); 799 | case 2: 800 | return new Target(args[0], args[1]); 801 | case 3: 802 | return new Target(args[0], args[1], args[2]); 803 | case 4: 804 | return new Target(args[0], args[1], args[2], args[3]); 805 | } 806 | } 807 | 808 | var a = [null]; 809 | a.push.apply(a, args); 810 | return new (bind.apply(Target, a))(); 811 | }; 812 | } 813 | 814 | if (typeof Reflect.ownKeys !== 'function') { 815 | Reflect.ownKeys = function (o) { 816 | return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)); 817 | }; 818 | } 819 | } 820 | 821 | if (typeof FEATURE_NO_ESNEXT === 'undefined') { 822 | 823 | var emptyMetadata = Object.freeze({}); 824 | var metadataContainerKey = '__metadata__'; 825 | 826 | if (typeof Reflect.getOwnMetadata !== 'function') { 827 | Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { 828 | if (target.hasOwnProperty(metadataContainerKey)) { 829 | return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey]; 830 | } 831 | }; 832 | } 833 | 834 | if (typeof Reflect.defineMetadata !== 'function') { 835 | Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { 836 | var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; 837 | var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); 838 | targetContainer[metadataKey] = metadataValue; 839 | }; 840 | } 841 | 842 | if (typeof Reflect.metadata !== 'function') { 843 | Reflect.metadata = function (metadataKey, metadataValue) { 844 | return function (target, targetKey) { 845 | Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); 846 | }; 847 | }; 848 | } 849 | } -------------------------------------------------------------------------------- /dist/commonjs/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _aureliaPolyfills = require('./aurelia-polyfills'); 8 | 9 | Object.keys(_aureliaPolyfills).forEach(function (key) { 10 | if (key === "default" || key === "__esModule") return; 11 | Object.defineProperty(exports, key, { 12 | enumerable: true, 13 | get: function get() { 14 | return _aureliaPolyfills[key]; 15 | } 16 | }); 17 | }); -------------------------------------------------------------------------------- /dist/es2015/aurelia-polyfills.js: -------------------------------------------------------------------------------- 1 | import { PLATFORM } from 'aurelia-pal'; 2 | 3 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 4 | 5 | (function (Object, GOPS) { 6 | 'use strict'; 7 | 8 | if (GOPS in Object) return; 9 | 10 | var setDescriptor, 11 | G = PLATFORM.global, 12 | id = 0, 13 | random = '' + Math.random(), 14 | prefix = '__\x01symbol:', 15 | prefixLength = prefix.length, 16 | internalSymbol = '__\x01symbol@@' + random, 17 | DP = 'defineProperty', 18 | DPies = 'defineProperties', 19 | GOPN = 'getOwnPropertyNames', 20 | GOPD = 'getOwnPropertyDescriptor', 21 | PIE = 'propertyIsEnumerable', 22 | gOPN = Object[GOPN], 23 | gOPD = Object[GOPD], 24 | create = Object.create, 25 | keys = Object.keys, 26 | defineProperty = Object[DP], 27 | $defineProperties = Object[DPies], 28 | descriptor = gOPD(Object, GOPN), 29 | ObjectProto = Object.prototype, 30 | hOP = ObjectProto.hasOwnProperty, 31 | pIE = ObjectProto[PIE], 32 | toString = ObjectProto.toString, 33 | indexOf = Array.prototype.indexOf || function (v) { 34 | for (var i = this.length; i-- && this[i] !== v;) {} 35 | return i; 36 | }, 37 | addInternalIfNeeded = function (o, uid, enumerable) { 38 | if (!hOP.call(o, internalSymbol)) { 39 | defineProperty(o, internalSymbol, { 40 | enumerable: false, 41 | configurable: false, 42 | writable: false, 43 | value: {} 44 | }); 45 | } 46 | o[internalSymbol]['@@' + uid] = enumerable; 47 | }, 48 | createWithSymbols = function (proto, descriptors) { 49 | var self = create(proto); 50 | if (descriptors !== null && typeof descriptors === 'object') { 51 | gOPN(descriptors).forEach(function (key) { 52 | if (propertyIsEnumerable.call(descriptors, key)) { 53 | $defineProperty(self, key, descriptors[key]); 54 | } 55 | }); 56 | } 57 | return self; 58 | }, 59 | copyAsNonEnumerable = function (descriptor) { 60 | var newDescriptor = create(descriptor); 61 | newDescriptor.enumerable = false; 62 | return newDescriptor; 63 | }, 64 | get = function get() {}, 65 | onlyNonSymbols = function (name) { 66 | return name != internalSymbol && !hOP.call(source, name); 67 | }, 68 | onlySymbols = function (name) { 69 | return name != internalSymbol && hOP.call(source, name); 70 | }, 71 | propertyIsEnumerable = function propertyIsEnumerable(key) { 72 | var uid = '' + key; 73 | return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol] && this[internalSymbol]['@@' + uid] : pIE.call(this, key); 74 | }, 75 | setAndGetSymbol = function (uid) { 76 | var descriptor = { 77 | enumerable: false, 78 | configurable: true, 79 | get: get, 80 | set: function (value) { 81 | setDescriptor(this, uid, { 82 | enumerable: false, 83 | configurable: true, 84 | writable: true, 85 | value: value 86 | }); 87 | addInternalIfNeeded(this, uid, true); 88 | } 89 | }; 90 | defineProperty(ObjectProto, uid, descriptor); 91 | return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor); 92 | }, 93 | Symbol = function Symbol(description) { 94 | if (this && this !== G) { 95 | throw new TypeError('Symbol is not a constructor'); 96 | } 97 | return setAndGetSymbol(prefix.concat(description || '', random, ++id)); 98 | }, 99 | source = create(null), 100 | sourceConstructor = { value: Symbol }, 101 | sourceMap = function (uid) { 102 | return source[uid]; 103 | }, 104 | $defineProperty = function defineProp(o, key, descriptor) { 105 | var uid = '' + key; 106 | if (onlySymbols(uid)) { 107 | setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor); 108 | addInternalIfNeeded(o, uid, !!descriptor.enumerable); 109 | } else { 110 | defineProperty(o, key, descriptor); 111 | } 112 | return o; 113 | }, 114 | $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 115 | var cof = toString.call(o); 116 | o = cof === '[object String]' ? o.split('') : Object(o); 117 | return gOPN(o).filter(onlySymbols).map(sourceMap); 118 | }; 119 | 120 | descriptor.value = $defineProperty; 121 | defineProperty(Object, DP, descriptor); 122 | 123 | descriptor.value = $getOwnPropertySymbols; 124 | defineProperty(Object, GOPS, descriptor); 125 | 126 | var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : []; 127 | var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames; 128 | descriptor.value = function getOwnPropertyNames(o) { 129 | if (toString.call(o) === '[object Window]') { 130 | try { 131 | return originalObjectGetOwnPropertyNames(o); 132 | } catch (e) { 133 | return [].concat([], cachedWindowNames); 134 | } 135 | } 136 | return gOPN(o).filter(onlyNonSymbols); 137 | }; 138 | defineProperty(Object, GOPN, descriptor); 139 | 140 | descriptor.value = function defineProperties(o, descriptors) { 141 | var symbols = $getOwnPropertySymbols(descriptors); 142 | if (symbols.length) { 143 | keys(descriptors).concat(symbols).forEach(function (uid) { 144 | if (propertyIsEnumerable.call(descriptors, uid)) { 145 | $defineProperty(o, uid, descriptors[uid]); 146 | } 147 | }); 148 | } else { 149 | $defineProperties(o, descriptors); 150 | } 151 | return o; 152 | }; 153 | defineProperty(Object, DPies, descriptor); 154 | 155 | descriptor.value = propertyIsEnumerable; 156 | defineProperty(ObjectProto, PIE, descriptor); 157 | 158 | descriptor.value = Symbol; 159 | defineProperty(G, 'Symbol', descriptor); 160 | 161 | descriptor.value = function (key) { 162 | var uid = prefix.concat(prefix, key, random); 163 | return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 164 | }; 165 | defineProperty(Symbol, 'for', descriptor); 166 | 167 | descriptor.value = function (symbol) { 168 | return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0; 169 | }; 170 | defineProperty(Symbol, 'keyFor', descriptor); 171 | 172 | descriptor.value = function getOwnPropertyDescriptor(o, key) { 173 | var descriptor = gOPD(o, key); 174 | if (descriptor && onlySymbols(key)) { 175 | descriptor.enumerable = propertyIsEnumerable.call(o, key); 176 | } 177 | return descriptor; 178 | }; 179 | defineProperty(Object, GOPD, descriptor); 180 | 181 | descriptor.value = function (proto, descriptors) { 182 | return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors); 183 | }; 184 | defineProperty(Object, 'create', descriptor); 185 | 186 | descriptor.value = function () { 187 | var str = toString.call(this); 188 | return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str; 189 | }; 190 | defineProperty(ObjectProto, 'toString', descriptor); 191 | 192 | try { 193 | setDescriptor = create(defineProperty({}, prefix, { 194 | get: function () { 195 | return defineProperty(this, prefix, { value: false })[prefix]; 196 | } 197 | }))[prefix] || defineProperty; 198 | } catch (o_O) { 199 | setDescriptor = function (o, key, descriptor) { 200 | var protoDescriptor = gOPD(ObjectProto, key); 201 | delete ObjectProto[key]; 202 | defineProperty(o, key, descriptor); 203 | defineProperty(ObjectProto, key, protoDescriptor); 204 | }; 205 | } 206 | })(Object, 'getOwnPropertySymbols'); 207 | 208 | (function (O, S) { 209 | var dP = O.defineProperty, 210 | ObjectProto = O.prototype, 211 | toString = ObjectProto.toString, 212 | toStringTag = 'toStringTag', 213 | descriptor; 214 | ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) { 215 | if (!(name in Symbol)) { 216 | dP(Symbol, name, { value: Symbol(name) }); 217 | switch (name) { 218 | case toStringTag: 219 | descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString'); 220 | descriptor.value = function () { 221 | var str = toString.call(this), 222 | tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag]; 223 | return typeof tst === 'undefined' ? str : '[object ' + tst + ']'; 224 | }; 225 | dP(ObjectProto, 'toString', descriptor); 226 | break; 227 | } 228 | } 229 | }); 230 | })(Object, Symbol); 231 | 232 | (function (Si, AP, SP) { 233 | 234 | function returnThis() { 235 | return this; 236 | } 237 | 238 | if (!AP[Si]) AP[Si] = function () { 239 | var i = 0, 240 | self = this, 241 | iterator = { 242 | next: function next() { 243 | var done = self.length <= i; 244 | return done ? { done: done } : { done: done, value: self[i++] }; 245 | } 246 | }; 247 | iterator[Si] = returnThis; 248 | return iterator; 249 | }; 250 | 251 | if (!SP[Si]) SP[Si] = function () { 252 | var fromCodePoint = String.fromCodePoint, 253 | self = this, 254 | i = 0, 255 | length = self.length, 256 | iterator = { 257 | next: function next() { 258 | var done = length <= i, 259 | c = done ? '' : fromCodePoint(self.codePointAt(i)); 260 | i += c.length; 261 | return done ? { done: done } : { done: done, value: c }; 262 | } 263 | }; 264 | iterator[Si] = returnThis; 265 | return iterator; 266 | }; 267 | })(Symbol.iterator, Array.prototype, String.prototype); 268 | } 269 | 270 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 271 | 272 | Number.isNaN = Number.isNaN || function (value) { 273 | return value !== value; 274 | }; 275 | 276 | Number.isFinite = Number.isFinite || function (value) { 277 | return typeof value === "number" && isFinite(value); 278 | }; 279 | } 280 | 281 | if (!String.prototype.endsWith || function () { 282 | try { 283 | return !"ab".endsWith("a", 1); 284 | } catch (e) { 285 | return true; 286 | } 287 | }()) { 288 | String.prototype.endsWith = function (searchString, position) { 289 | let subjectString = this.toString(); 290 | if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 291 | position = subjectString.length; 292 | } 293 | position -= searchString.length; 294 | let lastIndex = subjectString.indexOf(searchString, position); 295 | return lastIndex !== -1 && lastIndex === position; 296 | }; 297 | } 298 | 299 | if (!String.prototype.startsWith || function () { 300 | try { 301 | return !"ab".startsWith("b", 1); 302 | } catch (e) { 303 | return true; 304 | } 305 | }()) { 306 | String.prototype.startsWith = function (searchString, position) { 307 | position = position || 0; 308 | return this.substr(position, searchString.length) === searchString; 309 | }; 310 | } 311 | 312 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 313 | 314 | if (!Array.from) { 315 | Array.from = function () { 316 | var toInteger = function (it) { 317 | return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it); 318 | }; 319 | var toLength = function (it) { 320 | return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0; 321 | }; 322 | var iterCall = function (iter, fn, val, index) { 323 | try { 324 | return fn(val, index); 325 | } catch (E) { 326 | if (typeof iter.return == 'function') iter.return(); 327 | throw E; 328 | } 329 | }; 330 | 331 | return function from(arrayLike) { 332 | var O = Object(arrayLike), 333 | C = typeof this == 'function' ? this : Array, 334 | aLen = arguments.length, 335 | mapfn = aLen > 1 ? arguments[1] : undefined, 336 | mapping = mapfn !== undefined, 337 | index = 0, 338 | iterFn = O[Symbol.iterator], 339 | length, 340 | result, 341 | step, 342 | iterator; 343 | if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined); 344 | if (iterFn != undefined && !Array.isArray(arrayLike)) { 345 | for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { 346 | result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value; 347 | } 348 | } else { 349 | length = toLength(O.length); 350 | for (result = new C(length); length > index; index++) { 351 | result[index] = mapping ? mapfn(O[index], index) : O[index]; 352 | } 353 | } 354 | result.length = index; 355 | return result; 356 | }; 357 | }(); 358 | } 359 | 360 | if (!Array.prototype.find) { 361 | Object.defineProperty(Array.prototype, 'find', { 362 | configurable: true, 363 | writable: true, 364 | enumerable: false, 365 | value: function (predicate) { 366 | if (this === null) { 367 | throw new TypeError('Array.prototype.find called on null or undefined'); 368 | } 369 | if (typeof predicate !== 'function') { 370 | throw new TypeError('predicate must be a function'); 371 | } 372 | var list = Object(this); 373 | var length = list.length >>> 0; 374 | var thisArg = arguments[1]; 375 | var value; 376 | 377 | for (var i = 0; i < length; i++) { 378 | value = list[i]; 379 | if (predicate.call(thisArg, value, i, list)) { 380 | return value; 381 | } 382 | } 383 | return undefined; 384 | } 385 | }); 386 | } 387 | 388 | if (!Array.prototype.findIndex) { 389 | Object.defineProperty(Array.prototype, 'findIndex', { 390 | configurable: true, 391 | writable: true, 392 | enumerable: false, 393 | value: function (predicate) { 394 | if (this === null) { 395 | throw new TypeError('Array.prototype.findIndex called on null or undefined'); 396 | } 397 | if (typeof predicate !== 'function') { 398 | throw new TypeError('predicate must be a function'); 399 | } 400 | var list = Object(this); 401 | var length = list.length >>> 0; 402 | var thisArg = arguments[1]; 403 | var value; 404 | 405 | for (var i = 0; i < length; i++) { 406 | value = list[i]; 407 | if (predicate.call(thisArg, value, i, list)) { 408 | return i; 409 | } 410 | } 411 | return -1; 412 | } 413 | }); 414 | } 415 | } 416 | 417 | if (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) { 418 | Object.defineProperty(Array.prototype, 'includes', { 419 | configurable: true, 420 | writable: true, 421 | enumerable: false, 422 | value: function (searchElement) { 423 | var O = Object(this); 424 | var len = parseInt(O.length) || 0; 425 | if (len === 0) { 426 | return false; 427 | } 428 | var n = parseInt(arguments[1]) || 0; 429 | var k; 430 | if (n >= 0) { 431 | k = n; 432 | } else { 433 | k = len + n; 434 | if (k < 0) { 435 | k = 0; 436 | } 437 | } 438 | var currentElement; 439 | while (k < len) { 440 | currentElement = O[k]; 441 | if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { 442 | return true; 443 | } 444 | k++; 445 | } 446 | return false; 447 | } 448 | }); 449 | } 450 | 451 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 452 | 453 | (function () { 454 | let needsFix = false; 455 | 456 | try { 457 | let s = Object.keys('a'); 458 | needsFix = s.length !== 1 || s[0] !== '0'; 459 | } catch (e) { 460 | needsFix = true; 461 | } 462 | 463 | if (needsFix) { 464 | Object.keys = function () { 465 | var hasOwnProperty = Object.prototype.hasOwnProperty, 466 | hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), 467 | dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], 468 | dontEnumsLength = dontEnums.length; 469 | 470 | return function (obj) { 471 | if (obj === undefined || obj === null) { 472 | throw TypeError(`Cannot convert undefined or null to object`); 473 | } 474 | 475 | obj = Object(obj); 476 | 477 | var result = [], 478 | prop, 479 | i; 480 | 481 | for (prop in obj) { 482 | if (hasOwnProperty.call(obj, prop)) { 483 | result.push(prop); 484 | } 485 | } 486 | 487 | if (hasDontEnumBug) { 488 | for (i = 0; i < dontEnumsLength; i++) { 489 | if (hasOwnProperty.call(obj, dontEnums[i])) { 490 | result.push(dontEnums[i]); 491 | } 492 | } 493 | } 494 | 495 | return result; 496 | }; 497 | }(); 498 | } 499 | })(); 500 | 501 | (function (O) { 502 | if ('assign' in O) { 503 | return; 504 | } 505 | 506 | O.defineProperty(O, 'assign', { 507 | configurable: true, 508 | writable: true, 509 | value: function () { 510 | var gOPS = O.getOwnPropertySymbols, 511 | pIE = O.propertyIsEnumerable, 512 | filterOS = gOPS ? function (self) { 513 | return gOPS(self).filter(pIE, self); 514 | } : function () { 515 | return Array.prototype; 516 | }; 517 | 518 | return function assign(where) { 519 | if (gOPS && !(where instanceof O)) { 520 | console.warn('problematic Symbols', where); 521 | } 522 | 523 | function set(keyOrSymbol) { 524 | where[keyOrSymbol] = arg[keyOrSymbol]; 525 | } 526 | 527 | for (var i = 1, ii = arguments.length; i < ii; ++i) { 528 | var arg = arguments[i]; 529 | 530 | if (arg === null || arg === undefined) { 531 | continue; 532 | } 533 | 534 | O.keys(arg).concat(filterOS(arg)).forEach(set); 535 | } 536 | 537 | return where; 538 | }; 539 | }() 540 | }); 541 | })(Object); 542 | 543 | if (!Object.is) { 544 | Object.is = function (x, y) { 545 | if (x === y) { 546 | return x !== 0 || 1 / x === 1 / y; 547 | } else { 548 | return x !== x && y !== y; 549 | } 550 | }; 551 | } 552 | } 553 | 554 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 555 | 556 | (function (global) { 557 | var i; 558 | 559 | var defineProperty = Object.defineProperty, 560 | is = function (a, b) { 561 | return a === b || a !== a && b !== b; 562 | }; 563 | 564 | if (typeof WeakMap == 'undefined') { 565 | global.WeakMap = createCollection({ 566 | 'delete': sharedDelete, 567 | 568 | clear: sharedClear, 569 | 570 | get: sharedGet, 571 | 572 | has: mapHas, 573 | 574 | set: sharedSet 575 | }, true); 576 | } 577 | 578 | if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) { 579 | global.Map = createCollection({ 580 | 'delete': sharedDelete, 581 | 582 | has: mapHas, 583 | 584 | get: sharedGet, 585 | 586 | set: sharedSet, 587 | 588 | keys: sharedKeys, 589 | 590 | values: sharedValues, 591 | 592 | entries: mapEntries, 593 | 594 | forEach: sharedForEach, 595 | 596 | clear: sharedClear, 597 | 598 | [Symbol.iterator]: mapEntries 599 | }); 600 | } 601 | 602 | if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) { 603 | global.Set = createCollection({ 604 | has: setHas, 605 | 606 | add: sharedAdd, 607 | 608 | 'delete': sharedDelete, 609 | 610 | clear: sharedClear, 611 | 612 | keys: sharedValues, 613 | values: sharedValues, 614 | 615 | entries: setEntries, 616 | 617 | forEach: sharedForEach, 618 | 619 | [Symbol.iterator]: sharedValues 620 | }); 621 | } 622 | 623 | if (typeof WeakSet == 'undefined') { 624 | global.WeakSet = createCollection({ 625 | 'delete': sharedDelete, 626 | 627 | add: sharedAdd, 628 | 629 | clear: sharedClear, 630 | 631 | has: setHas 632 | }, true); 633 | } 634 | 635 | function createCollection(proto, objectOnly) { 636 | function Collection(a) { 637 | if (!this || this.constructor !== Collection) return new Collection(a); 638 | this._keys = []; 639 | this._values = []; 640 | this._itp = []; 641 | this.objectOnly = objectOnly; 642 | 643 | if (a) init.call(this, a); 644 | } 645 | 646 | if (!objectOnly) { 647 | defineProperty(proto, 'size', { 648 | get: sharedSize 649 | }); 650 | } 651 | 652 | proto.constructor = Collection; 653 | Collection.prototype = proto; 654 | 655 | return Collection; 656 | } 657 | 658 | function init(a) { 659 | var i; 660 | 661 | if (this.add) a.forEach(this.add, this);else a.forEach(function (a) { 662 | this.set(a[0], a[1]); 663 | }, this); 664 | } 665 | 666 | function sharedDelete(key) { 667 | if (this.has(key)) { 668 | this._keys.splice(i, 1); 669 | this._values.splice(i, 1); 670 | 671 | this._itp.forEach(function (p) { 672 | if (i < p[0]) p[0]--; 673 | }); 674 | } 675 | 676 | return -1 < i; 677 | }; 678 | 679 | function sharedGet(key) { 680 | return this.has(key) ? this._values[i] : undefined; 681 | } 682 | 683 | function has(list, key) { 684 | if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key"); 685 | 686 | if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key); 687 | return -1 < i; 688 | } 689 | 690 | function setHas(value) { 691 | return has.call(this, this._values, value); 692 | } 693 | 694 | function mapHas(value) { 695 | return has.call(this, this._keys, value); 696 | } 697 | 698 | function sharedSet(key, value) { 699 | this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value; 700 | return this; 701 | } 702 | 703 | function sharedAdd(value) { 704 | if (!this.has(value)) this._values.push(value); 705 | return this; 706 | } 707 | 708 | function sharedClear() { 709 | (this._keys || 0).length = this._values.length = 0; 710 | } 711 | 712 | function sharedKeys() { 713 | return sharedIterator(this._itp, this._keys); 714 | } 715 | 716 | function sharedValues() { 717 | return sharedIterator(this._itp, this._values); 718 | } 719 | 720 | function mapEntries() { 721 | return sharedIterator(this._itp, this._keys, this._values); 722 | } 723 | 724 | function setEntries() { 725 | return sharedIterator(this._itp, this._values, this._values); 726 | } 727 | 728 | function sharedIterator(itp, array, array2) { 729 | var p = [0], 730 | done = false; 731 | itp.push(p); 732 | return { 733 | [Symbol.iterator]: function () { 734 | return this; 735 | }, 736 | next: function () { 737 | var v, 738 | k = p[0]; 739 | if (!done && k < array.length) { 740 | v = array2 ? [array[k], array2[k]] : array[k]; 741 | p[0]++; 742 | } else { 743 | done = true; 744 | itp.splice(itp.indexOf(p), 1); 745 | } 746 | return { done: done, value: v }; 747 | } 748 | }; 749 | } 750 | 751 | function sharedSize() { 752 | return this._values.length; 753 | } 754 | 755 | function sharedForEach(callback, context) { 756 | var it = this.entries(); 757 | for (;;) { 758 | var r = it.next(); 759 | if (r.done) break; 760 | callback.call(context, r.value[1], r.value[0], this); 761 | } 762 | } 763 | })(PLATFORM.global); 764 | } 765 | 766 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 767 | 768 | const bind = Function.prototype.bind; 769 | 770 | if (typeof PLATFORM.global.Reflect === 'undefined') { 771 | PLATFORM.global.Reflect = {}; 772 | } 773 | 774 | if (typeof Reflect.defineProperty !== 'function') { 775 | Reflect.defineProperty = function (target, propertyKey, descriptor) { 776 | if (typeof target === 'object' ? target === null : typeof target !== 'function') { 777 | throw new TypeError('Reflect.defineProperty called on non-object'); 778 | } 779 | try { 780 | Object.defineProperty(target, propertyKey, descriptor); 781 | return true; 782 | } catch (e) { 783 | return false; 784 | } 785 | }; 786 | } 787 | 788 | if (typeof Reflect.construct !== 'function') { 789 | Reflect.construct = function (Target, args) { 790 | if (args) { 791 | switch (args.length) { 792 | case 0: 793 | return new Target(); 794 | case 1: 795 | return new Target(args[0]); 796 | case 2: 797 | return new Target(args[0], args[1]); 798 | case 3: 799 | return new Target(args[0], args[1], args[2]); 800 | case 4: 801 | return new Target(args[0], args[1], args[2], args[3]); 802 | } 803 | } 804 | 805 | var a = [null]; 806 | a.push.apply(a, args); 807 | return new (bind.apply(Target, a))(); 808 | }; 809 | } 810 | 811 | if (typeof Reflect.ownKeys !== 'function') { 812 | Reflect.ownKeys = function (o) { 813 | return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)); 814 | }; 815 | } 816 | } 817 | 818 | if (typeof FEATURE_NO_ESNEXT === 'undefined') { 819 | 820 | const emptyMetadata = Object.freeze({}); 821 | const metadataContainerKey = '__metadata__'; 822 | 823 | if (typeof Reflect.getOwnMetadata !== 'function') { 824 | Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { 825 | if (target.hasOwnProperty(metadataContainerKey)) { 826 | return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey]; 827 | } 828 | }; 829 | } 830 | 831 | if (typeof Reflect.defineMetadata !== 'function') { 832 | Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { 833 | let metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; 834 | let targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); 835 | targetContainer[metadataKey] = metadataValue; 836 | }; 837 | } 838 | 839 | if (typeof Reflect.metadata !== 'function') { 840 | Reflect.metadata = function (metadataKey, metadataValue) { 841 | return function (target, targetKey) { 842 | Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); 843 | }; 844 | }; 845 | } 846 | } -------------------------------------------------------------------------------- /dist/es2015/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-polyfills'; -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from 'aurelia-polyfills/aurelia-polyfills'; -------------------------------------------------------------------------------- /dist/native-modules/aurelia-polyfills.js: -------------------------------------------------------------------------------- 1 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 2 | 3 | import { PLATFORM } from 'aurelia-pal'; 4 | 5 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 6 | 7 | (function (Object, GOPS) { 8 | 'use strict'; 9 | 10 | if (GOPS in Object) return; 11 | 12 | var setDescriptor, 13 | G = PLATFORM.global, 14 | id = 0, 15 | random = '' + Math.random(), 16 | prefix = '__\x01symbol:', 17 | prefixLength = prefix.length, 18 | internalSymbol = '__\x01symbol@@' + random, 19 | DP = 'defineProperty', 20 | DPies = 'defineProperties', 21 | GOPN = 'getOwnPropertyNames', 22 | GOPD = 'getOwnPropertyDescriptor', 23 | PIE = 'propertyIsEnumerable', 24 | gOPN = Object[GOPN], 25 | gOPD = Object[GOPD], 26 | create = Object.create, 27 | keys = Object.keys, 28 | defineProperty = Object[DP], 29 | $defineProperties = Object[DPies], 30 | descriptor = gOPD(Object, GOPN), 31 | ObjectProto = Object.prototype, 32 | hOP = ObjectProto.hasOwnProperty, 33 | pIE = ObjectProto[PIE], 34 | toString = ObjectProto.toString, 35 | indexOf = Array.prototype.indexOf || function (v) { 36 | for (var i = this.length; i-- && this[i] !== v;) {} 37 | return i; 38 | }, 39 | addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) { 40 | if (!hOP.call(o, internalSymbol)) { 41 | defineProperty(o, internalSymbol, { 42 | enumerable: false, 43 | configurable: false, 44 | writable: false, 45 | value: {} 46 | }); 47 | } 48 | o[internalSymbol]['@@' + uid] = enumerable; 49 | }, 50 | createWithSymbols = function createWithSymbols(proto, descriptors) { 51 | var self = create(proto); 52 | if (descriptors !== null && (typeof descriptors === 'undefined' ? 'undefined' : _typeof(descriptors)) === 'object') { 53 | gOPN(descriptors).forEach(function (key) { 54 | if (propertyIsEnumerable.call(descriptors, key)) { 55 | $defineProperty(self, key, descriptors[key]); 56 | } 57 | }); 58 | } 59 | return self; 60 | }, 61 | copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) { 62 | var newDescriptor = create(descriptor); 63 | newDescriptor.enumerable = false; 64 | return newDescriptor; 65 | }, 66 | get = function get() {}, 67 | onlyNonSymbols = function onlyNonSymbols(name) { 68 | return name != internalSymbol && !hOP.call(source, name); 69 | }, 70 | onlySymbols = function onlySymbols(name) { 71 | return name != internalSymbol && hOP.call(source, name); 72 | }, 73 | propertyIsEnumerable = function propertyIsEnumerable(key) { 74 | var uid = '' + key; 75 | return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol] && this[internalSymbol]['@@' + uid] : pIE.call(this, key); 76 | }, 77 | setAndGetSymbol = function setAndGetSymbol(uid) { 78 | var descriptor = { 79 | enumerable: false, 80 | configurable: true, 81 | get: get, 82 | set: function set(value) { 83 | setDescriptor(this, uid, { 84 | enumerable: false, 85 | configurable: true, 86 | writable: true, 87 | value: value 88 | }); 89 | addInternalIfNeeded(this, uid, true); 90 | } 91 | }; 92 | defineProperty(ObjectProto, uid, descriptor); 93 | return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor); 94 | }, 95 | _Symbol = function _Symbol2(description) { 96 | if (this && this !== G) { 97 | throw new TypeError('Symbol is not a constructor'); 98 | } 99 | return setAndGetSymbol(prefix.concat(description || '', random, ++id)); 100 | }, 101 | source = create(null), 102 | sourceConstructor = { value: _Symbol }, 103 | sourceMap = function sourceMap(uid) { 104 | return source[uid]; 105 | }, 106 | $defineProperty = function defineProp(o, key, descriptor) { 107 | var uid = '' + key; 108 | if (onlySymbols(uid)) { 109 | setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor); 110 | addInternalIfNeeded(o, uid, !!descriptor.enumerable); 111 | } else { 112 | defineProperty(o, key, descriptor); 113 | } 114 | return o; 115 | }, 116 | $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 117 | var cof = toString.call(o); 118 | o = cof === '[object String]' ? o.split('') : Object(o); 119 | return gOPN(o).filter(onlySymbols).map(sourceMap); 120 | }; 121 | 122 | descriptor.value = $defineProperty; 123 | defineProperty(Object, DP, descriptor); 124 | 125 | descriptor.value = $getOwnPropertySymbols; 126 | defineProperty(Object, GOPS, descriptor); 127 | 128 | var cachedWindowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' ? Object.getOwnPropertyNames(window) : []; 129 | var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames; 130 | descriptor.value = function getOwnPropertyNames(o) { 131 | if (toString.call(o) === '[object Window]') { 132 | try { 133 | return originalObjectGetOwnPropertyNames(o); 134 | } catch (e) { 135 | return [].concat([], cachedWindowNames); 136 | } 137 | } 138 | return gOPN(o).filter(onlyNonSymbols); 139 | }; 140 | defineProperty(Object, GOPN, descriptor); 141 | 142 | descriptor.value = function defineProperties(o, descriptors) { 143 | var symbols = $getOwnPropertySymbols(descriptors); 144 | if (symbols.length) { 145 | keys(descriptors).concat(symbols).forEach(function (uid) { 146 | if (propertyIsEnumerable.call(descriptors, uid)) { 147 | $defineProperty(o, uid, descriptors[uid]); 148 | } 149 | }); 150 | } else { 151 | $defineProperties(o, descriptors); 152 | } 153 | return o; 154 | }; 155 | defineProperty(Object, DPies, descriptor); 156 | 157 | descriptor.value = propertyIsEnumerable; 158 | defineProperty(ObjectProto, PIE, descriptor); 159 | 160 | descriptor.value = _Symbol; 161 | defineProperty(G, 'Symbol', descriptor); 162 | 163 | descriptor.value = function (key) { 164 | var uid = prefix.concat(prefix, key, random); 165 | return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 166 | }; 167 | defineProperty(_Symbol, 'for', descriptor); 168 | 169 | descriptor.value = function (symbol) { 170 | return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0; 171 | }; 172 | defineProperty(_Symbol, 'keyFor', descriptor); 173 | 174 | descriptor.value = function getOwnPropertyDescriptor(o, key) { 175 | var descriptor = gOPD(o, key); 176 | if (descriptor && onlySymbols(key)) { 177 | descriptor.enumerable = propertyIsEnumerable.call(o, key); 178 | } 179 | return descriptor; 180 | }; 181 | defineProperty(Object, GOPD, descriptor); 182 | 183 | descriptor.value = function (proto, descriptors) { 184 | return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors); 185 | }; 186 | defineProperty(Object, 'create', descriptor); 187 | 188 | descriptor.value = function () { 189 | var str = toString.call(this); 190 | return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str; 191 | }; 192 | defineProperty(ObjectProto, 'toString', descriptor); 193 | 194 | try { 195 | setDescriptor = create(defineProperty({}, prefix, { 196 | get: function get() { 197 | return defineProperty(this, prefix, { value: false })[prefix]; 198 | } 199 | }))[prefix] || defineProperty; 200 | } catch (o_O) { 201 | setDescriptor = function setDescriptor(o, key, descriptor) { 202 | var protoDescriptor = gOPD(ObjectProto, key); 203 | delete ObjectProto[key]; 204 | defineProperty(o, key, descriptor); 205 | defineProperty(ObjectProto, key, protoDescriptor); 206 | }; 207 | } 208 | })(Object, 'getOwnPropertySymbols'); 209 | 210 | (function (O, S) { 211 | var dP = O.defineProperty, 212 | ObjectProto = O.prototype, 213 | toString = ObjectProto.toString, 214 | toStringTag = 'toStringTag', 215 | descriptor; 216 | ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) { 217 | if (!(name in Symbol)) { 218 | dP(Symbol, name, { value: Symbol(name) }); 219 | switch (name) { 220 | case toStringTag: 221 | descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString'); 222 | descriptor.value = function () { 223 | var str = toString.call(this), 224 | tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag]; 225 | return typeof tst === 'undefined' ? str : '[object ' + tst + ']'; 226 | }; 227 | dP(ObjectProto, 'toString', descriptor); 228 | break; 229 | } 230 | } 231 | }); 232 | })(Object, Symbol); 233 | 234 | (function (Si, AP, SP) { 235 | 236 | function returnThis() { 237 | return this; 238 | } 239 | 240 | if (!AP[Si]) AP[Si] = function () { 241 | var i = 0, 242 | self = this, 243 | iterator = { 244 | next: function next() { 245 | var done = self.length <= i; 246 | return done ? { done: done } : { done: done, value: self[i++] }; 247 | } 248 | }; 249 | iterator[Si] = returnThis; 250 | return iterator; 251 | }; 252 | 253 | if (!SP[Si]) SP[Si] = function () { 254 | var fromCodePoint = String.fromCodePoint, 255 | self = this, 256 | i = 0, 257 | length = self.length, 258 | iterator = { 259 | next: function next() { 260 | var done = length <= i, 261 | c = done ? '' : fromCodePoint(self.codePointAt(i)); 262 | i += c.length; 263 | return done ? { done: done } : { done: done, value: c }; 264 | } 265 | }; 266 | iterator[Si] = returnThis; 267 | return iterator; 268 | }; 269 | })(Symbol.iterator, Array.prototype, String.prototype); 270 | } 271 | 272 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 273 | 274 | Number.isNaN = Number.isNaN || function (value) { 275 | return value !== value; 276 | }; 277 | 278 | Number.isFinite = Number.isFinite || function (value) { 279 | return typeof value === "number" && isFinite(value); 280 | }; 281 | } 282 | 283 | if (!String.prototype.endsWith || function () { 284 | try { 285 | return !"ab".endsWith("a", 1); 286 | } catch (e) { 287 | return true; 288 | } 289 | }()) { 290 | String.prototype.endsWith = function (searchString, position) { 291 | var subjectString = this.toString(); 292 | if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 293 | position = subjectString.length; 294 | } 295 | position -= searchString.length; 296 | var lastIndex = subjectString.indexOf(searchString, position); 297 | return lastIndex !== -1 && lastIndex === position; 298 | }; 299 | } 300 | 301 | if (!String.prototype.startsWith || function () { 302 | try { 303 | return !"ab".startsWith("b", 1); 304 | } catch (e) { 305 | return true; 306 | } 307 | }()) { 308 | String.prototype.startsWith = function (searchString, position) { 309 | position = position || 0; 310 | return this.substr(position, searchString.length) === searchString; 311 | }; 312 | } 313 | 314 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 315 | 316 | if (!Array.from) { 317 | Array.from = function () { 318 | var toInteger = function toInteger(it) { 319 | return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it); 320 | }; 321 | var toLength = function toLength(it) { 322 | return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0; 323 | }; 324 | var iterCall = function iterCall(iter, fn, val, index) { 325 | try { 326 | return fn(val, index); 327 | } catch (E) { 328 | if (typeof iter.return == 'function') iter.return(); 329 | throw E; 330 | } 331 | }; 332 | 333 | return function from(arrayLike) { 334 | var O = Object(arrayLike), 335 | C = typeof this == 'function' ? this : Array, 336 | aLen = arguments.length, 337 | mapfn = aLen > 1 ? arguments[1] : undefined, 338 | mapping = mapfn !== undefined, 339 | index = 0, 340 | iterFn = O[Symbol.iterator], 341 | length, 342 | result, 343 | step, 344 | iterator; 345 | if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined); 346 | if (iterFn != undefined && !Array.isArray(arrayLike)) { 347 | for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { 348 | result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value; 349 | } 350 | } else { 351 | length = toLength(O.length); 352 | for (result = new C(length); length > index; index++) { 353 | result[index] = mapping ? mapfn(O[index], index) : O[index]; 354 | } 355 | } 356 | result.length = index; 357 | return result; 358 | }; 359 | }(); 360 | } 361 | 362 | if (!Array.prototype.find) { 363 | Object.defineProperty(Array.prototype, 'find', { 364 | configurable: true, 365 | writable: true, 366 | enumerable: false, 367 | value: function value(predicate) { 368 | if (this === null) { 369 | throw new TypeError('Array.prototype.find called on null or undefined'); 370 | } 371 | if (typeof predicate !== 'function') { 372 | throw new TypeError('predicate must be a function'); 373 | } 374 | var list = Object(this); 375 | var length = list.length >>> 0; 376 | var thisArg = arguments[1]; 377 | var value; 378 | 379 | for (var i = 0; i < length; i++) { 380 | value = list[i]; 381 | if (predicate.call(thisArg, value, i, list)) { 382 | return value; 383 | } 384 | } 385 | return undefined; 386 | } 387 | }); 388 | } 389 | 390 | if (!Array.prototype.findIndex) { 391 | Object.defineProperty(Array.prototype, 'findIndex', { 392 | configurable: true, 393 | writable: true, 394 | enumerable: false, 395 | value: function value(predicate) { 396 | if (this === null) { 397 | throw new TypeError('Array.prototype.findIndex called on null or undefined'); 398 | } 399 | if (typeof predicate !== 'function') { 400 | throw new TypeError('predicate must be a function'); 401 | } 402 | var list = Object(this); 403 | var length = list.length >>> 0; 404 | var thisArg = arguments[1]; 405 | var value; 406 | 407 | for (var i = 0; i < length; i++) { 408 | value = list[i]; 409 | if (predicate.call(thisArg, value, i, list)) { 410 | return i; 411 | } 412 | } 413 | return -1; 414 | } 415 | }); 416 | } 417 | } 418 | 419 | if (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) { 420 | Object.defineProperty(Array.prototype, 'includes', { 421 | configurable: true, 422 | writable: true, 423 | enumerable: false, 424 | value: function value(searchElement) { 425 | var O = Object(this); 426 | var len = parseInt(O.length) || 0; 427 | if (len === 0) { 428 | return false; 429 | } 430 | var n = parseInt(arguments[1]) || 0; 431 | var k; 432 | if (n >= 0) { 433 | k = n; 434 | } else { 435 | k = len + n; 436 | if (k < 0) { 437 | k = 0; 438 | } 439 | } 440 | var currentElement; 441 | while (k < len) { 442 | currentElement = O[k]; 443 | if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { 444 | return true; 445 | } 446 | k++; 447 | } 448 | return false; 449 | } 450 | }); 451 | } 452 | 453 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 454 | 455 | (function () { 456 | var needsFix = false; 457 | 458 | try { 459 | var s = Object.keys('a'); 460 | needsFix = s.length !== 1 || s[0] !== '0'; 461 | } catch (e) { 462 | needsFix = true; 463 | } 464 | 465 | if (needsFix) { 466 | Object.keys = function () { 467 | var hasOwnProperty = Object.prototype.hasOwnProperty, 468 | hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), 469 | dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], 470 | dontEnumsLength = dontEnums.length; 471 | 472 | return function (obj) { 473 | if (obj === undefined || obj === null) { 474 | throw TypeError('Cannot convert undefined or null to object'); 475 | } 476 | 477 | obj = Object(obj); 478 | 479 | var result = [], 480 | prop, 481 | i; 482 | 483 | for (prop in obj) { 484 | if (hasOwnProperty.call(obj, prop)) { 485 | result.push(prop); 486 | } 487 | } 488 | 489 | if (hasDontEnumBug) { 490 | for (i = 0; i < dontEnumsLength; i++) { 491 | if (hasOwnProperty.call(obj, dontEnums[i])) { 492 | result.push(dontEnums[i]); 493 | } 494 | } 495 | } 496 | 497 | return result; 498 | }; 499 | }(); 500 | } 501 | })(); 502 | 503 | (function (O) { 504 | if ('assign' in O) { 505 | return; 506 | } 507 | 508 | O.defineProperty(O, 'assign', { 509 | configurable: true, 510 | writable: true, 511 | value: function () { 512 | var gOPS = O.getOwnPropertySymbols, 513 | pIE = O.propertyIsEnumerable, 514 | filterOS = gOPS ? function (self) { 515 | return gOPS(self).filter(pIE, self); 516 | } : function () { 517 | return Array.prototype; 518 | }; 519 | 520 | return function assign(where) { 521 | if (gOPS && !(where instanceof O)) { 522 | console.warn('problematic Symbols', where); 523 | } 524 | 525 | function set(keyOrSymbol) { 526 | where[keyOrSymbol] = arg[keyOrSymbol]; 527 | } 528 | 529 | for (var i = 1, ii = arguments.length; i < ii; ++i) { 530 | var arg = arguments[i]; 531 | 532 | if (arg === null || arg === undefined) { 533 | continue; 534 | } 535 | 536 | O.keys(arg).concat(filterOS(arg)).forEach(set); 537 | } 538 | 539 | return where; 540 | }; 541 | }() 542 | }); 543 | })(Object); 544 | 545 | if (!Object.is) { 546 | Object.is = function (x, y) { 547 | if (x === y) { 548 | return x !== 0 || 1 / x === 1 / y; 549 | } else { 550 | return x !== x && y !== y; 551 | } 552 | }; 553 | } 554 | } 555 | 556 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 557 | 558 | (function (global) { 559 | var i; 560 | 561 | var defineProperty = Object.defineProperty, 562 | is = function is(a, b) { 563 | return a === b || a !== a && b !== b; 564 | }; 565 | 566 | if (typeof WeakMap == 'undefined') { 567 | global.WeakMap = createCollection({ 568 | 'delete': sharedDelete, 569 | 570 | clear: sharedClear, 571 | 572 | get: sharedGet, 573 | 574 | has: mapHas, 575 | 576 | set: sharedSet 577 | }, true); 578 | } 579 | 580 | if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) { 581 | var _createCollection; 582 | 583 | global.Map = createCollection((_createCollection = { 584 | 'delete': sharedDelete, 585 | 586 | has: mapHas, 587 | 588 | get: sharedGet, 589 | 590 | set: sharedSet, 591 | 592 | keys: sharedKeys, 593 | 594 | values: sharedValues, 595 | 596 | entries: mapEntries, 597 | 598 | forEach: sharedForEach, 599 | 600 | clear: sharedClear 601 | }, _createCollection[Symbol.iterator] = mapEntries, _createCollection)); 602 | } 603 | 604 | if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) { 605 | var _createCollection2; 606 | 607 | global.Set = createCollection((_createCollection2 = { 608 | has: setHas, 609 | 610 | add: sharedAdd, 611 | 612 | 'delete': sharedDelete, 613 | 614 | clear: sharedClear, 615 | 616 | keys: sharedValues, 617 | values: sharedValues, 618 | 619 | entries: setEntries, 620 | 621 | forEach: sharedForEach 622 | }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2)); 623 | } 624 | 625 | if (typeof WeakSet == 'undefined') { 626 | global.WeakSet = createCollection({ 627 | 'delete': sharedDelete, 628 | 629 | add: sharedAdd, 630 | 631 | clear: sharedClear, 632 | 633 | has: setHas 634 | }, true); 635 | } 636 | 637 | function createCollection(proto, objectOnly) { 638 | function Collection(a) { 639 | if (!this || this.constructor !== Collection) return new Collection(a); 640 | this._keys = []; 641 | this._values = []; 642 | this._itp = []; 643 | this.objectOnly = objectOnly; 644 | 645 | if (a) init.call(this, a); 646 | } 647 | 648 | if (!objectOnly) { 649 | defineProperty(proto, 'size', { 650 | get: sharedSize 651 | }); 652 | } 653 | 654 | proto.constructor = Collection; 655 | Collection.prototype = proto; 656 | 657 | return Collection; 658 | } 659 | 660 | function init(a) { 661 | var i; 662 | 663 | if (this.add) a.forEach(this.add, this);else a.forEach(function (a) { 664 | this.set(a[0], a[1]); 665 | }, this); 666 | } 667 | 668 | function sharedDelete(key) { 669 | if (this.has(key)) { 670 | this._keys.splice(i, 1); 671 | this._values.splice(i, 1); 672 | 673 | this._itp.forEach(function (p) { 674 | if (i < p[0]) p[0]--; 675 | }); 676 | } 677 | 678 | return -1 < i; 679 | }; 680 | 681 | function sharedGet(key) { 682 | return this.has(key) ? this._values[i] : undefined; 683 | } 684 | 685 | function has(list, key) { 686 | if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key"); 687 | 688 | if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key); 689 | return -1 < i; 690 | } 691 | 692 | function setHas(value) { 693 | return has.call(this, this._values, value); 694 | } 695 | 696 | function mapHas(value) { 697 | return has.call(this, this._keys, value); 698 | } 699 | 700 | function sharedSet(key, value) { 701 | this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value; 702 | return this; 703 | } 704 | 705 | function sharedAdd(value) { 706 | if (!this.has(value)) this._values.push(value); 707 | return this; 708 | } 709 | 710 | function sharedClear() { 711 | (this._keys || 0).length = this._values.length = 0; 712 | } 713 | 714 | function sharedKeys() { 715 | return sharedIterator(this._itp, this._keys); 716 | } 717 | 718 | function sharedValues() { 719 | return sharedIterator(this._itp, this._values); 720 | } 721 | 722 | function mapEntries() { 723 | return sharedIterator(this._itp, this._keys, this._values); 724 | } 725 | 726 | function setEntries() { 727 | return sharedIterator(this._itp, this._values, this._values); 728 | } 729 | 730 | function sharedIterator(itp, array, array2) { 731 | var _ref; 732 | 733 | var p = [0], 734 | done = false; 735 | itp.push(p); 736 | return _ref = {}, _ref[Symbol.iterator] = function () { 737 | return this; 738 | }, _ref.next = function next() { 739 | var v, 740 | k = p[0]; 741 | if (!done && k < array.length) { 742 | v = array2 ? [array[k], array2[k]] : array[k]; 743 | p[0]++; 744 | } else { 745 | done = true; 746 | itp.splice(itp.indexOf(p), 1); 747 | } 748 | return { done: done, value: v }; 749 | }, _ref; 750 | } 751 | 752 | function sharedSize() { 753 | return this._values.length; 754 | } 755 | 756 | function sharedForEach(callback, context) { 757 | var it = this.entries(); 758 | for (;;) { 759 | var r = it.next(); 760 | if (r.done) break; 761 | callback.call(context, r.value[1], r.value[0], this); 762 | } 763 | } 764 | })(PLATFORM.global); 765 | } 766 | 767 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 768 | 769 | var bind = Function.prototype.bind; 770 | 771 | if (typeof PLATFORM.global.Reflect === 'undefined') { 772 | PLATFORM.global.Reflect = {}; 773 | } 774 | 775 | if (typeof Reflect.defineProperty !== 'function') { 776 | Reflect.defineProperty = function (target, propertyKey, descriptor) { 777 | if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') { 778 | throw new TypeError('Reflect.defineProperty called on non-object'); 779 | } 780 | try { 781 | Object.defineProperty(target, propertyKey, descriptor); 782 | return true; 783 | } catch (e) { 784 | return false; 785 | } 786 | }; 787 | } 788 | 789 | if (typeof Reflect.construct !== 'function') { 790 | Reflect.construct = function (Target, args) { 791 | if (args) { 792 | switch (args.length) { 793 | case 0: 794 | return new Target(); 795 | case 1: 796 | return new Target(args[0]); 797 | case 2: 798 | return new Target(args[0], args[1]); 799 | case 3: 800 | return new Target(args[0], args[1], args[2]); 801 | case 4: 802 | return new Target(args[0], args[1], args[2], args[3]); 803 | } 804 | } 805 | 806 | var a = [null]; 807 | a.push.apply(a, args); 808 | return new (bind.apply(Target, a))(); 809 | }; 810 | } 811 | 812 | if (typeof Reflect.ownKeys !== 'function') { 813 | Reflect.ownKeys = function (o) { 814 | return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)); 815 | }; 816 | } 817 | } 818 | 819 | if (typeof FEATURE_NO_ESNEXT === 'undefined') { 820 | 821 | var emptyMetadata = Object.freeze({}); 822 | var metadataContainerKey = '__metadata__'; 823 | 824 | if (typeof Reflect.getOwnMetadata !== 'function') { 825 | Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { 826 | if (target.hasOwnProperty(metadataContainerKey)) { 827 | return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey]; 828 | } 829 | }; 830 | } 831 | 832 | if (typeof Reflect.defineMetadata !== 'function') { 833 | Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { 834 | var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; 835 | var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); 836 | targetContainer[metadataKey] = metadataValue; 837 | }; 838 | } 839 | 840 | if (typeof Reflect.metadata !== 'function') { 841 | Reflect.metadata = function (metadataKey, metadataValue) { 842 | return function (target, targetKey) { 843 | Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); 844 | }; 845 | }; 846 | } 847 | } -------------------------------------------------------------------------------- /dist/native-modules/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-polyfills'; -------------------------------------------------------------------------------- /dist/system/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['./aurelia-polyfills'], function (_export, _context) { 4 | "use strict"; 5 | 6 | return { 7 | setters: [function (_aureliaPolyfills) { 8 | var _exportObj = {}; 9 | 10 | for (var _key in _aureliaPolyfills) { 11 | if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _aureliaPolyfills[_key]; 12 | } 13 | 14 | _export(_exportObj); 15 | }], 16 | execute: function () {} 17 | }; 18 | }); -------------------------------------------------------------------------------- /doc/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## [1.3.5](https://github.com/aurelia/polyfills/compare/1.3.1...1.3.5) (2019-03-26) 3 | 4 | 5 | ### Bug Fixes 6 | 7 | * **all:** change es2015 back to native-modules ([2a9d9e3](https://github.com/aurelia/polyfills/commit/2a9d9e3)) 8 | 9 | 10 | 11 | 12 | ## [1.3.4](https://github.com/aurelia/polyfills/compare/1.3.1...1.3.4) (2019-02-05) 13 | 14 | 15 | ### Bug Fixes 16 | 17 | * **all:** change es2015 back to native-modules ([2a9d9e3](https://github.com/aurelia/polyfills/commit/2a9d9e3)) 18 | 19 | 20 | 21 | 22 | ## [1.3.3](https://github.com/aurelia/polyfills/compare/1.3.1...1.3.3) (2019-02-04) 23 | 24 | 25 | ### Bug Fixes 26 | 27 | * **all:** change es2015 back to native-modules ([2a9d9e3](https://github.com/aurelia/polyfills/commit/2a9d9e3)) 28 | 29 | 30 | 31 | 32 | ## [1.3.2](https://github.com/aurelia/polyfills/compare/1.3.1...1.3.2) (2019-02-03) 33 | 34 | 35 | ### Bug Fixes 36 | 37 | * **all:** change es2015 back to native-modules ([2a9d9e3](https://github.com/aurelia/polyfills/commit/2a9d9e3)) 38 | 39 | 40 | 41 | 42 | # [1.3.0](https://github.com/aurelia/polyfills/compare/1.2.2...v1.3.0) (2018-01-25) 43 | 44 | 45 | ### Features 46 | 47 | * **Object:** add Object.is() ([#58](https://github.com/aurelia/polyfills/issues/58)) ([3cf3410](https://github.com/aurelia/polyfills/commit/3cf3410)) 48 | 49 | 50 | 51 | 52 | ## [1.2.2](https://github.com/aurelia/polyfills/compare/1.2.1...v1.2.2) (2017-06-30) 53 | 54 | 55 | ### Bug Fixes 56 | 57 | * **symbols:** propertyIsEnumerable null reference ([b7c59e5](https://github.com/aurelia/polyfills/commit/b7c59e5)) 58 | * IE 11 access denied fix 59 | 60 | 61 | 62 | 63 | ## [1.2.1](https://github.com/aurelia/polyfills/compare/1.2.0...v1.2.1) (2017-03-23) 64 | 65 | 66 | ### Bug Fixes 67 | 68 | * **symbols:** check that descriptors is an object ([e181ff7](https://github.com/aurelia/polyfills/commit/e181ff7)) 69 | 70 | 71 | 72 | 73 | # [1.2.0](https://github.com/aurelia/polyfills/compare/1.1.1...v1.2.0) (2017-02-21) 74 | 75 | ### Features 76 | 77 | * opt-out for polyfills 78 | 79 | 80 | ## [1.1.1](https://github.com/aurelia/polyfills/compare/1.1.0...v1.1.1) (2016-09-13) 81 | 82 | 83 | ### Bug Fixes 84 | 85 | * **array:** make Array.from work with mapping functions ([c425a49](https://github.com/aurelia/polyfills/commit/c425a49)) 86 | 87 | 88 | 89 | 90 | # [1.0.0](https://github.com/aurelia/polyfills/compare/1.0.0-rc.1.0.0...v1.0.0) (2016-07-27) 91 | 92 | 93 | 94 | 95 | # [1.0.0-rc.1.0.0](https://github.com/aurelia/polyfills/compare/1.0.0-beta.2.0.1...v1.0.0-rc.1.0.0) (2016-06-22) 96 | 97 | 98 | 99 | ### 1.0.0-beta.1.1.6 (2016-05-24) 100 | 101 | 102 | #### Bug Fixes 103 | 104 | * **console:** remove in order to move to pal ([80f0c7b5](http://github.com/aurelia/polyfills/commit/80f0c7b5c2e3c1abf290b1ed42fb84f1c340d31d)) 105 | 106 | 107 | ### 1.0.0-beta.1.1.5 (2016-05-24) 108 | 109 | 110 | #### Features 111 | 112 | * **console:** moved console fix from logging-console to polyfills ([6db2334a](http://github.com/aurelia/polyfills/commit/6db2334a31e5d36f30e2dbda47bfaa2162f279bf)) 113 | 114 | 115 | ### 1.0.0-beta.1.1.4 (2016-05-10) 116 | 117 | 118 | ### 1.0.0-beta.1.1.3 (2016-05-03) 119 | 120 | 121 | #### Bug Fixes 122 | 123 | * **reflect:** fix target-is-object check ([841a64b5](http://github.com/aurelia/polyfills/commit/841a64b597d320425773b393dfe4366ca0fc22bb)) 124 | 125 | 126 | #### Features 127 | 128 | * **reflect:** add polyfill for defineProperty ([c6fbc900](http://github.com/aurelia/polyfills/commit/c6fbc900e8e62bbf6dd3730e3557de12e10d4f4b)) 129 | 130 | 131 | ### 1.0.0-beta.1.1.2 (2016-04-13) 132 | 133 | * fix: Object.getOwnPropertyNames: argument is not an Object error in symbol.js 134 | 135 | 136 | ### 1.0.0-beta.1.1.1 (2016-03-29) 137 | 138 | 139 | #### Bug Fixes 140 | 141 | * **symbol:** fix Object.defineProperties ([f548033d](http://github.com/aurelia/polyfills/commit/f548033d486a26770195daf95a94e905510106f1)) 142 | 143 | 144 | ### 1.0.0-beta.1.1.0 (2016-03-22) 145 | 146 | 147 | #### Features 148 | 149 | * **all:** add iterator support to Array.from ([5f237887](http://github.com/aurelia/polyfills/commit/5f237887f5f750c365ba71c292f3427ae5301a8b)) 150 | 151 | 152 | ### 1.0.0-beta.1.0.6 (2016-03-09) 153 | 154 | 155 | #### Bug Fixes 156 | 157 | * **symbol:** treat `null` value the same as `undefined` ([4b705bb1](http://github.com/aurelia/polyfills/commit/4b705bb1c4886e197d0e8dfcc291fb3308238372), closes [#13](http://github.com/aurelia/polyfills/issues/13)) 158 | 159 | 160 | ### 1.0.0-beta.1.0.5 (2016-03-08) 161 | 162 | 163 | #### Bug Fixes 164 | 165 | * **array:** make proto methods non enumerable ([6ed412fd](http://github.com/aurelia/polyfills/commit/6ed412fd206c2b987658e205470c496630a0dd6f), closes [#12](http://github.com/aurelia/polyfills/issues/12)) 166 | * **symbol:** remove window global ([14916c10](http://github.com/aurelia/polyfills/commit/14916c10efa17a6f2a109beb4979fbe038879649)) 167 | 168 | 169 | ### 1.0.0-beta.1.0.4 (2016-03-08) 170 | 171 | 172 | #### Bug Fixes 173 | 174 | * **object:** assign ignores null or undefined ([941a892f](http://github.com/aurelia/polyfills/commit/941a892f8a63bce8dea3566c97e911ee31622359)) 175 | 176 | 177 | ### 1.0.0-beta.1.0.3 (2016-03-07) 178 | 179 | 180 | #### Bug Fixes 181 | 182 | * **object:** correct es6 Object.keys behavior for primitives ([11852935](http://github.com/aurelia/polyfills/commit/11852935d02a451f2ea13c48dd0dd6877d890c8e)) 183 | 184 | 185 | ### 1.0.0-beta.1.0.2 (2016-03-06) 186 | 187 | 188 | #### Features 189 | 190 | * **all:** add symbols ([f11b8f42](http://github.com/aurelia/polyfills/commit/f11b8f422cb512c3e4aba377278ab0a33375a96d)) 191 | 192 | 193 | ### 1.0.0-beta.1.0.1 (2016-03-02) 194 | 195 | 196 | #### Features 197 | 198 | * **collections:** add weak map and set ([59d58dc6](http://github.com/aurelia/polyfills/commit/59d58dc6a571718a3b70329d6c54d3a5c00a063b)) 199 | 200 | 201 | ### 1.0.0-beta.1.0.0 (2016-03-01) 202 | 203 | 204 | #### Bug Fixes 205 | 206 | * **reflect:** 207 | * incorrect arg casing ([52f06db5](http://github.com/aurelia/polyfills/commit/52f06db5682042ee1b3c4601a4133b10e446e7b4)) 208 | * missing bind reference ([89964a16](http://github.com/aurelia/polyfills/commit/89964a1602ad216ef1db0f04823f62dd04a67dca)) 209 | 210 | 211 | ### 0.1.2 (2016-02-17) 212 | 213 | 214 | #### Bug Fixes 215 | 216 | * **reflect:** missed constants for implementation internals ([36e7a3e6](http://github.com/aurelia/polyfills/commit/36e7a3e6b8f7327af65e01fc98e04352998b0abc)) 217 | 218 | 219 | ### 0.1.1 (2016-02-17) 220 | 221 | 222 | #### Features 223 | 224 | * **all:** 225 | * fix dependencies and build ([913b2d74](http://github.com/aurelia/polyfills/commit/913b2d746f317102904346af30051140a9e50bf2)) 226 | * add remaining known polyfills ([c0391592](http://github.com/aurelia/polyfills/commit/c03915926a3c531ce67d0156d16729def2482b14)) 227 | * add object.assign and collection polyfills ([2ff683d6](http://github.com/aurelia/polyfills/commit/2ff683d6fdd6a36857d30a14f2b80c5e57815a54)) 228 | -------------------------------------------------------------------------------- /doc/api.json: -------------------------------------------------------------------------------- 1 | {"name":"aurelia-polyfills"} -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | require('require-dir')('build/tasks'); 2 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path that will be used to resolve all patterns (eg. files, exclude) 8 | basePath: '', 9 | 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['jspm', 'jasmine'], 14 | 15 | jspm: { 16 | // Edit this to your needs 17 | loadFiles: ['src/**/*.js', 'test/**/*.js'] 18 | }, 19 | 20 | 21 | // list of files / patterns to load in the browser 22 | files: [], 23 | 24 | 25 | // list of files to exclude 26 | exclude: [ 27 | ], 28 | 29 | 30 | // preprocess matching files before serving them to the browser 31 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 32 | preprocessors: { 33 | 'test/**/*.js': ['babel'], 34 | 'src/**/*.js': ['babel'] 35 | }, 36 | 'babelPreprocessor': { 37 | options: { 38 | sourceMap: 'inline', 39 | presets: [ 'es2015-loose', 'stage-1'], 40 | plugins: [ 41 | 'syntax-flow', 42 | 'transform-decorators-legacy', 43 | 'transform-flow-strip-types' 44 | ] 45 | } 46 | }, 47 | 48 | 49 | // test results reporter to use 50 | // possible values: 'dots', 'progress' 51 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 52 | reporters: ['progress'], 53 | 54 | 55 | // web server port 56 | port: 9876, 57 | 58 | 59 | // enable / disable colors in the output (reporters and logs) 60 | colors: true, 61 | 62 | 63 | // level of logging 64 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 65 | logLevel: config.LOG_INFO, 66 | 67 | 68 | // enable / disable watching file and executing tests whenever any file changes 69 | autoWatch: true, 70 | 71 | 72 | // start these browsers 73 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 74 | browsers: ['Chrome'], 75 | 76 | 77 | // Continuous Integration mode 78 | // if true, Karma captures browsers, runs the tests and exits 79 | singleRun: false 80 | }); 81 | }; 82 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-polyfills", 3 | "version": "1.3.5", 4 | "description": "The minimal set of polyfills that the Aurelia platform needs to run on ES5 browsers.", 5 | "keywords": [ 6 | "aurelia", 7 | "polyfill" 8 | ], 9 | "homepage": "http://aurelia.io", 10 | "bugs": { 11 | "url": "https://github.com/aurelia/polyfills/issues" 12 | }, 13 | "license": "MIT", 14 | "author": "Rob Eisenberg (http://robeisenberg.com/)", 15 | "main": "dist/commonjs/aurelia-polyfills.js", 16 | "module": "dist/native-modules/aurelia-polyfills.js", 17 | "typings": "dist/aurelia-polyfills.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "http://github.com/aurelia/polyfills" 21 | }, 22 | "scripts": { 23 | "test": "karma start --single-run", 24 | "build": "gulp build", 25 | "cut-release": "gulp prepare-release" 26 | }, 27 | "files": [ 28 | "dist", 29 | "doc", 30 | "src", 31 | "typings.json", 32 | "README.md", 33 | "LICENSE" 34 | ], 35 | "jspm": { 36 | "registry": "npm", 37 | "main": "aurelia-polyfills", 38 | "format": "amd", 39 | "directories": { 40 | "dist": "dist/amd" 41 | }, 42 | "dependencies": { 43 | "aurelia-pal": "^1.0.0" 44 | }, 45 | "devDependencies": { 46 | "babel": "babel-core@^5.8.22", 47 | "babel-runtime": "^5.8.20", 48 | "core-js": "^2.0.3" 49 | } 50 | }, 51 | "dependencies": { 52 | "aurelia-pal": "^1.0.0" 53 | }, 54 | "devDependencies": { 55 | "aurelia-tools": "^0.2.4", 56 | "babel-dts-generator": "^0.6.1", 57 | "babel-eslint": "^6.1.2", 58 | "babel-plugin-syntax-flow": "^6.8.0", 59 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 60 | "babel-plugin-transform-es2015-modules-amd": "^6.8.0", 61 | "babel-plugin-transform-es2015-modules-commonjs": "^6.11.5", 62 | "babel-plugin-transform-es2015-modules-systemjs": "^6.11.6", 63 | "babel-plugin-transform-flow-strip-types": "^6.8.0", 64 | "babel-preset-es2015": "^6.9.0", 65 | "babel-preset-es2015-loose": "^7.0.0", 66 | "babel-preset-es2015-loose-native-modules": "^1.0.0", 67 | "babel-preset-stage-1": "^6.5.0", 68 | "del": "^2.2.1", 69 | "gulp": "^3.9.1", 70 | "gulp-babel": "^6.1.2", 71 | "gulp-bump": "^2.2.0", 72 | "gulp-concat": "^2.6.0", 73 | "gulp-conventional-changelog": "^1.1.0", 74 | "gulp-eslint": "^3.0.1", 75 | "gulp-ignore": "^2.0.1", 76 | "gulp-insert": "^0.5.0", 77 | "gulp-rename": "^1.2.2", 78 | "gulp-typedoc": "^2.0.0", 79 | "gulp-typedoc-extractor": "^0.0.8", 80 | "gulp-typescript": "^2.13.6", 81 | "gulp-util": "^3.0.7", 82 | "jasmine-core": "^2.4.1", 83 | "jspm": "^0.16.53", 84 | "karma": "^1.1.2", 85 | "karma-babel-preprocessor": "^6.0.1", 86 | "karma-chrome-launcher": "^1.0.1", 87 | "karma-coverage": "^1.1.1", 88 | "karma-jasmine": "^1.0.2", 89 | "karma-jspm": "^2.2.0", 90 | "merge2": "^1.0.2", 91 | "object.assign": "^4.0.4", 92 | "require-dir": "^0.3.0", 93 | "run-sequence": "^1.2.2", 94 | "through2": "^2.0.1", 95 | "typedoc": "^0.4.4", 96 | "typescript": "^1.9.0-dev.20160622-1.0", 97 | "vinyl": "^1.1.1", 98 | "vinyl-paths": "^2.1.0", 99 | "yargs": "^4.8.1" 100 | }, 101 | "aurelia": { 102 | "documentation": { 103 | "articles": [] 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/array.js: -------------------------------------------------------------------------------- 1 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 2 | 3 | if (!Array.from) { 4 | Array.from = (function () { 5 | var toInteger = function(it) { 6 | return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it); 7 | }; 8 | var toLength = function(it) { 9 | return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 10 | }; 11 | var iterCall = function(iter, fn, val, index) { 12 | try { 13 | return fn(val, index) 14 | } 15 | catch (E) { 16 | if (typeof iter.return == 'function') iter.return(); 17 | throw E; 18 | } 19 | }; 20 | 21 | // The length property of the from method is 1. 22 | return function from(arrayLike/*, mapFn, thisArg */) { 23 | var O = Object(arrayLike) 24 | , C = typeof this == 'function' ? this : Array 25 | , aLen = arguments.length 26 | , mapfn = aLen > 1 ? arguments[1] : undefined 27 | , mapping = mapfn !== undefined 28 | , index = 0 29 | , iterFn = O[Symbol.iterator] 30 | , length, result, step, iterator; 31 | if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined); 32 | if (iterFn != undefined && !Array.isArray(arrayLike)) { 33 | for (iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++) { 34 | result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value; 35 | } 36 | } else { 37 | length = toLength(O.length); 38 | for (result = new C(length); length > index; index++) { 39 | result[index] = mapping ? mapfn(O[index], index) : O[index]; 40 | } 41 | } 42 | result.length = index; 43 | return result; 44 | }; 45 | }()); 46 | } 47 | 48 | if (!Array.prototype.find) { 49 | Object.defineProperty(Array.prototype, 'find', { 50 | configurable: true, 51 | writable: true, 52 | enumerable: false, 53 | value: function(predicate) { 54 | if (this === null) { 55 | throw new TypeError('Array.prototype.find called on null or undefined'); 56 | } 57 | if (typeof predicate !== 'function') { 58 | throw new TypeError('predicate must be a function'); 59 | } 60 | var list = Object(this); 61 | var length = list.length >>> 0; 62 | var thisArg = arguments[1]; 63 | var value; 64 | 65 | for (var i = 0; i < length; i++) { 66 | value = list[i]; 67 | if (predicate.call(thisArg, value, i, list)) { 68 | return value; 69 | } 70 | } 71 | return undefined; 72 | } 73 | }); 74 | } 75 | 76 | if (!Array.prototype.findIndex) { 77 | Object.defineProperty(Array.prototype, 'findIndex', { 78 | configurable: true, 79 | writable: true, 80 | enumerable: false, 81 | value: function(predicate) { 82 | if (this === null) { 83 | throw new TypeError('Array.prototype.findIndex called on null or undefined'); 84 | } 85 | if (typeof predicate !== 'function') { 86 | throw new TypeError('predicate must be a function'); 87 | } 88 | var list = Object(this); 89 | var length = list.length >>> 0; 90 | var thisArg = arguments[1]; 91 | var value; 92 | 93 | for (var i = 0; i < length; i++) { 94 | value = list[i]; 95 | if (predicate.call(thisArg, value, i, list)) { 96 | return i; 97 | } 98 | } 99 | return -1; 100 | } 101 | }); 102 | } 103 | 104 | } // endif FEATURE_NO_ES2015 105 | 106 | if (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) { 107 | Object.defineProperty(Array.prototype, 'includes', { 108 | configurable: true, 109 | writable: true, 110 | enumerable: false, 111 | value: function(searchElement /*, fromIndex*/ ) { 112 | var O = Object(this); 113 | var len = parseInt(O.length) || 0; 114 | if (len === 0) { 115 | return false; 116 | } 117 | var n = parseInt(arguments[1]) || 0; 118 | var k; 119 | if (n >= 0) { 120 | k = n; 121 | } else { 122 | k = len + n; 123 | if (k < 0) {k = 0;} 124 | } 125 | var currentElement; 126 | while (k < len) { 127 | currentElement = O[k]; 128 | if (searchElement === currentElement || 129 | (searchElement !== searchElement && currentElement !== currentElement)) { // NaN !== NaN 130 | return true; 131 | } 132 | k++; 133 | } 134 | return false; 135 | } 136 | }); 137 | } 138 | -------------------------------------------------------------------------------- /src/collections.js: -------------------------------------------------------------------------------- 1 | import {PLATFORM} from 'aurelia-pal'; 2 | 3 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 4 | 5 | (function (global) { 6 | //shared pointer 7 | var i; 8 | //shortcuts 9 | var defineProperty = Object.defineProperty, is = function(a,b) { return (a === b) || (a !== a && b !== b) }; 10 | 11 | //Polyfill global objects 12 | if (typeof WeakMap == 'undefined') { 13 | global.WeakMap = createCollection({ 14 | // WeakMap#delete(key:void*):boolean 15 | 'delete': sharedDelete, 16 | // WeakMap#clear(): 17 | clear: sharedClear, 18 | // WeakMap#get(key:void*):void* 19 | get: sharedGet, 20 | // WeakMap#has(key:void*):boolean 21 | has: mapHas, 22 | // WeakMap#set(key:void*, value:void*):void 23 | set: sharedSet 24 | }, true); 25 | } 26 | 27 | if (typeof Map == 'undefined' || typeof ((new Map).values) !== 'function' || !(new Map).values().next) { 28 | global.Map = createCollection({ 29 | // WeakMap#delete(key:void*):boolean 30 | 'delete': sharedDelete, 31 | //:was Map#get(key:void*[, d3fault:void*]):void* 32 | // Map#has(key:void*):boolean 33 | has: mapHas, 34 | // Map#get(key:void*):boolean 35 | get: sharedGet, 36 | // Map#set(key:void*, value:void*):void 37 | set: sharedSet, 38 | // Map#keys(void):Iterator 39 | keys: sharedKeys, 40 | // Map#values(void):Iterator 41 | values: sharedValues, 42 | // Map#entries(void):Iterator 43 | entries: mapEntries, 44 | // Map#forEach(callback:Function, context:void*):void ==> callback.call(context, key, value, mapObject) === not in specs` 45 | forEach: sharedForEach, 46 | // Map#clear(): 47 | clear: sharedClear, 48 | //iterator 49 | [Symbol.iterator]: mapEntries 50 | }); 51 | } 52 | 53 | if (typeof Set == 'undefined' || typeof ((new Set).values) !== 'function' || !(new Set).values().next) { 54 | global.Set = createCollection({ 55 | // Set#has(value:void*):boolean 56 | has: setHas, 57 | // Set#add(value:void*):boolean 58 | add: sharedAdd, 59 | // Set#delete(key:void*):boolean 60 | 'delete': sharedDelete, 61 | // Set#clear(): 62 | clear: sharedClear, 63 | // Set#keys(void):Iterator 64 | keys: sharedValues, // specs actually say "the same function object as the initial value of the values property" 65 | // Set#values(void):Iterator 66 | values: sharedValues, 67 | // Set#entries(void):Iterator 68 | entries: setEntries, 69 | // Set#forEach(callback:Function, context:void*):void ==> callback.call(context, value, index) === not in specs 70 | forEach: sharedForEach, 71 | //iterator 72 | [Symbol.iterator]: sharedValues 73 | }); 74 | } 75 | 76 | if (typeof WeakSet == 'undefined') { 77 | global.WeakSet = createCollection({ 78 | // WeakSet#delete(key:void*):boolean 79 | 'delete': sharedDelete, 80 | // WeakSet#add(value:void*):boolean 81 | add: sharedAdd, 82 | // WeakSet#clear(): 83 | clear: sharedClear, 84 | // WeakSet#has(value:void*):boolean 85 | has: setHas 86 | }, true); 87 | } 88 | 89 | /** 90 | * ES6 collection constructor 91 | * @return {Function} a collection class 92 | */ 93 | function createCollection(proto, objectOnly){ 94 | function Collection(a){ 95 | if (!this || this.constructor !== Collection) return new Collection(a); 96 | this._keys = []; 97 | this._values = []; 98 | this._itp = []; // iteration pointers 99 | this.objectOnly = objectOnly; 100 | 101 | //parse initial iterable argument passed 102 | if (a) init.call(this, a); 103 | } 104 | 105 | //define size for non object-only collections 106 | if (!objectOnly) { 107 | defineProperty(proto, 'size', { 108 | get: sharedSize 109 | }); 110 | } 111 | 112 | //set prototype 113 | proto.constructor = Collection; 114 | Collection.prototype = proto; 115 | 116 | return Collection; 117 | } 118 | 119 | 120 | /** parse initial iterable argument passed */ 121 | function init(a){ 122 | var i; 123 | //init Set argument, like `[1,2,3,{}]` 124 | if (this.add) 125 | a.forEach(this.add, this); 126 | //init Map argument like `[[1,2], [{}, 4]]` 127 | else 128 | a.forEach(function(a){this.set(a[0],a[1])}, this); 129 | } 130 | 131 | 132 | /** delete */ 133 | function sharedDelete(key) { 134 | if (this.has(key)) { 135 | this._keys.splice(i, 1); 136 | this._values.splice(i, 1); 137 | // update iteration pointers 138 | this._itp.forEach(function(p) { if (i < p[0]) p[0]--; }); 139 | } 140 | // Aurora here does it while Canary doesn't 141 | return -1 < i; 142 | }; 143 | 144 | function sharedGet(key) { 145 | return this.has(key) ? this._values[i] : undefined; 146 | } 147 | 148 | function has(list, key) { 149 | if (this.objectOnly && key !== Object(key)) 150 | throw new TypeError("Invalid value used as weak collection key"); 151 | //NaN or 0 passed 152 | if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);){} 153 | else i = list.indexOf(key); 154 | return -1 < i; 155 | } 156 | 157 | function setHas(value) { 158 | return has.call(this, this._values, value); 159 | } 160 | 161 | function mapHas(value) { 162 | return has.call(this, this._keys, value); 163 | } 164 | 165 | /** @chainable */ 166 | function sharedSet(key, value) { 167 | this.has(key) ? 168 | this._values[i] = value 169 | : 170 | this._values[this._keys.push(key) - 1] = value 171 | ; 172 | return this; 173 | } 174 | 175 | /** @chainable */ 176 | function sharedAdd(value) { 177 | if (!this.has(value)) this._values.push(value); 178 | return this; 179 | } 180 | 181 | function sharedClear() { 182 | (this._keys || 0).length = 183 | this._values.length = 0; 184 | } 185 | 186 | /** keys, values, and iterate related methods */ 187 | function sharedKeys() { 188 | return sharedIterator(this._itp, this._keys); 189 | } 190 | 191 | function sharedValues() { 192 | return sharedIterator(this._itp, this._values); 193 | } 194 | 195 | function mapEntries() { 196 | return sharedIterator(this._itp, this._keys, this._values); 197 | } 198 | 199 | function setEntries() { 200 | return sharedIterator(this._itp, this._values, this._values); 201 | } 202 | 203 | function sharedIterator(itp, array, array2) { 204 | var p = [0], done = false; 205 | itp.push(p); 206 | return { 207 | [Symbol.iterator]: function () { 208 | return this; 209 | }, 210 | next: function() { 211 | var v, k = p[0]; 212 | if (!done && k < array.length) { 213 | v = array2 ? [array[k], array2[k]]: array[k]; 214 | p[0]++; 215 | } else { 216 | done = true; 217 | itp.splice(itp.indexOf(p), 1); 218 | } 219 | return { done: done, value: v }; 220 | } 221 | }; 222 | } 223 | 224 | function sharedSize() { 225 | return this._values.length; 226 | } 227 | 228 | function sharedForEach(callback, context) { 229 | var it = this.entries(); 230 | for (;;) { 231 | var r = it.next(); 232 | if (r.done) break; 233 | callback.call(context, r.value[1], r.value[0], this); 234 | } 235 | } 236 | 237 | })(PLATFORM.global); 238 | 239 | } // endif (FEATURE_NO_ES2015) 240 | -------------------------------------------------------------------------------- /src/number.js: -------------------------------------------------------------------------------- 1 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 2 | 3 | Number.isNaN = Number.isNaN || function(value) { 4 | return value !== value; 5 | }; 6 | 7 | Number.isFinite = Number.isFinite || function(value) { 8 | return typeof value === "number" && isFinite(value); 9 | }; 10 | 11 | } // endif FEATURE_NO_ES2015 12 | -------------------------------------------------------------------------------- /src/object.js: -------------------------------------------------------------------------------- 1 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 2 | 3 | (function() { 4 | let needsFix = false; 5 | 6 | //ES5 did not accept primitives, but ES6 does 7 | try { 8 | let s = Object.keys('a'); 9 | needsFix = (s.length !== 1 || s[0] !== '0'); 10 | } catch(e) { 11 | needsFix = true; 12 | } 13 | 14 | if (needsFix) { 15 | Object.keys = (function() { 16 | var hasOwnProperty = Object.prototype.hasOwnProperty, 17 | hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), 18 | dontEnums = [ 19 | 'toString', 20 | 'toLocaleString', 21 | 'valueOf', 22 | 'hasOwnProperty', 23 | 'isPrototypeOf', 24 | 'propertyIsEnumerable', 25 | 'constructor' 26 | ], 27 | dontEnumsLength = dontEnums.length; 28 | 29 | return function(obj) { 30 | if (obj === undefined || obj === null){ 31 | throw TypeError(`Cannot convert undefined or null to object`); 32 | } 33 | 34 | obj = Object(obj); 35 | 36 | var result = [], prop, i; 37 | 38 | for (prop in obj) { 39 | if (hasOwnProperty.call(obj, prop)) { 40 | result.push(prop); 41 | } 42 | } 43 | 44 | if (hasDontEnumBug) { 45 | for (i = 0; i < dontEnumsLength; i++) { 46 | if (hasOwnProperty.call(obj, dontEnums[i])) { 47 | result.push(dontEnums[i]); 48 | } 49 | } 50 | } 51 | 52 | return result; 53 | }; 54 | }()); 55 | } 56 | }()); 57 | 58 | (function (O) { 59 | if ('assign' in O) { 60 | return; 61 | } 62 | 63 | O.defineProperty(O, 'assign', { 64 | configurable: true, 65 | writable: true, 66 | value: (function() { 67 | var gOPS = O.getOwnPropertySymbols, 68 | // shortcut without explicitly passing through prototype 69 | pIE = O.propertyIsEnumerable, 70 | filterOS = gOPS ? 71 | function (self) { 72 | return gOPS(self).filter(pIE, self); 73 | } : function () { 74 | // just empty Array won't do much within a .concat(...) 75 | return Array.prototype; 76 | }; 77 | 78 | return function assign(where) { 79 | // Object.create(null) and null objects in general 80 | // might not be fully compatible with Symbols libraries 81 | // it is important to know this, in case you assign Symbols 82 | // to null object ... but it should NOT be a show-stopper 83 | // if you know what you are doing ... so .... 84 | if (gOPS && !(where instanceof O)) { 85 | console.warn('problematic Symbols', where); 86 | // ... now this script does its business !!! 87 | } 88 | // avoid JSHint "don't make function in loop" 89 | function set(keyOrSymbol) { 90 | where[keyOrSymbol] = arg[keyOrSymbol]; 91 | } 92 | // the loop 93 | for (var i = 1, ii = arguments.length; i < ii; ++i) { 94 | var arg = arguments[i]; 95 | 96 | if (arg === null || arg === undefined) { 97 | continue; 98 | } 99 | 100 | O.keys(arg).concat(filterOS(arg)).forEach(set); 101 | } 102 | 103 | return where; 104 | }; 105 | }()) 106 | }); 107 | }(Object)); 108 | 109 | /** 110 | * Object.is() polyfill 111 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 112 | */ 113 | if (!Object.is) { 114 | Object.is = function(x, y) { 115 | // SameValue algorithm 116 | if (x === y) { // Steps 1-5, 7-10 117 | // Steps 6.b-6.e: +0 != -0 118 | return x !== 0 || 1 / x === 1 / y; 119 | } else { 120 | // Step 6.a: NaN == NaN 121 | return x !== x && y !== y; 122 | } 123 | }; 124 | } 125 | 126 | } // endif FEATURE_NO_ES2015 127 | -------------------------------------------------------------------------------- /src/reflect.js: -------------------------------------------------------------------------------- 1 | import {PLATFORM} from 'aurelia-pal'; 2 | 3 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 4 | 5 | const bind = Function.prototype.bind; 6 | 7 | if (typeof PLATFORM.global.Reflect === 'undefined') { 8 | PLATFORM.global.Reflect = {}; 9 | } 10 | 11 | if (typeof Reflect.defineProperty !== 'function') { 12 | Reflect.defineProperty = function(target, propertyKey, descriptor) { 13 | if (typeof target === 'object' ? target === null : typeof target !== 'function') { 14 | throw new TypeError('Reflect.defineProperty called on non-object'); 15 | } 16 | try { 17 | Object.defineProperty(target, propertyKey, descriptor); 18 | return true; 19 | } catch (e) { 20 | return false; 21 | } 22 | }; 23 | } 24 | 25 | if (typeof Reflect.construct !== 'function') { 26 | Reflect.construct = function(Target, args) { 27 | if (args) { 28 | switch (args.length){ 29 | case 0: return new Target(); 30 | case 1: return new Target(args[0]); 31 | case 2: return new Target(args[0], args[1]); 32 | case 3: return new Target(args[0], args[1], args[2]); 33 | case 4: return new Target(args[0], args[1], args[2], args[3]); 34 | } 35 | } 36 | 37 | var a = [null]; 38 | a.push.apply(a, args); 39 | return new (bind.apply(Target, a)); 40 | }; 41 | } 42 | 43 | if (typeof Reflect.ownKeys !== 'function') { 44 | Reflect.ownKeys = function(o) { return (Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))); } 45 | } 46 | 47 | } // endif FEATURE_NO_ES2015 48 | 49 | if (typeof FEATURE_NO_ESNEXT === 'undefined') { 50 | 51 | const emptyMetadata = Object.freeze({}); 52 | const metadataContainerKey = '__metadata__'; 53 | 54 | if (typeof Reflect.getOwnMetadata !== 'function') { 55 | Reflect.getOwnMetadata = function(metadataKey, target, targetKey) { 56 | if (target.hasOwnProperty(metadataContainerKey)) { 57 | return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey]; 58 | } 59 | }; 60 | } 61 | 62 | if (typeof Reflect.defineMetadata !== 'function') { 63 | Reflect.defineMetadata = function(metadataKey, metadataValue, target, targetKey) { 64 | let metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : (target[metadataContainerKey] = {}); 65 | let targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); 66 | targetContainer[metadataKey] = metadataValue; 67 | }; 68 | } 69 | 70 | if (typeof Reflect.metadata !== 'function') { 71 | Reflect.metadata = function(metadataKey, metadataValue) { 72 | return function(target, targetKey) { 73 | Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); 74 | }; 75 | }; 76 | } 77 | 78 | } // endif FEATURE_NO_ESNEXT 79 | -------------------------------------------------------------------------------- /src/string.js: -------------------------------------------------------------------------------- 1 | if ((!String.prototype.endsWith) || ((function() { try { return !("ab".endsWith("a",1)); } catch (e) { return true; } } )())) { 2 | String.prototype.endsWith = function(searchString, position) { 3 | let subjectString = this.toString(); 4 | if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 5 | position = subjectString.length; 6 | } 7 | position -= searchString.length; 8 | let lastIndex = subjectString.indexOf(searchString, position); 9 | return lastIndex !== -1 && lastIndex === position; 10 | }; 11 | } 12 | 13 | if ((!String.prototype.startsWith) || ((function() { try { return !("ab".startsWith("b", 1)); } catch (e) { return true; } } )())) { 14 | String.prototype.startsWith = function(searchString, position){ 15 | position = position || 0; 16 | return this.substr(position, searchString.length) === searchString; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/symbol.js: -------------------------------------------------------------------------------- 1 | import {PLATFORM} from 'aurelia-pal'; 2 | 3 | if (typeof FEATURE_NO_ES2015 === 'undefined') { 4 | 5 | (function (Object, GOPS) {'use strict'; 6 | 7 | // (C) Andrea Giammarchi - Mit Style 8 | 9 | if (GOPS in Object) return; 10 | 11 | var 12 | setDescriptor, 13 | G = PLATFORM.global, 14 | id = 0, 15 | random = '' + Math.random(), 16 | prefix = '__\x01symbol:', 17 | prefixLength = prefix.length, 18 | internalSymbol = '__\x01symbol@@' + random, 19 | DP = 'defineProperty', 20 | DPies = 'defineProperties', 21 | GOPN = 'getOwnPropertyNames', 22 | GOPD = 'getOwnPropertyDescriptor', 23 | PIE = 'propertyIsEnumerable', 24 | gOPN = Object[GOPN], 25 | gOPD = Object[GOPD], 26 | create = Object.create, 27 | keys = Object.keys, 28 | defineProperty = Object[DP], 29 | $defineProperties = Object[DPies], 30 | descriptor = gOPD(Object, GOPN), 31 | ObjectProto = Object.prototype, 32 | hOP = ObjectProto.hasOwnProperty, 33 | pIE = ObjectProto[PIE], 34 | toString = ObjectProto.toString, 35 | indexOf = Array.prototype.indexOf || function (v) { 36 | for (var i = this.length; i-- && this[i] !== v;) {} 37 | return i; 38 | }, 39 | addInternalIfNeeded = function (o, uid, enumerable) { 40 | if (!hOP.call(o, internalSymbol)) { 41 | defineProperty(o, internalSymbol, { 42 | enumerable: false, 43 | configurable: false, 44 | writable: false, 45 | value: {} 46 | }); 47 | } 48 | o[internalSymbol]['@@' + uid] = enumerable; 49 | }, 50 | createWithSymbols = function (proto, descriptors) { 51 | var self = create(proto); 52 | if (descriptors !== null && typeof descriptors === 'object') { 53 | gOPN(descriptors).forEach(function (key) { 54 | if (propertyIsEnumerable.call(descriptors, key)) { 55 | $defineProperty(self, key, descriptors[key]); 56 | } 57 | }); 58 | } 59 | return self; 60 | }, 61 | copyAsNonEnumerable = function (descriptor) { 62 | var newDescriptor = create(descriptor); 63 | newDescriptor.enumerable = false; 64 | return newDescriptor; 65 | }, 66 | get = function get(){}, 67 | onlyNonSymbols = function (name) { 68 | return name != internalSymbol && 69 | !hOP.call(source, name); 70 | }, 71 | onlySymbols = function (name) { 72 | return name != internalSymbol && 73 | hOP.call(source, name); 74 | }, 75 | propertyIsEnumerable = function propertyIsEnumerable(key) { 76 | var uid = '' + key; 77 | return onlySymbols(uid) ? ( 78 | hOP.call(this, uid) && 79 | this[internalSymbol] && 80 | this[internalSymbol]['@@' + uid] 81 | ) : pIE.call(this, key); 82 | }, 83 | setAndGetSymbol = function (uid) { 84 | var descriptor = { 85 | enumerable: false, 86 | configurable: true, 87 | get: get, 88 | set: function (value) { 89 | setDescriptor(this, uid, { 90 | enumerable: false, 91 | configurable: true, 92 | writable: true, 93 | value: value 94 | }); 95 | addInternalIfNeeded(this, uid, true); 96 | } 97 | }; 98 | defineProperty(ObjectProto, uid, descriptor); 99 | return (source[uid] = defineProperty( 100 | Object(uid), 101 | 'constructor', 102 | sourceConstructor 103 | )); 104 | }, 105 | Symbol = function Symbol(description) { 106 | if (this && this !== G) { 107 | throw new TypeError('Symbol is not a constructor'); 108 | } 109 | return setAndGetSymbol( 110 | prefix.concat(description || '', random, ++id) 111 | ); 112 | }, 113 | source = create(null), 114 | sourceConstructor = {value: Symbol}, 115 | sourceMap = function (uid) { 116 | return source[uid]; 117 | }, 118 | $defineProperty = function defineProp(o, key, descriptor) { 119 | var uid = '' + key; 120 | if (onlySymbols(uid)) { 121 | setDescriptor(o, uid, descriptor.enumerable ? 122 | copyAsNonEnumerable(descriptor) : descriptor); 123 | addInternalIfNeeded(o, uid, !!descriptor.enumerable); 124 | } else { 125 | defineProperty(o, key, descriptor); 126 | } 127 | return o; 128 | }, 129 | $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 130 | var cof = toString.call(o); 131 | o = (cof === '[object String]') ? o.split('') : Object(o); 132 | return gOPN(o).filter(onlySymbols).map(sourceMap); 133 | } 134 | ; 135 | 136 | descriptor.value = $defineProperty; 137 | defineProperty(Object, DP, descriptor); 138 | 139 | descriptor.value = $getOwnPropertySymbols; 140 | defineProperty(Object, GOPS, descriptor); 141 | 142 | var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : []; 143 | var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames; 144 | descriptor.value = function getOwnPropertyNames(o) { 145 | if (toString.call(o) === '[object Window]') { 146 | try { 147 | return originalObjectGetOwnPropertyNames(o); 148 | } catch (e) { 149 | // IE bug where layout engine calls userland gOPN for cross-domain "window" objects  150 | return [].concat([], cachedWindowNames); 151 | } 152 | } 153 | return gOPN(o).filter(onlyNonSymbols); 154 | }; 155 | defineProperty(Object, GOPN, descriptor); 156 | 157 | descriptor.value = function defineProperties(o, descriptors) { 158 | var symbols = $getOwnPropertySymbols(descriptors); 159 | if (symbols.length) { 160 | keys(descriptors).concat(symbols).forEach(function (uid) { 161 | if (propertyIsEnumerable.call(descriptors, uid)) { 162 | $defineProperty(o, uid, descriptors[uid]); 163 | } 164 | }); 165 | } else { 166 | $defineProperties(o, descriptors); 167 | } 168 | return o; 169 | }; 170 | defineProperty(Object, DPies, descriptor); 171 | 172 | descriptor.value = propertyIsEnumerable; 173 | defineProperty(ObjectProto, PIE, descriptor); 174 | 175 | descriptor.value = Symbol; 176 | defineProperty(G, 'Symbol', descriptor); 177 | 178 | // defining `Symbol.for(key)` 179 | descriptor.value = function (key) { 180 | var uid = prefix.concat(prefix, key, random); 181 | return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 182 | }; 183 | defineProperty(Symbol, 'for', descriptor); 184 | 185 | // defining `Symbol.keyFor(symbol)` 186 | descriptor.value = function (symbol) { 187 | return hOP.call(source, symbol) ? 188 | symbol.slice(prefixLength * 2, -random.length) : 189 | void 0 190 | ; 191 | }; 192 | defineProperty(Symbol, 'keyFor', descriptor); 193 | 194 | descriptor.value = function getOwnPropertyDescriptor(o, key) { 195 | var descriptor = gOPD(o, key); 196 | if (descriptor && onlySymbols(key)) { 197 | descriptor.enumerable = propertyIsEnumerable.call(o, key); 198 | } 199 | return descriptor; 200 | }; 201 | defineProperty(Object, GOPD, descriptor); 202 | 203 | descriptor.value = function (proto, descriptors) { 204 | return arguments.length === 1 ? 205 | create(proto) : 206 | createWithSymbols(proto, descriptors); 207 | }; 208 | defineProperty(Object, 'create', descriptor); 209 | 210 | descriptor.value = function () { 211 | var str = toString.call(this); 212 | return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str; 213 | }; 214 | defineProperty(ObjectProto, 'toString', descriptor); 215 | 216 | try { // fails in few pre ES 5.1 engines 217 | setDescriptor = create( 218 | defineProperty( 219 | {}, 220 | prefix, 221 | { 222 | get: function () { 223 | return defineProperty(this, prefix, {value: false})[prefix]; 224 | } 225 | } 226 | ) 227 | )[prefix] || defineProperty; 228 | } catch(o_O) { 229 | setDescriptor = function (o, key, descriptor) { 230 | var protoDescriptor = gOPD(ObjectProto, key); 231 | delete ObjectProto[key]; 232 | defineProperty(o, key, descriptor); 233 | defineProperty(ObjectProto, key, protoDescriptor); 234 | }; 235 | } 236 | 237 | }(Object, 'getOwnPropertySymbols')); 238 | 239 | (function (O, S) { 240 | var 241 | dP = O.defineProperty, 242 | ObjectProto = O.prototype, 243 | toString = ObjectProto.toString, 244 | toStringTag = 'toStringTag', 245 | descriptor 246 | ; 247 | [ 248 | 'iterator', // A method returning the default iterator for an object. Used by for...of. 249 | 'match', // A method that matches against a string, also used to determine if an object may be used as a regular expression. Used by String.prototype.match(). 250 | 'replace', // A method that replaces matched substrings of a string. Used by String.prototype.replace(). 251 | 'search', // A method that returns the index within a string that matches the regular expression. Used by String.prototype.search(). 252 | 'split', // A method that splits a string at the indices that match a regular expression. Used by String.prototype.split(). 253 | 'hasInstance', // A method determining if a constructor object recognizes an object as its instance. Used by instanceof. 254 | 'isConcatSpreadable', // A Boolean value indicating if an object should be flattened to its array elements. Used by Array.prototype.concat(). 255 | 'unscopables', // An Array of string values that are property values. These are excluded from the with environment bindings of the associated objects. 256 | 'species', // A constructor function that is used to create derived objects. 257 | 'toPrimitive', // A method converting an object to a primitive value. 258 | toStringTag // A string value used for the default description of an object. Used by Object.prototype.toString(). 259 | ].forEach(function (name) { 260 | if (!(name in Symbol)) { 261 | dP(Symbol, name, {value: Symbol(name)}); 262 | switch (name) { 263 | case toStringTag: 264 | descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString'); 265 | descriptor.value = function () { 266 | var 267 | str = toString.call(this), 268 | tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag] 269 | ; 270 | return typeof tst === 'undefined' ? str : ('[object ' + tst + ']'); 271 | }; 272 | dP(ObjectProto, 'toString', descriptor); 273 | break; 274 | } 275 | } 276 | }); 277 | }(Object, Symbol)); 278 | 279 | (function (Si, AP, SP) { 280 | 281 | function returnThis() { return this; } 282 | 283 | // make Arrays usable as iterators 284 | // so that other iterables can copy same logic 285 | if (!AP[Si]) AP[Si] = function () { 286 | var 287 | i = 0, 288 | self = this, 289 | iterator = { 290 | next: function next() { 291 | var done = self.length <= i; 292 | return done ? 293 | {done: done} : 294 | {done: done, value: self[i++]}; 295 | } 296 | } 297 | ; 298 | iterator[Si] = returnThis; 299 | return iterator; 300 | }; 301 | 302 | // make Strings usable as iterators 303 | // to simplify Array.from and 304 | if (!SP[Si]) SP[Si] = function () { 305 | var 306 | fromCodePoint = String.fromCodePoint, 307 | self = this, 308 | i = 0, 309 | length = self.length, 310 | iterator = { 311 | next: function next() { 312 | var 313 | done = length <= i, 314 | c = done ? '' : fromCodePoint(self.codePointAt(i)) 315 | ; 316 | i += c.length; 317 | return done ? 318 | {done: done} : 319 | {done: done, value: c}; 320 | } 321 | } 322 | ; 323 | iterator[Si] = returnThis; 324 | return iterator; 325 | }; 326 | 327 | }(Symbol.iterator, Array.prototype, String.prototype)); 328 | 329 | 330 | } // endif FEATURE_NO_ES2015 331 | -------------------------------------------------------------------------------- /test/polyfill.spec.js: -------------------------------------------------------------------------------- 1 | describe('polyfills', () => { 2 | it('should exist', () => { 3 | expect(true).toBe(true); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "es2015", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": false, 7 | "moduleResolution": "node", 8 | "stripInternal": true, 9 | "preserveConstEnums": true, 10 | "listFiles": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "lib": ["es2015", "dom"] 14 | }, 15 | "exclude": [ 16 | "node_modules", 17 | "dist", 18 | "build", 19 | "doc", 20 | "test", 21 | "config.js", 22 | "gulpfile.js", 23 | "karma.conf.js" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-polyfills", 3 | "main": "dist/aurelia-polyfills.d.ts" 4 | } 5 | --------------------------------------------------------------------------------