From 99bf7a4c53ebf29373ded95bd99fadfc139c758c Mon Sep 17 00:00:00 2001 From: juspears Date: Sun, 3 Apr 2016 19:14:53 -0700 Subject: [PATCH] Made es2015-loose for IE support --- .babelrc | 5 ++--- package.json | 1 + src/util.js | 32 ++++++++++++++++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.babelrc b/.babelrc index d036173..ba00742 100755 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,7 @@ { "presets": [ "react", - "es2015", + "es2015-loose", "stage-0" - ], - "plugins":[] + ] } diff --git a/package.json b/package.json index 20c473d..f447cd1 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-runtime": "^6.4.3", "babel-preset-es2015": "^6.3.13", + "babel-preset-es2015-loose": "^7.0.0", "babel-preset-react": "^6.3.13", "babel-preset-stage-0": "^6.3.13", "expect": "^1.13.4", diff --git a/src/util.js b/src/util.js index f88fe38..b971b24 100644 --- a/src/util.js +++ b/src/util.js @@ -31,14 +31,19 @@ function keyIn(key, ...args) { } function onlyKeys(keys, ...args) { const ret = {}; - KEYS: for (let key of keys) { - ARGS: for (let arg of args) { - if (arg == null) continue ARGS; + let break_key = false; + for (let key of keys) { + for (let arg of args) { + if (arg == null) continue; if (key in arg) { ret[key] = arg[key]; - continue KEYS; + break_key = true; + break; } } + if (break_key) { + break; + } } return ret; @@ -66,7 +71,7 @@ function didMount() { function listener(key, fn) { function listener$listen(props, context) { - if (!this.injected){ + if (!this.injected) { this.injected = {}; } if (!this._listeners) { @@ -128,4 +133,19 @@ function unmount(fn) { this.prototype.componentWillUnmount = applyNice(fn, this.prototype.componentWillUnmount); } -export {applyNice,listener, extend, prop, unmount, extendStatic, extendPrototype, onlyKeys, keyIn, uniqueKeys, execArg, push, removeListeners, clearListeners} \ No newline at end of file +export { + applyNice, + listener, + extend, + prop, + unmount, + extendStatic, + extendPrototype, + onlyKeys, + keyIn, + uniqueKeys, + execArg, + push, + removeListeners, + clearListeners +} \ No newline at end of file