forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
a75a78e5a0
commit
fb2a2e8b19
81 changed files with 3528 additions and 2729 deletions
|
@ -158,10 +158,10 @@ export default class LinkedDataLoader {
|
|||
openingHoursSpecification,
|
||||
<any>LinkedDataLoader.COMPACTING_CONTEXT_OH
|
||||
)
|
||||
const spec:({
|
||||
"@type":"http://schema.org/OpeningHoursSpecification",
|
||||
"dayOfWeek": string[]
|
||||
})[] = compacted["@graph"]
|
||||
const spec: {
|
||||
"@type": "http://schema.org/OpeningHoursSpecification"
|
||||
dayOfWeek: string[]
|
||||
}[] = compacted["@graph"]
|
||||
if (!spec) {
|
||||
return undefined
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ export default class LinkedDataLoader {
|
|||
return dow.toLowerCase().substring(0, 2)
|
||||
})
|
||||
const opens: string = rule["http://schema.org/opens"] ?? rule["opens"]
|
||||
let closes: string = (rule["http://schema.org/closes"] ?? rule["closes"])
|
||||
let closes: string = rule["http://schema.org/closes"] ?? rule["closes"]
|
||||
closes = closes === "23:59" ? "24:00" : closes
|
||||
|
||||
allRules.push(...OH.parseRule(dow + " " + opens + "-" + closes))
|
||||
|
@ -186,11 +186,14 @@ export default class LinkedDataLoader {
|
|||
return OH.toString(OH.MergeTimes(allRules))
|
||||
}
|
||||
|
||||
static async compact(data: object, options?: JsonLdLoaderOptions): Promise<Record<string, string> | Record<string, string>[]> {
|
||||
static async compact(
|
||||
data: object,
|
||||
options?: JsonLdLoaderOptions
|
||||
): Promise<Record<string, string> | Record<string, string>[]> {
|
||||
if (Array.isArray(data)) {
|
||||
|
||||
const result: Awaited<Record<string, string> | Record<string, string>[]>[] = await Promise.all(data.map((point) => LinkedDataLoader.compact(point, options)))
|
||||
return result.flatMap(x => Array.isArray(x) ? x : [x])
|
||||
const result: Awaited<Record<string, string> | Record<string, string>[]>[] =
|
||||
await Promise.all(data.map((point) => LinkedDataLoader.compact(point, options)))
|
||||
return result.flatMap((x) => (Array.isArray(x) ? x : [x]))
|
||||
}
|
||||
|
||||
const country = options?.country
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue