Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5cc53a0

Browse files
Use template literals instead of concatenation (#33497)
1 parent 8c3e6eb commit 5cc53a0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

js/src/modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class Modal extends BaseComponent {
474474
const actualValue = element.style[styleProp]
475475
const calculatedValue = window.getComputedStyle(element)[styleProp]
476476
Manipulator.setDataAttribute(element, styleProp, actualValue)
477-
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'
477+
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`
478478
})
479479
}
480480

js/src/util/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const getSelector = element => {
4848

4949
// Just in case some CMS puts out a full URL with the anchor appended
5050
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
51-
hrefAttr = '#' + hrefAttr.split('#')[1]
51+
hrefAttr = `#${hrefAttr.split('#')[1]}`
5252
}
5353

5454
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null
@@ -128,9 +128,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
128128

129129
if (!new RegExp(expectedTypes).test(valueType)) {
130130
throw new TypeError(
131-
`${componentName.toUpperCase()}: ` +
132-
`Option "${property}" provided type "${valueType}" ` +
133-
`but expected type "${expectedTypes}".`
131+
`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
134132
)
135133
}
136134
})

js/src/util/scrollbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const _setElementAttributes = (selector, styleProp, callback) => {
3535
const actualValue = element.style[styleProp]
3636
const calculatedValue = window.getComputedStyle(element)[styleProp]
3737
Manipulator.setDataAttribute(element, styleProp, actualValue)
38-
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'
38+
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`
3939
})
4040
}
4141

0 commit comments

Comments
 (0)