New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

path-params

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-params

Replace path params based on express route notation

0.1.0
latest
Source
npm
Version published
Weekly downloads
693
33.27%
Maintainers
1
Weekly downloads
 
Created
Source

path-params Build Status NPM js-standard-style

Replace path params based on express route notation.

Installation

Via npm:

npm install path-params --save

Via bower:

bower install path-params --save

Or loading the script:

<script src="//cdn.rawgit.com/h2non/path-params/master/path-params.js"></script>

Environments

Runs in any ES5 compliant engine:

Node.jsChromeFirefoxIEOperaSafari
+0.8+5+3.5+9+12+5

Usage

const pathParams = require('path-params')

const path = pathParams('/users/:id/:action', { id: 123, action: 'foo' })

if (path instanceof Error) {
  console.error('Params error:', err.message)
} else {
  console.log('Path:', path) // -> '/users/123/foo'
}

API

pathParams(path, params) => String|Error

License

MIT © Tomas Aparicio

Keywords

path

FAQs

Package last updated on 20 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts