Skip to content

Commit ba08ec4

Browse files
authored
Fixed webpack 4 builds breaking due to nullish coalescing operator (#3679)
* Fixed webpack 4 builds breaking due to nullish coalescing operator * Replaced another usage of nullish coalescing with explicit typechecks in order to fix webpack 4 builds --------- Co-authored-by: Martin Schön <[email protected]>
1 parent e1a6bf0 commit ba08ec4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/alpinejs/src/directives/x-model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function getInputValue(el, modifiers, event, currentValue) {
134134
// Safari autofill triggers event as CustomEvent and assigns value to target
135135
// so we return event.target.value instead of event.detail
136136
if (event instanceof CustomEvent && event.detail !== undefined)
137-
return event.detail ?? event.target.value
137+
return event.detail !== null && event.detail !== undefined ? event.detail : event.target.value
138138
else if (el.type === 'checkbox') {
139139
// If the data we are binding to is an array, toggle its value inside the array.
140140
if (Array.isArray(currentValue)) {

packages/mask/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ export function formatMoney(input, delimiter = '.', thousands, precision = 2) {
174174
if (input === '-') return '-'
175175
if (/^\D+$/.test(input)) return '9'
176176

177-
thousands = thousands ?? (delimiter === "," ? "." : ",")
177+
if (thousands === null || thousands === undefined) {
178+
thousands = delimiter === "," ? "." : ","
179+
}
178180

179181
let addThousands = (input, thousands) => {
180182
let output = ''

0 commit comments

Comments
 (0)