UNPKG

sequelize-pg-utilities

Version:

An opinionated set of database utilities that manage creating and connecting to a Postgres database

20 lines (15 loc) 347 B
const { URL } = require('url') const POSTGRES = 'postgres' const urlParser = dbUrl => { if (!dbUrl) return {} const { pathname, username, password, hostname: host, port } = new URL(dbUrl) return { username, password, host, port, database: pathname.substring(1), dialect: POSTGRES } } module.exports = urlParser