Skip to content

cdaringe/couchdb-urlify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeship Status for cdaringe/couchdb-urlify

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 compliant
var url = 'https://couchfun.org:8080/bad . spaces_ and _%chars';
couchdbUrlify(url); //=> 'https://couchfun.org:8080/badspaces_and_chars'

// valid couchdb url is unmodified
var url = 'https://sub.my.domain.org/my-couch-db';
couchdbUrlify(url); //=> 'https://sub.my.domain.org/my-couch-db'

assert

// THROWS as input and output dont match
var url = 'https://info.com:1/bad . spaces_ and _%chars';
couchdbUrlify.assert(url); //=> throws

var url = 'https://sub.my.domain.org/my-couch-db';
couchdbUrlify.assert(url); //=> returns true

validate

Same as assert, but doesn't throw. Returns only true or false. True when urls === each other, false they don't!

About

Convert, assert, or validate URLs to ensure that they are compatible with couchdb!

Resources

License

Stars

Watchers

Forks

Packages

No packages published