/query-dynamic-params

JavaScript/Typescript util for querying dynamic/named params

Primary LanguageTypeScriptMIT LicenseMIT

query-dynamic-params Build

JavaScript/Typescript util for querying dynamic/named params

Installation

npm install query-dynamic-params

Usage

import { queryDynamicParams } from 'query-dynamic-params';

const url = '/users/:id/:name';
const path = '/users/1/john';

const params = queryDynamicParams(url, path, ['id', 'name']);
console.log(params); // { id: '1', name: 'john' }

Build

npm run build

Test

npm run test

License

MIT