1.0.12 • Published 7 years ago
url-generator v1.0.12
URL Generator
A simple JavaScript url generator, takes an array of parameters and returns all possible permutations of the url as an array
Installation
For use with node you can either use yarn or npm
yarn install url-generator --save
Or for use in the browser you can intsall from bower
bower install url-generator --save
Useage
create
urlGenerator.create({
url: 'http://www.google.com',
params: [
{
key: 'utm_campaign',
value: [
'google',
'twitter',
'facebook'
]
},
{
key: 'utm_term',
value: 'something'
}
]
}).then(result => {
console.log(result)
}).catch(error => {
console.log(error)
})
search
urlGenerator.search([
{
key: 'utm_campaign',
value: [
'google',
'twitter',
'facebook'
]
},
{
key: 'utm_term',
value: 'something'
}
]).then(result => {
console.log(result)
}).catch(error => {
console.log(error)
})
slug
urlGenerator.slug('Hello World')
parseUrl
urlGenerator.parseUrl('http://www.google.com')