Package Exports
- connection-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (connection-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
connection-string
URL Connection String Parser - for all browsers and Node.js versions.
Takes a URL connection string (with every element being optional):
protocol://user:password@hostname:12345/seg1/seg2?p1=val1&p2=val2and converts it into an object:
{
protocol: 'protocol',
user: 'user',
password: 'password',
host: 'hostname:12345',
hostname: 'hostname',
port: 12345,
segments: ['seg1', 'seg2'],
params: {
p1: 'val1',
p2: 'val2'
}
}NOTE: It only sets properties that are present in the connection string.
Installing
$ npm install connection-stringUsage
- Node.js
var parse = require('connection-string');
var obj = parse('my-server:12345');- Browsers
<script src="./connection-string/src"></script>
<script>
var obj = parseConnectionString('my-server:12345');
</script>- TypeScript
import * as parse from './connection-string/src'
import {ConnectionOptions} from './connection-string/src'
var a: ConnectionOptions = parse('protocol://');For details and examples see the WiKi Pages.