ts-parse-database-url

Parse database urls

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ts-parse-database-url
1.0.34 years ago4 years agoMinified + gzip package size for ts-parse-database-url in KB

Readme

TypeScript Parse Database Url

Install

$ npm i ts-parse-database-url

Usage

import parseDatabaseUrl from 'ts-parse-database-url';

const dbUrl = 'mysql://someuser@server.heroku.com:1337/herokudb'
const parsed = parseDatabaseUrl(dbUrl)

/**
 * parsed = {
 *   'driver': 'mysql',
 *   'user': 'someuser',
 *   'host': 'server.heroku.com',
 *   'port': '1337',
 *   'database': 'herokudb'
 * }
*/

Look at src/__tests__ for more tests examples.
Thanks to https://github.com/pwnall/node-parse-database-url for creating the original lib :tada: