new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/let");
|
||||
//# sourceMappingURL=let.js.map
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "is-interactive",
|
||||
"version": "1.0.0",
|
||||
"description": "Check if stdout or stderr is interactive",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-interactive",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"interactive",
|
||||
"stdout",
|
||||
"stderr",
|
||||
"detect",
|
||||
"is",
|
||||
"terminal",
|
||||
"shell",
|
||||
"tty"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.12",
|
||||
"ava": "^2.1.0",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeScan.js","sources":["../src/operators/mergeScan.ts"],"names":[],"mappings":";;;;;AAAA,qDAAgD"}
|
||||
@@ -0,0 +1,66 @@
|
||||
# os-name [](https://travis-ci.com/github/sindresorhus/os-name)
|
||||
|
||||
> Get the name of the current operating system\
|
||||
> Example: `macOS Sierra`
|
||||
|
||||
Useful for analytics and debugging.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install os-name
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const os = require('os');
|
||||
const osName = require('os-name');
|
||||
|
||||
// On a macOS Sierra system
|
||||
|
||||
osName();
|
||||
//=> 'macOS Sierra'
|
||||
|
||||
osName(os.platform(), os.release());
|
||||
//=> 'macOS Sierra'
|
||||
|
||||
osName('darwin', '14.0.0');
|
||||
//=> 'OS X Yosemite'
|
||||
|
||||
osName('linux', '3.13.0-24-generic');
|
||||
//=> 'Linux 3.13'
|
||||
|
||||
osName('win32', '6.3.9600');
|
||||
//=> 'Windows 8.1'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### osName(platform?, release?)
|
||||
|
||||
By default, the name of the current operating system is returned.
|
||||
|
||||
You can optionally supply a custom [`os.platform()`](https://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](https://nodejs.org/api/os.html#os_os_release).
|
||||
|
||||
Check out [`getos`](https://github.com/wblankenship/getos) if you need the Linux distribution name.
|
||||
|
||||
## Contributing
|
||||
|
||||
Production systems depend on this package for logging / tracking. Please be careful when introducing new output, and adhere to existing output format (whitespace, capitalization, etc.).
|
||||
|
||||
## Related
|
||||
|
||||
- [os-name-cli](https://github.com/sindresorhus/os-name-cli) - CLI for this module
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-os-name?utm_source=npm-os-name&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
// https://github.com/Modernizr/Modernizr/issues/572
|
||||
// http://jsfiddle.net/glsee/JDsWQ/4/
|
||||
Modernizr.addTest('cssvmaxunit', function(){
|
||||
var bool;
|
||||
Modernizr.testStyles("#modernizr { width: 50vmax; }", function(elem, rule) {
|
||||
var one_vw = window.innerWidth/100,
|
||||
one_vh = window.innerHeight/100,
|
||||
compWidth = parseInt((window.getComputedStyle ?
|
||||
getComputedStyle(elem, null) :
|
||||
elem.currentStyle)['width'],10);
|
||||
bool = ( parseInt(Math.max(one_vw, one_vh)*50,10) == compWidth );
|
||||
});
|
||||
return bool;
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hostReportError.js","sources":["../../src/internal/util/hostReportError.ts"],"names":[],"mappings":";;AAKA,SAAgB,eAAe,CAAC,GAAQ;IACtC,UAAU,CAAC,cAAQ,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AAFD,0CAEC"}
|
||||
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
const pkg = require('../package.json');
|
||||
const create = require('./create');
|
||||
|
||||
const defaults = {
|
||||
options: {
|
||||
retry: {
|
||||
retries: 2,
|
||||
methods: [
|
||||
'GET',
|
||||
'PUT',
|
||||
'HEAD',
|
||||
'DELETE',
|
||||
'OPTIONS',
|
||||
'TRACE'
|
||||
],
|
||||
statusCodes: [
|
||||
408,
|
||||
413,
|
||||
429,
|
||||
500,
|
||||
502,
|
||||
503,
|
||||
504
|
||||
],
|
||||
errorCodes: [
|
||||
'ETIMEDOUT',
|
||||
'ECONNRESET',
|
||||
'EADDRINUSE',
|
||||
'ECONNREFUSED',
|
||||
'EPIPE',
|
||||
'ENOTFOUND',
|
||||
'ENETUNREACH',
|
||||
'EAI_AGAIN'
|
||||
]
|
||||
},
|
||||
headers: {
|
||||
'user-agent': `${pkg.name}/${pkg.version} (https://github.com/sindresorhus/got)`
|
||||
},
|
||||
hooks: {
|
||||
beforeRequest: [],
|
||||
beforeRedirect: [],
|
||||
beforeRetry: [],
|
||||
afterResponse: []
|
||||
},
|
||||
decompress: true,
|
||||
throwHttpErrors: true,
|
||||
followRedirect: true,
|
||||
stream: false,
|
||||
form: false,
|
||||
json: false,
|
||||
cache: false,
|
||||
useElectronNet: false
|
||||
},
|
||||
mutableDefaults: false
|
||||
};
|
||||
|
||||
const got = create(defaults);
|
||||
|
||||
module.exports = got;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"name":"@types/html-minifier","version":"4.0.0","files":{"LICENSE":{"checkedAt":1678887829795,"integrity":"sha512-HQaIQk9pwOcyKutyDk4o2a87WnotwYuLGYFW43emGm4FvIJFKPyg+OYaw5sTegKAKf+C5SKa1ACjzCLivbaHrQ==","mode":438,"size":1141},"README.md":{"checkedAt":1678887829795,"integrity":"sha512-yIuaN56MiygvlS5Dt7lNfkfPxat062o4y0PXJh1jvOuyCnrdhJB0jNl17q9DbuXGZFP+eeJLKp14saBrCJShOA==","mode":438,"size":806},"index.d.ts":{"checkedAt":1678887829795,"integrity":"sha512-5pRZqYavX8dPIwkrYHnAJqswHEgiiIFfXDZ69jYQsW1mtLU6wtF9x9ecE4p45DDd1Na7jD97D29fJyBwM0V33Q==","mode":438,"size":6846},"package.json":{"checkedAt":1678887829795,"integrity":"sha512-V1AMHFY5KXV8moRTiIZW0yg7cKdWwB9ocUYFaxVoFd6hn3ozS0HsX61kBf8KK1ESn1FFrNQ+a7FjDmJsuRdXcg==","mode":438,"size":1134}}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var switchMap_1 = require("./switchMap");
|
||||
var identity_1 = require("../util/identity");
|
||||
function switchAll() {
|
||||
return switchMap_1.switchMap(identity_1.identity);
|
||||
}
|
||||
exports.switchAll = switchAll;
|
||||
//# sourceMappingURL=switchAll.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Tests to see if the object is an ES2015 (ES6) Promise
|
||||
* @see {@link https://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects}
|
||||
* @param value the object to test
|
||||
*/
|
||||
export declare function isPromise(value: any): value is PromiseLike<any>;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "node index.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
# strict-uri-encode [](https://travis-ci.org/kevva/strict-uri-encode)
|
||||
|
||||
> A stricter URI encode adhering to [RFC 3986](http://tools.ietf.org/html/rfc3986)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save strict-uri-encode
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const strictUriEncode = require('strict-uri-encode');
|
||||
|
||||
strictUriEncode('unicorn!foobar');
|
||||
//=> 'unicorn%21foobar'
|
||||
|
||||
strictUriEncode('unicorn*foobar');
|
||||
//=> 'unicorn%2Afoobar'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### strictUriEncode(string)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`, `number`
|
||||
|
||||
String to URI encode.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](http://github.com/kevva)
|
||||
@@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isIdentityCard;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var validators = {
|
||||
ES: function ES(str) {
|
||||
(0, _assertString.default)(str);
|
||||
var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/;
|
||||
var charsValue = {
|
||||
X: 0,
|
||||
Y: 1,
|
||||
Z: 2
|
||||
};
|
||||
var controlDigits = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E']; // sanitize user input
|
||||
|
||||
var sanitized = str.trim().toUpperCase(); // validate the data structure
|
||||
|
||||
if (!DNI.test(sanitized)) {
|
||||
return false;
|
||||
} // validate the control digit
|
||||
|
||||
|
||||
var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function (char) {
|
||||
return charsValue[char];
|
||||
});
|
||||
return sanitized.endsWith(controlDigits[number % 23]);
|
||||
},
|
||||
IN: function IN(str) {
|
||||
var DNI = /^[1-9]\d{3}\s?\d{4}\s?\d{4}$/; // multiplication table
|
||||
|
||||
var d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]; // permutation table
|
||||
|
||||
var p = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; // sanitize user input
|
||||
|
||||
var sanitized = str.trim(); // validate the data structure
|
||||
|
||||
if (!DNI.test(sanitized)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var c = 0;
|
||||
var invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse();
|
||||
invertedArray.forEach(function (val, i) {
|
||||
c = d[c][p[i % 8][val]];
|
||||
});
|
||||
return c === 0;
|
||||
},
|
||||
IT: function IT(str) {
|
||||
if (str.length !== 9) return false;
|
||||
if (str === 'CA00000AA') return false; // https://it.wikipedia.org/wiki/Carta_d%27identit%C3%A0_elettronica_italiana
|
||||
|
||||
return str.search(/C[A-Z][0-9]{5}[A-Z]{2}/i) > -1;
|
||||
},
|
||||
NO: function NO(str) {
|
||||
var sanitized = str.trim();
|
||||
if (isNaN(Number(sanitized))) return false;
|
||||
if (sanitized.length !== 11) return false;
|
||||
if (sanitized === '00000000000') return false; // https://no.wikipedia.org/wiki/F%C3%B8dselsnummer
|
||||
|
||||
var f = sanitized.split('').map(Number);
|
||||
var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11;
|
||||
var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11;
|
||||
if (k1 !== f[9] || k2 !== f[10]) return false;
|
||||
return true;
|
||||
},
|
||||
'he-IL': function heIL(str) {
|
||||
var DNI = /^\d{9}$/; // sanitize user input
|
||||
|
||||
var sanitized = str.trim(); // validate the data structure
|
||||
|
||||
if (!DNI.test(sanitized)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var id = sanitized;
|
||||
var sum = 0,
|
||||
incNum;
|
||||
|
||||
for (var i = 0; i < id.length; i++) {
|
||||
incNum = Number(id[i]) * (i % 2 + 1); // Multiply number by 1 or 2
|
||||
|
||||
sum += incNum > 9 ? incNum - 9 : incNum; // Sum the digits up and add to total
|
||||
}
|
||||
|
||||
return sum % 10 === 0;
|
||||
},
|
||||
'ar-TN': function arTN(str) {
|
||||
var DNI = /^\d{8}$/; // sanitize user input
|
||||
|
||||
var sanitized = str.trim(); // validate the data structure
|
||||
|
||||
if (!DNI.test(sanitized)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
'zh-CN': function zhCN(str) {
|
||||
var provincesAndCities = ['11', // 北京
|
||||
'12', // 天津
|
||||
'13', // 河北
|
||||
'14', // 山西
|
||||
'15', // 内蒙古
|
||||
'21', // 辽宁
|
||||
'22', // 吉林
|
||||
'23', // 黑龙江
|
||||
'31', // 上海
|
||||
'32', // 江苏
|
||||
'33', // 浙江
|
||||
'34', // 安徽
|
||||
'35', // 福建
|
||||
'36', // 江西
|
||||
'37', // 山东
|
||||
'41', // 河南
|
||||
'42', // 湖北
|
||||
'43', // 湖南
|
||||
'44', // 广东
|
||||
'45', // 广西
|
||||
'46', // 海南
|
||||
'50', // 重庆
|
||||
'51', // 四川
|
||||
'52', // 贵州
|
||||
'53', // 云南
|
||||
'54', // 西藏
|
||||
'61', // 陕西
|
||||
'62', // 甘肃
|
||||
'63', // 青海
|
||||
'64', // 宁夏
|
||||
'65', // 新疆
|
||||
'71', // 台湾
|
||||
'81', // 香港
|
||||
'82', // 澳门
|
||||
'91' // 国外
|
||||
];
|
||||
var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2'];
|
||||
var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
|
||||
|
||||
var checkAddressCode = function checkAddressCode(addressCode) {
|
||||
return provincesAndCities.includes(addressCode);
|
||||
};
|
||||
|
||||
var checkBirthDayCode = function checkBirthDayCode(birDayCode) {
|
||||
var yyyy = parseInt(birDayCode.substring(0, 4), 10);
|
||||
var mm = parseInt(birDayCode.substring(4, 6), 10);
|
||||
var dd = parseInt(birDayCode.substring(6), 10);
|
||||
var xdata = new Date(yyyy, mm - 1, dd);
|
||||
|
||||
if (xdata > new Date()) {
|
||||
return false; // eslint-disable-next-line max-len
|
||||
} else if (xdata.getFullYear() === yyyy && xdata.getMonth() === mm - 1 && xdata.getDate() === dd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var getParityBit = function getParityBit(idCardNo) {
|
||||
var id17 = idCardNo.substring(0, 17);
|
||||
var power = 0;
|
||||
|
||||
for (var i = 0; i < 17; i++) {
|
||||
power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10);
|
||||
}
|
||||
|
||||
var mod = power % 11;
|
||||
return parityBit[mod];
|
||||
};
|
||||
|
||||
var checkParityBit = function checkParityBit(idCardNo) {
|
||||
return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
|
||||
};
|
||||
|
||||
var check15IdCardNo = function check15IdCardNo(idCardNo) {
|
||||
var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo);
|
||||
if (!check) return false;
|
||||
var addressCode = idCardNo.substring(0, 2);
|
||||
check = checkAddressCode(addressCode);
|
||||
if (!check) return false;
|
||||
var birDayCode = "19".concat(idCardNo.substring(6, 12));
|
||||
check = checkBirthDayCode(birDayCode);
|
||||
if (!check) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
var check18IdCardNo = function check18IdCardNo(idCardNo) {
|
||||
var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo);
|
||||
if (!check) return false;
|
||||
var addressCode = idCardNo.substring(0, 2);
|
||||
check = checkAddressCode(addressCode);
|
||||
if (!check) return false;
|
||||
var birDayCode = idCardNo.substring(6, 14);
|
||||
check = checkBirthDayCode(birDayCode);
|
||||
if (!check) return false;
|
||||
return checkParityBit(idCardNo);
|
||||
};
|
||||
|
||||
var checkIdCardNo = function checkIdCardNo(idCardNo) {
|
||||
var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
|
||||
if (!check) return false;
|
||||
|
||||
if (idCardNo.length === 15) {
|
||||
return check15IdCardNo(idCardNo);
|
||||
}
|
||||
|
||||
return check18IdCardNo(idCardNo);
|
||||
};
|
||||
|
||||
return checkIdCardNo(str);
|
||||
},
|
||||
'zh-TW': function zhTW(str) {
|
||||
var ALPHABET_CODES = {
|
||||
A: 10,
|
||||
B: 11,
|
||||
C: 12,
|
||||
D: 13,
|
||||
E: 14,
|
||||
F: 15,
|
||||
G: 16,
|
||||
H: 17,
|
||||
I: 34,
|
||||
J: 18,
|
||||
K: 19,
|
||||
L: 20,
|
||||
M: 21,
|
||||
N: 22,
|
||||
O: 35,
|
||||
P: 23,
|
||||
Q: 24,
|
||||
R: 25,
|
||||
S: 26,
|
||||
T: 27,
|
||||
U: 28,
|
||||
V: 29,
|
||||
W: 32,
|
||||
X: 30,
|
||||
Y: 31,
|
||||
Z: 33
|
||||
};
|
||||
var sanitized = str.trim().toUpperCase();
|
||||
if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false;
|
||||
return Array.from(sanitized).reduce(function (sum, number, index) {
|
||||
if (index === 0) {
|
||||
var code = ALPHABET_CODES[number];
|
||||
return code % 10 * 9 + Math.floor(code / 10);
|
||||
}
|
||||
|
||||
if (index === 9) {
|
||||
return (10 - sum % 10 - Number(number)) % 10 === 0;
|
||||
}
|
||||
|
||||
return sum + Number(number) * (9 - index);
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
function isIdentityCard(str, locale) {
|
||||
(0, _assertString.default)(str);
|
||||
|
||||
if (locale in validators) {
|
||||
return validators[locale](str);
|
||||
} else if (locale === 'any') {
|
||||
for (var key in validators) {
|
||||
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
||||
// istanbul ignore else
|
||||
if (validators.hasOwnProperty(key)) {
|
||||
var validator = validators[key];
|
||||
|
||||
if (validator(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(locale, "'"));
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
|
||||
var parseUrl = require("parse-url"),
|
||||
isSsh = require("is-ssh");
|
||||
|
||||
/**
|
||||
* gitUp
|
||||
* Parses the input url.
|
||||
*
|
||||
* @name gitUp
|
||||
* @function
|
||||
* @param {String} input The input url.
|
||||
* @return {Object} An object containing the following fields:
|
||||
*
|
||||
* - `protocols` (Array): An array with the url protocols (usually it has one element).
|
||||
* - `port` (null|Number): The domain port.
|
||||
* - `resource` (String): The url domain (including subdomains).
|
||||
* - `user` (String): The authentication user (usually for ssh urls).
|
||||
* - `pathname` (String): The url pathname.
|
||||
* - `hash` (String): The url hash.
|
||||
* - `search` (String): The url querystring value.
|
||||
* - `href` (String): The input url.
|
||||
* - `protocol` (String): The git url protocol.
|
||||
* - `token` (String): The oauth token (could appear in the https urls).
|
||||
*/
|
||||
function gitUp(input) {
|
||||
var output = parseUrl(input);
|
||||
output.token = "";
|
||||
|
||||
var splits = output.user.split(":");
|
||||
if (splits.length === 2) {
|
||||
if (splits[1] === "x-oauth-basic") {
|
||||
output.token = splits[0];
|
||||
} else if (splits[0] === "x-token-auth") {
|
||||
output.token = splits[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (isSsh(output.protocols) || isSsh(input)) {
|
||||
output.protocol = "ssh";
|
||||
} else if (output.protocols.length) {
|
||||
output.protocol = output.protocols[0];
|
||||
} else {
|
||||
output.protocol = "file";
|
||||
}
|
||||
|
||||
output.href = output.href.replace(/\/$/, "");
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = gitUp;
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/publish';
|
||||
Reference in New Issue
Block a user