Skip to main content
Home

@dldc/chemin@13.0.0
Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score100%
Downloads1/wk
Published11 months ago (13.0.0)

A type-safe pattern builder & route matching library written in TypeScript

v
chemin
No documentation available
f
cheminFactory

Factory function to create a chemin function with different default options. It returns a function that works exactly like chemin but with a default serialize / stringify options.

f
cheminParamsEqual

Compare two chemin params, this will return true if the two params have the same factory and parameters.

f
equal

Test if two chemins are equal.

f
extract

Extract all chemins from a chemin including itself.

f
flatten

Flatten a chemin into an array of chemin params.

f
isChemin

Check wether an object is a Chemin or not Accepts one argument and return true if it's a Chemin, false otherwise.

f
match

Match a chemin against a pathname and return the params

f
matchAll
No documentation available
f
matchAllNested
No documentation available
f
matchExact

Match a chemin against a pathname and return the params if the match is exact, otherwise null.

f
matchFirst

Match a pathname against a list of chemins and return the first match

f
matchFirstExact
No documentation available
f
namespace

Add a base to a set of chemins

T
OptionalValue

The match result for pOptional params

f
partialMatch
No documentation available
f
pConstant

Create a fixed value param

f
pInteger

Parse an integer params using parseInt(x, 10)

f
pMultiple

Repeat a param multiple times

f
pNumber

Parse a number params using parseFloat(x)

f
pOptional

Wrap a param to make it optional

f
pOptionalConst

Optional version of pConstant This can also be done with pOptional(pConstant("home")) but this has a nicer match result (true instead of { present: true, value: null })

f
pOptionalString

Optional version of pString This can also be done with pOptional(pString("name")) but this has a nicer match result ("name" or false instead of { present: boolean, value: "name" })

f
prefix
No documentation available
T
Prefixed
No documentation available
f
pString
No documentation available
f
serialize

Print a chemin from its params.

f
splitPathname

Split a pathname and prevent empty parts Accepts a string and returns an array of strings.

f
stringify

Transform a chemin into a string representation.

I
TCheminMatch

Chemin match result

T
TCheminMatchMaybe

Chemin match result or null if no match

T
TCheminParam

Chemin param type

T
TCheminParamAny

Chemin param type with any value

T
TCheminsNamespaced
No documentation available
T
TCheminsRecord
No documentation available
T
TCheminsRecordMatches
No documentation available
T
TCreateChemin

Advanced type of teh createChemin function

T
TEmptyObject

Empty object type

I
TFirstExactMatchResult
No documentation available
I
TFirstMatchResult
No documentation available
T
TIn

Type of the input of the serialize function

T
TNestedCheminsRecord
No documentation available
T
TNestedCheminsRecordMatches
No documentation available
T
TParams

Extract the params type of a chemin

T
TParsedPathname
No documentation available
T
TPart

Part of a chemin, can be a param or a chemin

T
TPartIsEqual

Part isEqual function

T
TPartMatch

Part match function

T
TPartMatchResult

Result of a match

T
TPartSerialize

Part serialize function

T
TPartStringify

Part stringify function

T
TPathname
No documentation available
T
TSerialize

Serialize function type

T
TSimplify

Simplify a type by removing the undefined type

I
TSlashOptions

Otpions for the serialize function

T
TUnionParams

Union of all the params of a list of chemins

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.