mapcomplete/UI/Studio/EditLayerState.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
584 B
TypeScript
Raw Normal View History

2023-06-16 02:36:11 +02:00
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
import { ConfigMeta } from "./configMeta"
2023-06-16 02:36:11 +02:00
export default class EditLayerState {
public readonly osmConnection: OsmConnection
public readonly schema: ConfigMeta[]
constructor(schema: ConfigMeta[]) {
this.schema = schema
2023-06-16 02:36:11 +02:00
this.osmConnection = new OsmConnection({})
}
public getSchemaStartingWith(path: string[]) {
return this.schema.filter(
(sch) =>
!path.some((part, i) => !(sch.path.length > path.length && sch.path[i] === part))
)
}
2023-06-16 02:36:11 +02:00
}