Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+15
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
module.exports = (url, opts) => {
|
||||
if (typeof url !== 'string') {
|
||||
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof url}\``);
|
||||
}
|
||||
|
||||
url = url.trim();
|
||||
opts = Object.assign({https: false}, opts);
|
||||
|
||||
if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
return url.replace(/^(?!(?:\w+:)?\/\/)/, opts.https ? 'https://' : 'http://');
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "prepend-http",
|
||||
"version": "2.0.0",
|
||||
"description": "Prepend `http://` to humanized URLs like todomvc.com and localhost",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/prepend-http",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"prepend",
|
||||
"protocol",
|
||||
"scheme",
|
||||
"url",
|
||||
"uri",
|
||||
"http",
|
||||
"https",
|
||||
"humanized"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz"
|
||||
,"_integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
|
||||
,"_from": "prepend-http@^2.0.0"
|
||||
}
|
||||
Reference in new issue
Block a user