Examples

Page 48 of 50

Browse code examples

typescriptSnippet

CSRF Double-Submit Token

Issue HMAC-bound CSRF tokens and verify that the header, cookie and session agree before accepting a state change.

typescriptSnippet

Dotenv File Parser

Parse .env files with comments, export prefixes, quoted values, escapes and multiline strings without mutating process.env.

typescriptSnippet

Glob Pattern Matcher

Compile glob patterns with star, globstar, question marks, character classes and braces into anchored regular expressions.

typescriptSnippet

Typed Route Pattern Parser

Match Express-style route patterns and infer parameter names as a TypeScript union, including named wildcards and percent decoding.

typescriptSnippet

Semver Range Checker

Parse semantic versions and test ranges with comparators, caret, tilde, wildcards, hyphen ranges and OR unions.

typescriptSnippet

Typed Query String Parser

Parse URL query strings into typed values with reusable string, integer, boolean, list, and enum decoders plus aggregated errors.