URI Name is a simple package that will take a generic string and produce a string that is safe to use as a URI component.
$ npm install uriname
var uriname = require('uriname')
//normal title
var title = 'My Fancy Title'
var uri = uriname(title)
console.log(uri) //my-fancy-title
//user input
var title = 'Something 0=&*(&) reaLLy c*(*)()l'
var uri = uriname(title)
console.log(uri) //something-0-really-c-l
//process multiples easily
var titles = ['Something Neat','Really Nice']
var uris = uriname(titles)
console.log(uris) ['something-neat','really-nice']
//enjoy!
Language | javascript |
Version | 0.2.0 |
Git URL | https://github.com/nullivex/uriname |
License | MIT |
Description | Node.js package to help convert strings to URI safe components |
Keywords | URI name, string to uri component, string to uri |