Skip to content

Commit f771f4e

Browse files
authored
Try fixup take 2
1 parent 9332194 commit f771f4e

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/layouts/Default.astro

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ const languageEntries = Object.entries(languages);
109109
}
110110

111111
function extractCommon(p, c, reverse) {
112-
s = 0;
113-
w = 0;
114-
i = reverse ? p.length - 1 : 0;
115-
j = reverse ? c.length - 1 : 0;
116-
pEnd = reverse ? 0 : p.length;
117-
cEnd = reverse ? 0 : c.length;
112+
let s = 0;
113+
let w = 0;
114+
let i = reverse ? p.length - 1 : 0;
115+
let j = reverse ? c.length - 1 : 0;
116+
const pEnd = reverse ? 0 : p.length;
117+
const cEnd = reverse ? 0 : c.length;
118+
let chr;
118119
while ((reverse ? i >= pEnd : i < pEnd) && (reverse ? j >= cEnd : j < cEnd) && (chr = p[reverse ? i-- : i++]) === c[reverse ? j-- : j++]) {
119120
w = chr === ' ' ? w + 1 : 0;
120121
s++;
@@ -128,7 +129,7 @@ const languageEntries = Object.entries(languages);
128129
if (!p.length) return;
129130
const c = formatter.formatToParts(-value, unit);
130131

131-
offset = getOffset(unit);
132+
const offset = getOffset(unit);
132133
if (p[0].type === 'literal') {
133134
if (!c.length || c[0].type !== 'literal') {
134135
prefix[offset] = p[0].value.length;
@@ -156,10 +157,10 @@ const languageEntries = Object.entries(languages);
156157
* @param {string} unit - The unit ('day', 'hour', 'minute', 'second')
157158
*/
158159
function getLocalizedUnit(value, unit, trimConjunction, trimSuffix) {
159-
offset = getOffset(unit);
160-
string = formatter.format(value, unit);
161-
p = prefix[offset];
162-
s = suffix[offset];
160+
const offset = getOffset(unit);
161+
const string = formatter.format(value, unit);
162+
const p = prefix[offset];
163+
const s = suffix[offset];
163164
return string.slice(trimConjunction && p || p == 1 && string[0] === '+' ? prefix[offset] : 0, trimSuffix && s ? -suffix[offset] : string.length);
164165
}
165166

0 commit comments

Comments
 (0)