aboutsummaryrefslogtreecommitdiff
path: root/js/src/util.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-11-25 14:59:28 -0800
committerMark Otto <[email protected]>2016-11-25 14:59:28 -0800
commit432fe74c3182f3be258320fec31b0a8c5d70848d (patch)
treecfff52601575c2bc32e50ee5875ffe6f6f0f1b98 /js/src/util.js
parentb1b1f30cbd0f4f620047dc158cf91e328eeecc6b (diff)
parentc2616fb74e6bdc0cd46a5678a2c5cffcbe422106 (diff)
downloadbootstrap-432fe74c3182f3be258320fec31b0a8c5d70848d.tar.xz
bootstrap-432fe74c3182f3be258320fec31b0a8c5d70848d.zip
Merge branch 'eslint' of https://github.com/bardiharborow/bootstrap into bardiharborow-eslint
Diffstat (limited to 'js/src/util.js')
-rw-r--r--js/src/util.js30
1 files changed, 13 insertions, 17 deletions
diff --git a/js/src/util.js b/js/src/util.js
index 5ddbbbf13..06424fbfe 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -27,7 +27,7 @@ const Util = (($) => {
// shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
- return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
+ return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
function isElement(obj) {
@@ -52,11 +52,13 @@ const Util = (($) => {
return false
}
- let el = document.createElement('bootstrap')
+ const el = document.createElement('bootstrap')
- for (let name in TransitionEndEvent) {
+ for (const name in TransitionEndEvent) {
if (el.style[name] !== undefined) {
- return { end: TransitionEndEvent[name] }
+ return {
+ end: TransitionEndEvent[name]
+ }
}
}
@@ -96,15 +98,14 @@ const Util = (($) => {
* --------------------------------------------------------------------------
*/
- let Util = {
+ const Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID(prefix) {
do {
- /* eslint-disable no-bitwise */
+ // eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
- /* eslint-enable no-bitwise */
} while (document.getElementById(prefix))
return prefix
},
@@ -133,17 +134,12 @@ const Util = (($) => {
},
typeCheckConfig(componentName, config, configTypes) {
- for (let property in configTypes) {
+ for (const property in configTypes) {
if (configTypes.hasOwnProperty(property)) {
- let expectedTypes = configTypes[property]
- let value = config[property]
- let valueType
-
- if (value && isElement(value)) {
- valueType = 'element'
- } else {
- valueType = toType(value)
- }
+ const expectedTypes = configTypes[property]
+ const value = config[property]
+ const valueType = value && isElement(value) ?
+ 'element' : toType(value)
if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error(