Skip to content

Commit

Permalink
Fixed webpack 4 builds breaking due to nullish coalescing operator (#…
Browse files Browse the repository at this point in the history
…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 <martin.schoen@spiegel.de>
  • Loading branch information
mgschoen and mgschoen authored Sep 11, 2023
1 parent e1a6bf0 commit ba08ec4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/alpinejs/src/directives/x-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function getInputValue(el, modifiers, event, currentValue) {
// Safari autofill triggers event as CustomEvent and assigns value to target
// so we return event.target.value instead of event.detail
if (event instanceof CustomEvent && event.detail !== undefined)
return event.detail ?? event.target.value
return event.detail !== null && event.detail !== undefined ? event.detail : event.target.value
else if (el.type === 'checkbox') {
// If the data we are binding to is an array, toggle its value inside the array.
if (Array.isArray(currentValue)) {
Expand Down
4 changes: 3 additions & 1 deletion packages/mask/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ export function formatMoney(input, delimiter = '.', thousands, precision = 2) {
if (input === '-') return '-'
if (/^\D+$/.test(input)) return '9'

thousands = thousands ?? (delimiter === "," ? "." : ",")
if (thousands === null || thousands === undefined) {
thousands = delimiter === "," ? "." : ","
}

let addThousands = (input, thousands) => {
let output = ''
Expand Down

0 comments on commit ba08ec4

Please sign in to comment.