ts-parse-database-url
v1.0.3
Published
Parse database urls
Downloads
82,923
Readme
TypeScript Parse Database Url
Install
$ npm i ts-parse-database-url
Usage
import parseDatabaseUrl from 'ts-parse-database-url';
const dbUrl = 'mysql://[email protected]: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: