couchdb-urlify

1.0.1 • Public • Published

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!

Readme

Keywords

none

Package Sidebar

Install

npm i couchdb-urlify

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • cdaringe