path.ts

Declarations
#

11 declarations

view source

FileFilter
#

parse_path_parts
#

path.ts view source

(path: string): string[]

path

type string

returns

string[]

examples

Example 1

parse_path_pieces
#

path.ts view source

(raw_path: string): PathPiece[]

Treats all paths as absolute, so the first piece is always a '/' with type 'separator'.

raw_path

type string

returns

PathPiece[]

parse_path_segments
#

path.ts view source

(path: string): string[]

Gets the individual parts of a path, ignoring dots and separators.

path

type string

returns

string[]

examples

Example 1

PathFilter
#

path.ts view source

PathFilter

A filter function for paths, can distinguish between files and directories.

PathId
#

path.ts view source

PathId

An absolute path on the filesystem. Named "id" to be consistent with Rollup.

PathInfo
#

PathPiece
#

path.ts view source

PathPiece

A piece of a parsed path, either a path segment or separator.

ResolvedPath
#

path.ts view source

ResolvedPath

A resolved path with both the original path string and its absolute id.

inheritance

extends:

path

type string

slugify
#

path.ts view source

(str: string, map_special_characters?: boolean): string

Converts a string into a URL-compatible slug.

str

the string to convert

type string

map_special_characters

if true, characters like ñ are converted to their ASCII equivalents, runs around 5x faster when disabled

type boolean
default true

returns

string

to_file_path
#

path.ts view source

(path_or_url: string | URL): string

Converts a URL to a file path string, or returns the string as-is.

path_or_url

type string | URL

returns

string

Imported by
#