couchdb-urlify
Convert, assert, or validate URLs to ensure that they are compatible with couchdb! Does the above tasks according to the CouchDB rules!
install
npm i --save couchdb-urlify
usage
var couchdbUrlify = require('couchdb-urlify');
convert
// invalid couchdb url is modified to be compliantvar url = 'https://couchfun.org:8080/bad . spaces_ and _%chars';; //=> 'https://couchfun.org:8080/badspaces_and_chars' // valid couchdb url is unmodifiedvar url = 'https://sub.my.domain.org/my-couch-db';; //=> 'https://sub.my.domain.org/my-couch-db'
assert
// THROWS as input and output dont matchvar url = 'https://info.com:1/bad . spaces_ and _%chars';couchdbUrlify; //=> throws var url = 'https://sub.my.domain.org/my-couch-db';couchdbUrlify; //=> returns true
validate
Same as assert
, but doesn't throw. Returns only true
or false
. True when urls === each other, false they don't!