Skip to content

jaywcjlove/path-templater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using my app is also a way to support me:
Scap: Screenshot & Markup Edit Screen Test Deskmark Keyzer Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Menuist Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

path-templater

Buy me a coffee Follow On X CI NPM Downloads NPM version Coverage Status

This is a simple path template replacement tool for nodejs.

Installation

$ npm install path-templater

Usage

import pathTemplater from 'path-templater';

pathTemplater('/:name', { name: 'wcj' })       // => /wcj
pathTemplater('/:name/:name', { name: 'wcj' }) // => /wcj/wcj
pathTemplater('http://localhost/:name/:name', { name: 'wcj' }) // => http://localhost/wcj/wcj

pathTemplater('https://github.com/:owner/:repo', { owner: 'jaywcjlove', repo: 'path-templater' })
// => https://github.com/jaywcjlove/path-templater

pathTemplater(':apiBaseUrl/:owner/:repo', {
  owner: 'jaywcjlove',
  repo: 'path-templater',
  apiBaseUrl: 'https://github.com'
})
// => https://github.com/jaywcjlove/path-templater

pathTemplater('http://localhost:3001/:name/:name', { name: 'wcj' })
// => http://localhost:3001/wcj/wcj

pathTemplater('http://localhost:3001/:name/:name?id=:user', { name: 'wcj', user: 'jaywcjlove' })
// => http://localhost:3001/wcj/wcj?id=jaywcjlove

pathTemplater(':apiBaseUrl/:owner/:repo', { owner: 'jaywcjlove', repo: 'path-templater' })
// 🚨 => Could not find url parameter apiBaseUrl in passed options object;

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

This package is licensed under the MIT License.

About

This is a simple path template replacement tool for nodejs.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors