Skip to content

Commit 6319825

Browse files
committed
Formatted code
1 parent a306044 commit 6319825

File tree

6 files changed

+70
-66
lines changed

6 files changed

+70
-66
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ map.once("styledata", (event) => {
3737
map.setLayoutProperty(
3838
"country-labels",
3939
"text-field",
40-
maplibregl.Diplomat.localizedName
40+
maplibregl.Diplomat.localizedName,
4141
);
4242
map.setLayoutProperty(
4343
"city-labels",
4444
"text-field",
45-
maplibregl.Diplomat.localizedNameWithGloss
45+
maplibregl.Diplomat.localizedNameWithGloss,
4646
);
4747
map.setLayoutProperty(
4848
"road-labels",
4949
"text-field",
50-
maplibregl.Diplomat.localizedNameInline
50+
maplibregl.Diplomat.localizedNameInline,
5151
);
5252

5353
// Localize the layers.
@@ -63,10 +63,10 @@ If you set the `hash` option to a string when creating the `Map`, you can have t
6363
```js
6464
addEventListener("hashchange", (event) => {
6565
let oldLanguage = maplibregl.Diplomat.getLanguageFromURL(
66-
new URL(event.oldURL)
66+
new URL(event.oldURL),
6767
);
6868
let newLanguage = maplibregl.Diplomat.getLanguageFromURL(
69-
new URL(event.newURL)
69+
new URL(event.newURL),
7070
);
7171

7272
if (oldLanguage !== newLanguage) {
@@ -108,7 +108,7 @@ Example:
108108
map.setLayoutProperty(
109109
"country-labels",
110110
"text-field",
111-
maplibregl.Diplomat.localizedName
111+
maplibregl.Diplomat.localizedName,
112112
);
113113
```
114114

@@ -124,7 +124,7 @@ Example:
124124
map.setLayoutProperty(
125125
"road-labels",
126126
"text-field",
127-
maplibregl.Diplomat.localizedNameInline
127+
maplibregl.Diplomat.localizedNameInline,
128128
);
129129
```
130130

@@ -140,7 +140,7 @@ Example:
140140
map.setLayoutProperty(
141141
"city-labels",
142142
"text-field",
143-
maplibregl.Diplomat.localizedNameWithGloss
143+
maplibregl.Diplomat.localizedNameWithGloss,
144144
);
145145
```
146146

@@ -160,7 +160,7 @@ Example:
160160
map.setLayoutProperty(
161161
"boundary-edge-labels",
162162
"text-field",
163-
getCountryName(["get", "adm0_l"])
163+
getCountryName(["get", "adm0_l"]),
164164
);
165165
```
166166

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="utf-8" />

example/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ addEventListener("load", () => {
4242

4343
maplibregl.setRTLTextPlugin(
4444
"https://unpkg.com/@mapbox/[email protected]/mapbox-gl-rtl-text.min.js",
45-
true
45+
true,
4646
);
4747

4848
map.once("styledata", (event) => {
4949
map.setLayoutProperty(
5050
"place-labels",
5151
"text-field",
52-
maplibregl.Diplomat.localizedNameWithLocalGloss
52+
maplibregl.Diplomat.localizedNameWithLocalGloss,
5353
);
5454
let locales = maplibregl.Diplomat.getLocales();
5555
let style = map.getStyle();
@@ -59,10 +59,10 @@ addEventListener("load", () => {
5959

6060
addEventListener("hashchange", (event) => {
6161
let oldLanguage = maplibregl.Diplomat.getLanguageFromURL(
62-
new URL(event.oldURL)
62+
new URL(event.oldURL),
6363
);
6464
let newLanguage = maplibregl.Diplomat.getLanguageFromURL(
65-
new URL(event.newURL)
65+
new URL(event.newURL),
6666
);
6767
if (oldLanguage !== newLanguage) {
6868
let locales = maplibregl.Diplomat.getLocales();

index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function localizeLayers(layers, locales = getLocales()) {
104104
// https://github.com/openmaptiles/openmaptiles/issues/769
105105
layer["source-layer"] === "transportation_name"
106106
? legacyLocalizedNameExpression
107-
: localizedNameExpression
107+
: localizedNameExpression,
108108
);
109109

110110
updateVariable(textField, localizedCollatorVariable, [
@@ -141,7 +141,7 @@ export function localizeLayers(layers, locales = getLocales()) {
141141
?.toLocaleUpperCase(locales)
142142
// Word boundaries are less discernible in uppercase text, so pad each word by an additional space.
143143
.replaceAll(" ", " ") ?? null,
144-
])
144+
]),
145145
);
146146
Object.assign(countryNamesByCode, localizedCountryNamesByCode);
147147
}
@@ -170,7 +170,7 @@ function listValueExpression(
170170
separator,
171171
valueToOmit,
172172
listStart,
173-
numReplacements
173+
numReplacements,
174174
) {
175175
let asIs = ["slice", list, listStart];
176176
if (numReplacements <= 0) {
@@ -265,7 +265,7 @@ function listValueExpression(
265265
separator,
266266
valueToOmit,
267267
["var", nextListStartVariable],
268-
numReplacements - 1
268+
numReplacements - 1,
269269
),
270270
],
271271
],
@@ -316,7 +316,7 @@ export function listValuesExpression(valueList, separator, valueToOmit) {
316316
separator,
317317
["var", valueToOmitVariable],
318318
0,
319-
maxSeparators
319+
maxSeparators,
320320
),
321321
];
322322
}
@@ -463,14 +463,14 @@ export const localizedNameWithLocalGloss = [
463463
startsWithExpression(
464464
["var", localizedNameVariable],
465465
["get", "name"],
466-
["var", diacriticInsensitiveCollatorVariable]
466+
["var", diacriticInsensitiveCollatorVariable],
467467
),
468468
// ...then replace the common prefix with the local name.
469469
[
470470
"format",
471471
overwritePrefixExpression(
472472
["var", localizedNameVariable],
473-
["var", nameListVariable]
473+
["var", nameListVariable],
474474
),
475475
],
476476
// If the name in the preferred language is the same as the name in the
@@ -479,14 +479,14 @@ export const localizedNameWithLocalGloss = [
479479
endsWithExpression(
480480
["var", localizedNameVariable],
481481
["get", "name"],
482-
["var", diacriticInsensitiveCollatorVariable]
482+
["var", diacriticInsensitiveCollatorVariable],
483483
),
484484
// ...then replace the common suffix with the local name.
485485
[
486486
"format",
487487
overwriteSuffixExpression(
488488
["var", localizedNameVariable],
489-
["var", nameListVariable]
489+
["var", nameListVariable],
490490
),
491491
],
492492
// Otherwise, gloss the name in the local language if it differs from the

0 commit comments

Comments
 (0)