@d-mok/quasar-app-extension-quasar-axe 1.0.77 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-mok/quasar-app-extension-quasar-axe",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -63,6 +63,10 @@ function extractObj<T extends object>(
63
63
  return obj
64
64
  }
65
65
 
66
+ function maxStringLength(strings: string[]): number {
67
+ return Math.max(0, ...strings.map($ => $.length))
68
+ }
69
+
66
70
  class QDialog {
67
71
  /**
68
72
  * The basic dialog. If cancel, throw error.
@@ -112,15 +116,12 @@ class QDialog {
112
116
  options: QDialogOptions,
113
117
  sample: object[]
114
118
  ): Promise<string> {
115
- let words = unparseCSV(sample)
116
- .split('\n')
117
- .flatMap(l => l.split('\t'))
118
- let maxWordLength = Math.max(0, ...words.map($ => $.length))
119
-
120
- let lines = unparseCSV(sample)
121
- .split('\n')
122
- .map($ => $.replace('\t', ' '.repeat(maxWordLength + 2)))
123
- let maxLineLength = Math.max(0, ...lines.map($ => $.length))
119
+ let lines = unparseCSV(sample).split('\n')
120
+ let words = lines.flatMap(l => l.split('\t'))
121
+ let maxWordLength = maxStringLength(words)
122
+ let maxLineLength = maxStringLength(
123
+ lines.map($ => $.replace('\t', ' '.repeat(maxWordLength + 2)))
124
+ )
124
125
 
125
126
  let { prompt, ...rest } = options
126
127
  let csv = await this.baseDialog({