generatepath
v1.0.0
Published
Generate dynamic paths from string
Downloads
86
Maintainers
Readme
generatePath
easily create urls from string
Example
import generatePath from './generatePath'
const urls = {
home: '/',
blog : '/blog/:title/:year/:month'
}
generatePath(urls.blog,{
title: 'some-cool-title',
year: new Date().getFullYear(),
month: new Date().getMonth() + 1
})
// output: /blog/some-cool-title/2021/10