diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
commit | d25e11bee6ca5ca523884da132d18e1400e077b9 (patch) | |
tree | 8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/url-to-options | |
download | kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2 kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip |
Initial commit
Diffstat (limited to 'node_modules/url-to-options')
-rw-r--r-- | node_modules/url-to-options/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/url-to-options/README.md | 29 | ||||
-rw-r--r-- | node_modules/url-to-options/index.js | 28 | ||||
-rw-r--r-- | node_modules/url-to-options/package.json | 24 |
4 files changed, 102 insertions, 0 deletions
diff --git a/node_modules/url-to-options/LICENSE b/node_modules/url-to-options/LICENSE new file mode 100644 index 0000000..274147a --- /dev/null +++ b/node_modules/url-to-options/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Steven Vachon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/url-to-options/README.md b/node_modules/url-to-options/README.md new file mode 100644 index 0000000..5158636 --- /dev/null +++ b/node_modules/url-to-options/README.md @@ -0,0 +1,29 @@ +# url-to-options [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] + +Convert a WHATWG [URL](https://developer.mozilla.org/en/docs/Web/API/URL) to an `http.request`/`https.request` options object. + + +## Installation + +[Node.js](http://nodejs.org/) `>= 4` is required. To install, type this at the command line: +```shell +npm install url-to-options +``` + + +## Usage + +```js +const urlToOptions = require('url-to-options'); + +const url = new URL('http://user:pass@hostname:8080/'); + +const opts = urlToOptions(url); +//-> { auth:'user:pass', port:8080, … } +``` + + +[npm-image]: https://img.shields.io/npm/v/url-to-options.svg +[npm-url]: https://npmjs.org/package/url-to-options +[travis-image]: https://img.shields.io/travis/stevenvachon/url-to-options.svg +[travis-url]: https://travis-ci.org/stevenvachon/url-to-options diff --git a/node_modules/url-to-options/index.js b/node_modules/url-to-options/index.js new file mode 100644 index 0000000..25ef0bd --- /dev/null +++ b/node_modules/url-to-options/index.js @@ -0,0 +1,28 @@ +'use strict'; + + + +// Copied from https://github.com/nodejs/node/blob/master/lib/internal/url.js + +function urlToOptions(url) { + var options = { + protocol: url.protocol, + hostname: url.hostname, + hash: url.hash, + search: url.search, + pathname: url.pathname, + path: `${url.pathname}${url.search}`, + href: url.href + }; + if (url.port !== '') { + options.port = Number(url.port); + } + if (url.username || url.password) { + options.auth = `${url.username}:${url.password}`; + } + return options; +} + + + +module.exports = urlToOptions; diff --git a/node_modules/url-to-options/package.json b/node_modules/url-to-options/package.json new file mode 100644 index 0000000..0dce30d --- /dev/null +++ b/node_modules/url-to-options/package.json @@ -0,0 +1,24 @@ +{ + "name": "url-to-options", + "description": "Convert a WHATWG URL to an http(s).request options object.", + "version": "1.0.1", + "license": "MIT", + "author": "Steven Vachon <contact@svachon.com> (https://www.svachon.com/)", + "repository": "stevenvachon/url-to-options", + "devDependencies": { + "universal-url": "^1.0.0-alpha" + }, + "engines": { + "node": ">= 4" + }, + "scripts": { + "test": "node test.js" + }, + "files": ["index.js"], + "keywords": [ + "http", + "https", + "url", + "whatwg" + ] +} |