lib/index.js
/**
     * Function to create a database
     * @returns {Promise} - ES6 Promise
     */
Function to create a database
@returns {Promise} - ES6 Promise
Function to create a database @returns { Promise } - ES6 Promise
createDB() {
        return new Promise((resolve, reject) => {
            request(`${this.hostUrl.href}${this.database}`, (err, res, body) => {
                if (err) {
                    reject(err);
                }
                else if (res.statusCode == 200) {
                    resolve(true, JSON.parse(body));
                }
                else {
                    request.put(`${this.hostUrl.href}${this.database}`, (err, res, body) => {
                        if (err) {
                            reject(err);
                        }
                        else if (res.statusCode == 201) {
                            resolve(true, JSON.parse(body));
                        }
                        else {
                            resolve(false, JSON.parse(body));
                        }
                    });
                }
            });
        });
    }
createDB ( ) { return new Promise ( ( resolve , reject ) => { request ( ` ${ this . hostUrl . href } ${ this . database } ` , ( err , res , body ) => { if ( err ) { reject ( err ) ; } else if ( res . statusCode == 200 ) { resolve ( true , JSON . parse ( body ) ) ; } else { request . put ( ` ${ this . hostUrl . href } ${ this . database } ` , ( err , res , body ) => { if ( err ) { reject ( err ) ; } else if ( res . statusCode == 201 ) { resolve ( true , JSON . parse ( body ) ) ; } else { resolve ( false , JSON . parse ( body ) ) ; } } ) ; } } ) ; } ) ; }
Function to create a database
 @returns {Promise} - ES6 Promise
Function to create a database @returns { Promise } - ES6 Promise