diff --git a/.babelrc b/.babelrc index eb6c7cd..1fdd15c 100644 --- a/.babelrc +++ b/.babelrc @@ -3,19 +3,11 @@ [ "@babel/preset-env", { - "useBuiltIns": "entry", + "useBuiltIns": "usage", "corejs": "3.0.0", - "targets": { - "ie": "8" - }, + "targets": "> 0.25%, not dead, ie 8", "spec": true } ] - ], - "plugins": ["@babel/plugin-external-helpers"], - "env": { - "production": { - "plugins": ["@babel/plugin-external-helpers"] - } - } + ] } diff --git a/lib/index.js b/lib/index.js index 678f463..73a985f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MtUtils=e()}(this,function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(e){var n=t(e);return null!=e&&"object"===n}var n,o,r,l=(n=document.createElement("div"),o="Khtml O Moz Ms Webkit".split(" "),r=o.length,function(t,e){if(t in n.style)return!e||(n.style[t]=e,n.style[t]===e);var l=r;for(t=t.replace(/^[a-z]/,function(t){return t.toUpperCase()});l--;){var i=o[l];if(i+t in n.style)return!e||(n.style[i+t]=e,n.style[i+t]===e)}return!1}),i=["auto","scroll"];function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical",n=window.getComputedStyle(t);return"vertical"===e?i.includes(n.overflowY):"horizontal"===e?i.includes(n.overflowX):void 0}return{obj2qs:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e(t))return"";var l=Object.keys(t).map(function(o){!function(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}(this,n);var l=t[o];return e(l)&&(l=JSON.stringify(l)),"".concat(o,"=").concat(r?encodeURIComponent(l):l)}.bind(this)).join("&");return o?"?".concat(l):l},isObject:e,cssSupports:l,isScrollElement:c,getScrollElementOfFirstChild:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical";if(!t||!t.childNodes)return null;for(var n=[].slice.apply(t.childNodes);n.length;){var o=n.shift();if(1===o.nodeType)return c(o,e)?o:(o.childNodes.length&&(n=n.concat([].slice.apply(o.childNodes))),null)}},getScrollElementOfFirstParent:function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical";return e&&e.parentElement?c(e.parentElement,n)?e.parentElement:t(e.parentElement,n):(console.log(e,e.parentElement),null)}}}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MtUtils=e()}(this,function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(e){var n=t(e);return null!=e&&"object"===n}var n,o,r,l=(n=document.createElement("div"),o="Khtml O Moz Ms Webkit".split(" "),r=o.length,function(t,e){if(t in n.style)return!e||(n.style[t]=e,n.style[t]===e);var l=r;for(t=t.replace(/^[a-z]/,function(t){return t.toUpperCase()});l--;){var i=o[l];if(i+t in n.style)return!e||(n.style[i+t]=e,n.style[i+t]===e)}return!1}),i=["auto","scroll"];function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical",n=window.getComputedStyle(t);return"vertical"===e?i.includes(n.overflowY):"horizontal"===e?i.includes(n.overflowX):void 0}return{obj2qs:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e(t))return"";var l=Object.keys(t).map(function(o){!function(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}(this,n);var l=t[o];return e(l)&&(l=JSON.stringify(l)),"".concat(o,"=").concat(r?encodeURIComponent(l):l)}.bind(this)).join("&");return o?"?".concat(l):l},isObject:e,cssSupports:l,isScrollElement:c,getScrollElementOfFirstChild:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical";if(!t||!t.childNodes)return null;for(var n=[].slice.apply(t.childNodes);n.length;){var o=n.shift();if(1===o.nodeType)return c(o,e)?o:(o.childNodes.length&&(n=n.concat([].slice.apply(o.childNodes))),null)}},getScrollElementOfFirstParent:function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vertical";return e&&e.parentElement?c(e.parentElement,n)?e.parentElement:t(e.parentElement,n):(console.log(e,e.parentElement),null)}}}); \ No newline at end of file diff --git a/package.json b/package.json index 9a971ee..37add38 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "git remote add origin https://github.com/txs1992/mt-utils.git", "main": "lib/index.js", "scripts": { - "build": "npm run lint && rollup -c", + "build": "yarn lint && rollup -c", "lint": "eslint --ext .js src", "format": "prettier --config ./.prettierrc.yml --write '**/*.{js,bue,css,scss}'", "precommit": "pretty-quick --staged" @@ -24,7 +24,6 @@ "homepage": "https://github.com/txs1992/mt-utils#readme", "dependencies": { "@babel/core": "^7.4.3", - "@babel/plugin-external-helpers": "^7.0.0", "@babel/preset-env": "^7.0.0", "core-js": "2", "eslint": "^5.16.0", diff --git a/yarn.lock b/yarn.lock index 285a0fb..d0ff698 100644 --- a/yarn.lock +++ b/yarn.lock @@ -218,13 +218,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.3.tgz#eb3ac80f64aa101c907d4ce5406360fe75b7895b" integrity sha512-gxpEUhTS1sGA63EGQGuA+WESPR/6tz6ng7tSHFCmaTJK/cGK8y37cBTspX+U2xCAue2IQVvF6Z0oigmjwD8YGQ== -"@babel/plugin-external-helpers@^7.0.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.2.0.tgz#7f4cb7dee651cd380d2034847d914288467a6be4" - integrity sha512-QFmtcCShFkyAsNtdCM3lJPmRe1iB+vPZymlB4LnDIKEBj2yKQLQKtoxXxJ8ePT5fwMl4QGg303p4mB0UsSI2/g== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e"