import {success} from "@http4t/result"; import {PathMatcher} from "../PathMatcher"; import {Parser, ParserPath, ParserResult} from "./index"; class SplitStringParser implements Parser { constructor(private readonly separator: string) { } parse(pathSegment: string): ParserResult { return success(pathSegment.split(this.separator)); } unparse(value: string[]): string { return value.join(this.separator); } } export class SplitStringPath extends ParserPath { constructor(base: PathMatcher, separator: string) { super(base, new SplitStringParser(separator)) } }