url-template-param-parser
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

URL Parameter Parser

A TypeScript library for parsing parameters in a URL template string.

Installation

npm i url-template-param-parser --save

Usage

import parseURLParams from 'url-template-param-parser';

const url = 'https://test.com:8080/user/:user_id/comment/:comment_id';
const result = parseURLParams(url);
console.log(result); // ['user_id', 'comment_id']

Example

import parseURLParams from 'url-template-param-parser';

const template = '/user/:user_id/comment/:comment_id';
const result = parseURLParams(template);
console.log(result); // ['user_id', 'comment_id']

License

This library is licensed under the MIT License.

Package Sidebar

Install

npm i url-template-param-parser

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

20.6 kB

Total Files

12

Last publish

Collaborators

  • levchenko_d