JSPM

@nimpl/path-parser

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 35
  • Score
    100M100P100Q81472F
  • License MIT

Helper for next.js-styled pathname parsing (f.e. /(site)/docs/[key]) to get dynamic params

Package Exports

  • @nimpl/path-parser
  • @nimpl/path-parser/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nimpl/path-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@nimpl/path-parser

Helper for next.js-styled pathname parsing (f.e. /(site)/docs/[key]) to get dynamic params

Visit https://nimpl.tech/docs/path-parser to view the full documentation.

Installation

Using npm:

npm i @nimpl/path-parser

Using yarn:

yarn add @nimpl/path-parser

Usage

import { parse } from "@nimpl/path-parser";

// ...

const params = parse("/docs/path-parser", "/(site)/docs/[key]"); // { key: 'path-parser' }
const { segments } = parse("/docs/path-parser", "/(site)/[[...segments]]"); // { segments: ['docs', 'path-parser'] }

Additional

Please consider giving a star if you like it, it will help promote the implementation in the eyes of the Next.js team. This also motivates the author to continue working on this and other solutions ❤️

Create issues with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.