Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/deep/internal.ts>Deep.Path.Result.Tokenize

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias Deep.Path.Result.Tokenize
import { type Deep } from "https://deno.land/x/rimbu@1.2.0/deep/internal.ts";
const { Tokenize } = Deep.Path.Result;

Converts a path string into separate tokens in a string array.

Type Parameters

P extends string
optional
Token extends string = ""
optional
Res extends string[] = []
definition: P extends "" ? Path.Internal.AppendIfNotEmpty<Res, Token> : P extends `[${infer Index}]${infer Rest}` ? Tokenize<Rest, "", [...Path.Internal.AppendIfNotEmpty<Res, Token>, Index]> : P extends `?.${infer Rest}` ? Tokenize<Rest, "", [...Path.Internal.AppendIfNotEmpty<Res, Token>, "?."]> : P extends `.${infer Rest}` ? Tokenize<Rest, "", [...Path.Internal.AppendIfNotEmpty<Res, Token>, "."]> : P extends `${infer First}${infer Rest}` ? Tokenize<Rest, `${Token}${First}`, Res> : never