ajoslin / url-parse-auth

Parse the password and user out of a url. Do in one step what would take two steps and a string.split with require('url').

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

url-parse-auth Build Status

Parse the password and user out of a url. Do in one step what would take two steps and a string.split with require('url').

Install

$ npm install --save url-parse-auth

Usage

var urlParseAuth = require('url-parse-auth')

urlParseAuth('https://user:pass@baz.com')
//=> {user: 'user', pass: 'pass'}

API

urlParsePassword(url) -> {user, password}

Both user and password will be undefined if the url has no auth section.

License

MIT © Andrew Joslin

About

Parse the password and user out of a url. Do in one step what would take two steps and a string.split with require('url').

License:MIT License


Languages

Language:JavaScript 100.0%