mirror of https://github.com/actions/cache.git
55005 lines
2.5 MiB
55005 lines
2.5 MiB
/******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ 1518:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
var m = o[Symbol.asyncIterator], i;
|
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0;
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
const exec = __importStar(__nccwpck_require__(1514));
|
|
const glob = __importStar(__nccwpck_require__(8090));
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
const fs = __importStar(__nccwpck_require__(7147));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const semver = __importStar(__nccwpck_require__(5911));
|
|
const util = __importStar(__nccwpck_require__(3837));
|
|
const uuid_1 = __nccwpck_require__(2155);
|
|
const constants_1 = __nccwpck_require__(8840);
|
|
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
|
function createTempDirectory() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
|
if (!tempDirectory) {
|
|
let baseLocation;
|
|
if (IS_WINDOWS) {
|
|
// On Windows use the USERPROFILE env variable
|
|
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
|
}
|
|
else {
|
|
if (process.platform === 'darwin') {
|
|
baseLocation = '/Users';
|
|
}
|
|
else {
|
|
baseLocation = '/home';
|
|
}
|
|
}
|
|
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
|
}
|
|
const dest = path.join(tempDirectory, (0, uuid_1.v4)());
|
|
yield io.mkdirP(dest);
|
|
return dest;
|
|
});
|
|
}
|
|
exports.createTempDirectory = createTempDirectory;
|
|
function getArchiveFileSizeInBytes(filePath) {
|
|
return fs.statSync(filePath).size;
|
|
}
|
|
exports.getArchiveFileSizeInBytes = getArchiveFileSizeInBytes;
|
|
function resolvePaths(patterns) {
|
|
var _a, e_1, _b, _c;
|
|
var _d;
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const paths = [];
|
|
const workspace = (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
|
|
const globber = yield glob.create(patterns.join('\n'), {
|
|
implicitDescendants: false
|
|
});
|
|
try {
|
|
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
|
|
_c = _g.value;
|
|
_e = false;
|
|
const file = _c;
|
|
const relativeFile = path
|
|
.relative(workspace, file)
|
|
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
|
core.debug(`Matched: ${relativeFile}`);
|
|
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
|
if (relativeFile === '') {
|
|
// path.relative returns empty string if workspace and file are equal
|
|
paths.push('.');
|
|
}
|
|
else {
|
|
paths.push(`${relativeFile}`);
|
|
}
|
|
}
|
|
}
|
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
finally {
|
|
try {
|
|
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
|
}
|
|
finally { if (e_1) throw e_1.error; }
|
|
}
|
|
return paths;
|
|
});
|
|
}
|
|
exports.resolvePaths = resolvePaths;
|
|
function unlinkFile(filePath) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return util.promisify(fs.unlink)(filePath);
|
|
});
|
|
}
|
|
exports.unlinkFile = unlinkFile;
|
|
function getVersion(app, additionalArgs = []) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
let versionOutput = '';
|
|
additionalArgs.push('--version');
|
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
|
|
try {
|
|
yield exec.exec(`${app}`, additionalArgs, {
|
|
ignoreReturnCode: true,
|
|
silent: true,
|
|
listeners: {
|
|
stdout: (data) => (versionOutput += data.toString()),
|
|
stderr: (data) => (versionOutput += data.toString())
|
|
}
|
|
});
|
|
}
|
|
catch (err) {
|
|
core.debug(err.message);
|
|
}
|
|
versionOutput = versionOutput.trim();
|
|
core.debug(versionOutput);
|
|
return versionOutput;
|
|
});
|
|
}
|
|
// Use zstandard if possible to maximize cache performance
|
|
function getCompressionMethod() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
|
const version = semver.clean(versionOutput);
|
|
core.debug(`zstd version: ${version}`);
|
|
if (versionOutput === '') {
|
|
return constants_1.CompressionMethod.Gzip;
|
|
}
|
|
else {
|
|
return constants_1.CompressionMethod.ZstdWithoutLong;
|
|
}
|
|
});
|
|
}
|
|
exports.getCompressionMethod = getCompressionMethod;
|
|
function getCacheFileName(compressionMethod) {
|
|
return compressionMethod === constants_1.CompressionMethod.Gzip
|
|
? constants_1.CacheFilename.Gzip
|
|
: constants_1.CacheFilename.Zstd;
|
|
}
|
|
exports.getCacheFileName = getCacheFileName;
|
|
function getGnuTarPathOnWindows() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (fs.existsSync(constants_1.GnuTarPathOnWindows)) {
|
|
return constants_1.GnuTarPathOnWindows;
|
|
}
|
|
const versionOutput = yield getVersion('tar');
|
|
return versionOutput.toLowerCase().includes('gnu tar') ? io.which('tar') : '';
|
|
});
|
|
}
|
|
exports.getGnuTarPathOnWindows = getGnuTarPathOnWindows;
|
|
function assertDefined(name, value) {
|
|
if (value === undefined) {
|
|
throw Error(`Expected ${name} but value was undefiend`);
|
|
}
|
|
return value;
|
|
}
|
|
exports.assertDefined = assertDefined;
|
|
function isGhes() {
|
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
|
const isGitHubHost = hostname === 'GITHUB.COM';
|
|
const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST');
|
|
return !isGitHubHost && !isGheHost;
|
|
}
|
|
exports.isGhes = isGhes;
|
|
//# sourceMappingURL=cacheUtils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8840:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = void 0;
|
|
var CacheFilename;
|
|
(function (CacheFilename) {
|
|
CacheFilename["Gzip"] = "cache.tgz";
|
|
CacheFilename["Zstd"] = "cache.tzst";
|
|
})(CacheFilename || (exports.CacheFilename = CacheFilename = {}));
|
|
var CompressionMethod;
|
|
(function (CompressionMethod) {
|
|
CompressionMethod["Gzip"] = "gzip";
|
|
// Long range mode was added to zstd in v1.3.2.
|
|
// This enum is for earlier version of zstd that does not have --long support
|
|
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
|
|
CompressionMethod["Zstd"] = "zstd";
|
|
})(CompressionMethod || (exports.CompressionMethod = CompressionMethod = {}));
|
|
var ArchiveToolType;
|
|
(function (ArchiveToolType) {
|
|
ArchiveToolType["GNU"] = "gnu";
|
|
ArchiveToolType["BSD"] = "bsd";
|
|
})(ArchiveToolType || (exports.ArchiveToolType = ArchiveToolType = {}));
|
|
// The default number of retry attempts.
|
|
exports.DefaultRetryAttempts = 2;
|
|
// The default delay in milliseconds between retry attempts.
|
|
exports.DefaultRetryDelay = 5000;
|
|
// Socket timeout in milliseconds during download. If no traffic is received
|
|
// over the socket during this period, the socket is destroyed and the download
|
|
// is aborted.
|
|
exports.SocketTimeout = 5000;
|
|
// The default path of GNUtar on hosted Windows runners
|
|
exports.GnuTarPathOnWindows = `${process.env['PROGRAMFILES']}\\Git\\usr\\bin\\tar.exe`;
|
|
// The default path of BSDtar on hosted Windows runners
|
|
exports.SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe`;
|
|
exports.TarFilename = 'cache.tar';
|
|
exports.ManifestFilename = 'manifest.txt';
|
|
//# sourceMappingURL=constants.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6490:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.createTar = exports.extractTar = exports.listTar = void 0;
|
|
const exec_1 = __nccwpck_require__(1514);
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
const fs_1 = __nccwpck_require__(7147);
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const utils = __importStar(__nccwpck_require__(1518));
|
|
const constants_1 = __nccwpck_require__(8840);
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
// Returns tar path and type: BSD or GNU
|
|
function getTarPath() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
switch (process.platform) {
|
|
case 'win32': {
|
|
const gnuTar = yield utils.getGnuTarPathOnWindows();
|
|
const systemTar = constants_1.SystemTarPathOnWindows;
|
|
if (gnuTar) {
|
|
// Use GNUtar as default on windows
|
|
return { path: gnuTar, type: constants_1.ArchiveToolType.GNU };
|
|
}
|
|
else if ((0, fs_1.existsSync)(systemTar)) {
|
|
return { path: systemTar, type: constants_1.ArchiveToolType.BSD };
|
|
}
|
|
break;
|
|
}
|
|
case 'darwin': {
|
|
const gnuTar = yield io.which('gtar', false);
|
|
if (gnuTar) {
|
|
// fix permission denied errors when extracting BSD tar archive with GNU tar - https://github.com/actions/cache/issues/527
|
|
return { path: gnuTar, type: constants_1.ArchiveToolType.GNU };
|
|
}
|
|
else {
|
|
return {
|
|
path: yield io.which('tar', true),
|
|
type: constants_1.ArchiveToolType.BSD
|
|
};
|
|
}
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
// Default assumption is GNU tar is present in path
|
|
return {
|
|
path: yield io.which('tar', true),
|
|
type: constants_1.ArchiveToolType.GNU
|
|
};
|
|
});
|
|
}
|
|
// Return arguments for tar as per tarPath, compressionMethod, method type and os
|
|
function getTarArgs(tarPath, compressionMethod, type, archivePath = '') {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const args = [`"${tarPath.path}"`];
|
|
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
|
const tarFile = 'cache.tar';
|
|
const workingDirectory = getWorkingDirectory();
|
|
// Speficic args for BSD tar on windows for workaround
|
|
const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD &&
|
|
compressionMethod !== constants_1.CompressionMethod.Gzip &&
|
|
IS_WINDOWS;
|
|
// Method specific args
|
|
switch (type) {
|
|
case 'create':
|
|
args.push('--posix', '-cf', BSD_TAR_ZSTD
|
|
? tarFile
|
|
: cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--exclude', BSD_TAR_ZSTD
|
|
? tarFile
|
|
: cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--files-from', constants_1.ManifestFilename);
|
|
break;
|
|
case 'extract':
|
|
args.push('-xf', BSD_TAR_ZSTD
|
|
? tarFile
|
|
: archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'));
|
|
break;
|
|
case 'list':
|
|
args.push('-tf', BSD_TAR_ZSTD
|
|
? tarFile
|
|
: archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P');
|
|
break;
|
|
}
|
|
// Platform specific args
|
|
if (tarPath.type === constants_1.ArchiveToolType.GNU) {
|
|
switch (process.platform) {
|
|
case 'win32':
|
|
args.push('--force-local');
|
|
break;
|
|
case 'darwin':
|
|
args.push('--delay-directory-restore');
|
|
break;
|
|
}
|
|
}
|
|
return args;
|
|
});
|
|
}
|
|
// Returns commands to run tar and compression program
|
|
function getCommands(compressionMethod, type, archivePath = '') {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
let args;
|
|
const tarPath = yield getTarPath();
|
|
const tarArgs = yield getTarArgs(tarPath, compressionMethod, type, archivePath);
|
|
const compressionArgs = type !== 'create'
|
|
? yield getDecompressionProgram(tarPath, compressionMethod, archivePath)
|
|
: yield getCompressionProgram(tarPath, compressionMethod);
|
|
const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD &&
|
|
compressionMethod !== constants_1.CompressionMethod.Gzip &&
|
|
IS_WINDOWS;
|
|
if (BSD_TAR_ZSTD && type !== 'create') {
|
|
args = [[...compressionArgs].join(' '), [...tarArgs].join(' ')];
|
|
}
|
|
else {
|
|
args = [[...tarArgs].join(' '), [...compressionArgs].join(' ')];
|
|
}
|
|
if (BSD_TAR_ZSTD) {
|
|
return args;
|
|
}
|
|
return [args.join(' ')];
|
|
});
|
|
}
|
|
function getWorkingDirectory() {
|
|
var _a;
|
|
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
|
|
}
|
|
// Common function for extractTar and listTar to get the compression method
|
|
function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// -d: Decompress.
|
|
// unzstd is equivalent to 'zstd -d'
|
|
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
|
// Using 30 here because we also support 32-bit self-hosted runners.
|
|
const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD &&
|
|
compressionMethod !== constants_1.CompressionMethod.Gzip &&
|
|
IS_WINDOWS;
|
|
switch (compressionMethod) {
|
|
case constants_1.CompressionMethod.Zstd:
|
|
return BSD_TAR_ZSTD
|
|
? [
|
|
'zstd -d --long=30 --force -o',
|
|
constants_1.TarFilename,
|
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
|
]
|
|
: [
|
|
'--use-compress-program',
|
|
IS_WINDOWS ? '"zstd -d --long=30"' : 'unzstd --long=30'
|
|
];
|
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
|
return BSD_TAR_ZSTD
|
|
? [
|
|
'zstd -d --force -o',
|
|
constants_1.TarFilename,
|
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
|
]
|
|
: ['--use-compress-program', IS_WINDOWS ? '"zstd -d"' : 'unzstd'];
|
|
default:
|
|
return ['-z'];
|
|
}
|
|
});
|
|
}
|
|
// Used for creating the archive
|
|
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
|
// zstdmt is equivalent to 'zstd -T0'
|
|
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
|
// Using 30 here because we also support 32-bit self-hosted runners.
|
|
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
|
function getCompressionProgram(tarPath, compressionMethod) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
|
const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD &&
|
|
compressionMethod !== constants_1.CompressionMethod.Gzip &&
|
|
IS_WINDOWS;
|
|
switch (compressionMethod) {
|
|
case constants_1.CompressionMethod.Zstd:
|
|
return BSD_TAR_ZSTD
|
|
? [
|
|
'zstd -T0 --long=30 --force -o',
|
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
|
constants_1.TarFilename
|
|
]
|
|
: [
|
|
'--use-compress-program',
|
|
IS_WINDOWS ? '"zstd -T0 --long=30"' : 'zstdmt --long=30'
|
|
];
|
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
|
return BSD_TAR_ZSTD
|
|
? [
|
|
'zstd -T0 --force -o',
|
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
|
constants_1.TarFilename
|
|
]
|
|
: ['--use-compress-program', IS_WINDOWS ? '"zstd -T0"' : 'zstdmt'];
|
|
default:
|
|
return ['-z'];
|
|
}
|
|
});
|
|
}
|
|
// Executes all commands as separate processes
|
|
function execCommands(commands, cwd) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
for (const command of commands) {
|
|
try {
|
|
yield (0, exec_1.exec)(command, undefined, {
|
|
cwd,
|
|
env: Object.assign(Object.assign({}, process.env), { MSYS: 'winsymlinks:nativestrict' })
|
|
});
|
|
}
|
|
catch (error) {
|
|
throw new Error(`${command.split(' ')[0]} failed with error: ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
// List the contents of a tar
|
|
function listTar(archivePath, compressionMethod) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const commands = yield getCommands(compressionMethod, 'list', archivePath);
|
|
yield execCommands(commands);
|
|
});
|
|
}
|
|
exports.listTar = listTar;
|
|
// Extract a tar
|
|
function extractTar(archivePath, compressionMethod) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// Create directory to extract tar into
|
|
const workingDirectory = getWorkingDirectory();
|
|
yield io.mkdirP(workingDirectory);
|
|
const commands = yield getCommands(compressionMethod, 'extract', archivePath);
|
|
yield execCommands(commands);
|
|
});
|
|
}
|
|
exports.extractTar = extractTar;
|
|
// Create a tar
|
|
function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// Write source directories to manifest.txt to avoid command length limits
|
|
(0, fs_1.writeFileSync)(path.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join('\n'));
|
|
const commands = yield getCommands(compressionMethod, 'create');
|
|
yield execCommands(commands, archiveFolder);
|
|
});
|
|
}
|
|
exports.createTar = createTar;
|
|
//# sourceMappingURL=tar.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7351:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.issue = exports.issueCommand = void 0;
|
|
const os = __importStar(__nccwpck_require__(2037));
|
|
const utils_1 = __nccwpck_require__(5278);
|
|
/**
|
|
* Commands
|
|
*
|
|
* Command Format:
|
|
* ::name key=value,key=value::message
|
|
*
|
|
* Examples:
|
|
* ::warning::This is the message
|
|
* ::set-env name=MY_VAR::some value
|
|
*/
|
|
function issueCommand(command, properties, message) {
|
|
const cmd = new Command(command, properties, message);
|
|
process.stdout.write(cmd.toString() + os.EOL);
|
|
}
|
|
exports.issueCommand = issueCommand;
|
|
function issue(name, message = '') {
|
|
issueCommand(name, {}, message);
|
|
}
|
|
exports.issue = issue;
|
|
const CMD_STRING = '::';
|
|
class Command {
|
|
constructor(command, properties, message) {
|
|
if (!command) {
|
|
command = 'missing.command';
|
|
}
|
|
this.command = command;
|
|
this.properties = properties;
|
|
this.message = message;
|
|
}
|
|
toString() {
|
|
let cmdStr = CMD_STRING + this.command;
|
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
cmdStr += ' ';
|
|
let first = true;
|
|
for (const key in this.properties) {
|
|
if (this.properties.hasOwnProperty(key)) {
|
|
const val = this.properties[key];
|
|
if (val) {
|
|
if (first) {
|
|
first = false;
|
|
}
|
|
else {
|
|
cmdStr += ',';
|
|
}
|
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
|
return cmdStr;
|
|
}
|
|
}
|
|
function escapeData(s) {
|
|
return utils_1.toCommandValue(s)
|
|
.replace(/%/g, '%25')
|
|
.replace(/\r/g, '%0D')
|
|
.replace(/\n/g, '%0A');
|
|
}
|
|
function escapeProperty(s) {
|
|
return utils_1.toCommandValue(s)
|
|
.replace(/%/g, '%25')
|
|
.replace(/\r/g, '%0D')
|
|
.replace(/\n/g, '%0A')
|
|
.replace(/:/g, '%3A')
|
|
.replace(/,/g, '%2C');
|
|
}
|
|
//# sourceMappingURL=command.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2186:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
const command_1 = __nccwpck_require__(7351);
|
|
const file_command_1 = __nccwpck_require__(717);
|
|
const utils_1 = __nccwpck_require__(5278);
|
|
const os = __importStar(__nccwpck_require__(2037));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const oidc_utils_1 = __nccwpck_require__(8041);
|
|
/**
|
|
* The code to exit an action
|
|
*/
|
|
var ExitCode;
|
|
(function (ExitCode) {
|
|
/**
|
|
* A code indicating that the action was successful
|
|
*/
|
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
/**
|
|
* A code indicating that the action was a failure
|
|
*/
|
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
//-----------------------------------------------------------------------
|
|
// Variables
|
|
//-----------------------------------------------------------------------
|
|
/**
|
|
* Sets env variable for this action and future actions in the job
|
|
* @param name the name of the variable to set
|
|
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
function exportVariable(name, val) {
|
|
const convertedVal = utils_1.toCommandValue(val);
|
|
process.env[name] = convertedVal;
|
|
const filePath = process.env['GITHUB_ENV'] || '';
|
|
if (filePath) {
|
|
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
|
|
}
|
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
|
}
|
|
exports.exportVariable = exportVariable;
|
|
/**
|
|
* Registers a secret which will get masked from logs
|
|
* @param secret value of the secret
|
|
*/
|
|
function setSecret(secret) {
|
|
command_1.issueCommand('add-mask', {}, secret);
|
|
}
|
|
exports.setSecret = setSecret;
|
|
/**
|
|
* Prepends inputPath to the PATH (for this action and future actions)
|
|
* @param inputPath
|
|
*/
|
|
function addPath(inputPath) {
|
|
const filePath = process.env['GITHUB_PATH'] || '';
|
|
if (filePath) {
|
|
file_command_1.issueFileCommand('PATH', inputPath);
|
|
}
|
|
else {
|
|
command_1.issueCommand('add-path', {}, inputPath);
|
|
}
|
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
}
|
|
exports.addPath = addPath;
|
|
/**
|
|
* Gets the value of an input.
|
|
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
* Returns an empty string if the value is not defined.
|
|
*
|
|
* @param name name of the input to get
|
|
* @param options optional. See InputOptions.
|
|
* @returns string
|
|
*/
|
|
function getInput(name, options) {
|
|
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
if (options && options.required && !val) {
|
|
throw new Error(`Input required and not supplied: ${name}`);
|
|
}
|
|
if (options && options.trimWhitespace === false) {
|
|
return val;
|
|
}
|
|
return val.trim();
|
|
}
|
|
exports.getInput = getInput;
|
|
/**
|
|
* Gets the values of an multiline input. Each value is also trimmed.
|
|
*
|
|
* @param name name of the input to get
|
|
* @param options optional. See InputOptions.
|
|
* @returns string[]
|
|
*
|
|
*/
|
|
function getMultilineInput(name, options) {
|
|
const inputs = getInput(name, options)
|
|
.split('\n')
|
|
.filter(x => x !== '');
|
|
if (options && options.trimWhitespace === false) {
|
|
return inputs;
|
|
}
|
|
return inputs.map(input => input.trim());
|
|
}
|
|
exports.getMultilineInput = getMultilineInput;
|
|
/**
|
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
* The return value is also in boolean type.
|
|
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
*
|
|
* @param name name of the input to get
|
|
* @param options optional. See InputOptions.
|
|
* @returns boolean
|
|
*/
|
|
function getBooleanInput(name, options) {
|
|
const trueValue = ['true', 'True', 'TRUE'];
|
|
const falseValue = ['false', 'False', 'FALSE'];
|
|
const val = getInput(name, options);
|
|
if (trueValue.includes(val))
|
|
return true;
|
|
if (falseValue.includes(val))
|
|
return false;
|
|
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
|
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
}
|
|
exports.getBooleanInput = getBooleanInput;
|
|
/**
|
|
* Sets the value of an output.
|
|
*
|
|
* @param name name of the output to set
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
function setOutput(name, value) {
|
|
const filePath = process.env['GITHUB_OUTPUT'] || '';
|
|
if (filePath) {
|
|
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
|
|
}
|
|
process.stdout.write(os.EOL);
|
|
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
|
|
}
|
|
exports.setOutput = setOutput;
|
|
/**
|
|
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
*
|
|
*/
|
|
function setCommandEcho(enabled) {
|
|
command_1.issue('echo', enabled ? 'on' : 'off');
|
|
}
|
|
exports.setCommandEcho = setCommandEcho;
|
|
//-----------------------------------------------------------------------
|
|
// Results
|
|
//-----------------------------------------------------------------------
|
|
/**
|
|
* Sets the action status to failed.
|
|
* When the action exits it will be with an exit code of 1
|
|
* @param message add error issue message
|
|
*/
|
|
function setFailed(message) {
|
|
process.exitCode = ExitCode.Failure;
|
|
error(message);
|
|
}
|
|
exports.setFailed = setFailed;
|
|
//-----------------------------------------------------------------------
|
|
// Logging Commands
|
|
//-----------------------------------------------------------------------
|
|
/**
|
|
* Gets whether Actions Step Debug is on or not
|
|
*/
|
|
function isDebug() {
|
|
return process.env['RUNNER_DEBUG'] === '1';
|
|
}
|
|
exports.isDebug = isDebug;
|
|
/**
|
|
* Writes debug message to user log
|
|
* @param message debug message
|
|
*/
|
|
function debug(message) {
|
|
command_1.issueCommand('debug', {}, message);
|
|
}
|
|
exports.debug = debug;
|
|
/**
|
|
* Adds an error issue
|
|
* @param message error issue message. Errors will be converted to string via toString()
|
|
* @param properties optional properties to add to the annotation.
|
|
*/
|
|
function error(message, properties = {}) {
|
|
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
}
|
|
exports.error = error;
|
|
/**
|
|
* Adds a warning issue
|
|
* @param message warning issue message. Errors will be converted to string via toString()
|
|
* @param properties optional properties to add to the annotation.
|
|
*/
|
|
function warning(message, properties = {}) {
|
|
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
}
|
|
exports.warning = warning;
|
|
/**
|
|
* Adds a notice issue
|
|
* @param message notice issue message. Errors will be converted to string via toString()
|
|
* @param properties optional properties to add to the annotation.
|
|
*/
|
|
function notice(message, properties = {}) {
|
|
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
}
|
|
exports.notice = notice;
|
|
/**
|
|
* Writes info to log with console.log.
|
|
* @param message info message
|
|
*/
|
|
function info(message) {
|
|
process.stdout.write(message + os.EOL);
|
|
}
|
|
exports.info = info;
|
|
/**
|
|
* Begin an output group.
|
|
*
|
|
* Output until the next `groupEnd` will be foldable in this group
|
|
*
|
|
* @param name The name of the output group
|
|
*/
|
|
function startGroup(name) {
|
|
command_1.issue('group', name);
|
|
}
|
|
exports.startGroup = startGroup;
|
|
/**
|
|
* End an output group.
|
|
*/
|
|
function endGroup() {
|
|
command_1.issue('endgroup');
|
|
}
|
|
exports.endGroup = endGroup;
|
|
/**
|
|
* Wrap an asynchronous function call in a group.
|
|
*
|
|
* Returns the same type as the function itself.
|
|
*
|
|
* @param name The name of the group
|
|
* @param fn The function to wrap in the group
|
|
*/
|
|
function group(name, fn) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
startGroup(name);
|
|
let result;
|
|
try {
|
|
result = yield fn();
|
|
}
|
|
finally {
|
|
endGroup();
|
|
}
|
|
return result;
|
|
});
|
|
}
|
|
exports.group = group;
|
|
//-----------------------------------------------------------------------
|
|
// Wrapper action state
|
|
//-----------------------------------------------------------------------
|
|
/**
|
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
*
|
|
* @param name name of the state to store
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
function saveState(name, value) {
|
|
const filePath = process.env['GITHUB_STATE'] || '';
|
|
if (filePath) {
|
|
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
|
|
}
|
|
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
|
|
}
|
|
exports.saveState = saveState;
|
|
/**
|
|
* Gets the value of an state set by this action's main execution.
|
|
*
|
|
* @param name name of the state to get
|
|
* @returns string
|
|
*/
|
|
function getState(name) {
|
|
return process.env[`STATE_${name}`] || '';
|
|
}
|
|
exports.getState = getState;
|
|
function getIDToken(aud) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return yield oidc_utils_1.OidcClient.getIDToken(aud);
|
|
});
|
|
}
|
|
exports.getIDToken = getIDToken;
|
|
/**
|
|
* Summary exports
|
|
*/
|
|
var summary_1 = __nccwpck_require__(1327);
|
|
Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
|
|
/**
|
|
* @deprecated use core.summary
|
|
*/
|
|
var summary_2 = __nccwpck_require__(1327);
|
|
Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
|
|
/**
|
|
* Path exports
|
|
*/
|
|
var path_utils_1 = __nccwpck_require__(2981);
|
|
Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
|
|
Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
|
|
Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
|
|
//# sourceMappingURL=core.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 717:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
// For internal use, subject to change.
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
|
|
// We use any as a valid input type
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
const fs = __importStar(__nccwpck_require__(7147));
|
|
const os = __importStar(__nccwpck_require__(2037));
|
|
const uuid_1 = __nccwpck_require__(8974);
|
|
const utils_1 = __nccwpck_require__(5278);
|
|
function issueFileCommand(command, message) {
|
|
const filePath = process.env[`GITHUB_${command}`];
|
|
if (!filePath) {
|
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
|
}
|
|
if (!fs.existsSync(filePath)) {
|
|
throw new Error(`Missing file at path: ${filePath}`);
|
|
}
|
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
|
encoding: 'utf8'
|
|
});
|
|
}
|
|
exports.issueFileCommand = issueFileCommand;
|
|
function prepareKeyValueMessage(key, value) {
|
|
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
|
const convertedValue = utils_1.toCommandValue(value);
|
|
// These should realistically never happen, but just in case someone finds a
|
|
// way to exploit uuid generation let's not allow keys or values that contain
|
|
// the delimiter.
|
|
if (key.includes(delimiter)) {
|
|
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
|
}
|
|
if (convertedValue.includes(delimiter)) {
|
|
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
|
}
|
|
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
|
|
}
|
|
exports.prepareKeyValueMessage = prepareKeyValueMessage;
|
|
//# sourceMappingURL=file-command.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8041:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.OidcClient = void 0;
|
|
const http_client_1 = __nccwpck_require__(6255);
|
|
const auth_1 = __nccwpck_require__(5526);
|
|
const core_1 = __nccwpck_require__(2186);
|
|
class OidcClient {
|
|
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
|
const requestOptions = {
|
|
allowRetries: allowRetry,
|
|
maxRetries: maxRetry
|
|
};
|
|
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
|
|
}
|
|
static getRequestToken() {
|
|
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
|
|
if (!token) {
|
|
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
|
|
}
|
|
return token;
|
|
}
|
|
static getIDTokenUrl() {
|
|
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
|
|
if (!runtimeUrl) {
|
|
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
|
|
}
|
|
return runtimeUrl;
|
|
}
|
|
static getCall(id_token_url) {
|
|
var _a;
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const httpclient = OidcClient.createHttpClient();
|
|
const res = yield httpclient
|
|
.getJson(id_token_url)
|
|
.catch(error => {
|
|
throw new Error(`Failed to get ID Token. \n
|
|
Error Code : ${error.statusCode}\n
|
|
Error Message: ${error.message}`);
|
|
});
|
|
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
|
if (!id_token) {
|
|
throw new Error('Response json body do not have ID Token field');
|
|
}
|
|
return id_token;
|
|
});
|
|
}
|
|
static getIDToken(audience) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
try {
|
|
// New ID Token is requested from action service
|
|
let id_token_url = OidcClient.getIDTokenUrl();
|
|
if (audience) {
|
|
const encodedAudience = encodeURIComponent(audience);
|
|
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
|
|
}
|
|
core_1.debug(`ID token url is ${id_token_url}`);
|
|
const id_token = yield OidcClient.getCall(id_token_url);
|
|
core_1.setSecret(id_token);
|
|
return id_token;
|
|
}
|
|
catch (error) {
|
|
throw new Error(`Error message: ${error.message}`);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
exports.OidcClient = OidcClient;
|
|
//# sourceMappingURL=oidc-utils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2981:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
/**
|
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
|
* replaced with /.
|
|
*
|
|
* @param pth. Path to transform.
|
|
* @return string Posix path.
|
|
*/
|
|
function toPosixPath(pth) {
|
|
return pth.replace(/[\\]/g, '/');
|
|
}
|
|
exports.toPosixPath = toPosixPath;
|
|
/**
|
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
|
* replaced with \\.
|
|
*
|
|
* @param pth. Path to transform.
|
|
* @return string Win32 path.
|
|
*/
|
|
function toWin32Path(pth) {
|
|
return pth.replace(/[/]/g, '\\');
|
|
}
|
|
exports.toWin32Path = toWin32Path;
|
|
/**
|
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
|
* this by replacing instances of / and \ with the platform-specific path
|
|
* separator.
|
|
*
|
|
* @param pth The path to platformize.
|
|
* @return string The platform-specific path.
|
|
*/
|
|
function toPlatformPath(pth) {
|
|
return pth.replace(/[/\\]/g, path.sep);
|
|
}
|
|
exports.toPlatformPath = toPlatformPath;
|
|
//# sourceMappingURL=path-utils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1327:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
|
|
const os_1 = __nccwpck_require__(2037);
|
|
const fs_1 = __nccwpck_require__(7147);
|
|
const { access, appendFile, writeFile } = fs_1.promises;
|
|
exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
|
|
exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
|
|
class Summary {
|
|
constructor() {
|
|
this._buffer = '';
|
|
}
|
|
/**
|
|
* Finds the summary file path from the environment, rejects if env var is not found or file does not exist
|
|
* Also checks r/w permissions.
|
|
*
|
|
* @returns step summary file path
|
|
*/
|
|
filePath() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (this._filePath) {
|
|
return this._filePath;
|
|
}
|
|
const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
|
|
if (!pathFromEnv) {
|
|
throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
|
|
}
|
|
try {
|
|
yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
|
|
}
|
|
catch (_a) {
|
|
throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
|
|
}
|
|
this._filePath = pathFromEnv;
|
|
return this._filePath;
|
|
});
|
|
}
|
|
/**
|
|
* Wraps content in an HTML tag, adding any HTML attributes
|
|
*
|
|
* @param {string} tag HTML tag to wrap
|
|
* @param {string | null} content content within the tag
|
|
* @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
|
|
*
|
|
* @returns {string} content wrapped in HTML element
|
|
*/
|
|
wrap(tag, content, attrs = {}) {
|
|
const htmlAttrs = Object.entries(attrs)
|
|
.map(([key, value]) => ` ${key}="${value}"`)
|
|
.join('');
|
|
if (!content) {
|
|
return `<${tag}${htmlAttrs}>`;
|
|
}
|
|
return `<${tag}${htmlAttrs}>${content}</${tag}>`;
|
|
}
|
|
/**
|
|
* Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
|
|
*
|
|
* @param {SummaryWriteOptions} [options] (optional) options for write operation
|
|
*
|
|
* @returns {Promise<Summary>} summary instance
|
|
*/
|
|
write(options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
|
|
const filePath = yield this.filePath();
|
|
const writeFunc = overwrite ? writeFile : appendFile;
|
|
yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
|
|
return this.emptyBuffer();
|
|
});
|
|
}
|
|
/**
|
|
* Clears the summary buffer and wipes the summary file
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
clear() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.emptyBuffer().write({ overwrite: true });
|
|
});
|
|
}
|
|
/**
|
|
* Returns the current summary buffer as a string
|
|
*
|
|
* @returns {string} string of summary buffer
|
|
*/
|
|
stringify() {
|
|
return this._buffer;
|
|
}
|
|
/**
|
|
* If the summary buffer is empty
|
|
*
|
|
* @returns {boolen} true if the buffer is empty
|
|
*/
|
|
isEmptyBuffer() {
|
|
return this._buffer.length === 0;
|
|
}
|
|
/**
|
|
* Resets the summary buffer without writing to summary file
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
emptyBuffer() {
|
|
this._buffer = '';
|
|
return this;
|
|
}
|
|
/**
|
|
* Adds raw text to the summary buffer
|
|
*
|
|
* @param {string} text content to add
|
|
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addRaw(text, addEOL = false) {
|
|
this._buffer += text;
|
|
return addEOL ? this.addEOL() : this;
|
|
}
|
|
/**
|
|
* Adds the operating system-specific end-of-line marker to the buffer
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addEOL() {
|
|
return this.addRaw(os_1.EOL);
|
|
}
|
|
/**
|
|
* Adds an HTML codeblock to the summary buffer
|
|
*
|
|
* @param {string} code content to render within fenced code block
|
|
* @param {string} lang (optional) language to syntax highlight code
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addCodeBlock(code, lang) {
|
|
const attrs = Object.assign({}, (lang && { lang }));
|
|
const element = this.wrap('pre', this.wrap('code', code), attrs);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML list to the summary buffer
|
|
*
|
|
* @param {string[]} items list of items to render
|
|
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addList(items, ordered = false) {
|
|
const tag = ordered ? 'ol' : 'ul';
|
|
const listItems = items.map(item => this.wrap('li', item)).join('');
|
|
const element = this.wrap(tag, listItems);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML table to the summary buffer
|
|
*
|
|
* @param {SummaryTableCell[]} rows table rows
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addTable(rows) {
|
|
const tableBody = rows
|
|
.map(row => {
|
|
const cells = row
|
|
.map(cell => {
|
|
if (typeof cell === 'string') {
|
|
return this.wrap('td', cell);
|
|
}
|
|
const { header, data, colspan, rowspan } = cell;
|
|
const tag = header ? 'th' : 'td';
|
|
const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
|
|
return this.wrap(tag, data, attrs);
|
|
})
|
|
.join('');
|
|
return this.wrap('tr', cells);
|
|
})
|
|
.join('');
|
|
const element = this.wrap('table', tableBody);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds a collapsable HTML details element to the summary buffer
|
|
*
|
|
* @param {string} label text for the closed state
|
|
* @param {string} content collapsable content
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addDetails(label, content) {
|
|
const element = this.wrap('details', this.wrap('summary', label) + content);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML image tag to the summary buffer
|
|
*
|
|
* @param {string} src path to the image you to embed
|
|
* @param {string} alt text description of the image
|
|
* @param {SummaryImageOptions} options (optional) addition image attributes
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addImage(src, alt, options) {
|
|
const { width, height } = options || {};
|
|
const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
|
|
const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML section heading element
|
|
*
|
|
* @param {string} text heading text
|
|
* @param {number | string} [level=1] (optional) the heading level, default: 1
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addHeading(text, level) {
|
|
const tag = `h${level}`;
|
|
const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
|
|
? tag
|
|
: 'h1';
|
|
const element = this.wrap(allowedTag, text);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML thematic break (<hr>) to the summary buffer
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addSeparator() {
|
|
const element = this.wrap('hr', null);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML line break (<br>) to the summary buffer
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addBreak() {
|
|
const element = this.wrap('br', null);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML blockquote to the summary buffer
|
|
*
|
|
* @param {string} text quote text
|
|
* @param {string} cite (optional) citation url
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addQuote(text, cite) {
|
|
const attrs = Object.assign({}, (cite && { cite }));
|
|
const element = this.wrap('blockquote', text, attrs);
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
/**
|
|
* Adds an HTML anchor tag to the summary buffer
|
|
*
|
|
* @param {string} text link text/content
|
|
* @param {string} href hyperlink
|
|
*
|
|
* @returns {Summary} summary instance
|
|
*/
|
|
addLink(text, href) {
|
|
const element = this.wrap('a', text, { href });
|
|
return this.addRaw(element).addEOL();
|
|
}
|
|
}
|
|
const _summary = new Summary();
|
|
/**
|
|
* @deprecated use `core.summary`
|
|
*/
|
|
exports.markdownSummary = _summary;
|
|
exports.summary = _summary;
|
|
//# sourceMappingURL=summary.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5278:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
// We use any as a valid input type
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.toCommandProperties = exports.toCommandValue = void 0;
|
|
/**
|
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
* @param input input to sanitize into a string
|
|
*/
|
|
function toCommandValue(input) {
|
|
if (input === null || input === undefined) {
|
|
return '';
|
|
}
|
|
else if (typeof input === 'string' || input instanceof String) {
|
|
return input;
|
|
}
|
|
return JSON.stringify(input);
|
|
}
|
|
exports.toCommandValue = toCommandValue;
|
|
/**
|
|
*
|
|
* @param annotationProperties
|
|
* @returns The command properties to send with the actual annotation command
|
|
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
*/
|
|
function toCommandProperties(annotationProperties) {
|
|
if (!Object.keys(annotationProperties).length) {
|
|
return {};
|
|
}
|
|
return {
|
|
title: annotationProperties.title,
|
|
file: annotationProperties.file,
|
|
line: annotationProperties.startLine,
|
|
endLine: annotationProperties.endLine,
|
|
col: annotationProperties.startColumn,
|
|
endColumn: annotationProperties.endColumn
|
|
};
|
|
}
|
|
exports.toCommandProperties = toCommandProperties;
|
|
//# sourceMappingURL=utils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8974:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
Object.defineProperty(exports, "v1", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _v.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "v3", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _v2.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "v4", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _v3.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "v5", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _v4.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "NIL", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _nil.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "version", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _version.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "validate", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _validate.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "stringify", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _stringify.default;
|
|
}
|
|
}));
|
|
Object.defineProperty(exports, "parse", ({
|
|
enumerable: true,
|
|
get: function () {
|
|
return _parse.default;
|
|
}
|
|
}));
|
|
|
|
var _v = _interopRequireDefault(__nccwpck_require__(1595));
|
|
|
|
var _v2 = _interopRequireDefault(__nccwpck_require__(6993));
|
|
|
|
var _v3 = _interopRequireDefault(__nccwpck_require__(1472));
|
|
|
|
var _v4 = _interopRequireDefault(__nccwpck_require__(6217));
|
|
|
|
var _nil = _interopRequireDefault(__nccwpck_require__(2381));
|
|
|
|
var _version = _interopRequireDefault(__nccwpck_require__(427));
|
|
|
|
var _validate = _interopRequireDefault(__nccwpck_require__(2609));
|
|
|
|
var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
|
|
|
|
var _parse = _interopRequireDefault(__nccwpck_require__(6385));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5842:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function md5(bytes) {
|
|
if (Array.isArray(bytes)) {
|
|
bytes = Buffer.from(bytes);
|
|
} else if (typeof bytes === 'string') {
|
|
bytes = Buffer.from(bytes, 'utf8');
|
|
}
|
|
|
|
return _crypto.default.createHash('md5').update(bytes).digest();
|
|
}
|
|
|
|
var _default = md5;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2381:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
var _default = '00000000-0000-0000-0000-000000000000';
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6385:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _validate = _interopRequireDefault(__nccwpck_require__(2609));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function parse(uuid) {
|
|
if (!(0, _validate.default)(uuid)) {
|
|
throw TypeError('Invalid UUID');
|
|
}
|
|
|
|
let v;
|
|
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
|
|
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
arr[1] = v >>> 16 & 0xff;
|
|
arr[2] = v >>> 8 & 0xff;
|
|
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
|
|
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
|
|
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
|
|
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
|
|
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
arr[11] = v / 0x100000000 & 0xff;
|
|
arr[12] = v >>> 24 & 0xff;
|
|
arr[13] = v >>> 16 & 0xff;
|
|
arr[14] = v >>> 8 & 0xff;
|
|
arr[15] = v & 0xff;
|
|
return arr;
|
|
}
|
|
|
|
var _default = parse;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6230:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9784:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = rng;
|
|
|
|
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
|
|
|
|
let poolPtr = rnds8Pool.length;
|
|
|
|
function rng() {
|
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
_crypto.default.randomFillSync(rnds8Pool);
|
|
|
|
poolPtr = 0;
|
|
}
|
|
|
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8844:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function sha1(bytes) {
|
|
if (Array.isArray(bytes)) {
|
|
bytes = Buffer.from(bytes);
|
|
} else if (typeof bytes === 'string') {
|
|
bytes = Buffer.from(bytes, 'utf8');
|
|
}
|
|
|
|
return _crypto.default.createHash('sha1').update(bytes).digest();
|
|
}
|
|
|
|
var _default = sha1;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1458:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _validate = _interopRequireDefault(__nccwpck_require__(2609));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
/**
|
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
*/
|
|
const byteToHex = [];
|
|
|
|
for (let i = 0; i < 256; ++i) {
|
|
byteToHex.push((i + 0x100).toString(16).substr(1));
|
|
}
|
|
|
|
function stringify(arr, offset = 0) {
|
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
// of the following:
|
|
// - One or more input array values don't map to a hex octet (leading to
|
|
// "undefined" in the uuid)
|
|
// - Invalid input values for the RFC `version` or `variant` fields
|
|
|
|
if (!(0, _validate.default)(uuid)) {
|
|
throw TypeError('Stringified UUID is invalid');
|
|
}
|
|
|
|
return uuid;
|
|
}
|
|
|
|
var _default = stringify;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1595:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _rng = _interopRequireDefault(__nccwpck_require__(9784));
|
|
|
|
var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
// **`v1()` - Generate time-based UUID**
|
|
//
|
|
// Inspired by https://github.com/LiosK/UUID.js
|
|
// and http://docs.python.org/library/uuid.html
|
|
let _nodeId;
|
|
|
|
let _clockseq; // Previous uuid creation time
|
|
|
|
|
|
let _lastMSecs = 0;
|
|
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
|
|
|
function v1(options, buf, offset) {
|
|
let i = buf && offset || 0;
|
|
const b = buf || new Array(16);
|
|
options = options || {};
|
|
let node = options.node || _nodeId;
|
|
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
// specified. We do this lazily to minimize issues related to insufficient
|
|
// system entropy. See #189
|
|
|
|
if (node == null || clockseq == null) {
|
|
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
|
|
if (node == null) {
|
|
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
}
|
|
|
|
if (clockseq == null) {
|
|
// Per 4.2.2, randomize (14 bit) clockseq
|
|
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
}
|
|
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
|
|
|
|
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
// cycle to simulate higher resolution clock
|
|
|
|
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
|
|
|
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
|
|
if (dt < 0 && options.clockseq === undefined) {
|
|
clockseq = clockseq + 1 & 0x3fff;
|
|
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
// time interval
|
|
|
|
|
|
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
nsecs = 0;
|
|
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
|
|
|
|
|
if (nsecs >= 10000) {
|
|
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
}
|
|
|
|
_lastMSecs = msecs;
|
|
_lastNSecs = nsecs;
|
|
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
|
|
msecs += 12219292800000; // `time_low`
|
|
|
|
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
b[i++] = tl >>> 24 & 0xff;
|
|
b[i++] = tl >>> 16 & 0xff;
|
|
b[i++] = tl >>> 8 & 0xff;
|
|
b[i++] = tl & 0xff; // `time_mid`
|
|
|
|
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
b[i++] = tmh >>> 8 & 0xff;
|
|
b[i++] = tmh & 0xff; // `time_high_and_version`
|
|
|
|
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
|
|
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
|
|
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
|
|
|
b[i++] = clockseq & 0xff; // `node`
|
|
|
|
for (let n = 0; n < 6; ++n) {
|
|
b[i + n] = node[n];
|
|
}
|
|
|
|
return buf || (0, _stringify.default)(b);
|
|
}
|
|
|
|
var _default = v1;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6993:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _v = _interopRequireDefault(__nccwpck_require__(5920));
|
|
|
|
var _md = _interopRequireDefault(__nccwpck_require__(5842));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
var _default = v3;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5920:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = _default;
|
|
exports.URL = exports.DNS = void 0;
|
|
|
|
var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
|
|
|
|
var _parse = _interopRequireDefault(__nccwpck_require__(6385));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function stringToBytes(str) {
|
|
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
|
|
const bytes = [];
|
|
|
|
for (let i = 0; i < str.length; ++i) {
|
|
bytes.push(str.charCodeAt(i));
|
|
}
|
|
|
|
return bytes;
|
|
}
|
|
|
|
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
exports.DNS = DNS;
|
|
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
exports.URL = URL;
|
|
|
|
function _default(name, version, hashfunc) {
|
|
function generateUUID(value, namespace, buf, offset) {
|
|
if (typeof value === 'string') {
|
|
value = stringToBytes(value);
|
|
}
|
|
|
|
if (typeof namespace === 'string') {
|
|
namespace = (0, _parse.default)(namespace);
|
|
}
|
|
|
|
if (namespace.length !== 16) {
|
|
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
} // Compute hash of namespace and value, Per 4.3
|
|
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
// hashfunc([...namespace, ... value])`
|
|
|
|
|
|
let bytes = new Uint8Array(16 + value.length);
|
|
bytes.set(namespace);
|
|
bytes.set(value, namespace.length);
|
|
bytes = hashfunc(bytes);
|
|
bytes[6] = bytes[6] & 0x0f | version;
|
|
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
|
|
if (buf) {
|
|
offset = offset || 0;
|
|
|
|
for (let i = 0; i < 16; ++i) {
|
|
buf[offset + i] = bytes[i];
|
|
}
|
|
|
|
return buf;
|
|
}
|
|
|
|
return (0, _stringify.default)(bytes);
|
|
} // Function#name is not settable on some platforms (#270)
|
|
|
|
|
|
try {
|
|
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
} catch (err) {} // For CommonJS default export support
|
|
|
|
|
|
generateUUID.DNS = DNS;
|
|
generateUUID.URL = URL;
|
|
return generateUUID;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1472:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _rng = _interopRequireDefault(__nccwpck_require__(9784));
|
|
|
|
var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function v4(options, buf, offset) {
|
|
options = options || {};
|
|
|
|
const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
|
|
|
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
|
|
if (buf) {
|
|
offset = offset || 0;
|
|
|
|
for (let i = 0; i < 16; ++i) {
|
|
buf[offset + i] = rnds[i];
|
|
}
|
|
|
|
return buf;
|
|
}
|
|
|
|
return (0, _stringify.default)(rnds);
|
|
}
|
|
|
|
var _default = v4;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6217:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _v = _interopRequireDefault(__nccwpck_require__(5920));
|
|
|
|
var _sha = _interopRequireDefault(__nccwpck_require__(8844));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
var _default = v5;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2609:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _regex = _interopRequireDefault(__nccwpck_require__(6230));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function validate(uuid) {
|
|
return typeof uuid === 'string' && _regex.default.test(uuid);
|
|
}
|
|
|
|
var _default = validate;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 427:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports["default"] = void 0;
|
|
|
|
var _validate = _interopRequireDefault(__nccwpck_require__(2609));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function version(uuid) {
|
|
if (!(0, _validate.default)(uuid)) {
|
|
throw TypeError('Invalid UUID');
|
|
}
|
|
|
|
return parseInt(uuid.substr(14, 1), 16);
|
|
}
|
|
|
|
var _default = version;
|
|
exports["default"] = _default;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1514:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.getExecOutput = exports.exec = void 0;
|
|
const string_decoder_1 = __nccwpck_require__(1576);
|
|
const tr = __importStar(__nccwpck_require__(8159));
|
|
/**
|
|
* Exec a command.
|
|
* Output will be streamed to the live console.
|
|
* Returns promise with return code
|
|
*
|
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
* @param options optional exec options. See ExecOptions
|
|
* @returns Promise<number> exit code
|
|
*/
|
|
function exec(commandLine, args, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const commandArgs = tr.argStringToArray(commandLine);
|
|
if (commandArgs.length === 0) {
|
|
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
|
}
|
|
// Path to tool to execute should be first arg
|
|
const toolPath = commandArgs[0];
|
|
args = commandArgs.slice(1).concat(args || []);
|
|
const runner = new tr.ToolRunner(toolPath, args, options);
|
|
return runner.exec();
|
|
});
|
|
}
|
|
exports.exec = exec;
|
|
/**
|
|
* Exec a command and get the output.
|
|
* Output will be streamed to the live console.
|
|
* Returns promise with the exit code and collected stdout and stderr
|
|
*
|
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
* @param options optional exec options. See ExecOptions
|
|
* @returns Promise<ExecOutput> exit code, stdout, and stderr
|
|
*/
|
|
function getExecOutput(commandLine, args, options) {
|
|
var _a, _b;
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
let stdout = '';
|
|
let stderr = '';
|
|
//Using string decoder covers the case where a mult-byte character is split
|
|
const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
|
|
const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
|
|
const stdErrListener = (data) => {
|
|
stderr += stderrDecoder.write(data);
|
|
if (originalStdErrListener) {
|
|
originalStdErrListener(data);
|
|
}
|
|
};
|
|
const stdOutListener = (data) => {
|
|
stdout += stdoutDecoder.write(data);
|
|
if (originalStdoutListener) {
|
|
originalStdoutListener(data);
|
|
}
|
|
};
|
|
const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
|
|
const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
|
|
//flush any remaining characters
|
|
stdout += stdoutDecoder.end();
|
|
stderr += stderrDecoder.end();
|
|
return {
|
|
exitCode,
|
|
stdout,
|
|
stderr
|
|
};
|
|
});
|
|
}
|
|
exports.getExecOutput = getExecOutput;
|
|
//# sourceMappingURL=exec.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8159:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.argStringToArray = exports.ToolRunner = void 0;
|
|
const os = __importStar(__nccwpck_require__(2037));
|
|
const events = __importStar(__nccwpck_require__(2361));
|
|
const child = __importStar(__nccwpck_require__(2081));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
const ioUtil = __importStar(__nccwpck_require__(1962));
|
|
const timers_1 = __nccwpck_require__(9512);
|
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
/*
|
|
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
|
*/
|
|
class ToolRunner extends events.EventEmitter {
|
|
constructor(toolPath, args, options) {
|
|
super();
|
|
if (!toolPath) {
|
|
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
|
}
|
|
this.toolPath = toolPath;
|
|
this.args = args || [];
|
|
this.options = options || {};
|
|
}
|
|
_debug(message) {
|
|
if (this.options.listeners && this.options.listeners.debug) {
|
|
this.options.listeners.debug(message);
|
|
}
|
|
}
|
|
_getCommandString(options, noPrefix) {
|
|
const toolPath = this._getSpawnFileName();
|
|
const args = this._getSpawnArgs(options);
|
|
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
|
if (IS_WINDOWS) {
|
|
// Windows + cmd file
|
|
if (this._isCmdFile()) {
|
|
cmd += toolPath;
|
|
for (const a of args) {
|
|
cmd += ` ${a}`;
|
|
}
|
|
}
|
|
// Windows + verbatim
|
|
else if (options.windowsVerbatimArguments) {
|
|
cmd += `"${toolPath}"`;
|
|
for (const a of args) {
|
|
cmd += ` ${a}`;
|
|
}
|
|
}
|
|
// Windows (regular)
|
|
else {
|
|
cmd += this._windowsQuoteCmdArg(toolPath);
|
|
for (const a of args) {
|
|
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// OSX/Linux - this can likely be improved with some form of quoting.
|
|
// creating processes on Unix is fundamentally different than Windows.
|
|
// on Unix, execvp() takes an arg array.
|
|
cmd += toolPath;
|
|
for (const a of args) {
|
|
cmd += ` ${a}`;
|
|
}
|
|
}
|
|
return cmd;
|
|
}
|
|
_processLineBuffer(data, strBuffer, onLine) {
|
|
try {
|
|
let s = strBuffer + data.toString();
|
|
let n = s.indexOf(os.EOL);
|
|
while (n > -1) {
|
|
const line = s.substring(0, n);
|
|
onLine(line);
|
|
// the rest of the string ...
|
|
s = s.substring(n + os.EOL.length);
|
|
n = s.indexOf(os.EOL);
|
|
}
|
|
return s;
|
|
}
|
|
catch (err) {
|
|
// streaming lines to console is best effort. Don't fail a build.
|
|
this._debug(`error processing line. Failed with error ${err}`);
|
|
return '';
|
|
}
|
|
}
|
|
_getSpawnFileName() {
|
|
if (IS_WINDOWS) {
|
|
if (this._isCmdFile()) {
|
|
return process.env['COMSPEC'] || 'cmd.exe';
|
|
}
|
|
}
|
|
return this.toolPath;
|
|
}
|
|
_getSpawnArgs(options) {
|
|
if (IS_WINDOWS) {
|
|
if (this._isCmdFile()) {
|
|
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
|
for (const a of this.args) {
|
|
argline += ' ';
|
|
argline += options.windowsVerbatimArguments
|
|
? a
|
|
: this._windowsQuoteCmdArg(a);
|
|
}
|
|
argline += '"';
|
|
return [argline];
|
|
}
|
|
}
|
|
return this.args;
|
|
}
|
|
_endsWith(str, end) {
|
|
return str.endsWith(end);
|
|
}
|
|
_isCmdFile() {
|
|
const upperToolPath = this.toolPath.toUpperCase();
|
|
return (this._endsWith(upperToolPath, '.CMD') ||
|
|
this._endsWith(upperToolPath, '.BAT'));
|
|
}
|
|
_windowsQuoteCmdArg(arg) {
|
|
// for .exe, apply the normal quoting rules that libuv applies
|
|
if (!this._isCmdFile()) {
|
|
return this._uvQuoteCmdArg(arg);
|
|
}
|
|
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
|
// the libuv rules are generic and are not designed specifically for cmd.exe
|
|
// command line parser.
|
|
//
|
|
// for a detailed description of the cmd.exe command line parser, refer to
|
|
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
|
// need quotes for empty arg
|
|
if (!arg) {
|
|
return '""';
|
|
}
|
|
// determine whether the arg needs to be quoted
|
|
const cmdSpecialChars = [
|
|
' ',
|
|
'\t',
|
|
'&',
|
|
'(',
|
|
')',
|
|
'[',
|
|
']',
|
|
'{',
|
|
'}',
|
|
'^',
|
|
'=',
|
|
';',
|
|
'!',
|
|
"'",
|
|
'+',
|
|
',',
|
|
'`',
|
|
'~',
|
|
'|',
|
|
'<',
|
|
'>',
|
|
'"'
|
|
];
|
|
let needsQuotes = false;
|
|
for (const char of arg) {
|
|
if (cmdSpecialChars.some(x => x === char)) {
|
|
needsQuotes = true;
|
|
break;
|
|
}
|
|
}
|
|
// short-circuit if quotes not needed
|
|
if (!needsQuotes) {
|
|
return arg;
|
|
}
|
|
// the following quoting rules are very similar to the rules that by libuv applies.
|
|
//
|
|
// 1) wrap the string in quotes
|
|
//
|
|
// 2) double-up quotes - i.e. " => ""
|
|
//
|
|
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
|
// doesn't work well with a cmd.exe command line.
|
|
//
|
|
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
|
// for example, the command line:
|
|
// foo.exe "myarg:""my val"""
|
|
// is parsed by a .NET console app into an arg array:
|
|
// [ "myarg:\"my val\"" ]
|
|
// which is the same end result when applying libuv quoting rules. although the actual
|
|
// command line from libuv quoting rules would look like:
|
|
// foo.exe "myarg:\"my val\""
|
|
//
|
|
// 3) double-up slashes that precede a quote,
|
|
// e.g. hello \world => "hello \world"
|
|
// hello\"world => "hello\\""world"
|
|
// hello\\"world => "hello\\\\""world"
|
|
// hello world\ => "hello world\\"
|
|
//
|
|
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
|
// the reasons for including this as a .cmd quoting rule are:
|
|
//
|
|
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
|
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
|
//
|
|
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
|
// haven't heard any complaints about that aspect.
|
|
//
|
|
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
|
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
|
// by using %%.
|
|
//
|
|
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
|
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
|
//
|
|
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
|
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
|
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
|
// to an external program.
|
|
//
|
|
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
|
// % can be escaped within a .cmd file.
|
|
let reverse = '"';
|
|
let quoteHit = true;
|
|
for (let i = arg.length; i > 0; i--) {
|
|
// walk the string in reverse
|
|
reverse += arg[i - 1];
|
|
if (quoteHit && arg[i - 1] === '\\') {
|
|
reverse += '\\'; // double the slash
|
|
}
|
|
else if (arg[i - 1] === '"') {
|
|
quoteHit = true;
|
|
reverse += '"'; // double the quote
|
|
}
|
|
else {
|
|
quoteHit = false;
|
|
}
|
|
}
|
|
reverse += '"';
|
|
return reverse
|
|
.split('')
|
|
.reverse()
|
|
.join('');
|
|
}
|
|
_uvQuoteCmdArg(arg) {
|
|
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
|
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
|
// is used.
|
|
//
|
|
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
|
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
|
// pasting copyright notice from Node within this function:
|
|
//
|
|
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
//
|
|
// 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.
|
|
if (!arg) {
|
|
// Need double quotation for empty argument
|
|
return '""';
|
|
}
|
|
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
|
// No quotation needed
|
|
return arg;
|
|
}
|
|
if (!arg.includes('"') && !arg.includes('\\')) {
|
|
// No embedded double quotes or backslashes, so I can just wrap
|
|
// quote marks around the whole thing.
|
|
return `"${arg}"`;
|
|
}
|
|
// Expected input/output:
|
|
// input : hello"world
|
|
// output: "hello\"world"
|
|
// input : hello""world
|
|
// output: "hello\"\"world"
|
|
// input : hello\world
|
|
// output: hello\world
|
|
// input : hello\\world
|
|
// output: hello\\world
|
|
// input : hello\"world
|
|
// output: "hello\\\"world"
|
|
// input : hello\\"world
|
|
// output: "hello\\\\\"world"
|
|
// input : hello world\
|
|
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
|
// but it appears the comment is wrong, it should be "hello world\\"
|
|
let reverse = '"';
|
|
let quoteHit = true;
|
|
for (let i = arg.length; i > 0; i--) {
|
|
// walk the string in reverse
|
|
reverse += arg[i - 1];
|
|
if (quoteHit && arg[i - 1] === '\\') {
|
|
reverse += '\\';
|
|
}
|
|
else if (arg[i - 1] === '"') {
|
|
quoteHit = true;
|
|
reverse += '\\';
|
|
}
|
|
else {
|
|
quoteHit = false;
|
|
}
|
|
}
|
|
reverse += '"';
|
|
return reverse
|
|
.split('')
|
|
.reverse()
|
|
.join('');
|
|
}
|
|
_cloneExecOptions(options) {
|
|
options = options || {};
|
|
const result = {
|
|
cwd: options.cwd || process.cwd(),
|
|
env: options.env || process.env,
|
|
silent: options.silent || false,
|
|
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
|
failOnStdErr: options.failOnStdErr || false,
|
|
ignoreReturnCode: options.ignoreReturnCode || false,
|
|
delay: options.delay || 10000
|
|
};
|
|
result.outStream = options.outStream || process.stdout;
|
|
result.errStream = options.errStream || process.stderr;
|
|
return result;
|
|
}
|
|
_getSpawnOptions(options, toolPath) {
|
|
options = options || {};
|
|
const result = {};
|
|
result.cwd = options.cwd;
|
|
result.env = options.env;
|
|
result['windowsVerbatimArguments'] =
|
|
options.windowsVerbatimArguments || this._isCmdFile();
|
|
if (options.windowsVerbatimArguments) {
|
|
result.argv0 = `"${toolPath}"`;
|
|
}
|
|
return result;
|
|
}
|
|
/**
|
|
* Exec a tool.
|
|
* Output will be streamed to the live console.
|
|
* Returns promise with return code
|
|
*
|
|
* @param tool path to tool to exec
|
|
* @param options optional exec options. See ExecOptions
|
|
* @returns number
|
|
*/
|
|
exec() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// root the tool path if it is unrooted and contains relative pathing
|
|
if (!ioUtil.isRooted(this.toolPath) &&
|
|
(this.toolPath.includes('/') ||
|
|
(IS_WINDOWS && this.toolPath.includes('\\')))) {
|
|
// prefer options.cwd if it is specified, however options.cwd may also need to be rooted
|
|
this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
|
|
}
|
|
// if the tool is only a file name, then resolve it from the PATH
|
|
// otherwise verify it exists (add extension on Windows if necessary)
|
|
this.toolPath = yield io.which(this.toolPath, true);
|
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
this._debug(`exec tool: ${this.toolPath}`);
|
|
this._debug('arguments:');
|
|
for (const arg of this.args) {
|
|
this._debug(` ${arg}`);
|
|
}
|
|
const optionsNonNull = this._cloneExecOptions(this.options);
|
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
|
}
|
|
const state = new ExecState(optionsNonNull, this.toolPath);
|
|
state.on('debug', (message) => {
|
|
this._debug(message);
|
|
});
|
|
if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
|
|
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
|
|
}
|
|
const fileName = this._getSpawnFileName();
|
|
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
|
let stdbuffer = '';
|
|
if (cp.stdout) {
|
|
cp.stdout.on('data', (data) => {
|
|
if (this.options.listeners && this.options.listeners.stdout) {
|
|
this.options.listeners.stdout(data);
|
|
}
|
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
optionsNonNull.outStream.write(data);
|
|
}
|
|
stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
|
|
if (this.options.listeners && this.options.listeners.stdline) {
|
|
this.options.listeners.stdline(line);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
let errbuffer = '';
|
|
if (cp.stderr) {
|
|
cp.stderr.on('data', (data) => {
|
|
state.processStderr = true;
|
|
if (this.options.listeners && this.options.listeners.stderr) {
|
|
this.options.listeners.stderr(data);
|
|
}
|
|
if (!optionsNonNull.silent &&
|
|
optionsNonNull.errStream &&
|
|
optionsNonNull.outStream) {
|
|
const s = optionsNonNull.failOnStdErr
|
|
? optionsNonNull.errStream
|
|
: optionsNonNull.outStream;
|
|
s.write(data);
|
|
}
|
|
errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
|
|
if (this.options.listeners && this.options.listeners.errline) {
|
|
this.options.listeners.errline(line);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
cp.on('error', (err) => {
|
|
state.processError = err.message;
|
|
state.processExited = true;
|
|
state.processClosed = true;
|
|
state.CheckComplete();
|
|
});
|
|
cp.on('exit', (code) => {
|
|
state.processExitCode = code;
|
|
state.processExited = true;
|
|
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
|
state.CheckComplete();
|
|
});
|
|
cp.on('close', (code) => {
|
|
state.processExitCode = code;
|
|
state.processExited = true;
|
|
state.processClosed = true;
|
|
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
|
state.CheckComplete();
|
|
});
|
|
state.on('done', (error, exitCode) => {
|
|
if (stdbuffer.length > 0) {
|
|
this.emit('stdline', stdbuffer);
|
|
}
|
|
if (errbuffer.length > 0) {
|
|
this.emit('errline', errbuffer);
|
|
}
|
|
cp.removeAllListeners();
|
|
if (error) {
|
|
reject(error);
|
|
}
|
|
else {
|
|
resolve(exitCode);
|
|
}
|
|
});
|
|
if (this.options.input) {
|
|
if (!cp.stdin) {
|
|
throw new Error('child process missing stdin');
|
|
}
|
|
cp.stdin.end(this.options.input);
|
|
}
|
|
}));
|
|
});
|
|
}
|
|
}
|
|
exports.ToolRunner = ToolRunner;
|
|
/**
|
|
* Convert an arg string to an array of args. Handles escaping
|
|
*
|
|
* @param argString string of arguments
|
|
* @returns string[] array of arguments
|
|
*/
|
|
function argStringToArray(argString) {
|
|
const args = [];
|
|
let inQuotes = false;
|
|
let escaped = false;
|
|
let arg = '';
|
|
function append(c) {
|
|
// we only escape double quotes.
|
|
if (escaped && c !== '"') {
|
|
arg += '\\';
|
|
}
|
|
arg += c;
|
|
escaped = false;
|
|
}
|
|
for (let i = 0; i < argString.length; i++) {
|
|
const c = argString.charAt(i);
|
|
if (c === '"') {
|
|
if (!escaped) {
|
|
inQuotes = !inQuotes;
|
|
}
|
|
else {
|
|
append(c);
|
|
}
|
|
continue;
|
|
}
|
|
if (c === '\\' && escaped) {
|
|
append(c);
|
|
continue;
|
|
}
|
|
if (c === '\\' && inQuotes) {
|
|
escaped = true;
|
|
continue;
|
|
}
|
|
if (c === ' ' && !inQuotes) {
|
|
if (arg.length > 0) {
|
|
args.push(arg);
|
|
arg = '';
|
|
}
|
|
continue;
|
|
}
|
|
append(c);
|
|
}
|
|
if (arg.length > 0) {
|
|
args.push(arg.trim());
|
|
}
|
|
return args;
|
|
}
|
|
exports.argStringToArray = argStringToArray;
|
|
class ExecState extends events.EventEmitter {
|
|
constructor(options, toolPath) {
|
|
super();
|
|
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
|
this.processError = '';
|
|
this.processExitCode = 0;
|
|
this.processExited = false; // tracks whether the process has exited
|
|
this.processStderr = false; // tracks whether stderr was written to
|
|
this.delay = 10000; // 10 seconds
|
|
this.done = false;
|
|
this.timeout = null;
|
|
if (!toolPath) {
|
|
throw new Error('toolPath must not be empty');
|
|
}
|
|
this.options = options;
|
|
this.toolPath = toolPath;
|
|
if (options.delay) {
|
|
this.delay = options.delay;
|
|
}
|
|
}
|
|
CheckComplete() {
|
|
if (this.done) {
|
|
return;
|
|
}
|
|
if (this.processClosed) {
|
|
this._setResult();
|
|
}
|
|
else if (this.processExited) {
|
|
this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
}
|
|
}
|
|
_debug(message) {
|
|
this.emit('debug', message);
|
|
}
|
|
_setResult() {
|
|
// determine whether there is an error
|
|
let error;
|
|
if (this.processExited) {
|
|
if (this.processError) {
|
|
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
|
}
|
|
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
|
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
|
}
|
|
else if (this.processStderr && this.options.failOnStdErr) {
|
|
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
|
}
|
|
}
|
|
// clear the timeout
|
|
if (this.timeout) {
|
|
clearTimeout(this.timeout);
|
|
this.timeout = null;
|
|
}
|
|
this.done = true;
|
|
this.emit('done', error, this.processExitCode);
|
|
}
|
|
static HandleTimeout(state) {
|
|
if (state.done) {
|
|
return;
|
|
}
|
|
if (!state.processClosed && state.processExited) {
|
|
const message = `The STDIO streams did not close within ${state.delay /
|
|
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
|
state._debug(message);
|
|
}
|
|
state._setResult();
|
|
}
|
|
}
|
|
//# sourceMappingURL=toolrunner.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8090:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.create = void 0;
|
|
const internal_globber_1 = __nccwpck_require__(8298);
|
|
/**
|
|
* Constructs a globber
|
|
*
|
|
* @param patterns Patterns separated by newlines
|
|
* @param options Glob options
|
|
*/
|
|
function create(patterns, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return yield internal_globber_1.DefaultGlobber.create(patterns, options);
|
|
});
|
|
}
|
|
exports.create = create;
|
|
//# sourceMappingURL=glob.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1026:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.getOptions = void 0;
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
/**
|
|
* Returns a copy with defaults filled in.
|
|
*/
|
|
function getOptions(copy) {
|
|
const result = {
|
|
followSymbolicLinks: true,
|
|
implicitDescendants: true,
|
|
omitBrokenSymbolicLinks: true
|
|
};
|
|
if (copy) {
|
|
if (typeof copy.followSymbolicLinks === 'boolean') {
|
|
result.followSymbolicLinks = copy.followSymbolicLinks;
|
|
core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`);
|
|
}
|
|
if (typeof copy.implicitDescendants === 'boolean') {
|
|
result.implicitDescendants = copy.implicitDescendants;
|
|
core.debug(`implicitDescendants '${result.implicitDescendants}'`);
|
|
}
|
|
if (typeof copy.omitBrokenSymbolicLinks === 'boolean') {
|
|
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
|
|
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
exports.getOptions = getOptions;
|
|
//# sourceMappingURL=internal-glob-options-helper.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8298:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
var m = o[Symbol.asyncIterator], i;
|
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
};
|
|
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
function fulfill(value) { resume("next", value); }
|
|
function reject(value) { resume("throw", value); }
|
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.DefaultGlobber = void 0;
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
const fs = __importStar(__nccwpck_require__(7147));
|
|
const globOptionsHelper = __importStar(__nccwpck_require__(1026));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const patternHelper = __importStar(__nccwpck_require__(9005));
|
|
const internal_match_kind_1 = __nccwpck_require__(1063);
|
|
const internal_pattern_1 = __nccwpck_require__(4536);
|
|
const internal_search_state_1 = __nccwpck_require__(9117);
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
class DefaultGlobber {
|
|
constructor(options) {
|
|
this.patterns = [];
|
|
this.searchPaths = [];
|
|
this.options = globOptionsHelper.getOptions(options);
|
|
}
|
|
getSearchPaths() {
|
|
// Return a copy
|
|
return this.searchPaths.slice();
|
|
}
|
|
glob() {
|
|
var e_1, _a;
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const result = [];
|
|
try {
|
|
for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
|
|
const itemPath = _c.value;
|
|
result.push(itemPath);
|
|
}
|
|
}
|
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
finally {
|
|
try {
|
|
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
}
|
|
finally { if (e_1) throw e_1.error; }
|
|
}
|
|
return result;
|
|
});
|
|
}
|
|
globGenerator() {
|
|
return __asyncGenerator(this, arguments, function* globGenerator_1() {
|
|
// Fill in defaults options
|
|
const options = globOptionsHelper.getOptions(this.options);
|
|
// Implicit descendants?
|
|
const patterns = [];
|
|
for (const pattern of this.patterns) {
|
|
patterns.push(pattern);
|
|
if (options.implicitDescendants &&
|
|
(pattern.trailingSeparator ||
|
|
pattern.segments[pattern.segments.length - 1] !== '**')) {
|
|
patterns.push(new internal_pattern_1.Pattern(pattern.negate, true, pattern.segments.concat('**')));
|
|
}
|
|
}
|
|
// Push the search paths
|
|
const stack = [];
|
|
for (const searchPath of patternHelper.getSearchPaths(patterns)) {
|
|
core.debug(`Search path '${searchPath}'`);
|
|
// Exists?
|
|
try {
|
|
// Intentionally using lstat. Detection for broken symlink
|
|
// will be performed later (if following symlinks).
|
|
yield __await(fs.promises.lstat(searchPath));
|
|
}
|
|
catch (err) {
|
|
if (err.code === 'ENOENT') {
|
|
continue;
|
|
}
|
|
throw err;
|
|
}
|
|
stack.unshift(new internal_search_state_1.SearchState(searchPath, 1));
|
|
}
|
|
// Search
|
|
const traversalChain = []; // used to detect cycles
|
|
while (stack.length) {
|
|
// Pop
|
|
const item = stack.pop();
|
|
// Match?
|
|
const match = patternHelper.match(patterns, item.path);
|
|
const partialMatch = !!match || patternHelper.partialMatch(patterns, item.path);
|
|
if (!match && !partialMatch) {
|
|
continue;
|
|
}
|
|
// Stat
|
|
const stats = yield __await(DefaultGlobber.stat(item, options, traversalChain)
|
|
// Broken symlink, or symlink cycle detected, or no longer exists
|
|
);
|
|
// Broken symlink, or symlink cycle detected, or no longer exists
|
|
if (!stats) {
|
|
continue;
|
|
}
|
|
// Directory
|
|
if (stats.isDirectory()) {
|
|
// Matched
|
|
if (match & internal_match_kind_1.MatchKind.Directory) {
|
|
yield yield __await(item.path);
|
|
}
|
|
// Descend?
|
|
else if (!partialMatch) {
|
|
continue;
|
|
}
|
|
// Push the child items in reverse
|
|
const childLevel = item.level + 1;
|
|
const childItems = (yield __await(fs.promises.readdir(item.path))).map(x => new internal_search_state_1.SearchState(path.join(item.path, x), childLevel));
|
|
stack.push(...childItems.reverse());
|
|
}
|
|
// File
|
|
else if (match & internal_match_kind_1.MatchKind.File) {
|
|
yield yield __await(item.path);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* Constructs a DefaultGlobber
|
|
*/
|
|
static create(patterns, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const result = new DefaultGlobber(options);
|
|
if (IS_WINDOWS) {
|
|
patterns = patterns.replace(/\r\n/g, '\n');
|
|
patterns = patterns.replace(/\r/g, '\n');
|
|
}
|
|
const lines = patterns.split('\n').map(x => x.trim());
|
|
for (const line of lines) {
|
|
// Empty or comment
|
|
if (!line || line.startsWith('#')) {
|
|
continue;
|
|
}
|
|
// Pattern
|
|
else {
|
|
result.patterns.push(new internal_pattern_1.Pattern(line));
|
|
}
|
|
}
|
|
result.searchPaths.push(...patternHelper.getSearchPaths(result.patterns));
|
|
return result;
|
|
});
|
|
}
|
|
static stat(item, options, traversalChain) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// Note:
|
|
// `stat` returns info about the target of a symlink (or symlink chain)
|
|
// `lstat` returns info about a symlink itself
|
|
let stats;
|
|
if (options.followSymbolicLinks) {
|
|
try {
|
|
// Use `stat` (following symlinks)
|
|
stats = yield fs.promises.stat(item.path);
|
|
}
|
|
catch (err) {
|
|
if (err.code === 'ENOENT') {
|
|
if (options.omitBrokenSymbolicLinks) {
|
|
core.debug(`Broken symlink '${item.path}'`);
|
|
return undefined;
|
|
}
|
|
throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`);
|
|
}
|
|
throw err;
|
|
}
|
|
}
|
|
else {
|
|
// Use `lstat` (not following symlinks)
|
|
stats = yield fs.promises.lstat(item.path);
|
|
}
|
|
// Note, isDirectory() returns false for the lstat of a symlink
|
|
if (stats.isDirectory() && options.followSymbolicLinks) {
|
|
// Get the realpath
|
|
const realPath = yield fs.promises.realpath(item.path);
|
|
// Fixup the traversal chain to match the item level
|
|
while (traversalChain.length >= item.level) {
|
|
traversalChain.pop();
|
|
}
|
|
// Test for a cycle
|
|
if (traversalChain.some((x) => x === realPath)) {
|
|
core.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`);
|
|
return undefined;
|
|
}
|
|
// Update the traversal chain
|
|
traversalChain.push(realPath);
|
|
}
|
|
return stats;
|
|
});
|
|
}
|
|
}
|
|
exports.DefaultGlobber = DefaultGlobber;
|
|
//# sourceMappingURL=internal-globber.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1063:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.MatchKind = void 0;
|
|
/**
|
|
* Indicates whether a pattern matches a path
|
|
*/
|
|
var MatchKind;
|
|
(function (MatchKind) {
|
|
/** Not matched */
|
|
MatchKind[MatchKind["None"] = 0] = "None";
|
|
/** Matched if the path is a directory */
|
|
MatchKind[MatchKind["Directory"] = 1] = "Directory";
|
|
/** Matched if the path is a regular file */
|
|
MatchKind[MatchKind["File"] = 2] = "File";
|
|
/** Matched */
|
|
MatchKind[MatchKind["All"] = 3] = "All";
|
|
})(MatchKind = exports.MatchKind || (exports.MatchKind = {}));
|
|
//# sourceMappingURL=internal-match-kind.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1849:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0;
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const assert_1 = __importDefault(__nccwpck_require__(9491));
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
/**
|
|
* Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths.
|
|
*
|
|
* For example, on Linux/macOS:
|
|
* - `/ => /`
|
|
* - `/hello => /`
|
|
*
|
|
* For example, on Windows:
|
|
* - `C:\ => C:\`
|
|
* - `C:\hello => C:\`
|
|
* - `C: => C:`
|
|
* - `C:hello => C:`
|
|
* - `\ => \`
|
|
* - `\hello => \`
|
|
* - `\\hello => \\hello`
|
|
* - `\\hello\world => \\hello\world`
|
|
*/
|
|
function dirname(p) {
|
|
// Normalize slashes and trim unnecessary trailing slash
|
|
p = safeTrimTrailingSeparator(p);
|
|
// Windows UNC root, e.g. \\hello or \\hello\world
|
|
if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
|
|
return p;
|
|
}
|
|
// Get dirname
|
|
let result = path.dirname(p);
|
|
// Trim trailing slash for Windows UNC root, e.g. \\hello\world\
|
|
if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
|
|
result = safeTrimTrailingSeparator(result);
|
|
}
|
|
return result;
|
|
}
|
|
exports.dirname = dirname;
|
|
/**
|
|
* Roots the path if not already rooted. On Windows, relative roots like `\`
|
|
* or `C:` are expanded based on the current working directory.
|
|
*/
|
|
function ensureAbsoluteRoot(root, itemPath) {
|
|
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
|
|
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
// Already rooted
|
|
if (hasAbsoluteRoot(itemPath)) {
|
|
return itemPath;
|
|
}
|
|
// Windows
|
|
if (IS_WINDOWS) {
|
|
// Check for itemPath like C: or C:foo
|
|
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
|
|
let cwd = process.cwd();
|
|
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
|
// Drive letter matches cwd? Expand to cwd
|
|
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
|
|
// Drive only, e.g. C:
|
|
if (itemPath.length === 2) {
|
|
// Preserve specified drive letter case (upper or lower)
|
|
return `${itemPath[0]}:\\${cwd.substr(3)}`;
|
|
}
|
|
// Drive + path, e.g. C:foo
|
|
else {
|
|
if (!cwd.endsWith('\\')) {
|
|
cwd += '\\';
|
|
}
|
|
// Preserve specified drive letter case (upper or lower)
|
|
return `${itemPath[0]}:\\${cwd.substr(3)}${itemPath.substr(2)}`;
|
|
}
|
|
}
|
|
// Different drive
|
|
else {
|
|
return `${itemPath[0]}:\\${itemPath.substr(2)}`;
|
|
}
|
|
}
|
|
// Check for itemPath like \ or \foo
|
|
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
|
|
const cwd = process.cwd();
|
|
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
|
return `${cwd[0]}:\\${itemPath.substr(1)}`;
|
|
}
|
|
}
|
|
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
|
|
// Otherwise ensure root ends with a separator
|
|
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
|
|
// Intentionally empty
|
|
}
|
|
else {
|
|
// Append separator
|
|
root += path.sep;
|
|
}
|
|
return root + itemPath;
|
|
}
|
|
exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
|
|
/**
|
|
* On Linux/macOS, true if path starts with `/`. On Windows, true for paths like:
|
|
* `\\hello\share` and `C:\hello` (and using alternate separator).
|
|
*/
|
|
function hasAbsoluteRoot(itemPath) {
|
|
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
// Normalize separators
|
|
itemPath = normalizeSeparators(itemPath);
|
|
// Windows
|
|
if (IS_WINDOWS) {
|
|
// E.g. \\hello\share or C:\hello
|
|
return itemPath.startsWith('\\\\') || /^[A-Z]:\\/i.test(itemPath);
|
|
}
|
|
// E.g. /hello
|
|
return itemPath.startsWith('/');
|
|
}
|
|
exports.hasAbsoluteRoot = hasAbsoluteRoot;
|
|
/**
|
|
* On Linux/macOS, true if path starts with `/`. On Windows, true for paths like:
|
|
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
|
|
*/
|
|
function hasRoot(itemPath) {
|
|
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
|
|
// Normalize separators
|
|
itemPath = normalizeSeparators(itemPath);
|
|
// Windows
|
|
if (IS_WINDOWS) {
|
|
// E.g. \ or \hello or \\hello
|
|
// E.g. C: or C:\hello
|
|
return itemPath.startsWith('\\') || /^[A-Z]:/i.test(itemPath);
|
|
}
|
|
// E.g. /hello
|
|
return itemPath.startsWith('/');
|
|
}
|
|
exports.hasRoot = hasRoot;
|
|
/**
|
|
* Removes redundant slashes and converts `/` to `\` on Windows
|
|
*/
|
|
function normalizeSeparators(p) {
|
|
p = p || '';
|
|
// Windows
|
|
if (IS_WINDOWS) {
|
|
// Convert slashes on Windows
|
|
p = p.replace(/\//g, '\\');
|
|
// Remove redundant slashes
|
|
const isUnc = /^\\\\+[^\\]/.test(p); // e.g. \\hello
|
|
return (isUnc ? '\\' : '') + p.replace(/\\\\+/g, '\\'); // preserve leading \\ for UNC
|
|
}
|
|
// Remove redundant slashes
|
|
return p.replace(/\/\/+/g, '/');
|
|
}
|
|
exports.normalizeSeparators = normalizeSeparators;
|
|
/**
|
|
* Normalizes the path separators and trims the trailing separator (when safe).
|
|
* For example, `/foo/ => /foo` but `/ => /`
|
|
*/
|
|
function safeTrimTrailingSeparator(p) {
|
|
// Short-circuit if empty
|
|
if (!p) {
|
|
return '';
|
|
}
|
|
// Normalize separators
|
|
p = normalizeSeparators(p);
|
|
// No trailing slash
|
|
if (!p.endsWith(path.sep)) {
|
|
return p;
|
|
}
|
|
// Check '/' on Linux/macOS and '\' on Windows
|
|
if (p === path.sep) {
|
|
return p;
|
|
}
|
|
// On Windows check if drive root. E.g. C:\
|
|
if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) {
|
|
return p;
|
|
}
|
|
// Otherwise trim trailing slash
|
|
return p.substr(0, p.length - 1);
|
|
}
|
|
exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
|
|
//# sourceMappingURL=internal-path-helper.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6836:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.Path = void 0;
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const pathHelper = __importStar(__nccwpck_require__(1849));
|
|
const assert_1 = __importDefault(__nccwpck_require__(9491));
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
/**
|
|
* Helper class for parsing paths into segments
|
|
*/
|
|
class Path {
|
|
/**
|
|
* Constructs a Path
|
|
* @param itemPath Path or array of segments
|
|
*/
|
|
constructor(itemPath) {
|
|
this.segments = [];
|
|
// String
|
|
if (typeof itemPath === 'string') {
|
|
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
|
|
// Normalize slashes and trim unnecessary trailing slash
|
|
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
|
// Not rooted
|
|
if (!pathHelper.hasRoot(itemPath)) {
|
|
this.segments = itemPath.split(path.sep);
|
|
}
|
|
// Rooted
|
|
else {
|
|
// Add all segments, while not at the root
|
|
let remaining = itemPath;
|
|
let dir = pathHelper.dirname(remaining);
|
|
while (dir !== remaining) {
|
|
// Add the segment
|
|
const basename = path.basename(remaining);
|
|
this.segments.unshift(basename);
|
|
// Truncate the last segment
|
|
remaining = dir;
|
|
dir = pathHelper.dirname(remaining);
|
|
}
|
|
// Remainder is the root
|
|
this.segments.unshift(remaining);
|
|
}
|
|
}
|
|
// Array
|
|
else {
|
|
// Must not be empty
|
|
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
|
|
// Each segment
|
|
for (let i = 0; i < itemPath.length; i++) {
|
|
let segment = itemPath[i];
|
|
// Must not be empty
|
|
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
|
|
// Normalize slashes
|
|
segment = pathHelper.normalizeSeparators(itemPath[i]);
|
|
// Root segment
|
|
if (i === 0 && pathHelper.hasRoot(segment)) {
|
|
segment = pathHelper.safeTrimTrailingSeparator(segment);
|
|
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
|
|
this.segments.push(segment);
|
|
}
|
|
// All other segments
|
|
else {
|
|
// Must not contain slash
|
|
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
|
|
this.segments.push(segment);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* Converts the path to it's string representation
|
|
*/
|
|
toString() {
|
|
// First segment
|
|
let result = this.segments[0];
|
|
// All others
|
|
let skipSlash = result.endsWith(path.sep) || (IS_WINDOWS && /^[A-Z]:$/i.test(result));
|
|
for (let i = 1; i < this.segments.length; i++) {
|
|
if (skipSlash) {
|
|
skipSlash = false;
|
|
}
|
|
else {
|
|
result += path.sep;
|
|
}
|
|
result += this.segments[i];
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
exports.Path = Path;
|
|
//# sourceMappingURL=internal-path.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9005:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.partialMatch = exports.match = exports.getSearchPaths = void 0;
|
|
const pathHelper = __importStar(__nccwpck_require__(1849));
|
|
const internal_match_kind_1 = __nccwpck_require__(1063);
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
/**
|
|
* Given an array of patterns, returns an array of paths to search.
|
|
* Duplicates and paths under other included paths are filtered out.
|
|
*/
|
|
function getSearchPaths(patterns) {
|
|
// Ignore negate patterns
|
|
patterns = patterns.filter(x => !x.negate);
|
|
// Create a map of all search paths
|
|
const searchPathMap = {};
|
|
for (const pattern of patterns) {
|
|
const key = IS_WINDOWS
|
|
? pattern.searchPath.toUpperCase()
|
|
: pattern.searchPath;
|
|
searchPathMap[key] = 'candidate';
|
|
}
|
|
const result = [];
|
|
for (const pattern of patterns) {
|
|
// Check if already included
|
|
const key = IS_WINDOWS
|
|
? pattern.searchPath.toUpperCase()
|
|
: pattern.searchPath;
|
|
if (searchPathMap[key] === 'included') {
|
|
continue;
|
|
}
|
|
// Check for an ancestor search path
|
|
let foundAncestor = false;
|
|
let tempKey = key;
|
|
let parent = pathHelper.dirname(tempKey);
|
|
while (parent !== tempKey) {
|
|
if (searchPathMap[parent]) {
|
|
foundAncestor = true;
|
|
break;
|
|
}
|
|
tempKey = parent;
|
|
parent = pathHelper.dirname(tempKey);
|
|
}
|
|
// Include the search pattern in the result
|
|
if (!foundAncestor) {
|
|
result.push(pattern.searchPath);
|
|
searchPathMap[key] = 'included';
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
exports.getSearchPaths = getSearchPaths;
|
|
/**
|
|
* Matches the patterns against the path
|
|
*/
|
|
function match(patterns, itemPath) {
|
|
let result = internal_match_kind_1.MatchKind.None;
|
|
for (const pattern of patterns) {
|
|
if (pattern.negate) {
|
|
result &= ~pattern.match(itemPath);
|
|
}
|
|
else {
|
|
result |= pattern.match(itemPath);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
exports.match = match;
|
|
/**
|
|
* Checks whether to descend further into the directory
|
|
*/
|
|
function partialMatch(patterns, itemPath) {
|
|
return patterns.some(x => !x.negate && x.partialMatch(itemPath));
|
|
}
|
|
exports.partialMatch = partialMatch;
|
|
//# sourceMappingURL=internal-pattern-helper.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4536:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.Pattern = void 0;
|
|
const os = __importStar(__nccwpck_require__(2037));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const pathHelper = __importStar(__nccwpck_require__(1849));
|
|
const assert_1 = __importDefault(__nccwpck_require__(9491));
|
|
const minimatch_1 = __nccwpck_require__(3973);
|
|
const internal_match_kind_1 = __nccwpck_require__(1063);
|
|
const internal_path_1 = __nccwpck_require__(6836);
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
class Pattern {
|
|
constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) {
|
|
/**
|
|
* Indicates whether matches should be excluded from the result set
|
|
*/
|
|
this.negate = false;
|
|
// Pattern overload
|
|
let pattern;
|
|
if (typeof patternOrNegate === 'string') {
|
|
pattern = patternOrNegate.trim();
|
|
}
|
|
// Segments overload
|
|
else {
|
|
// Convert to pattern
|
|
segments = segments || [];
|
|
assert_1.default(segments.length, `Parameter 'segments' must not empty`);
|
|
const root = Pattern.getLiteral(segments[0]);
|
|
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
|
|
pattern = new internal_path_1.Path(segments).toString().trim();
|
|
if (patternOrNegate) {
|
|
pattern = `!${pattern}`;
|
|
}
|
|
}
|
|
// Negate
|
|
while (pattern.startsWith('!')) {
|
|
this.negate = !this.negate;
|
|
pattern = pattern.substr(1).trim();
|
|
}
|
|
// Normalize slashes and ensures absolute root
|
|
pattern = Pattern.fixupPattern(pattern, homedir);
|
|
// Segments
|
|
this.segments = new internal_path_1.Path(pattern).segments;
|
|
// Trailing slash indicates the pattern should only match directories, not regular files
|
|
this.trailingSeparator = pathHelper
|
|
.normalizeSeparators(pattern)
|
|
.endsWith(path.sep);
|
|
pattern = pathHelper.safeTrimTrailingSeparator(pattern);
|
|
// Search path (literal path prior to the first glob segment)
|
|
let foundGlob = false;
|
|
const searchSegments = this.segments
|
|
.map(x => Pattern.getLiteral(x))
|
|
.filter(x => !foundGlob && !(foundGlob = x === ''));
|
|
this.searchPath = new internal_path_1.Path(searchSegments).toString();
|
|
// Root RegExp (required when determining partial match)
|
|
this.rootRegExp = new RegExp(Pattern.regExpEscape(searchSegments[0]), IS_WINDOWS ? 'i' : '');
|
|
this.isImplicitPattern = isImplicitPattern;
|
|
// Create minimatch
|
|
const minimatchOptions = {
|
|
dot: true,
|
|
nobrace: true,
|
|
nocase: IS_WINDOWS,
|
|
nocomment: true,
|
|
noext: true,
|
|
nonegate: true
|
|
};
|
|
pattern = IS_WINDOWS ? pattern.replace(/\\/g, '/') : pattern;
|
|
this.minimatch = new minimatch_1.Minimatch(pattern, minimatchOptions);
|
|
}
|
|
/**
|
|
* Matches the pattern against the specified path
|
|
*/
|
|
match(itemPath) {
|
|
// Last segment is globstar?
|
|
if (this.segments[this.segments.length - 1] === '**') {
|
|
// Normalize slashes
|
|
itemPath = pathHelper.normalizeSeparators(itemPath);
|
|
// Append a trailing slash. Otherwise Minimatch will not match the directory immediately
|
|
// preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
|
|
// false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk.
|
|
if (!itemPath.endsWith(path.sep) && this.isImplicitPattern === false) {
|
|
// Note, this is safe because the constructor ensures the pattern has an absolute root.
|
|
// For example, formats like C: and C:foo on Windows are resolved to an absolute root.
|
|
itemPath = `${itemPath}${path.sep}`;
|
|
}
|
|
}
|
|
else {
|
|
// Normalize slashes and trim unnecessary trailing slash
|
|
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
|
}
|
|
// Match
|
|
if (this.minimatch.match(itemPath)) {
|
|
return this.trailingSeparator ? internal_match_kind_1.MatchKind.Directory : internal_match_kind_1.MatchKind.All;
|
|
}
|
|
return internal_match_kind_1.MatchKind.None;
|
|
}
|
|
/**
|
|
* Indicates whether the pattern may match descendants of the specified path
|
|
*/
|
|
partialMatch(itemPath) {
|
|
// Normalize slashes and trim unnecessary trailing slash
|
|
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
|
// matchOne does not handle root path correctly
|
|
if (pathHelper.dirname(itemPath) === itemPath) {
|
|
return this.rootRegExp.test(itemPath);
|
|
}
|
|
return this.minimatch.matchOne(itemPath.split(IS_WINDOWS ? /\\+/ : /\/+/), this.minimatch.set[0], true);
|
|
}
|
|
/**
|
|
* Escapes glob patterns within a path
|
|
*/
|
|
static globEscape(s) {
|
|
return (IS_WINDOWS ? s : s.replace(/\\/g, '\\\\')) // escape '\' on Linux/macOS
|
|
.replace(/(\[)(?=[^/]+\])/g, '[[]') // escape '[' when ']' follows within the path segment
|
|
.replace(/\?/g, '[?]') // escape '?'
|
|
.replace(/\*/g, '[*]'); // escape '*'
|
|
}
|
|
/**
|
|
* Normalizes slashes and ensures absolute root
|
|
*/
|
|
static fixupPattern(pattern, homedir) {
|
|
// Empty
|
|
assert_1.default(pattern, 'pattern cannot be empty');
|
|
// Must not contain `.` segment, unless first segment
|
|
// Must not contain `..` segment
|
|
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
|
|
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
|
|
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
|
|
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
|
|
// Normalize slashes
|
|
pattern = pathHelper.normalizeSeparators(pattern);
|
|
// Replace leading `.` segment
|
|
if (pattern === '.' || pattern.startsWith(`.${path.sep}`)) {
|
|
pattern = Pattern.globEscape(process.cwd()) + pattern.substr(1);
|
|
}
|
|
// Replace leading `~` segment
|
|
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
|
|
homedir = homedir || os.homedir();
|
|
assert_1.default(homedir, 'Unable to determine HOME directory');
|
|
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
|
|
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
|
|
}
|
|
// Replace relative drive root, e.g. pattern is C: or C:foo
|
|
else if (IS_WINDOWS &&
|
|
(pattern.match(/^[A-Z]:$/i) || pattern.match(/^[A-Z]:[^\\]/i))) {
|
|
let root = pathHelper.ensureAbsoluteRoot('C:\\dummy-root', pattern.substr(0, 2));
|
|
if (pattern.length > 2 && !root.endsWith('\\')) {
|
|
root += '\\';
|
|
}
|
|
pattern = Pattern.globEscape(root) + pattern.substr(2);
|
|
}
|
|
// Replace relative root, e.g. pattern is \ or \foo
|
|
else if (IS_WINDOWS && (pattern === '\\' || pattern.match(/^\\[^\\]/))) {
|
|
let root = pathHelper.ensureAbsoluteRoot('C:\\dummy-root', '\\');
|
|
if (!root.endsWith('\\')) {
|
|
root += '\\';
|
|
}
|
|
pattern = Pattern.globEscape(root) + pattern.substr(1);
|
|
}
|
|
// Otherwise ensure absolute root
|
|
else {
|
|
pattern = pathHelper.ensureAbsoluteRoot(Pattern.globEscape(process.cwd()), pattern);
|
|
}
|
|
return pathHelper.normalizeSeparators(pattern);
|
|
}
|
|
/**
|
|
* Attempts to unescape a pattern segment to create a literal path segment.
|
|
* Otherwise returns empty string.
|
|
*/
|
|
static getLiteral(segment) {
|
|
let literal = '';
|
|
for (let i = 0; i < segment.length; i++) {
|
|
const c = segment[i];
|
|
// Escape
|
|
if (c === '\\' && !IS_WINDOWS && i + 1 < segment.length) {
|
|
literal += segment[++i];
|
|
continue;
|
|
}
|
|
// Wildcard
|
|
else if (c === '*' || c === '?') {
|
|
return '';
|
|
}
|
|
// Character set
|
|
else if (c === '[' && i + 1 < segment.length) {
|
|
let set = '';
|
|
let closed = -1;
|
|
for (let i2 = i + 1; i2 < segment.length; i2++) {
|
|
const c2 = segment[i2];
|
|
// Escape
|
|
if (c2 === '\\' && !IS_WINDOWS && i2 + 1 < segment.length) {
|
|
set += segment[++i2];
|
|
continue;
|
|
}
|
|
// Closed
|
|
else if (c2 === ']') {
|
|
closed = i2;
|
|
break;
|
|
}
|
|
// Otherwise
|
|
else {
|
|
set += c2;
|
|
}
|
|
}
|
|
// Closed?
|
|
if (closed >= 0) {
|
|
// Cannot convert
|
|
if (set.length > 1) {
|
|
return '';
|
|
}
|
|
// Convert to literal
|
|
if (set) {
|
|
literal += set;
|
|
i = closed;
|
|
continue;
|
|
}
|
|
}
|
|
// Otherwise fall thru
|
|
}
|
|
// Append
|
|
literal += c;
|
|
}
|
|
return literal;
|
|
}
|
|
/**
|
|
* Escapes regexp special characters
|
|
* https://javascript.info/regexp-escaping
|
|
*/
|
|
static regExpEscape(s) {
|
|
return s.replace(/[[\\^$.|?*+()]/g, '\\$&');
|
|
}
|
|
}
|
|
exports.Pattern = Pattern;
|
|
//# sourceMappingURL=internal-pattern.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9117:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.SearchState = void 0;
|
|
class SearchState {
|
|
constructor(path, level) {
|
|
this.path = path;
|
|
this.level = level;
|
|
}
|
|
}
|
|
exports.SearchState = SearchState;
|
|
//# sourceMappingURL=internal-search-state.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5526:
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
|
|
class BasicCredentialHandler {
|
|
constructor(username, password) {
|
|
this.username = username;
|
|
this.password = password;
|
|
}
|
|
prepareRequest(options) {
|
|
if (!options.headers) {
|
|
throw Error('The request has no headers');
|
|
}
|
|
options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
|
|
}
|
|
// This handler cannot handle 401
|
|
canHandleAuthentication() {
|
|
return false;
|
|
}
|
|
handleAuthentication() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
throw new Error('not implemented');
|
|
});
|
|
}
|
|
}
|
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|
class BearerCredentialHandler {
|
|
constructor(token) {
|
|
this.token = token;
|
|
}
|
|
// currently implements pre-authorization
|
|
// TODO: support preAuth = false where it hooks on 401
|
|
prepareRequest(options) {
|
|
if (!options.headers) {
|
|
throw Error('The request has no headers');
|
|
}
|
|
options.headers['Authorization'] = `Bearer ${this.token}`;
|
|
}
|
|
// This handler cannot handle 401
|
|
canHandleAuthentication() {
|
|
return false;
|
|
}
|
|
handleAuthentication() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
throw new Error('not implemented');
|
|
});
|
|
}
|
|
}
|
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|
class PersonalAccessTokenCredentialHandler {
|
|
constructor(token) {
|
|
this.token = token;
|
|
}
|
|
// currently implements pre-authorization
|
|
// TODO: support preAuth = false where it hooks on 401
|
|
prepareRequest(options) {
|
|
if (!options.headers) {
|
|
throw Error('The request has no headers');
|
|
}
|
|
options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
|
|
}
|
|
// This handler cannot handle 401
|
|
canHandleAuthentication() {
|
|
return false;
|
|
}
|
|
handleAuthentication() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
throw new Error('not implemented');
|
|
});
|
|
}
|
|
}
|
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|
//# sourceMappingURL=auth.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6255:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
|
|
const http = __importStar(__nccwpck_require__(3685));
|
|
const https = __importStar(__nccwpck_require__(5687));
|
|
const pm = __importStar(__nccwpck_require__(9835));
|
|
const tunnel = __importStar(__nccwpck_require__(4294));
|
|
var HttpCodes;
|
|
(function (HttpCodes) {
|
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
|
var Headers;
|
|
(function (Headers) {
|
|
Headers["Accept"] = "accept";
|
|
Headers["ContentType"] = "content-type";
|
|
})(Headers = exports.Headers || (exports.Headers = {}));
|
|
var MediaTypes;
|
|
(function (MediaTypes) {
|
|
MediaTypes["ApplicationJson"] = "application/json";
|
|
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
|
/**
|
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
*/
|
|
function getProxyUrl(serverUrl) {
|
|
const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
|
return proxyUrl ? proxyUrl.href : '';
|
|
}
|
|
exports.getProxyUrl = getProxyUrl;
|
|
const HttpRedirectCodes = [
|
|
HttpCodes.MovedPermanently,
|
|
HttpCodes.ResourceMoved,
|
|
HttpCodes.SeeOther,
|
|
HttpCodes.TemporaryRedirect,
|
|
HttpCodes.PermanentRedirect
|
|
];
|
|
const HttpResponseRetryCodes = [
|
|
HttpCodes.BadGateway,
|
|
HttpCodes.ServiceUnavailable,
|
|
HttpCodes.GatewayTimeout
|
|
];
|
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
|
const ExponentialBackoffCeiling = 10;
|
|
const ExponentialBackoffTimeSlice = 5;
|
|
class HttpClientError extends Error {
|
|
constructor(message, statusCode) {
|
|
super(message);
|
|
this.name = 'HttpClientError';
|
|
this.statusCode = statusCode;
|
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
|
}
|
|
}
|
|
exports.HttpClientError = HttpClientError;
|
|
class HttpClientResponse {
|
|
constructor(message) {
|
|
this.message = message;
|
|
}
|
|
readBody() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
let output = Buffer.alloc(0);
|
|
this.message.on('data', (chunk) => {
|
|
output = Buffer.concat([output, chunk]);
|
|
});
|
|
this.message.on('end', () => {
|
|
resolve(output.toString());
|
|
});
|
|
}));
|
|
});
|
|
}
|
|
readBodyBuffer() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
const chunks = [];
|
|
this.message.on('data', (chunk) => {
|
|
chunks.push(chunk);
|
|
});
|
|
this.message.on('end', () => {
|
|
resolve(Buffer.concat(chunks));
|
|
});
|
|
}));
|
|
});
|
|
}
|
|
}
|
|
exports.HttpClientResponse = HttpClientResponse;
|
|
function isHttps(requestUrl) {
|
|
const parsedUrl = new URL(requestUrl);
|
|
return parsedUrl.protocol === 'https:';
|
|
}
|
|
exports.isHttps = isHttps;
|
|
class HttpClient {
|
|
constructor(userAgent, handlers, requestOptions) {
|
|
this._ignoreSslError = false;
|
|
this._allowRedirects = true;
|
|
this._allowRedirectDowngrade = false;
|
|
this._maxRedirects = 50;
|
|
this._allowRetries = false;
|
|
this._maxRetries = 1;
|
|
this._keepAlive = false;
|
|
this._disposed = false;
|
|
this.userAgent = userAgent;
|
|
this.handlers = handlers || [];
|
|
this.requestOptions = requestOptions;
|
|
if (requestOptions) {
|
|
if (requestOptions.ignoreSslError != null) {
|
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
|
}
|
|
this._socketTimeout = requestOptions.socketTimeout;
|
|
if (requestOptions.allowRedirects != null) {
|
|
this._allowRedirects = requestOptions.allowRedirects;
|
|
}
|
|
if (requestOptions.allowRedirectDowngrade != null) {
|
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
|
}
|
|
if (requestOptions.maxRedirects != null) {
|
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
|
}
|
|
if (requestOptions.keepAlive != null) {
|
|
this._keepAlive = requestOptions.keepAlive;
|
|
}
|
|
if (requestOptions.allowRetries != null) {
|
|
this._allowRetries = requestOptions.allowRetries;
|
|
}
|
|
if (requestOptions.maxRetries != null) {
|
|
this._maxRetries = requestOptions.maxRetries;
|
|
}
|
|
}
|
|
}
|
|
options(requestUrl, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
|
});
|
|
}
|
|
get(requestUrl, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
|
});
|
|
}
|
|
del(requestUrl, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
|
});
|
|
}
|
|
post(requestUrl, data, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
|
});
|
|
}
|
|
patch(requestUrl, data, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
|
});
|
|
}
|
|
put(requestUrl, data, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
|
});
|
|
}
|
|
head(requestUrl, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
|
});
|
|
}
|
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|
});
|
|
}
|
|
/**
|
|
* Gets a typed object from an endpoint
|
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
*/
|
|
getJson(requestUrl, additionalHeaders = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
const res = yield this.get(requestUrl, additionalHeaders);
|
|
return this._processResponse(res, this.requestOptions);
|
|
});
|
|
}
|
|
postJson(requestUrl, obj, additionalHeaders = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const data = JSON.stringify(obj, null, 2);
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
const res = yield this.post(requestUrl, data, additionalHeaders);
|
|
return this._processResponse(res, this.requestOptions);
|
|
});
|
|
}
|
|
putJson(requestUrl, obj, additionalHeaders = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const data = JSON.stringify(obj, null, 2);
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
const res = yield this.put(requestUrl, data, additionalHeaders);
|
|
return this._processResponse(res, this.requestOptions);
|
|
});
|
|
}
|
|
patchJson(requestUrl, obj, additionalHeaders = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const data = JSON.stringify(obj, null, 2);
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
const res = yield this.patch(requestUrl, data, additionalHeaders);
|
|
return this._processResponse(res, this.requestOptions);
|
|
});
|
|
}
|
|
/**
|
|
* Makes a raw http request.
|
|
* All other methods such as get, post, patch, and request ultimately call this.
|
|
* Prefer get, del, post and patch
|
|
*/
|
|
request(verb, requestUrl, data, headers) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (this._disposed) {
|
|
throw new Error('Client has already been disposed.');
|
|
}
|
|
const parsedUrl = new URL(requestUrl);
|
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
|
// Only perform retries on reads since writes may not be idempotent.
|
|
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
|
|
? this._maxRetries + 1
|
|
: 1;
|
|
let numTries = 0;
|
|
let response;
|
|
do {
|
|
response = yield this.requestRaw(info, data);
|
|
// Check if it's an authentication challenge
|
|
if (response &&
|
|
response.message &&
|
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
|
let authenticationHandler;
|
|
for (const handler of this.handlers) {
|
|
if (handler.canHandleAuthentication(response)) {
|
|
authenticationHandler = handler;
|
|
break;
|
|
}
|
|
}
|
|
if (authenticationHandler) {
|
|
return authenticationHandler.handleAuthentication(this, info, data);
|
|
}
|
|
else {
|
|
// We have received an unauthorized response but have no handlers to handle it.
|
|
// Let the response return to the caller.
|
|
return response;
|
|
}
|
|
}
|
|
let redirectsRemaining = this._maxRedirects;
|
|
while (response.message.statusCode &&
|
|
HttpRedirectCodes.includes(response.message.statusCode) &&
|
|
this._allowRedirects &&
|
|
redirectsRemaining > 0) {
|
|
const redirectUrl = response.message.headers['location'];
|
|
if (!redirectUrl) {
|
|
// if there's no location to redirect to, we won't
|
|
break;
|
|
}
|
|
const parsedRedirectUrl = new URL(redirectUrl);
|
|
if (parsedUrl.protocol === 'https:' &&
|
|
parsedUrl.protocol !== parsedRedirectUrl.protocol &&
|
|
!this._allowRedirectDowngrade) {
|
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
|
}
|
|
// we need to finish reading the response before reassigning response
|
|
// which will leak the open socket.
|
|
yield response.readBody();
|
|
// strip authorization header if redirected to a different hostname
|
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
|
for (const header in headers) {
|
|
// header names are case insensitive
|
|
if (header.toLowerCase() === 'authorization') {
|
|
delete headers[header];
|
|
}
|
|
}
|
|
}
|
|
// let's make the request with the new redirectUrl
|
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
|
response = yield this.requestRaw(info, data);
|
|
redirectsRemaining--;
|
|
}
|
|
if (!response.message.statusCode ||
|
|
!HttpResponseRetryCodes.includes(response.message.statusCode)) {
|
|
// If not a retry code, return immediately instead of retrying
|
|
return response;
|
|
}
|
|
numTries += 1;
|
|
if (numTries < maxTries) {
|
|
yield response.readBody();
|
|
yield this._performExponentialBackoff(numTries);
|
|
}
|
|
} while (numTries < maxTries);
|
|
return response;
|
|
});
|
|
}
|
|
/**
|
|
* Needs to be called if keepAlive is set to true in request options.
|
|
*/
|
|
dispose() {
|
|
if (this._agent) {
|
|
this._agent.destroy();
|
|
}
|
|
this._disposed = true;
|
|
}
|
|
/**
|
|
* Raw request.
|
|
* @param info
|
|
* @param data
|
|
*/
|
|
requestRaw(info, data) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return new Promise((resolve, reject) => {
|
|
function callbackForResult(err, res) {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
else if (!res) {
|
|
// If `err` is not passed, then `res` must be passed.
|
|
reject(new Error('Unknown error'));
|
|
}
|
|
else {
|
|
resolve(res);
|
|
}
|
|
}
|
|
this.requestRawWithCallback(info, data, callbackForResult);
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
* Raw request with callback.
|
|
* @param info
|
|
* @param data
|
|
* @param onResult
|
|
*/
|
|
requestRawWithCallback(info, data, onResult) {
|
|
if (typeof data === 'string') {
|
|
if (!info.options.headers) {
|
|
info.options.headers = {};
|
|
}
|
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
}
|
|
let callbackCalled = false;
|
|
function handleResult(err, res) {
|
|
if (!callbackCalled) {
|
|
callbackCalled = true;
|
|
onResult(err, res);
|
|
}
|
|
}
|
|
const req = info.httpModule.request(info.options, (msg) => {
|
|
const res = new HttpClientResponse(msg);
|
|
handleResult(undefined, res);
|
|
});
|
|
let socket;
|
|
req.on('socket', sock => {
|
|
socket = sock;
|
|
});
|
|
// If we ever get disconnected, we want the socket to timeout eventually
|
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|
if (socket) {
|
|
socket.end();
|
|
}
|
|
handleResult(new Error(`Request timeout: ${info.options.path}`));
|
|
});
|
|
req.on('error', function (err) {
|
|
// err has statusCode property
|
|
// res should have headers
|
|
handleResult(err);
|
|
});
|
|
if (data && typeof data === 'string') {
|
|
req.write(data, 'utf8');
|
|
}
|
|
if (data && typeof data !== 'string') {
|
|
data.on('close', function () {
|
|
req.end();
|
|
});
|
|
data.pipe(req);
|
|
}
|
|
else {
|
|
req.end();
|
|
}
|
|
}
|
|
/**
|
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
*/
|
|
getAgent(serverUrl) {
|
|
const parsedUrl = new URL(serverUrl);
|
|
return this._getAgent(parsedUrl);
|
|
}
|
|
_prepareRequest(method, requestUrl, headers) {
|
|
const info = {};
|
|
info.parsedUrl = requestUrl;
|
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
|
info.httpModule = usingSsl ? https : http;
|
|
const defaultPort = usingSsl ? 443 : 80;
|
|
info.options = {};
|
|
info.options.host = info.parsedUrl.hostname;
|
|
info.options.port = info.parsedUrl.port
|
|
? parseInt(info.parsedUrl.port)
|
|
: defaultPort;
|
|
info.options.path =
|
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
|
info.options.method = method;
|
|
info.options.headers = this._mergeHeaders(headers);
|
|
if (this.userAgent != null) {
|
|
info.options.headers['user-agent'] = this.userAgent;
|
|
}
|
|
info.options.agent = this._getAgent(info.parsedUrl);
|
|
// gives handlers an opportunity to participate
|
|
if (this.handlers) {
|
|
for (const handler of this.handlers) {
|
|
handler.prepareRequest(info.options);
|
|
}
|
|
}
|
|
return info;
|
|
}
|
|
_mergeHeaders(headers) {
|
|
if (this.requestOptions && this.requestOptions.headers) {
|
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
|
|
}
|
|
return lowercaseKeys(headers || {});
|
|
}
|
|
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
|
let clientHeader;
|
|
if (this.requestOptions && this.requestOptions.headers) {
|
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
|
}
|
|
return additionalHeaders[header] || clientHeader || _default;
|
|
}
|
|
_getAgent(parsedUrl) {
|
|
let agent;
|
|
const proxyUrl = pm.getProxyUrl(parsedUrl);
|
|
const useProxy = proxyUrl && proxyUrl.hostname;
|
|
if (this._keepAlive && useProxy) {
|
|
agent = this._proxyAgent;
|
|
}
|
|
if (this._keepAlive && !useProxy) {
|
|
agent = this._agent;
|
|
}
|
|
// if agent is already assigned use that agent.
|
|
if (agent) {
|
|
return agent;
|
|
}
|
|
const usingSsl = parsedUrl.protocol === 'https:';
|
|
let maxSockets = 100;
|
|
if (this.requestOptions) {
|
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
|
}
|
|
// This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
|
|
if (proxyUrl && proxyUrl.hostname) {
|
|
const agentOptions = {
|
|
maxSockets,
|
|
keepAlive: this._keepAlive,
|
|
proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
|
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
|
})), { host: proxyUrl.hostname, port: proxyUrl.port })
|
|
};
|
|
let tunnelAgent;
|
|
const overHttps = proxyUrl.protocol === 'https:';
|
|
if (usingSsl) {
|
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
|
}
|
|
else {
|
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
|
}
|
|
agent = tunnelAgent(agentOptions);
|
|
this._proxyAgent = agent;
|
|
}
|
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|
if (this._keepAlive && !agent) {
|
|
const options = { keepAlive: this._keepAlive, maxSockets };
|
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|
this._agent = agent;
|
|
}
|
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
|
if (!agent) {
|
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|
}
|
|
if (usingSsl && this._ignoreSslError) {
|
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|
// we have to cast it to any and change it directly
|
|
agent.options = Object.assign(agent.options || {}, {
|
|
rejectUnauthorized: false
|
|
});
|
|
}
|
|
return agent;
|
|
}
|
|
_performExponentialBackoff(retryNumber) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
|
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
|
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
|
});
|
|
}
|
|
_processResponse(res, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
const statusCode = res.message.statusCode || 0;
|
|
const response = {
|
|
statusCode,
|
|
result: null,
|
|
headers: {}
|
|
};
|
|
// not found leads to null obj returned
|
|
if (statusCode === HttpCodes.NotFound) {
|
|
resolve(response);
|
|
}
|
|
// get the result from the body
|
|
function dateTimeDeserializer(key, value) {
|
|
if (typeof value === 'string') {
|
|
const a = new Date(value);
|
|
if (!isNaN(a.valueOf())) {
|
|
return a;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
let obj;
|
|
let contents;
|
|
try {
|
|
contents = yield res.readBody();
|
|
if (contents && contents.length > 0) {
|
|
if (options && options.deserializeDates) {
|
|
obj = JSON.parse(contents, dateTimeDeserializer);
|
|
}
|
|
else {
|
|
obj = JSON.parse(contents);
|
|
}
|
|
response.result = obj;
|
|
}
|
|
response.headers = res.message.headers;
|
|
}
|
|
catch (err) {
|
|
// Invalid resource (contents not json); leaving result obj null
|
|
}
|
|
// note that 3xx redirects are handled by the http layer.
|
|
if (statusCode > 299) {
|
|
let msg;
|
|
// if exception/error in body, attempt to get better error
|
|
if (obj && obj.message) {
|
|
msg = obj.message;
|
|
}
|
|
else if (contents && contents.length > 0) {
|
|
// it may be the case that the exception is in the body message as string
|
|
msg = contents;
|
|
}
|
|
else {
|
|
msg = `Failed request: (${statusCode})`;
|
|
}
|
|
const err = new HttpClientError(msg, statusCode);
|
|
err.result = response.result;
|
|
reject(err);
|
|
}
|
|
else {
|
|
resolve(response);
|
|
}
|
|
}));
|
|
});
|
|
}
|
|
}
|
|
exports.HttpClient = HttpClient;
|
|
const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9835:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.checkBypass = exports.getProxyUrl = void 0;
|
|
function getProxyUrl(reqUrl) {
|
|
const usingSsl = reqUrl.protocol === 'https:';
|
|
if (checkBypass(reqUrl)) {
|
|
return undefined;
|
|
}
|
|
const proxyVar = (() => {
|
|
if (usingSsl) {
|
|
return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
|
}
|
|
else {
|
|
return process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
|
}
|
|
})();
|
|
if (proxyVar) {
|
|
try {
|
|
return new URL(proxyVar);
|
|
}
|
|
catch (_a) {
|
|
if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
|
|
return new URL(`http://${proxyVar}`);
|
|
}
|
|
}
|
|
else {
|
|
return undefined;
|
|
}
|
|
}
|
|
exports.getProxyUrl = getProxyUrl;
|
|
function checkBypass(reqUrl) {
|
|
if (!reqUrl.hostname) {
|
|
return false;
|
|
}
|
|
const reqHost = reqUrl.hostname;
|
|
if (isLoopbackAddress(reqHost)) {
|
|
return true;
|
|
}
|
|
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
|
if (!noProxy) {
|
|
return false;
|
|
}
|
|
// Determine the request port
|
|
let reqPort;
|
|
if (reqUrl.port) {
|
|
reqPort = Number(reqUrl.port);
|
|
}
|
|
else if (reqUrl.protocol === 'http:') {
|
|
reqPort = 80;
|
|
}
|
|
else if (reqUrl.protocol === 'https:') {
|
|
reqPort = 443;
|
|
}
|
|
// Format the request hostname and hostname with port
|
|
const upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
|
if (typeof reqPort === 'number') {
|
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
|
}
|
|
// Compare request host against noproxy
|
|
for (const upperNoProxyItem of noProxy
|
|
.split(',')
|
|
.map(x => x.trim().toUpperCase())
|
|
.filter(x => x)) {
|
|
if (upperNoProxyItem === '*' ||
|
|
upperReqHosts.some(x => x === upperNoProxyItem ||
|
|
x.endsWith(`.${upperNoProxyItem}`) ||
|
|
(upperNoProxyItem.startsWith('.') &&
|
|
x.endsWith(`${upperNoProxyItem}`)))) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
exports.checkBypass = checkBypass;
|
|
function isLoopbackAddress(host) {
|
|
const hostLower = host.toLowerCase();
|
|
return (hostLower === 'localhost' ||
|
|
hostLower.startsWith('127.') ||
|
|
hostLower.startsWith('[::1]') ||
|
|
hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
|
|
}
|
|
//# sourceMappingURL=proxy.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1962:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var _a;
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
|
const fs = __importStar(__nccwpck_require__(7147));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
|
exports.IS_WINDOWS = process.platform === 'win32';
|
|
function exists(fsPath) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
try {
|
|
yield exports.stat(fsPath);
|
|
}
|
|
catch (err) {
|
|
if (err.code === 'ENOENT') {
|
|
return false;
|
|
}
|
|
throw err;
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
exports.exists = exists;
|
|
function isDirectory(fsPath, useStat = false) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
|
return stats.isDirectory();
|
|
});
|
|
}
|
|
exports.isDirectory = isDirectory;
|
|
/**
|
|
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
|
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
|
*/
|
|
function isRooted(p) {
|
|
p = normalizeSeparators(p);
|
|
if (!p) {
|
|
throw new Error('isRooted() parameter "p" cannot be empty');
|
|
}
|
|
if (exports.IS_WINDOWS) {
|
|
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
|
); // e.g. C: or C:\hello
|
|
}
|
|
return p.startsWith('/');
|
|
}
|
|
exports.isRooted = isRooted;
|
|
/**
|
|
* Best effort attempt to determine whether a file exists and is executable.
|
|
* @param filePath file path to check
|
|
* @param extensions additional file extensions to try
|
|
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
|
*/
|
|
function tryGetExecutablePath(filePath, extensions) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
let stats = undefined;
|
|
try {
|
|
// test file exists
|
|
stats = yield exports.stat(filePath);
|
|
}
|
|
catch (err) {
|
|
if (err.code !== 'ENOENT') {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
}
|
|
}
|
|
if (stats && stats.isFile()) {
|
|
if (exports.IS_WINDOWS) {
|
|
// on Windows, test for valid extension
|
|
const upperExt = path.extname(filePath).toUpperCase();
|
|
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
|
return filePath;
|
|
}
|
|
}
|
|
else {
|
|
if (isUnixExecutable(stats)) {
|
|
return filePath;
|
|
}
|
|
}
|
|
}
|
|
// try each extension
|
|
const originalFilePath = filePath;
|
|
for (const extension of extensions) {
|
|
filePath = originalFilePath + extension;
|
|
stats = undefined;
|
|
try {
|
|
stats = yield exports.stat(filePath);
|
|
}
|
|
catch (err) {
|
|
if (err.code !== 'ENOENT') {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
}
|
|
}
|
|
if (stats && stats.isFile()) {
|
|
if (exports.IS_WINDOWS) {
|
|
// preserve the case of the actual file (since an extension was appended)
|
|
try {
|
|
const directory = path.dirname(filePath);
|
|
const upperName = path.basename(filePath).toUpperCase();
|
|
for (const actualName of yield exports.readdir(directory)) {
|
|
if (upperName === actualName.toUpperCase()) {
|
|
filePath = path.join(directory, actualName);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
catch (err) {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
|
}
|
|
return filePath;
|
|
}
|
|
else {
|
|
if (isUnixExecutable(stats)) {
|
|
return filePath;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return '';
|
|
});
|
|
}
|
|
exports.tryGetExecutablePath = tryGetExecutablePath;
|
|
function normalizeSeparators(p) {
|
|
p = p || '';
|
|
if (exports.IS_WINDOWS) {
|
|
// convert slashes on Windows
|
|
p = p.replace(/\//g, '\\');
|
|
// remove redundant slashes
|
|
return p.replace(/\\\\+/g, '\\');
|
|
}
|
|
// remove redundant slashes
|
|
return p.replace(/\/\/+/g, '/');
|
|
}
|
|
// on Mac/Linux, test the execute bit
|
|
// R W X R W X R W X
|
|
// 256 128 64 32 16 8 4 2 1
|
|
function isUnixExecutable(stats) {
|
|
return ((stats.mode & 1) > 0 ||
|
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
|
}
|
|
// Get the path of cmd.exe in windows
|
|
function getCmdPath() {
|
|
var _a;
|
|
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
|
}
|
|
exports.getCmdPath = getCmdPath;
|
|
//# sourceMappingURL=io-util.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7436:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
|
const assert_1 = __nccwpck_require__(9491);
|
|
const childProcess = __importStar(__nccwpck_require__(2081));
|
|
const path = __importStar(__nccwpck_require__(1017));
|
|
const util_1 = __nccwpck_require__(3837);
|
|
const ioUtil = __importStar(__nccwpck_require__(1962));
|
|
const exec = util_1.promisify(childProcess.exec);
|
|
const execFile = util_1.promisify(childProcess.execFile);
|
|
/**
|
|
* Copies a file or folder.
|
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
*
|
|
* @param source source path
|
|
* @param dest destination path
|
|
* @param options optional. See CopyOptions.
|
|
*/
|
|
function cp(source, dest, options = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
|
// Dest is an existing file, but not forcing
|
|
if (destStat && destStat.isFile() && !force) {
|
|
return;
|
|
}
|
|
// If dest is an existing directory, should copy inside.
|
|
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
|
? path.join(dest, path.basename(source))
|
|
: dest;
|
|
if (!(yield ioUtil.exists(source))) {
|
|
throw new Error(`no such file or directory: ${source}`);
|
|
}
|
|
const sourceStat = yield ioUtil.stat(source);
|
|
if (sourceStat.isDirectory()) {
|
|
if (!recursive) {
|
|
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
|
}
|
|
else {
|
|
yield cpDirRecursive(source, newDest, 0, force);
|
|
}
|
|
}
|
|
else {
|
|
if (path.relative(source, newDest) === '') {
|
|
// a file cannot be copied to itself
|
|
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
|
}
|
|
yield copyFile(source, newDest, force);
|
|
}
|
|
});
|
|
}
|
|
exports.cp = cp;
|
|
/**
|
|
* Moves a path.
|
|
*
|
|
* @param source source path
|
|
* @param dest destination path
|
|
* @param options optional. See MoveOptions.
|
|
*/
|
|
function mv(source, dest, options = {}) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (yield ioUtil.exists(dest)) {
|
|
let destExists = true;
|
|
if (yield ioUtil.isDirectory(dest)) {
|
|
// If dest is directory copy src into dest
|
|
dest = path.join(dest, path.basename(source));
|
|
destExists = yield ioUtil.exists(dest);
|
|
}
|
|
if (destExists) {
|
|
if (options.force == null || options.force) {
|
|
yield rmRF(dest);
|
|
}
|
|
else {
|
|
throw new Error('Destination already exists');
|
|
}
|
|
}
|
|
}
|
|
yield mkdirP(path.dirname(dest));
|
|
yield ioUtil.rename(source, dest);
|
|
});
|
|
}
|
|
exports.mv = mv;
|
|
/**
|
|
* Remove a path recursively with force
|
|
*
|
|
* @param inputPath path to remove
|
|
*/
|
|
function rmRF(inputPath) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (ioUtil.IS_WINDOWS) {
|
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
// Check for invalid characters
|
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
|
if (/[*"<>|]/.test(inputPath)) {
|
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
|
}
|
|
try {
|
|
const cmdPath = ioUtil.getCmdPath();
|
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
|
env: { inputPath }
|
|
});
|
|
}
|
|
else {
|
|
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
|
env: { inputPath }
|
|
});
|
|
}
|
|
}
|
|
catch (err) {
|
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
// other errors are valid
|
|
if (err.code !== 'ENOENT')
|
|
throw err;
|
|
}
|
|
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
|
try {
|
|
yield ioUtil.unlink(inputPath);
|
|
}
|
|
catch (err) {
|
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
// other errors are valid
|
|
if (err.code !== 'ENOENT')
|
|
throw err;
|
|
}
|
|
}
|
|
else {
|
|
let isDir = false;
|
|
try {
|
|
isDir = yield ioUtil.isDirectory(inputPath);
|
|
}
|
|
catch (err) {
|
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
// other errors are valid
|
|
if (err.code !== 'ENOENT')
|
|
throw err;
|
|
return;
|
|
}
|
|
if (isDir) {
|
|
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
|
}
|
|
else {
|
|
yield ioUtil.unlink(inputPath);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
exports.rmRF = rmRF;
|
|
/**
|
|
* Make a directory. Creates the full path with folders in between
|
|
* Will throw if it fails
|
|
*
|
|
* @param fsPath path to create
|
|
* @returns Promise<void>
|
|
*/
|
|
function mkdirP(fsPath) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
yield ioUtil.mkdir(fsPath, { recursive: true });
|
|
});
|
|
}
|
|
exports.mkdirP = mkdirP;
|
|
/**
|
|
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
|
* If you check and the tool does not exist, it will throw.
|
|
*
|
|
* @param tool name of the tool
|
|
* @param check whether to check if tool exists
|
|
* @returns Promise<string> path to tool
|
|
*/
|
|
function which(tool, check) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (!tool) {
|
|
throw new Error("parameter 'tool' is required");
|
|
}
|
|
// recursive when check=true
|
|
if (check) {
|
|
const result = yield which(tool, false);
|
|
if (!result) {
|
|
if (ioUtil.IS_WINDOWS) {
|
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
|
}
|
|
else {
|
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
const matches = yield findInPath(tool);
|
|
if (matches && matches.length > 0) {
|
|
return matches[0];
|
|
}
|
|
return '';
|
|
});
|
|
}
|
|
exports.which = which;
|
|
/**
|
|
* Returns a list of all occurrences of the given tool on the system path.
|
|
*
|
|
* @returns Promise<string[]> the paths of the tool
|
|
*/
|
|
function findInPath(tool) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if (!tool) {
|
|
throw new Error("parameter 'tool' is required");
|
|
}
|
|
// build the list of extensions to try
|
|
const extensions = [];
|
|
if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) {
|
|
for (const extension of process.env['PATHEXT'].split(path.delimiter)) {
|
|
if (extension) {
|
|
extensions.push(extension);
|
|
}
|
|
}
|
|
}
|
|
// if it's rooted, return it if exists. otherwise return empty.
|
|
if (ioUtil.isRooted(tool)) {
|
|
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
|
if (filePath) {
|
|
return [filePath];
|
|
}
|
|
return [];
|
|
}
|
|
// if any path separators, return empty
|
|
if (tool.includes(path.sep)) {
|
|
return [];
|
|
}
|
|
// build the list of directories
|
|
//
|
|
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
|
// it feels like we should not do this. Checking the current directory seems like more of a use
|
|
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
|
// across platforms.
|
|
const directories = [];
|
|
if (process.env.PATH) {
|
|
for (const p of process.env.PATH.split(path.delimiter)) {
|
|
if (p) {
|
|
directories.push(p);
|
|
}
|
|
}
|
|
}
|
|
// find all matches
|
|
const matches = [];
|
|
for (const directory of directories) {
|
|
const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions);
|
|
if (filePath) {
|
|
matches.push(filePath);
|
|
}
|
|
}
|
|
return matches;
|
|
});
|
|
}
|
|
exports.findInPath = findInPath;
|
|
function readCopyOptions(options) {
|
|
const force = options.force == null ? true : options.force;
|
|
const recursive = Boolean(options.recursive);
|
|
const copySourceDirectory = options.copySourceDirectory == null
|
|
? true
|
|
: Boolean(options.copySourceDirectory);
|
|
return { force, recursive, copySourceDirectory };
|
|
}
|
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// Ensure there is not a run away recursive copy
|
|
if (currentDepth >= 255)
|
|
return;
|
|
currentDepth++;
|
|
yield mkdirP(destDir);
|
|
const files = yield ioUtil.readdir(sourceDir);
|
|
for (const fileName of files) {
|
|
const srcFile = `${sourceDir}/${fileName}`;
|
|
const destFile = `${destDir}/${fileName}`;
|
|
const srcFileStat = yield ioUtil.lstat(srcFile);
|
|
if (srcFileStat.isDirectory()) {
|
|
// Recurse
|
|
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
|
}
|
|
else {
|
|
yield copyFile(srcFile, destFile, force);
|
|
}
|
|
}
|
|
// Change the mode for the newly created directory
|
|
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
|
});
|
|
}
|
|
// Buffered file copy
|
|
function copyFile(srcFile, destFile, force) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
|
// unlink/re-link it
|
|
try {
|
|
yield ioUtil.lstat(destFile);
|
|
yield ioUtil.unlink(destFile);
|
|
}
|
|
catch (e) {
|
|
// Try to override file permission
|
|
if (e.code === 'EPERM') {
|
|
yield ioUtil.chmod(destFile, '0666');
|
|
yield ioUtil.unlink(destFile);
|
|
}
|
|
// other errors = it doesn't exist, no work to do
|
|
}
|
|
// Copy over symlink
|
|
const symlinkFull = yield ioUtil.readlink(srcFile);
|
|
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
|
}
|
|
else if (!(yield ioUtil.exists(destFile)) || force) {
|
|
yield ioUtil.copyFile(srcFile, destFile);
|
|
}
|
|
});
|
|
}
|
|
//# sourceMappingURL=io.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5628:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.restoreCache = exports.saveCache = exports.isFeatureAvailable = void 0;
|
|
var utils_1 = __nccwpck_require__(1099);
|
|
Object.defineProperty(exports, "isFeatureAvailable", ({ enumerable: true, get: function () { return utils_1.isFeatureAvailable; } }));
|
|
var save_1 = __nccwpck_require__(5324);
|
|
Object.defineProperty(exports, "saveCache", ({ enumerable: true, get: function () { return save_1.saveCache; } }));
|
|
var restore_1 = __nccwpck_require__(1840);
|
|
Object.defineProperty(exports, "restoreCache", ({ enumerable: true, get: function () { return restore_1.restoreCache; } }));
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1840:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
};
|
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
if (ar || !(i in from)) {
|
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
ar[i] = from[i];
|
|
}
|
|
}
|
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.restoreCache = void 0;
|
|
var core = __importStar(__nccwpck_require__(2186));
|
|
var utils = __importStar(__nccwpck_require__(1518));
|
|
var path = __importStar(__nccwpck_require__(1017));
|
|
var tar_1 = __nccwpck_require__(6490);
|
|
var utils_1 = __nccwpck_require__(1099);
|
|
/**
|
|
* Restores cache from keys
|
|
*
|
|
* @param paths a list of file paths to restore from the cache
|
|
* @param primaryKey an explicit key for restoring the cache
|
|
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
|
* @param options cache download options
|
|
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
|
* @param objectStoreOptions object store access options
|
|
* @returns string returns the key for the cache hit, otherwise returns undefined
|
|
*/
|
|
function restoreCache(paths_1, primaryKey_1, restoreKeys_1, options_1) {
|
|
return __awaiter(this, arguments, void 0, function (paths, primaryKey, restoreKeys, options, enableCrossOsArchive, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
objectStoreOptions) {
|
|
var keys, _i, keys_1, key, compressionMethod, archivePath, mc, bucket, entry, _a, _b, archiveFileSize, error_1, typedError, error_2;
|
|
if (enableCrossOsArchive === void 0) { enableCrossOsArchive = false; }
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
objectStoreOptions !== null && objectStoreOptions !== void 0 ? objectStoreOptions : (objectStoreOptions = {});
|
|
(0, utils_1.checkPaths)(paths);
|
|
restoreKeys = restoreKeys || [];
|
|
keys = __spreadArray([primaryKey], restoreKeys, true);
|
|
core.debug('Resolved Keys:');
|
|
core.debug(JSON.stringify(keys));
|
|
if (keys.length > 10) {
|
|
throw new utils_1.ValidationError("Key Validation Error: Keys are limited to a maximum of 10.");
|
|
}
|
|
for (_i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
key = keys_1[_i];
|
|
(0, utils_1.checkKey)(key);
|
|
}
|
|
return [4 /*yield*/, utils.getCompressionMethod()];
|
|
case 1:
|
|
compressionMethod = _c.sent();
|
|
archivePath = '';
|
|
_c.label = 2;
|
|
case 2:
|
|
_c.trys.push([2, 9, 10, 14]);
|
|
mc = (0, utils_1.getClient)(objectStoreOptions);
|
|
bucket = (0, utils_1.getBucket)(objectStoreOptions);
|
|
return [4 /*yield*/, (0, utils_1.findObject)(mc, bucket, primaryKey, restoreKeys, compressionMethod)];
|
|
case 3:
|
|
entry = _c.sent();
|
|
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
|
|
core.info('Lookup only - skipping download');
|
|
return [2 /*return*/, entry.key];
|
|
}
|
|
if (entry.item.name === undefined) {
|
|
return [2 /*return*/, undefined];
|
|
}
|
|
_b = (_a = path).join;
|
|
return [4 /*yield*/, utils.createTempDirectory()];
|
|
case 4:
|
|
archivePath = _b.apply(_a, [_c.sent(), utils.getCacheFileName(compressionMethod)]);
|
|
core.debug("Archive Path: ".concat(archivePath));
|
|
core.debug("Downloading object ".concat(entry.item.name, " from bucket ").concat(bucket));
|
|
return [4 /*yield*/, mc.fGetObject(bucket, entry.item.name, archivePath)];
|
|
case 5:
|
|
_c.sent();
|
|
if (!core.isDebug()) return [3 /*break*/, 7];
|
|
return [4 /*yield*/, (0, tar_1.listTar)(archivePath, compressionMethod)];
|
|
case 6:
|
|
_c.sent();
|
|
_c.label = 7;
|
|
case 7:
|
|
archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
core.info("Cache Size: ~".concat(Math.round(archiveFileSize / (1024 * 1024)), " MB (").concat(archiveFileSize, " B)"));
|
|
return [4 /*yield*/, (0, tar_1.extractTar)(archivePath, compressionMethod)];
|
|
case 8:
|
|
_c.sent();
|
|
core.info('Cache restored successfully');
|
|
return [2 /*return*/, entry.key];
|
|
case 9:
|
|
error_1 = _c.sent();
|
|
typedError = error_1;
|
|
if (typedError.name === utils_1.ValidationError.name) {
|
|
throw error_1;
|
|
}
|
|
else {
|
|
// Supress all non-validation cache related errors because caching should be optional
|
|
core.warning("Failed to restore: ".concat(error_1.message));
|
|
}
|
|
return [3 /*break*/, 14];
|
|
case 10:
|
|
_c.trys.push([10, 12, , 13]);
|
|
return [4 /*yield*/, utils.unlinkFile(archivePath)];
|
|
case 11:
|
|
_c.sent();
|
|
return [3 /*break*/, 13];
|
|
case 12:
|
|
error_2 = _c.sent();
|
|
core.debug("Failed to delete archive: ".concat(error_2));
|
|
return [3 /*break*/, 13];
|
|
case 13: return [7 /*endfinally*/];
|
|
case 14: return [2 /*return*/, undefined];
|
|
}
|
|
});
|
|
});
|
|
}
|
|
exports.restoreCache = restoreCache;
|
|
//# sourceMappingURL=restore.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5324:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.saveCache = void 0;
|
|
var core = __importStar(__nccwpck_require__(2186));
|
|
var utils = __importStar(__nccwpck_require__(1518));
|
|
var path = __importStar(__nccwpck_require__(1017));
|
|
var tar_1 = __nccwpck_require__(6490);
|
|
var utils_1 = __nccwpck_require__(1099);
|
|
/**
|
|
* Saves a list of files with the specified key
|
|
*
|
|
* @param paths a list of file paths to be cached
|
|
* @param key an explicit key for restoring the cache
|
|
* @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform (ignored)
|
|
* @param options cache upload options (ignored)
|
|
* @param objectStoreOptions object store access options
|
|
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
|
*/
|
|
function saveCache(paths_1, key_1, options_1) {
|
|
return __awaiter(this, arguments, void 0, function (paths, key, options, enableCrossOsArchive, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
objectStoreOptions) {
|
|
var compressionMethod, cachePaths, archiveFolder, cacheFileName, archivePath, archiveFileSize, object, bucket, mc, error_1, typedError, error_2;
|
|
if (enableCrossOsArchive === void 0) { enableCrossOsArchive = false; }
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
objectStoreOptions !== null && objectStoreOptions !== void 0 ? objectStoreOptions : (objectStoreOptions = {});
|
|
(0, utils_1.checkPaths)(paths);
|
|
(0, utils_1.checkKey)(key);
|
|
return [4 /*yield*/, utils.getCompressionMethod()];
|
|
case 1:
|
|
compressionMethod = _a.sent();
|
|
return [4 /*yield*/, utils.resolvePaths(paths)];
|
|
case 2:
|
|
cachePaths = _a.sent();
|
|
core.debug('Cache Paths:');
|
|
core.debug("".concat(JSON.stringify(cachePaths)));
|
|
if (cachePaths.length === 0) {
|
|
throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");
|
|
}
|
|
return [4 /*yield*/, utils.createTempDirectory()];
|
|
case 3:
|
|
archiveFolder = _a.sent();
|
|
cacheFileName = utils.getCacheFileName(compressionMethod);
|
|
archivePath = path.join(archiveFolder, cacheFileName);
|
|
core.debug("Archive Path: ".concat(archivePath));
|
|
_a.label = 4;
|
|
case 4:
|
|
_a.trys.push([4, 9, 10, 14]);
|
|
return [4 /*yield*/, (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod)];
|
|
case 5:
|
|
_a.sent();
|
|
if (!core.isDebug()) return [3 /*break*/, 7];
|
|
return [4 /*yield*/, (0, tar_1.listTar)(archivePath, compressionMethod)];
|
|
case 6:
|
|
_a.sent();
|
|
_a.label = 7;
|
|
case 7:
|
|
archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
core.debug("File Size: ".concat(archiveFileSize));
|
|
object = path.join(key, cacheFileName);
|
|
bucket = (0, utils_1.getBucket)(objectStoreOptions);
|
|
core.debug("Uploading object ".concat(object, " to bucket ").concat(bucket));
|
|
mc = (0, utils_1.getClient)(objectStoreOptions);
|
|
return [4 /*yield*/, mc.fPutObject(bucket, object, archivePath, {})];
|
|
case 8:
|
|
_a.sent();
|
|
core.debug("Uploaded object ".concat(object, " to bucket ").concat(bucket, " successfully"));
|
|
return [3 /*break*/, 14];
|
|
case 9:
|
|
error_1 = _a.sent();
|
|
typedError = error_1;
|
|
if (typedError.name === utils_1.ValidationError.name) {
|
|
throw error_1;
|
|
}
|
|
else {
|
|
core.warning("Failed to save: ".concat(typedError.message));
|
|
}
|
|
return [3 /*break*/, 14];
|
|
case 10:
|
|
_a.trys.push([10, 12, , 13]);
|
|
return [4 /*yield*/, utils.unlinkFile(archivePath)];
|
|
case 11:
|
|
_a.sent();
|
|
return [3 /*break*/, 13];
|
|
case 12:
|
|
error_2 = _a.sent();
|
|
core.debug("Failed to delete archive: ".concat(error_2));
|
|
return [3 /*break*/, 13];
|
|
case 13: return [7 /*endfinally*/];
|
|
case 14: return [2 /*return*/, 1];
|
|
}
|
|
});
|
|
});
|
|
}
|
|
exports.saveCache = saveCache;
|
|
//# sourceMappingURL=save.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1099:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __extends = (this && this.__extends) || (function () {
|
|
var extendStatics = function (d, b) {
|
|
extendStatics = Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
return extendStatics(d, b);
|
|
};
|
|
return function (d, b) {
|
|
if (typeof b !== "function" && b !== null)
|
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
extendStatics(d, b);
|
|
function __() { this.constructor = d; }
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
};
|
|
})();
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
};
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.checkKey = exports.ValidationError = exports.checkPaths = exports.getBucket = exports.getClient = exports.listObjects = exports.findObject = exports.isFeatureAvailable = void 0;
|
|
var utils = __importStar(__nccwpck_require__(1518));
|
|
var minio = __importStar(__nccwpck_require__(8308));
|
|
var yn_1 = __importDefault(__nccwpck_require__(7579));
|
|
/**
|
|
* isFeatureAvailable to check the presence of Actions cache service
|
|
*
|
|
* @returns boolean return true if Actions cache service feature is available, otherwise false
|
|
*/
|
|
function isFeatureAvailable() {
|
|
return true;
|
|
}
|
|
exports.isFeatureAvailable = isFeatureAvailable;
|
|
function findObject(mc, bucket, key, restoreKeys, compressionMethod) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var exactMatch, _loop_1, _i, restoreKeys_1, restoreKey, state_1;
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0: return [4 /*yield*/, listObjects(mc, bucket, key)];
|
|
case 1:
|
|
exactMatch = _a.sent();
|
|
if (exactMatch.length) {
|
|
return [2 /*return*/, { item: exactMatch[0], key: key }];
|
|
}
|
|
_loop_1 = function (restoreKey) {
|
|
var fn, objects, sorted;
|
|
return __generator(this, function (_b) {
|
|
switch (_b.label) {
|
|
case 0:
|
|
fn = utils.getCacheFileName(compressionMethod);
|
|
return [4 /*yield*/, listObjects(mc, bucket, restoreKey)];
|
|
case 1:
|
|
objects = _b.sent();
|
|
objects = objects.filter(function (o) { var _a; return (_a = o.name) === null || _a === void 0 ? void 0 : _a.includes(fn); });
|
|
if (objects.length < 1) {
|
|
return [2 /*return*/, "continue"];
|
|
}
|
|
sorted = objects.sort(function (a, b) { var _a, _b, _c, _d; return ((_b = (_a = b.lastModified) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = a.lastModified) === null || _c === void 0 ? void 0 : _c.getTime()) !== null && _d !== void 0 ? _d : 0); });
|
|
return [2 /*return*/, { value: { item: sorted[0], key: restoreKey } }];
|
|
}
|
|
});
|
|
};
|
|
_i = 0, restoreKeys_1 = restoreKeys;
|
|
_a.label = 2;
|
|
case 2:
|
|
if (!(_i < restoreKeys_1.length)) return [3 /*break*/, 5];
|
|
restoreKey = restoreKeys_1[_i];
|
|
return [5 /*yield**/, _loop_1(restoreKey)];
|
|
case 3:
|
|
state_1 = _a.sent();
|
|
if (typeof state_1 === "object")
|
|
return [2 /*return*/, state_1.value];
|
|
_a.label = 4;
|
|
case 4:
|
|
_i++;
|
|
return [3 /*break*/, 2];
|
|
case 5: throw new Error('Cache item not found');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
exports.findObject = findObject;
|
|
function listObjects(mc, bucket, prefix) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
return __generator(this, function (_a) {
|
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
var h = mc.listObjectsV2(bucket, prefix, true);
|
|
var r = [];
|
|
var resolved = false;
|
|
var timeout = setTimeout(function () {
|
|
if (!resolved)
|
|
reject(new Error('list objects got no result after 10 seconds'));
|
|
}, 10000);
|
|
h.on('data', function (obj) {
|
|
r.push(obj);
|
|
});
|
|
h.on('error', function (e) {
|
|
resolved = true;
|
|
reject(e);
|
|
clearTimeout(timeout);
|
|
});
|
|
h.on('end', function () {
|
|
resolved = true;
|
|
resolve(r);
|
|
clearTimeout(timeout);
|
|
});
|
|
})];
|
|
});
|
|
});
|
|
}
|
|
exports.listObjects = listObjects;
|
|
function getClient(options) {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
return new minio.Client({
|
|
endPoint: (_b = (_a = options.endPoint) !== null && _a !== void 0 ? _a : process.env['ALT_GHA_CACHE_ENDPOINT']) !== null && _b !== void 0 ? _b : 's3.amazon.aws',
|
|
port: (_d = (_c = options.port) !== null && _c !== void 0 ? _c : Number(process.env['ALT_GHA_CACHE_PORT'])) !== null && _d !== void 0 ? _d : 9000,
|
|
accessKey: (_g = (_f = (_e = options.accessKey) !== null && _e !== void 0 ? _e : process.env['ALT_GHA_CACHE_ACCESS_KEY']) !== null && _f !== void 0 ? _f : process.env['AWS_ACCESS_KEY_ID']) !== null && _g !== void 0 ? _g : '',
|
|
secretKey: (_k = (_j = (_h = options.secretKey) !== null && _h !== void 0 ? _h : process.env['ALT_GHA_CACHE_SECRET_KEY']) !== null && _j !== void 0 ? _j : process.env['AWS_SECRET_ACCESS_KEY']) !== null && _k !== void 0 ? _k : '',
|
|
sessionToken: (_o = (_m = (_l = options.sessionToken) !== null && _l !== void 0 ? _l : process.env['ALT_GHA_CACHE_SESSION_TOKEN']) !== null && _m !== void 0 ? _m : process.env['AWS_SESSION_TOKEN']) !== null && _o !== void 0 ? _o : '',
|
|
region: (_r = (_q = (_p = options.region) !== null && _p !== void 0 ? _p : process.env['ALT_GHA_CACHE_REGION']) !== null && _q !== void 0 ? _q : process.env['AWS_REGION']) !== null && _r !== void 0 ? _r : '',
|
|
useSSL: (_t = (_s = options.useSSL) !== null && _s !== void 0 ? _s : (0, yn_1.default)(process.env['ALT_GHA_CACHE_USE_SSL'])) !== null && _t !== void 0 ? _t : true
|
|
});
|
|
}
|
|
exports.getClient = getClient;
|
|
function getBucket(options) {
|
|
var _a, _b;
|
|
return (_b = (_a = options.bucket) !== null && _a !== void 0 ? _a : process.env['ALT_GHA_CACHE_BUCKET']) !== null && _b !== void 0 ? _b : '';
|
|
}
|
|
exports.getBucket = getBucket;
|
|
function checkPaths(paths) {
|
|
if (!paths || paths.length === 0) {
|
|
throw new ValidationError("Path Validation Error: At least one directory or file path is required");
|
|
}
|
|
}
|
|
exports.checkPaths = checkPaths;
|
|
var ValidationError = /** @class */ (function (_super) {
|
|
__extends(ValidationError, _super);
|
|
function ValidationError(message) {
|
|
var _this = _super.call(this, message) || this;
|
|
_this.name = 'ValidationError';
|
|
Object.setPrototypeOf(_this, ValidationError.prototype);
|
|
return _this;
|
|
}
|
|
return ValidationError;
|
|
}(Error));
|
|
exports.ValidationError = ValidationError;
|
|
function checkKey(key) {
|
|
if (key.length > 512) {
|
|
throw new ValidationError("Key Validation Error: ".concat(key, " cannot be larger than 512 characters."));
|
|
}
|
|
var regex = /^[^,]*$/;
|
|
if (!regex.test(key)) {
|
|
throw new ValidationError("Key Validation Error: ".concat(key, " cannot contain commas."));
|
|
}
|
|
}
|
|
exports.checkKey = checkKey;
|
|
//# sourceMappingURL=utils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7888:
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
(function (global, factory) {
|
|
true ? factory(exports) :
|
|
0;
|
|
})(this, (function (exports) { 'use strict';
|
|
|
|
/**
|
|
* Creates a continuation function with some arguments already applied.
|
|
*
|
|
* Useful as a shorthand when combined with other control flow functions. Any
|
|
* arguments passed to the returned function are added to the arguments
|
|
* originally passed to apply.
|
|
*
|
|
* @name apply
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {Function} fn - The function you want to eventually apply all
|
|
* arguments to. Invokes with (arguments...).
|
|
* @param {...*} arguments... - Any number of arguments to automatically apply
|
|
* when the continuation is called.
|
|
* @returns {Function} the partially-applied function
|
|
* @example
|
|
*
|
|
* // using apply
|
|
* async.parallel([
|
|
* async.apply(fs.writeFile, 'testfile1', 'test1'),
|
|
* async.apply(fs.writeFile, 'testfile2', 'test2')
|
|
* ]);
|
|
*
|
|
*
|
|
* // the same process without using apply
|
|
* async.parallel([
|
|
* function(callback) {
|
|
* fs.writeFile('testfile1', 'test1', callback);
|
|
* },
|
|
* function(callback) {
|
|
* fs.writeFile('testfile2', 'test2', callback);
|
|
* }
|
|
* ]);
|
|
*
|
|
* // It's possible to pass any number of additional arguments when calling the
|
|
* // continuation:
|
|
*
|
|
* node> var fn = async.apply(sys.puts, 'one');
|
|
* node> fn('two', 'three');
|
|
* one
|
|
* two
|
|
* three
|
|
*/
|
|
function apply(fn, ...args) {
|
|
return (...callArgs) => fn(...args,...callArgs);
|
|
}
|
|
|
|
function initialParams (fn) {
|
|
return function (...args/*, callback*/) {
|
|
var callback = args.pop();
|
|
return fn.call(this, args, callback);
|
|
};
|
|
}
|
|
|
|
/* istanbul ignore file */
|
|
|
|
var hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask;
|
|
var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
|
|
var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
|
|
|
|
function fallback(fn) {
|
|
setTimeout(fn, 0);
|
|
}
|
|
|
|
function wrap(defer) {
|
|
return (fn, ...args) => defer(() => fn(...args));
|
|
}
|
|
|
|
var _defer$1;
|
|
|
|
if (hasQueueMicrotask) {
|
|
_defer$1 = queueMicrotask;
|
|
} else if (hasSetImmediate) {
|
|
_defer$1 = setImmediate;
|
|
} else if (hasNextTick) {
|
|
_defer$1 = process.nextTick;
|
|
} else {
|
|
_defer$1 = fallback;
|
|
}
|
|
|
|
var setImmediate$1 = wrap(_defer$1);
|
|
|
|
/**
|
|
* Take a sync function and make it async, passing its return value to a
|
|
* callback. This is useful for plugging sync functions into a waterfall,
|
|
* series, or other async functions. Any arguments passed to the generated
|
|
* function will be passed to the wrapped function (except for the final
|
|
* callback argument). Errors thrown will be passed to the callback.
|
|
*
|
|
* If the function passed to `asyncify` returns a Promise, that promises's
|
|
* resolved/rejected state will be used to call the callback, rather than simply
|
|
* the synchronous return value.
|
|
*
|
|
* This also means you can asyncify ES2017 `async` functions.
|
|
*
|
|
* @name asyncify
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @alias wrapSync
|
|
* @category Util
|
|
* @param {Function} func - The synchronous function, or Promise-returning
|
|
* function to convert to an {@link AsyncFunction}.
|
|
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
|
|
* invoked with `(args..., callback)`.
|
|
* @example
|
|
*
|
|
* // passing a regular synchronous function
|
|
* async.waterfall([
|
|
* async.apply(fs.readFile, filename, "utf8"),
|
|
* async.asyncify(JSON.parse),
|
|
* function (data, next) {
|
|
* // data is the result of parsing the text.
|
|
* // If there was a parsing error, it would have been caught.
|
|
* }
|
|
* ], callback);
|
|
*
|
|
* // passing a function returning a promise
|
|
* async.waterfall([
|
|
* async.apply(fs.readFile, filename, "utf8"),
|
|
* async.asyncify(function (contents) {
|
|
* return db.model.create(contents);
|
|
* }),
|
|
* function (model, next) {
|
|
* // `model` is the instantiated model object.
|
|
* // If there was an error, this function would be skipped.
|
|
* }
|
|
* ], callback);
|
|
*
|
|
* // es2017 example, though `asyncify` is not needed if your JS environment
|
|
* // supports async functions out of the box
|
|
* var q = async.queue(async.asyncify(async function(file) {
|
|
* var intermediateStep = await processFile(file);
|
|
* return await somePromise(intermediateStep)
|
|
* }));
|
|
*
|
|
* q.push(files);
|
|
*/
|
|
function asyncify(func) {
|
|
if (isAsync(func)) {
|
|
return function (...args/*, callback*/) {
|
|
const callback = args.pop();
|
|
const promise = func.apply(this, args);
|
|
return handlePromise(promise, callback)
|
|
}
|
|
}
|
|
|
|
return initialParams(function (args, callback) {
|
|
var result;
|
|
try {
|
|
result = func.apply(this, args);
|
|
} catch (e) {
|
|
return callback(e);
|
|
}
|
|
// if result is Promise object
|
|
if (result && typeof result.then === 'function') {
|
|
return handlePromise(result, callback)
|
|
} else {
|
|
callback(null, result);
|
|
}
|
|
});
|
|
}
|
|
|
|
function handlePromise(promise, callback) {
|
|
return promise.then(value => {
|
|
invokeCallback(callback, null, value);
|
|
}, err => {
|
|
invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
|
|
});
|
|
}
|
|
|
|
function invokeCallback(callback, error, value) {
|
|
try {
|
|
callback(error, value);
|
|
} catch (err) {
|
|
setImmediate$1(e => { throw e }, err);
|
|
}
|
|
}
|
|
|
|
function isAsync(fn) {
|
|
return fn[Symbol.toStringTag] === 'AsyncFunction';
|
|
}
|
|
|
|
function isAsyncGenerator(fn) {
|
|
return fn[Symbol.toStringTag] === 'AsyncGenerator';
|
|
}
|
|
|
|
function isAsyncIterable(obj) {
|
|
return typeof obj[Symbol.asyncIterator] === 'function';
|
|
}
|
|
|
|
function wrapAsync(asyncFn) {
|
|
if (typeof asyncFn !== 'function') throw new Error('expected a function')
|
|
return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
|
|
}
|
|
|
|
// conditionally promisify a function.
|
|
// only return a promise if a callback is omitted
|
|
function awaitify (asyncFn, arity) {
|
|
if (!arity) arity = asyncFn.length;
|
|
if (!arity) throw new Error('arity is undefined')
|
|
function awaitable (...args) {
|
|
if (typeof args[arity - 1] === 'function') {
|
|
return asyncFn.apply(this, args)
|
|
}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
args[arity - 1] = (err, ...cbArgs) => {
|
|
if (err) return reject(err)
|
|
resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
|
|
};
|
|
asyncFn.apply(this, args);
|
|
})
|
|
}
|
|
|
|
return awaitable
|
|
}
|
|
|
|
function applyEach$1 (eachfn) {
|
|
return function applyEach(fns, ...callArgs) {
|
|
const go = awaitify(function (callback) {
|
|
var that = this;
|
|
return eachfn(fns, (fn, cb) => {
|
|
wrapAsync(fn).apply(that, callArgs.concat(cb));
|
|
}, callback);
|
|
});
|
|
return go;
|
|
};
|
|
}
|
|
|
|
function _asyncMap(eachfn, arr, iteratee, callback) {
|
|
arr = arr || [];
|
|
var results = [];
|
|
var counter = 0;
|
|
var _iteratee = wrapAsync(iteratee);
|
|
|
|
return eachfn(arr, (value, _, iterCb) => {
|
|
var index = counter++;
|
|
_iteratee(value, (err, v) => {
|
|
results[index] = v;
|
|
iterCb(err);
|
|
});
|
|
}, err => {
|
|
callback(err, results);
|
|
});
|
|
}
|
|
|
|
function isArrayLike(value) {
|
|
return value &&
|
|
typeof value.length === 'number' &&
|
|
value.length >= 0 &&
|
|
value.length % 1 === 0;
|
|
}
|
|
|
|
// A temporary value used to identify if the loop should be broken.
|
|
// See #1064, #1293
|
|
const breakLoop = {};
|
|
var breakLoop$1 = breakLoop;
|
|
|
|
function once(fn) {
|
|
function wrapper (...args) {
|
|
if (fn === null) return;
|
|
var callFn = fn;
|
|
fn = null;
|
|
callFn.apply(this, args);
|
|
}
|
|
Object.assign(wrapper, fn);
|
|
return wrapper
|
|
}
|
|
|
|
function getIterator (coll) {
|
|
return coll[Symbol.iterator] && coll[Symbol.iterator]();
|
|
}
|
|
|
|
function createArrayIterator(coll) {
|
|
var i = -1;
|
|
var len = coll.length;
|
|
return function next() {
|
|
return ++i < len ? {value: coll[i], key: i} : null;
|
|
}
|
|
}
|
|
|
|
function createES2015Iterator(iterator) {
|
|
var i = -1;
|
|
return function next() {
|
|
var item = iterator.next();
|
|
if (item.done)
|
|
return null;
|
|
i++;
|
|
return {value: item.value, key: i};
|
|
}
|
|
}
|
|
|
|
function createObjectIterator(obj) {
|
|
var okeys = obj ? Object.keys(obj) : [];
|
|
var i = -1;
|
|
var len = okeys.length;
|
|
return function next() {
|
|
var key = okeys[++i];
|
|
if (key === '__proto__') {
|
|
return next();
|
|
}
|
|
return i < len ? {value: obj[key], key} : null;
|
|
};
|
|
}
|
|
|
|
function createIterator(coll) {
|
|
if (isArrayLike(coll)) {
|
|
return createArrayIterator(coll);
|
|
}
|
|
|
|
var iterator = getIterator(coll);
|
|
return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
|
|
}
|
|
|
|
function onlyOnce(fn) {
|
|
return function (...args) {
|
|
if (fn === null) throw new Error("Callback was already called.");
|
|
var callFn = fn;
|
|
fn = null;
|
|
callFn.apply(this, args);
|
|
};
|
|
}
|
|
|
|
// for async generators
|
|
function asyncEachOfLimit(generator, limit, iteratee, callback) {
|
|
let done = false;
|
|
let canceled = false;
|
|
let awaiting = false;
|
|
let running = 0;
|
|
let idx = 0;
|
|
|
|
function replenish() {
|
|
//console.log('replenish')
|
|
if (running >= limit || awaiting || done) return
|
|
//console.log('replenish awaiting')
|
|
awaiting = true;
|
|
generator.next().then(({value, done: iterDone}) => {
|
|
//console.log('got value', value)
|
|
if (canceled || done) return
|
|
awaiting = false;
|
|
if (iterDone) {
|
|
done = true;
|
|
if (running <= 0) {
|
|
//console.log('done nextCb')
|
|
callback(null);
|
|
}
|
|
return;
|
|
}
|
|
running++;
|
|
iteratee(value, idx, iterateeCallback);
|
|
idx++;
|
|
replenish();
|
|
}).catch(handleError);
|
|
}
|
|
|
|
function iterateeCallback(err, result) {
|
|
//console.log('iterateeCallback')
|
|
running -= 1;
|
|
if (canceled) return
|
|
if (err) return handleError(err)
|
|
|
|
if (err === false) {
|
|
done = true;
|
|
canceled = true;
|
|
return
|
|
}
|
|
|
|
if (result === breakLoop$1 || (done && running <= 0)) {
|
|
done = true;
|
|
//console.log('done iterCb')
|
|
return callback(null);
|
|
}
|
|
replenish();
|
|
}
|
|
|
|
function handleError(err) {
|
|
if (canceled) return
|
|
awaiting = false;
|
|
done = true;
|
|
callback(err);
|
|
}
|
|
|
|
replenish();
|
|
}
|
|
|
|
var eachOfLimit$2 = (limit) => {
|
|
return (obj, iteratee, callback) => {
|
|
callback = once(callback);
|
|
if (limit <= 0) {
|
|
throw new RangeError('concurrency limit cannot be less than 1')
|
|
}
|
|
if (!obj) {
|
|
return callback(null);
|
|
}
|
|
if (isAsyncGenerator(obj)) {
|
|
return asyncEachOfLimit(obj, limit, iteratee, callback)
|
|
}
|
|
if (isAsyncIterable(obj)) {
|
|
return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback)
|
|
}
|
|
var nextElem = createIterator(obj);
|
|
var done = false;
|
|
var canceled = false;
|
|
var running = 0;
|
|
var looping = false;
|
|
|
|
function iterateeCallback(err, value) {
|
|
if (canceled) return
|
|
running -= 1;
|
|
if (err) {
|
|
done = true;
|
|
callback(err);
|
|
}
|
|
else if (err === false) {
|
|
done = true;
|
|
canceled = true;
|
|
}
|
|
else if (value === breakLoop$1 || (done && running <= 0)) {
|
|
done = true;
|
|
return callback(null);
|
|
}
|
|
else if (!looping) {
|
|
replenish();
|
|
}
|
|
}
|
|
|
|
function replenish () {
|
|
looping = true;
|
|
while (running < limit && !done) {
|
|
var elem = nextElem();
|
|
if (elem === null) {
|
|
done = true;
|
|
if (running <= 0) {
|
|
callback(null);
|
|
}
|
|
return;
|
|
}
|
|
running += 1;
|
|
iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
|
|
}
|
|
looping = false;
|
|
}
|
|
|
|
replenish();
|
|
};
|
|
};
|
|
|
|
/**
|
|
* The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name eachOfLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.eachOf]{@link module:Collections.eachOf}
|
|
* @alias forEachOfLimit
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each
|
|
* item in `coll`. The `key` is the item's key, or index in the case of an
|
|
* array.
|
|
* Invoked with (item, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all
|
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function eachOfLimit(coll, limit, iteratee, callback) {
|
|
return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
|
|
}
|
|
|
|
var eachOfLimit$1 = awaitify(eachOfLimit, 4);
|
|
|
|
// eachOf implementation optimized for array-likes
|
|
function eachOfArrayLike(coll, iteratee, callback) {
|
|
callback = once(callback);
|
|
var index = 0,
|
|
completed = 0,
|
|
{length} = coll,
|
|
canceled = false;
|
|
if (length === 0) {
|
|
callback(null);
|
|
}
|
|
|
|
function iteratorCallback(err, value) {
|
|
if (err === false) {
|
|
canceled = true;
|
|
}
|
|
if (canceled === true) return
|
|
if (err) {
|
|
callback(err);
|
|
} else if ((++completed === length) || value === breakLoop$1) {
|
|
callback(null);
|
|
}
|
|
}
|
|
|
|
for (; index < length; index++) {
|
|
iteratee(coll[index], index, onlyOnce(iteratorCallback));
|
|
}
|
|
}
|
|
|
|
// a generic version of eachOf which can handle array, object, and iterator cases.
|
|
function eachOfGeneric (coll, iteratee, callback) {
|
|
return eachOfLimit$1(coll, Infinity, iteratee, callback);
|
|
}
|
|
|
|
/**
|
|
* Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
|
|
* to the iteratee.
|
|
*
|
|
* @name eachOf
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias forEachOf
|
|
* @category Collection
|
|
* @see [async.each]{@link module:Collections.each}
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each
|
|
* item in `coll`.
|
|
* The `key` is the item's key, or index in the case of an array.
|
|
* Invoked with (item, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all
|
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
* @example
|
|
*
|
|
* // dev.json is a file containing a valid json object config for dev environment
|
|
* // dev.json is a file containing a valid json object config for test environment
|
|
* // prod.json is a file containing a valid json object config for prod environment
|
|
* // invalid.json is a file with a malformed json object
|
|
*
|
|
* let configs = {}; //global variable
|
|
* let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
|
|
* let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
|
|
*
|
|
* // asynchronous function that reads a json file and parses the contents as json object
|
|
* function parseFile(file, key, callback) {
|
|
* fs.readFile(file, "utf8", function(err, data) {
|
|
* if (err) return calback(err);
|
|
* try {
|
|
* configs[key] = JSON.parse(data);
|
|
* } catch (e) {
|
|
* return callback(e);
|
|
* }
|
|
* callback();
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.forEachOf(validConfigFileMap, parseFile, function (err) {
|
|
* if (err) {
|
|
* console.error(err);
|
|
* } else {
|
|
* console.log(configs);
|
|
* // configs is now a map of JSON data, e.g.
|
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
* }
|
|
* });
|
|
*
|
|
* //Error handing
|
|
* async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
|
|
* if (err) {
|
|
* console.error(err);
|
|
* // JSON parse error exception
|
|
* } else {
|
|
* console.log(configs);
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.forEachOf(validConfigFileMap, parseFile)
|
|
* .then( () => {
|
|
* console.log(configs);
|
|
* // configs is now a map of JSON data, e.g.
|
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
* }).catch( err => {
|
|
* console.error(err);
|
|
* });
|
|
*
|
|
* //Error handing
|
|
* async.forEachOf(invalidConfigFileMap, parseFile)
|
|
* .then( () => {
|
|
* console.log(configs);
|
|
* }).catch( err => {
|
|
* console.error(err);
|
|
* // JSON parse error exception
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.forEachOf(validConfigFileMap, parseFile);
|
|
* console.log(configs);
|
|
* // configs is now a map of JSON data, e.g.
|
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* //Error handing
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.forEachOf(invalidConfigFileMap, parseFile);
|
|
* console.log(configs);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // JSON parse error exception
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function eachOf(coll, iteratee, callback) {
|
|
var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
|
|
return eachOfImplementation(coll, wrapAsync(iteratee), callback);
|
|
}
|
|
|
|
var eachOf$1 = awaitify(eachOf, 3);
|
|
|
|
/**
|
|
* Produces a new collection of values by mapping each value in `coll` through
|
|
* the `iteratee` function. The `iteratee` is called with an item from `coll`
|
|
* and a callback for when it has finished processing. Each of these callbacks
|
|
* takes 2 arguments: an `error`, and the transformed item from `coll`. If
|
|
* `iteratee` passes an error to its callback, the main `callback` (for the
|
|
* `map` function) is immediately called with the error.
|
|
*
|
|
* Note, that since this function applies the `iteratee` to each item in
|
|
* parallel, there is no guarantee that the `iteratee` functions will complete
|
|
* in order. However, the results array will be in the same order as the
|
|
* original `coll`.
|
|
*
|
|
* If `map` is passed an Object, the results will be an Array. The results
|
|
* will roughly be in the order of the original Objects' keys (but this can
|
|
* vary across JavaScript engines).
|
|
*
|
|
* @name map
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with the transformed item.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Results is an Array of the
|
|
* transformed items from the `coll`. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // file1.txt is a file that is 1000 bytes in size
|
|
* // file2.txt is a file that is 2000 bytes in size
|
|
* // file3.txt is a file that is 3000 bytes in size
|
|
* // file4.txt does not exist
|
|
*
|
|
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
*
|
|
* // asynchronous function that returns the file size in bytes
|
|
* function getFileSizeInBytes(file, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* callback(null, stat.size);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.map(fileList, getFileSizeInBytes, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // results is now an array of the file size in bytes for each file, e.g.
|
|
* // [ 1000, 2000, 3000]
|
|
* }
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* } else {
|
|
* console.log(results);
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.map(fileList, getFileSizeInBytes)
|
|
* .then( results => {
|
|
* console.log(results);
|
|
* // results is now an array of the file size in bytes for each file, e.g.
|
|
* // [ 1000, 2000, 3000]
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.map(withMissingFileList, getFileSizeInBytes)
|
|
* .then( results => {
|
|
* console.log(results);
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.map(fileList, getFileSizeInBytes);
|
|
* console.log(results);
|
|
* // results is now an array of the file size in bytes for each file, e.g.
|
|
* // [ 1000, 2000, 3000]
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // Error Handling
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.map(withMissingFileList, getFileSizeInBytes);
|
|
* console.log(results);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function map (coll, iteratee, callback) {
|
|
return _asyncMap(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var map$1 = awaitify(map, 3);
|
|
|
|
/**
|
|
* Applies the provided arguments to each function in the array, calling
|
|
* `callback` after all functions have completed. If you only provide the first
|
|
* argument, `fns`, then it will return a function which lets you pass in the
|
|
* arguments as if it were a single function call. If more arguments are
|
|
* provided, `callback` is required while `args` is still optional. The results
|
|
* for each of the applied async functions are passed to the final callback
|
|
* as an array.
|
|
*
|
|
* @name applyEach
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
|
|
* to all call with the same arguments
|
|
* @param {...*} [args] - any number of separate arguments to pass to the
|
|
* function.
|
|
* @param {Function} [callback] - the final argument should be the callback,
|
|
* called when all functions have completed processing.
|
|
* @returns {AsyncFunction} - Returns a function that takes no args other than
|
|
* an optional callback, that is the result of applying the `args` to each
|
|
* of the functions.
|
|
* @example
|
|
*
|
|
* const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
|
|
*
|
|
* appliedFn((err, results) => {
|
|
* // results[0] is the results for `enableSearch`
|
|
* // results[1] is the results for `updateSchema`
|
|
* });
|
|
*
|
|
* // partial application example:
|
|
* async.each(
|
|
* buckets,
|
|
* async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
|
|
* callback
|
|
* );
|
|
*/
|
|
var applyEach = applyEach$1(map$1);
|
|
|
|
/**
|
|
* The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
|
|
*
|
|
* @name eachOfSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.eachOf]{@link module:Collections.eachOf}
|
|
* @alias forEachOfSeries
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* Invoked with (item, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function eachOfSeries(coll, iteratee, callback) {
|
|
return eachOfLimit$1(coll, 1, iteratee, callback)
|
|
}
|
|
var eachOfSeries$1 = awaitify(eachOfSeries, 3);
|
|
|
|
/**
|
|
* The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time.
|
|
*
|
|
* @name mapSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.map]{@link module:Collections.map}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with the transformed item.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Results is an array of the
|
|
* transformed items from the `coll`. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function mapSeries (coll, iteratee, callback) {
|
|
return _asyncMap(eachOfSeries$1, coll, iteratee, callback)
|
|
}
|
|
var mapSeries$1 = awaitify(mapSeries, 3);
|
|
|
|
/**
|
|
* The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
|
|
*
|
|
* @name applyEachSeries
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.applyEach]{@link module:ControlFlow.applyEach}
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
|
|
* call with the same arguments
|
|
* @param {...*} [args] - any number of separate arguments to pass to the
|
|
* function.
|
|
* @param {Function} [callback] - the final argument should be the callback,
|
|
* called when all functions have completed processing.
|
|
* @returns {AsyncFunction} - A function, that when called, is the result of
|
|
* appling the `args` to the list of functions. It takes no args, other than
|
|
* a callback.
|
|
*/
|
|
var applyEachSeries = applyEach$1(mapSeries$1);
|
|
|
|
const PROMISE_SYMBOL = Symbol('promiseCallback');
|
|
|
|
function promiseCallback () {
|
|
let resolve, reject;
|
|
function callback (err, ...args) {
|
|
if (err) return reject(err)
|
|
resolve(args.length > 1 ? args : args[0]);
|
|
}
|
|
|
|
callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
|
|
resolve = res,
|
|
reject = rej;
|
|
});
|
|
|
|
return callback
|
|
}
|
|
|
|
/**
|
|
* Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
|
|
* their requirements. Each function can optionally depend on other functions
|
|
* being completed first, and each function is run as soon as its requirements
|
|
* are satisfied.
|
|
*
|
|
* If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
|
|
* will stop. Further tasks will not execute (so any other functions depending
|
|
* on it will not run), and the main `callback` is immediately called with the
|
|
* error.
|
|
*
|
|
* {@link AsyncFunction}s also receive an object containing the results of functions which
|
|
* have completed so far as the first argument, if they have dependencies. If a
|
|
* task function has no dependencies, it will only be passed a callback.
|
|
*
|
|
* @name auto
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Object} tasks - An object. Each of its properties is either a
|
|
* function or an array of requirements, with the {@link AsyncFunction} itself the last item
|
|
* in the array. The object's key of a property serves as the name of the task
|
|
* defined by that property, i.e. can be used when specifying requirements for
|
|
* other tasks. The function receives one or two arguments:
|
|
* * a `results` object, containing the results of the previously executed
|
|
* functions, only passed if the task has any dependencies,
|
|
* * a `callback(err, result)` function, which must be called when finished,
|
|
* passing an `error` (which can be `null`) and the result of the function's
|
|
* execution.
|
|
* @param {number} [concurrency=Infinity] - An optional `integer` for
|
|
* determining the maximum number of tasks that can be run in parallel. By
|
|
* default, as many as possible.
|
|
* @param {Function} [callback] - An optional callback which is called when all
|
|
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
|
* pass an error to their callback. Results are always returned; however, if an
|
|
* error occurs, no further `tasks` will be performed, and the results object
|
|
* will only contain partial results. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if a callback is not passed
|
|
* @example
|
|
*
|
|
* //Using Callbacks
|
|
* async.auto({
|
|
* get_data: function(callback) {
|
|
* // async code to get some data
|
|
* callback(null, 'data', 'converted to array');
|
|
* },
|
|
* make_folder: function(callback) {
|
|
* // async code to create a directory to store a file in
|
|
* // this is run at the same time as getting the data
|
|
* callback(null, 'folder');
|
|
* },
|
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
* // once there is some data and the directory exists,
|
|
* // write the data to a file in the directory
|
|
* callback(null, 'filename');
|
|
* }],
|
|
* email_link: ['write_file', function(results, callback) {
|
|
* // once the file is written let's email a link to it...
|
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
* }]
|
|
* }, function(err, results) {
|
|
* if (err) {
|
|
* console.log('err = ', err);
|
|
* }
|
|
* console.log('results = ', results);
|
|
* // results = {
|
|
* // get_data: ['data', 'converted to array']
|
|
* // make_folder; 'folder',
|
|
* // write_file: 'filename'
|
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
* // }
|
|
* });
|
|
*
|
|
* //Using Promises
|
|
* async.auto({
|
|
* get_data: function(callback) {
|
|
* console.log('in get_data');
|
|
* // async code to get some data
|
|
* callback(null, 'data', 'converted to array');
|
|
* },
|
|
* make_folder: function(callback) {
|
|
* console.log('in make_folder');
|
|
* // async code to create a directory to store a file in
|
|
* // this is run at the same time as getting the data
|
|
* callback(null, 'folder');
|
|
* },
|
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
* // once there is some data and the directory exists,
|
|
* // write the data to a file in the directory
|
|
* callback(null, 'filename');
|
|
* }],
|
|
* email_link: ['write_file', function(results, callback) {
|
|
* // once the file is written let's email a link to it...
|
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
* }]
|
|
* }).then(results => {
|
|
* console.log('results = ', results);
|
|
* // results = {
|
|
* // get_data: ['data', 'converted to array']
|
|
* // make_folder; 'folder',
|
|
* // write_file: 'filename'
|
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
* // }
|
|
* }).catch(err => {
|
|
* console.log('err = ', err);
|
|
* });
|
|
*
|
|
* //Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.auto({
|
|
* get_data: function(callback) {
|
|
* // async code to get some data
|
|
* callback(null, 'data', 'converted to array');
|
|
* },
|
|
* make_folder: function(callback) {
|
|
* // async code to create a directory to store a file in
|
|
* // this is run at the same time as getting the data
|
|
* callback(null, 'folder');
|
|
* },
|
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
* // once there is some data and the directory exists,
|
|
* // write the data to a file in the directory
|
|
* callback(null, 'filename');
|
|
* }],
|
|
* email_link: ['write_file', function(results, callback) {
|
|
* // once the file is written let's email a link to it...
|
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
* }]
|
|
* });
|
|
* console.log('results = ', results);
|
|
* // results = {
|
|
* // get_data: ['data', 'converted to array']
|
|
* // make_folder; 'folder',
|
|
* // write_file: 'filename'
|
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
* // }
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function auto(tasks, concurrency, callback) {
|
|
if (typeof concurrency !== 'number') {
|
|
// concurrency is optional, shift the args.
|
|
callback = concurrency;
|
|
concurrency = null;
|
|
}
|
|
callback = once(callback || promiseCallback());
|
|
var numTasks = Object.keys(tasks).length;
|
|
if (!numTasks) {
|
|
return callback(null);
|
|
}
|
|
if (!concurrency) {
|
|
concurrency = numTasks;
|
|
}
|
|
|
|
var results = {};
|
|
var runningTasks = 0;
|
|
var canceled = false;
|
|
var hasError = false;
|
|
|
|
var listeners = Object.create(null);
|
|
|
|
var readyTasks = [];
|
|
|
|
// for cycle detection:
|
|
var readyToCheck = []; // tasks that have been identified as reachable
|
|
// without the possibility of returning to an ancestor task
|
|
var uncheckedDependencies = {};
|
|
|
|
Object.keys(tasks).forEach(key => {
|
|
var task = tasks[key];
|
|
if (!Array.isArray(task)) {
|
|
// no dependencies
|
|
enqueueTask(key, [task]);
|
|
readyToCheck.push(key);
|
|
return;
|
|
}
|
|
|
|
var dependencies = task.slice(0, task.length - 1);
|
|
var remainingDependencies = dependencies.length;
|
|
if (remainingDependencies === 0) {
|
|
enqueueTask(key, task);
|
|
readyToCheck.push(key);
|
|
return;
|
|
}
|
|
uncheckedDependencies[key] = remainingDependencies;
|
|
|
|
dependencies.forEach(dependencyName => {
|
|
if (!tasks[dependencyName]) {
|
|
throw new Error('async.auto task `' + key +
|
|
'` has a non-existent dependency `' +
|
|
dependencyName + '` in ' +
|
|
dependencies.join(', '));
|
|
}
|
|
addListener(dependencyName, () => {
|
|
remainingDependencies--;
|
|
if (remainingDependencies === 0) {
|
|
enqueueTask(key, task);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
checkForDeadlocks();
|
|
processQueue();
|
|
|
|
function enqueueTask(key, task) {
|
|
readyTasks.push(() => runTask(key, task));
|
|
}
|
|
|
|
function processQueue() {
|
|
if (canceled) return
|
|
if (readyTasks.length === 0 && runningTasks === 0) {
|
|
return callback(null, results);
|
|
}
|
|
while(readyTasks.length && runningTasks < concurrency) {
|
|
var run = readyTasks.shift();
|
|
run();
|
|
}
|
|
|
|
}
|
|
|
|
function addListener(taskName, fn) {
|
|
var taskListeners = listeners[taskName];
|
|
if (!taskListeners) {
|
|
taskListeners = listeners[taskName] = [];
|
|
}
|
|
|
|
taskListeners.push(fn);
|
|
}
|
|
|
|
function taskComplete(taskName) {
|
|
var taskListeners = listeners[taskName] || [];
|
|
taskListeners.forEach(fn => fn());
|
|
processQueue();
|
|
}
|
|
|
|
|
|
function runTask(key, task) {
|
|
if (hasError) return;
|
|
|
|
var taskCallback = onlyOnce((err, ...result) => {
|
|
runningTasks--;
|
|
if (err === false) {
|
|
canceled = true;
|
|
return
|
|
}
|
|
if (result.length < 2) {
|
|
[result] = result;
|
|
}
|
|
if (err) {
|
|
var safeResults = {};
|
|
Object.keys(results).forEach(rkey => {
|
|
safeResults[rkey] = results[rkey];
|
|
});
|
|
safeResults[key] = result;
|
|
hasError = true;
|
|
listeners = Object.create(null);
|
|
if (canceled) return
|
|
callback(err, safeResults);
|
|
} else {
|
|
results[key] = result;
|
|
taskComplete(key);
|
|
}
|
|
});
|
|
|
|
runningTasks++;
|
|
var taskFn = wrapAsync(task[task.length - 1]);
|
|
if (task.length > 1) {
|
|
taskFn(results, taskCallback);
|
|
} else {
|
|
taskFn(taskCallback);
|
|
}
|
|
}
|
|
|
|
function checkForDeadlocks() {
|
|
// Kahn's algorithm
|
|
// https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm
|
|
// http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html
|
|
var currentTask;
|
|
var counter = 0;
|
|
while (readyToCheck.length) {
|
|
currentTask = readyToCheck.pop();
|
|
counter++;
|
|
getDependents(currentTask).forEach(dependent => {
|
|
if (--uncheckedDependencies[dependent] === 0) {
|
|
readyToCheck.push(dependent);
|
|
}
|
|
});
|
|
}
|
|
|
|
if (counter !== numTasks) {
|
|
throw new Error(
|
|
'async.auto cannot execute tasks due to a recursive dependency'
|
|
);
|
|
}
|
|
}
|
|
|
|
function getDependents(taskName) {
|
|
var result = [];
|
|
Object.keys(tasks).forEach(key => {
|
|
const task = tasks[key];
|
|
if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
|
|
result.push(key);
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
return callback[PROMISE_SYMBOL]
|
|
}
|
|
|
|
var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
|
|
var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
|
|
var FN_ARG_SPLIT = /,/;
|
|
var FN_ARG = /(=.+)?(\s*)$/;
|
|
|
|
function stripComments(string) {
|
|
let stripped = '';
|
|
let index = 0;
|
|
let endBlockComment = string.indexOf('*/');
|
|
while (index < string.length) {
|
|
if (string[index] === '/' && string[index+1] === '/') {
|
|
// inline comment
|
|
let endIndex = string.indexOf('\n', index);
|
|
index = (endIndex === -1) ? string.length : endIndex;
|
|
} else if ((endBlockComment !== -1) && (string[index] === '/') && (string[index+1] === '*')) {
|
|
// block comment
|
|
let endIndex = string.indexOf('*/', index);
|
|
if (endIndex !== -1) {
|
|
index = endIndex + 2;
|
|
endBlockComment = string.indexOf('*/', index);
|
|
} else {
|
|
stripped += string[index];
|
|
index++;
|
|
}
|
|
} else {
|
|
stripped += string[index];
|
|
index++;
|
|
}
|
|
}
|
|
return stripped;
|
|
}
|
|
|
|
function parseParams(func) {
|
|
const src = stripComments(func.toString());
|
|
let match = src.match(FN_ARGS);
|
|
if (!match) {
|
|
match = src.match(ARROW_FN_ARGS);
|
|
}
|
|
if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src)
|
|
let [, args] = match;
|
|
return args
|
|
.replace(/\s/g, '')
|
|
.split(FN_ARG_SPLIT)
|
|
.map((arg) => arg.replace(FN_ARG, '').trim());
|
|
}
|
|
|
|
/**
|
|
* A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
|
|
* tasks are specified as parameters to the function, after the usual callback
|
|
* parameter, with the parameter names matching the names of the tasks it
|
|
* depends on. This can provide even more readable task graphs which can be
|
|
* easier to maintain.
|
|
*
|
|
* If a final callback is specified, the task results are similarly injected,
|
|
* specified as named parameters after the initial error parameter.
|
|
*
|
|
* The autoInject function is purely syntactic sugar and its semantics are
|
|
* otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
|
|
*
|
|
* @name autoInject
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.auto]{@link module:ControlFlow.auto}
|
|
* @category Control Flow
|
|
* @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
|
|
* the form 'func([dependencies...], callback). The object's key of a property
|
|
* serves as the name of the task defined by that property, i.e. can be used
|
|
* when specifying requirements for other tasks.
|
|
* * The `callback` parameter is a `callback(err, result)` which must be called
|
|
* when finished, passing an `error` (which can be `null`) and the result of
|
|
* the function's execution. The remaining parameters name other tasks on
|
|
* which the task is dependent, and the results from those tasks are the
|
|
* arguments of those parameters.
|
|
* @param {Function} [callback] - An optional callback which is called when all
|
|
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
|
* pass an error to their callback, and a `results` object with any completed
|
|
* task results, similar to `auto`.
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // The example from `auto` can be rewritten as follows:
|
|
* async.autoInject({
|
|
* get_data: function(callback) {
|
|
* // async code to get some data
|
|
* callback(null, 'data', 'converted to array');
|
|
* },
|
|
* make_folder: function(callback) {
|
|
* // async code to create a directory to store a file in
|
|
* // this is run at the same time as getting the data
|
|
* callback(null, 'folder');
|
|
* },
|
|
* write_file: function(get_data, make_folder, callback) {
|
|
* // once there is some data and the directory exists,
|
|
* // write the data to a file in the directory
|
|
* callback(null, 'filename');
|
|
* },
|
|
* email_link: function(write_file, callback) {
|
|
* // once the file is written let's email a link to it...
|
|
* // write_file contains the filename returned by write_file.
|
|
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
|
* }
|
|
* }, function(err, results) {
|
|
* console.log('err = ', err);
|
|
* console.log('email_link = ', results.email_link);
|
|
* });
|
|
*
|
|
* // If you are using a JS minifier that mangles parameter names, `autoInject`
|
|
* // will not work with plain functions, since the parameter names will be
|
|
* // collapsed to a single letter identifier. To work around this, you can
|
|
* // explicitly specify the names of the parameters your task function needs
|
|
* // in an array, similar to Angular.js dependency injection.
|
|
*
|
|
* // This still has an advantage over plain `auto`, since the results a task
|
|
* // depends on are still spread into arguments.
|
|
* async.autoInject({
|
|
* //...
|
|
* write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
|
|
* callback(null, 'filename');
|
|
* }],
|
|
* email_link: ['write_file', function(write_file, callback) {
|
|
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
|
* }]
|
|
* //...
|
|
* }, function(err, results) {
|
|
* console.log('err = ', err);
|
|
* console.log('email_link = ', results.email_link);
|
|
* });
|
|
*/
|
|
function autoInject(tasks, callback) {
|
|
var newTasks = {};
|
|
|
|
Object.keys(tasks).forEach(key => {
|
|
var taskFn = tasks[key];
|
|
var params;
|
|
var fnIsAsync = isAsync(taskFn);
|
|
var hasNoDeps =
|
|
(!fnIsAsync && taskFn.length === 1) ||
|
|
(fnIsAsync && taskFn.length === 0);
|
|
|
|
if (Array.isArray(taskFn)) {
|
|
params = [...taskFn];
|
|
taskFn = params.pop();
|
|
|
|
newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
|
|
} else if (hasNoDeps) {
|
|
// no dependencies, use the function as-is
|
|
newTasks[key] = taskFn;
|
|
} else {
|
|
params = parseParams(taskFn);
|
|
if ((taskFn.length === 0 && !fnIsAsync) && params.length === 0) {
|
|
throw new Error("autoInject task functions require explicit parameters.");
|
|
}
|
|
|
|
// remove callback param
|
|
if (!fnIsAsync) params.pop();
|
|
|
|
newTasks[key] = params.concat(newTask);
|
|
}
|
|
|
|
function newTask(results, taskCb) {
|
|
var newArgs = params.map(name => results[name]);
|
|
newArgs.push(taskCb);
|
|
wrapAsync(taskFn)(...newArgs);
|
|
}
|
|
});
|
|
|
|
return auto(newTasks, callback);
|
|
}
|
|
|
|
// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation
|
|
// used for queues. This implementation assumes that the node provided by the user can be modified
|
|
// to adjust the next and last properties. We implement only the minimal functionality
|
|
// for queue support.
|
|
class DLL {
|
|
constructor() {
|
|
this.head = this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
|
|
removeLink(node) {
|
|
if (node.prev) node.prev.next = node.next;
|
|
else this.head = node.next;
|
|
if (node.next) node.next.prev = node.prev;
|
|
else this.tail = node.prev;
|
|
|
|
node.prev = node.next = null;
|
|
this.length -= 1;
|
|
return node;
|
|
}
|
|
|
|
empty () {
|
|
while(this.head) this.shift();
|
|
return this;
|
|
}
|
|
|
|
insertAfter(node, newNode) {
|
|
newNode.prev = node;
|
|
newNode.next = node.next;
|
|
if (node.next) node.next.prev = newNode;
|
|
else this.tail = newNode;
|
|
node.next = newNode;
|
|
this.length += 1;
|
|
}
|
|
|
|
insertBefore(node, newNode) {
|
|
newNode.prev = node.prev;
|
|
newNode.next = node;
|
|
if (node.prev) node.prev.next = newNode;
|
|
else this.head = newNode;
|
|
node.prev = newNode;
|
|
this.length += 1;
|
|
}
|
|
|
|
unshift(node) {
|
|
if (this.head) this.insertBefore(this.head, node);
|
|
else setInitial(this, node);
|
|
}
|
|
|
|
push(node) {
|
|
if (this.tail) this.insertAfter(this.tail, node);
|
|
else setInitial(this, node);
|
|
}
|
|
|
|
shift() {
|
|
return this.head && this.removeLink(this.head);
|
|
}
|
|
|
|
pop() {
|
|
return this.tail && this.removeLink(this.tail);
|
|
}
|
|
|
|
toArray() {
|
|
return [...this]
|
|
}
|
|
|
|
*[Symbol.iterator] () {
|
|
var cur = this.head;
|
|
while (cur) {
|
|
yield cur.data;
|
|
cur = cur.next;
|
|
}
|
|
}
|
|
|
|
remove (testFn) {
|
|
var curr = this.head;
|
|
while(curr) {
|
|
var {next} = curr;
|
|
if (testFn(curr)) {
|
|
this.removeLink(curr);
|
|
}
|
|
curr = next;
|
|
}
|
|
return this;
|
|
}
|
|
}
|
|
|
|
function setInitial(dll, node) {
|
|
dll.length = 1;
|
|
dll.head = dll.tail = node;
|
|
}
|
|
|
|
function queue$1(worker, concurrency, payload) {
|
|
if (concurrency == null) {
|
|
concurrency = 1;
|
|
}
|
|
else if(concurrency === 0) {
|
|
throw new RangeError('Concurrency must not be zero');
|
|
}
|
|
|
|
var _worker = wrapAsync(worker);
|
|
var numRunning = 0;
|
|
var workersList = [];
|
|
const events = {
|
|
error: [],
|
|
drain: [],
|
|
saturated: [],
|
|
unsaturated: [],
|
|
empty: []
|
|
};
|
|
|
|
function on (event, handler) {
|
|
events[event].push(handler);
|
|
}
|
|
|
|
function once (event, handler) {
|
|
const handleAndRemove = (...args) => {
|
|
off(event, handleAndRemove);
|
|
handler(...args);
|
|
};
|
|
events[event].push(handleAndRemove);
|
|
}
|
|
|
|
function off (event, handler) {
|
|
if (!event) return Object.keys(events).forEach(ev => events[ev] = [])
|
|
if (!handler) return events[event] = []
|
|
events[event] = events[event].filter(ev => ev !== handler);
|
|
}
|
|
|
|
function trigger (event, ...args) {
|
|
events[event].forEach(handler => handler(...args));
|
|
}
|
|
|
|
var processingScheduled = false;
|
|
function _insert(data, insertAtFront, rejectOnError, callback) {
|
|
if (callback != null && typeof callback !== 'function') {
|
|
throw new Error('task callback must be a function');
|
|
}
|
|
q.started = true;
|
|
|
|
var res, rej;
|
|
function promiseCallback (err, ...args) {
|
|
// we don't care about the error, let the global error handler
|
|
// deal with it
|
|
if (err) return rejectOnError ? rej(err) : res()
|
|
if (args.length <= 1) return res(args[0])
|
|
res(args);
|
|
}
|
|
|
|
var item = q._createTaskItem(
|
|
data,
|
|
rejectOnError ? promiseCallback :
|
|
(callback || promiseCallback)
|
|
);
|
|
|
|
if (insertAtFront) {
|
|
q._tasks.unshift(item);
|
|
} else {
|
|
q._tasks.push(item);
|
|
}
|
|
|
|
if (!processingScheduled) {
|
|
processingScheduled = true;
|
|
setImmediate$1(() => {
|
|
processingScheduled = false;
|
|
q.process();
|
|
});
|
|
}
|
|
|
|
if (rejectOnError || !callback) {
|
|
return new Promise((resolve, reject) => {
|
|
res = resolve;
|
|
rej = reject;
|
|
})
|
|
}
|
|
}
|
|
|
|
function _createCB(tasks) {
|
|
return function (err, ...args) {
|
|
numRunning -= 1;
|
|
|
|
for (var i = 0, l = tasks.length; i < l; i++) {
|
|
var task = tasks[i];
|
|
|
|
var index = workersList.indexOf(task);
|
|
if (index === 0) {
|
|
workersList.shift();
|
|
} else if (index > 0) {
|
|
workersList.splice(index, 1);
|
|
}
|
|
|
|
task.callback(err, ...args);
|
|
|
|
if (err != null) {
|
|
trigger('error', err, task.data);
|
|
}
|
|
}
|
|
|
|
if (numRunning <= (q.concurrency - q.buffer) ) {
|
|
trigger('unsaturated');
|
|
}
|
|
|
|
if (q.idle()) {
|
|
trigger('drain');
|
|
}
|
|
q.process();
|
|
};
|
|
}
|
|
|
|
function _maybeDrain(data) {
|
|
if (data.length === 0 && q.idle()) {
|
|
// call drain immediately if there are no tasks
|
|
setImmediate$1(() => trigger('drain'));
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
const eventMethod = (name) => (handler) => {
|
|
if (!handler) {
|
|
return new Promise((resolve, reject) => {
|
|
once(name, (err, data) => {
|
|
if (err) return reject(err)
|
|
resolve(data);
|
|
});
|
|
})
|
|
}
|
|
off(name);
|
|
on(name, handler);
|
|
|
|
};
|
|
|
|
var isProcessing = false;
|
|
var q = {
|
|
_tasks: new DLL(),
|
|
_createTaskItem (data, callback) {
|
|
return {
|
|
data,
|
|
callback
|
|
};
|
|
},
|
|
*[Symbol.iterator] () {
|
|
yield* q._tasks[Symbol.iterator]();
|
|
},
|
|
concurrency,
|
|
payload,
|
|
buffer: concurrency / 4,
|
|
started: false,
|
|
paused: false,
|
|
push (data, callback) {
|
|
if (Array.isArray(data)) {
|
|
if (_maybeDrain(data)) return
|
|
return data.map(datum => _insert(datum, false, false, callback))
|
|
}
|
|
return _insert(data, false, false, callback);
|
|
},
|
|
pushAsync (data, callback) {
|
|
if (Array.isArray(data)) {
|
|
if (_maybeDrain(data)) return
|
|
return data.map(datum => _insert(datum, false, true, callback))
|
|
}
|
|
return _insert(data, false, true, callback);
|
|
},
|
|
kill () {
|
|
off();
|
|
q._tasks.empty();
|
|
},
|
|
unshift (data, callback) {
|
|
if (Array.isArray(data)) {
|
|
if (_maybeDrain(data)) return
|
|
return data.map(datum => _insert(datum, true, false, callback))
|
|
}
|
|
return _insert(data, true, false, callback);
|
|
},
|
|
unshiftAsync (data, callback) {
|
|
if (Array.isArray(data)) {
|
|
if (_maybeDrain(data)) return
|
|
return data.map(datum => _insert(datum, true, true, callback))
|
|
}
|
|
return _insert(data, true, true, callback);
|
|
},
|
|
remove (testFn) {
|
|
q._tasks.remove(testFn);
|
|
},
|
|
process () {
|
|
// Avoid trying to start too many processing operations. This can occur
|
|
// when callbacks resolve synchronously (#1267).
|
|
if (isProcessing) {
|
|
return;
|
|
}
|
|
isProcessing = true;
|
|
while(!q.paused && numRunning < q.concurrency && q._tasks.length){
|
|
var tasks = [], data = [];
|
|
var l = q._tasks.length;
|
|
if (q.payload) l = Math.min(l, q.payload);
|
|
for (var i = 0; i < l; i++) {
|
|
var node = q._tasks.shift();
|
|
tasks.push(node);
|
|
workersList.push(node);
|
|
data.push(node.data);
|
|
}
|
|
|
|
numRunning += 1;
|
|
|
|
if (q._tasks.length === 0) {
|
|
trigger('empty');
|
|
}
|
|
|
|
if (numRunning === q.concurrency) {
|
|
trigger('saturated');
|
|
}
|
|
|
|
var cb = onlyOnce(_createCB(tasks));
|
|
_worker(data, cb);
|
|
}
|
|
isProcessing = false;
|
|
},
|
|
length () {
|
|
return q._tasks.length;
|
|
},
|
|
running () {
|
|
return numRunning;
|
|
},
|
|
workersList () {
|
|
return workersList;
|
|
},
|
|
idle() {
|
|
return q._tasks.length + numRunning === 0;
|
|
},
|
|
pause () {
|
|
q.paused = true;
|
|
},
|
|
resume () {
|
|
if (q.paused === false) { return; }
|
|
q.paused = false;
|
|
setImmediate$1(q.process);
|
|
}
|
|
};
|
|
// define these as fixed properties, so people get useful errors when updating
|
|
Object.defineProperties(q, {
|
|
saturated: {
|
|
writable: false,
|
|
value: eventMethod('saturated')
|
|
},
|
|
unsaturated: {
|
|
writable: false,
|
|
value: eventMethod('unsaturated')
|
|
},
|
|
empty: {
|
|
writable: false,
|
|
value: eventMethod('empty')
|
|
},
|
|
drain: {
|
|
writable: false,
|
|
value: eventMethod('drain')
|
|
},
|
|
error: {
|
|
writable: false,
|
|
value: eventMethod('error')
|
|
},
|
|
});
|
|
return q;
|
|
}
|
|
|
|
/**
|
|
* Creates a `cargo` object with the specified payload. Tasks added to the
|
|
* cargo will be processed altogether (up to the `payload` limit). If the
|
|
* `worker` is in progress, the task is queued until it becomes available. Once
|
|
* the `worker` has completed some tasks, each callback of those tasks is
|
|
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
|
* for how `cargo` and `queue` work.
|
|
*
|
|
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
|
* at a time, cargo passes an array of tasks to a single worker, repeating
|
|
* when the worker is finished.
|
|
*
|
|
* @name cargo
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.queue]{@link module:ControlFlow.queue}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
|
* of queued tasks. Invoked with `(tasks, callback)`.
|
|
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
|
* how many tasks should be processed per round; if omitted, the default is
|
|
* unlimited.
|
|
* @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can
|
|
* attached as certain properties to listen for specific events during the
|
|
* lifecycle of the cargo and inner queue.
|
|
* @example
|
|
*
|
|
* // create a cargo object with payload 2
|
|
* var cargo = async.cargo(function(tasks, callback) {
|
|
* for (var i=0; i<tasks.length; i++) {
|
|
* console.log('hello ' + tasks[i].name);
|
|
* }
|
|
* callback();
|
|
* }, 2);
|
|
*
|
|
* // add some items
|
|
* cargo.push({name: 'foo'}, function(err) {
|
|
* console.log('finished processing foo');
|
|
* });
|
|
* cargo.push({name: 'bar'}, function(err) {
|
|
* console.log('finished processing bar');
|
|
* });
|
|
* await cargo.push({name: 'baz'});
|
|
* console.log('finished processing baz');
|
|
*/
|
|
function cargo$1(worker, payload) {
|
|
return queue$1(worker, 1, payload);
|
|
}
|
|
|
|
/**
|
|
* Creates a `cargoQueue` object with the specified payload. Tasks added to the
|
|
* cargoQueue will be processed together (up to the `payload` limit) in `concurrency` parallel workers.
|
|
* If the all `workers` are in progress, the task is queued until one becomes available. Once
|
|
* a `worker` has completed some tasks, each callback of those tasks is
|
|
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
|
* for how `cargo` and `queue` work.
|
|
*
|
|
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
|
* at a time, and [`cargo`]{@link module:ControlFlow.cargo} passes an array of tasks to a single worker,
|
|
* the cargoQueue passes an array of tasks to multiple parallel workers.
|
|
*
|
|
* @name cargoQueue
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.queue]{@link module:ControlFlow.queue}
|
|
* @see [async.cargo]{@link module:ControlFLow.cargo}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
|
* of queued tasks. Invoked with `(tasks, callback)`.
|
|
* @param {number} [concurrency=1] - An `integer` for determining how many
|
|
* `worker` functions should be run in parallel. If omitted, the concurrency
|
|
* defaults to `1`. If the concurrency is `0`, an error is thrown.
|
|
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
|
* how many tasks should be processed per round; if omitted, the default is
|
|
* unlimited.
|
|
* @returns {module:ControlFlow.QueueObject} A cargoQueue object to manage the tasks. Callbacks can
|
|
* attached as certain properties to listen for specific events during the
|
|
* lifecycle of the cargoQueue and inner queue.
|
|
* @example
|
|
*
|
|
* // create a cargoQueue object with payload 2 and concurrency 2
|
|
* var cargoQueue = async.cargoQueue(function(tasks, callback) {
|
|
* for (var i=0; i<tasks.length; i++) {
|
|
* console.log('hello ' + tasks[i].name);
|
|
* }
|
|
* callback();
|
|
* }, 2, 2);
|
|
*
|
|
* // add some items
|
|
* cargoQueue.push({name: 'foo'}, function(err) {
|
|
* console.log('finished processing foo');
|
|
* });
|
|
* cargoQueue.push({name: 'bar'}, function(err) {
|
|
* console.log('finished processing bar');
|
|
* });
|
|
* cargoQueue.push({name: 'baz'}, function(err) {
|
|
* console.log('finished processing baz');
|
|
* });
|
|
* cargoQueue.push({name: 'boo'}, function(err) {
|
|
* console.log('finished processing boo');
|
|
* });
|
|
*/
|
|
function cargo(worker, concurrency, payload) {
|
|
return queue$1(worker, concurrency, payload);
|
|
}
|
|
|
|
/**
|
|
* Reduces `coll` into a single value using an async `iteratee` to return each
|
|
* successive step. `memo` is the initial state of the reduction. This function
|
|
* only operates in series.
|
|
*
|
|
* For performance reasons, it may make sense to split a call to this function
|
|
* into a parallel map, and then use the normal `Array.prototype.reduce` on the
|
|
* results. This function is for situations where each step in the reduction
|
|
* needs to be async; if you can get the data before reducing it, then it's
|
|
* probably a good idea to do so.
|
|
*
|
|
* @name reduce
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias inject
|
|
* @alias foldl
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {*} memo - The initial state of the reduction.
|
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
* array to produce the next step in the reduction.
|
|
* The `iteratee` should complete with the next state of the reduction.
|
|
* If the iteratee completes with an error, the reduction is stopped and the
|
|
* main `callback` is immediately called with the error.
|
|
* Invoked with (memo, item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result is the reduced value. Invoked with
|
|
* (err, result).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // file1.txt is a file that is 1000 bytes in size
|
|
* // file2.txt is a file that is 2000 bytes in size
|
|
* // file3.txt is a file that is 3000 bytes in size
|
|
* // file4.txt does not exist
|
|
*
|
|
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
* const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
|
|
*
|
|
* // asynchronous function that computes the file size in bytes
|
|
* // file size is added to the memoized value, then returned
|
|
* function getFileSizeInBytes(memo, file, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* callback(null, memo + stat.size);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // 6000
|
|
* // which is the sum of the file sizes of the three files
|
|
* }
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* } else {
|
|
* console.log(result);
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.reduce(fileList, 0, getFileSizeInBytes)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // 6000
|
|
* // which is the sum of the file sizes of the three files
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.reduce(withMissingFileList, 0, getFileSizeInBytes)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.reduce(fileList, 0, getFileSizeInBytes);
|
|
* console.log(result);
|
|
* // 6000
|
|
* // which is the sum of the file sizes of the three files
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // Error Handling
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
|
|
* console.log(result);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function reduce(coll, memo, iteratee, callback) {
|
|
callback = once(callback);
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return eachOfSeries$1(coll, (x, i, iterCb) => {
|
|
_iteratee(memo, x, (err, v) => {
|
|
memo = v;
|
|
iterCb(err);
|
|
});
|
|
}, err => callback(err, memo));
|
|
}
|
|
var reduce$1 = awaitify(reduce, 4);
|
|
|
|
/**
|
|
* Version of the compose function that is more natural to read. Each function
|
|
* consumes the return value of the previous function. It is the equivalent of
|
|
* [compose]{@link module:ControlFlow.compose} with the arguments reversed.
|
|
*
|
|
* Each function is executed with the `this` binding of the composed function.
|
|
*
|
|
* @name seq
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.compose]{@link module:ControlFlow.compose}
|
|
* @category Control Flow
|
|
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
|
* @returns {Function} a function that composes the `functions` in order
|
|
* @example
|
|
*
|
|
* // Requires lodash (or underscore), express3 and dresende's orm2.
|
|
* // Part of an app, that fetches cats of the logged user.
|
|
* // This example uses `seq` function to avoid overnesting and error
|
|
* // handling clutter.
|
|
* app.get('/cats', function(request, response) {
|
|
* var User = request.models.User;
|
|
* async.seq(
|
|
* User.get.bind(User), // 'User.get' has signature (id, callback(err, data))
|
|
* function(user, fn) {
|
|
* user.getCats(fn); // 'getCats' has signature (callback(err, data))
|
|
* }
|
|
* )(req.session.user_id, function (err, cats) {
|
|
* if (err) {
|
|
* console.error(err);
|
|
* response.json({ status: 'error', message: err.message });
|
|
* } else {
|
|
* response.json({ status: 'ok', message: 'Cats found', data: cats });
|
|
* }
|
|
* });
|
|
* });
|
|
*/
|
|
function seq(...functions) {
|
|
var _functions = functions.map(wrapAsync);
|
|
return function (...args) {
|
|
var that = this;
|
|
|
|
var cb = args[args.length - 1];
|
|
if (typeof cb == 'function') {
|
|
args.pop();
|
|
} else {
|
|
cb = promiseCallback();
|
|
}
|
|
|
|
reduce$1(_functions, args, (newargs, fn, iterCb) => {
|
|
fn.apply(that, newargs.concat((err, ...nextargs) => {
|
|
iterCb(err, nextargs);
|
|
}));
|
|
},
|
|
(err, results) => cb(err, ...results));
|
|
|
|
return cb[PROMISE_SYMBOL]
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function which is a composition of the passed asynchronous
|
|
* functions. Each function consumes the return value of the function that
|
|
* follows. Composing functions `f()`, `g()`, and `h()` would produce the result
|
|
* of `f(g(h()))`, only this version uses callbacks to obtain the return values.
|
|
*
|
|
* If the last argument to the composed function is not a function, a promise
|
|
* is returned when you call it.
|
|
*
|
|
* Each function is executed with the `this` binding of the composed function.
|
|
*
|
|
* @name compose
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
|
* @returns {Function} an asynchronous function that is the composed
|
|
* asynchronous `functions`
|
|
* @example
|
|
*
|
|
* function add1(n, callback) {
|
|
* setTimeout(function () {
|
|
* callback(null, n + 1);
|
|
* }, 10);
|
|
* }
|
|
*
|
|
* function mul3(n, callback) {
|
|
* setTimeout(function () {
|
|
* callback(null, n * 3);
|
|
* }, 10);
|
|
* }
|
|
*
|
|
* var add1mul3 = async.compose(mul3, add1);
|
|
* add1mul3(4, function (err, result) {
|
|
* // result now equals 15
|
|
* });
|
|
*/
|
|
function compose(...args) {
|
|
return seq(...args.reverse());
|
|
}
|
|
|
|
/**
|
|
* The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name mapLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.map]{@link module:Collections.map}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with the transformed item.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Results is an array of the
|
|
* transformed items from the `coll`. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function mapLimit (coll, limit, iteratee, callback) {
|
|
return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var mapLimit$1 = awaitify(mapLimit, 4);
|
|
|
|
/**
|
|
* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name concatLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.concat]{@link module:Collections.concat}
|
|
* @category Collection
|
|
* @alias flatMapLimit
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
|
* which should use an array as its result. Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
* (err, results).
|
|
* @returns A Promise, if no callback is passed
|
|
*/
|
|
function concatLimit(coll, limit, iteratee, callback) {
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return mapLimit$1(coll, limit, (val, iterCb) => {
|
|
_iteratee(val, (err, ...args) => {
|
|
if (err) return iterCb(err);
|
|
return iterCb(err, args);
|
|
});
|
|
}, (err, mapResults) => {
|
|
var result = [];
|
|
for (var i = 0; i < mapResults.length; i++) {
|
|
if (mapResults[i]) {
|
|
result = result.concat(...mapResults[i]);
|
|
}
|
|
}
|
|
|
|
return callback(err, result);
|
|
});
|
|
}
|
|
var concatLimit$1 = awaitify(concatLimit, 4);
|
|
|
|
/**
|
|
* Applies `iteratee` to each item in `coll`, concatenating the results. Returns
|
|
* the concatenated list. The `iteratee`s are called in parallel, and the
|
|
* results are concatenated as they return. The results array will be returned in
|
|
* the original order of `coll` passed to the `iteratee` function.
|
|
*
|
|
* @name concat
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @alias flatMap
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
|
* which should use an array as its result. Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
* (err, results).
|
|
* @returns A Promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* let directoryList = ['dir1','dir2','dir3'];
|
|
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
|
*
|
|
* // Using callbacks
|
|
* async.concat(directoryList, fs.readdir, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
* }
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4 does not exist
|
|
* } else {
|
|
* console.log(results);
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.concat(directoryList, fs.readdir)
|
|
* .then(results => {
|
|
* console.log(results);
|
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.concat(withMissingDirectoryList, fs.readdir)
|
|
* .then(results => {
|
|
* console.log(results);
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4 does not exist
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.concat(directoryList, fs.readdir);
|
|
* console.log(results);
|
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
* } catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // Error Handling
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
|
* console.log(results);
|
|
* } catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4 does not exist
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function concat(coll, iteratee, callback) {
|
|
return concatLimit$1(coll, Infinity, iteratee, callback)
|
|
}
|
|
var concat$1 = awaitify(concat, 3);
|
|
|
|
/**
|
|
* The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
|
|
*
|
|
* @name concatSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.concat]{@link module:Collections.concat}
|
|
* @category Collection
|
|
* @alias flatMapSeries
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
|
|
* The iteratee should complete with an array an array of results.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
* (err, results).
|
|
* @returns A Promise, if no callback is passed
|
|
*/
|
|
function concatSeries(coll, iteratee, callback) {
|
|
return concatLimit$1(coll, 1, iteratee, callback)
|
|
}
|
|
var concatSeries$1 = awaitify(concatSeries, 3);
|
|
|
|
/**
|
|
* Returns a function that when called, calls-back with the values provided.
|
|
* Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
|
|
* [`auto`]{@link module:ControlFlow.auto}.
|
|
*
|
|
* @name constant
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {...*} arguments... - Any number of arguments to automatically invoke
|
|
* callback with.
|
|
* @returns {AsyncFunction} Returns a function that when invoked, automatically
|
|
* invokes the callback with the previous given arguments.
|
|
* @example
|
|
*
|
|
* async.waterfall([
|
|
* async.constant(42),
|
|
* function (value, next) {
|
|
* // value === 42
|
|
* },
|
|
* //...
|
|
* ], callback);
|
|
*
|
|
* async.waterfall([
|
|
* async.constant(filename, "utf8"),
|
|
* fs.readFile,
|
|
* function (fileData, next) {
|
|
* //...
|
|
* }
|
|
* //...
|
|
* ], callback);
|
|
*
|
|
* async.auto({
|
|
* hostname: async.constant("https://server.net/"),
|
|
* port: findFreePort,
|
|
* launchServer: ["hostname", "port", function (options, cb) {
|
|
* startServer(options, cb);
|
|
* }],
|
|
* //...
|
|
* }, callback);
|
|
*/
|
|
function constant$1(...args) {
|
|
return function (...ignoredArgs/*, callback*/) {
|
|
var callback = ignoredArgs.pop();
|
|
return callback(null, ...args);
|
|
};
|
|
}
|
|
|
|
function _createTester(check, getResult) {
|
|
return (eachfn, arr, _iteratee, cb) => {
|
|
var testPassed = false;
|
|
var testResult;
|
|
const iteratee = wrapAsync(_iteratee);
|
|
eachfn(arr, (value, _, callback) => {
|
|
iteratee(value, (err, result) => {
|
|
if (err || err === false) return callback(err);
|
|
|
|
if (check(result) && !testResult) {
|
|
testPassed = true;
|
|
testResult = getResult(true, value);
|
|
return callback(null, breakLoop$1);
|
|
}
|
|
callback();
|
|
});
|
|
}, err => {
|
|
if (err) return cb(err);
|
|
cb(null, testPassed ? testResult : getResult(false));
|
|
});
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Returns the first value in `coll` that passes an async truth test. The
|
|
* `iteratee` is applied in parallel, meaning the first iteratee to return
|
|
* `true` will fire the detect `callback` with that result. That means the
|
|
* result might not be the first item in the original `coll` (in terms of order)
|
|
* that passes the test.
|
|
|
|
* If order within the original `coll` is important, then look at
|
|
* [`detectSeries`]{@link module:Collections.detectSeries}.
|
|
*
|
|
* @name detect
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias find
|
|
* @category Collections
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
|
* The iteratee must complete with a boolean value as its result.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
|
* Result will be the first item in the array that passes the truth test
|
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
|
* (err, result).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
*
|
|
* // asynchronous function that checks if a file exists
|
|
* function fileExists(file, callback) {
|
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
* callback(null, !err);
|
|
* });
|
|
* }
|
|
*
|
|
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
|
|
* function(err, result) {
|
|
* console.log(result);
|
|
* // dir1/file1.txt
|
|
* // result now equals the first file in the list that exists
|
|
* }
|
|
*);
|
|
*
|
|
* // Using Promises
|
|
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
|
|
* .then(result => {
|
|
* console.log(result);
|
|
* // dir1/file1.txt
|
|
* // result now equals the first file in the list that exists
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
|
|
* console.log(result);
|
|
* // dir1/file1.txt
|
|
* // result now equals the file in the list that exists
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function detect(coll, iteratee, callback) {
|
|
return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var detect$1 = awaitify(detect, 3);
|
|
|
|
/**
|
|
* The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name detectLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.detect]{@link module:Collections.detect}
|
|
* @alias findLimit
|
|
* @category Collections
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
|
* The iteratee must complete with a boolean value as its result.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
|
* Result will be the first item in the array that passes the truth test
|
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
|
* (err, result).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function detectLimit(coll, limit, iteratee, callback) {
|
|
return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var detectLimit$1 = awaitify(detectLimit, 4);
|
|
|
|
/**
|
|
* The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
|
|
*
|
|
* @name detectSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.detect]{@link module:Collections.detect}
|
|
* @alias findSeries
|
|
* @category Collections
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
|
* The iteratee must complete with a boolean value as its result.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
|
* Result will be the first item in the array that passes the truth test
|
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
|
* (err, result).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function detectSeries(coll, iteratee, callback) {
|
|
return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback)
|
|
}
|
|
|
|
var detectSeries$1 = awaitify(detectSeries, 3);
|
|
|
|
function consoleFunc(name) {
|
|
return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
|
|
/* istanbul ignore else */
|
|
if (typeof console === 'object') {
|
|
/* istanbul ignore else */
|
|
if (err) {
|
|
/* istanbul ignore else */
|
|
if (console.error) {
|
|
console.error(err);
|
|
}
|
|
} else if (console[name]) { /* istanbul ignore else */
|
|
resultArgs.forEach(x => console[name](x));
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Logs the result of an [`async` function]{@link AsyncFunction} to the
|
|
* `console` using `console.dir` to display the properties of the resulting object.
|
|
* Only works in Node.js or in browsers that support `console.dir` and
|
|
* `console.error` (such as FF and Chrome).
|
|
* If multiple arguments are returned from the async function,
|
|
* `console.dir` is called on each argument in order.
|
|
*
|
|
* @name dir
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} function - The function you want to eventually apply
|
|
* all arguments to.
|
|
* @param {...*} arguments... - Any number of arguments to apply to the function.
|
|
* @example
|
|
*
|
|
* // in a module
|
|
* var hello = function(name, callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, {hello: name});
|
|
* }, 1000);
|
|
* };
|
|
*
|
|
* // in the node repl
|
|
* node> async.dir(hello, 'world');
|
|
* {hello: 'world'}
|
|
*/
|
|
var dir = consoleFunc('dir');
|
|
|
|
/**
|
|
* The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
|
|
* the order of operations, the arguments `test` and `iteratee` are switched.
|
|
*
|
|
* `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
|
|
*
|
|
* @name doWhilst
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} iteratee - A function which is called each time `test`
|
|
* passes. Invoked with (callback).
|
|
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
|
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
|
* non-error args from the previous callback of `iteratee`.
|
|
* @param {Function} [callback] - A callback which is called after the test
|
|
* function has failed and repeated execution of `iteratee` has stopped.
|
|
* `callback` will be passed an error and any arguments passed to the final
|
|
* `iteratee`'s callback. Invoked with (err, [results]);
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function doWhilst(iteratee, test, callback) {
|
|
callback = onlyOnce(callback);
|
|
var _fn = wrapAsync(iteratee);
|
|
var _test = wrapAsync(test);
|
|
var results;
|
|
|
|
function next(err, ...args) {
|
|
if (err) return callback(err);
|
|
if (err === false) return;
|
|
results = args;
|
|
_test(...args, check);
|
|
}
|
|
|
|
function check(err, truth) {
|
|
if (err) return callback(err);
|
|
if (err === false) return;
|
|
if (!truth) return callback(null, ...results);
|
|
_fn(next);
|
|
}
|
|
|
|
return check(null, true);
|
|
}
|
|
|
|
var doWhilst$1 = awaitify(doWhilst, 3);
|
|
|
|
/**
|
|
* Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
|
|
* argument ordering differs from `until`.
|
|
*
|
|
* @name doUntil
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} iteratee - An async function which is called each time
|
|
* `test` fails. Invoked with (callback).
|
|
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
|
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
|
* non-error args from the previous callback of `iteratee`
|
|
* @param {Function} [callback] - A callback which is called after the test
|
|
* function has passed and repeated execution of `iteratee` has stopped. `callback`
|
|
* will be passed an error and any arguments passed to the final `iteratee`'s
|
|
* callback. Invoked with (err, [results]);
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function doUntil(iteratee, test, callback) {
|
|
const _test = wrapAsync(test);
|
|
return doWhilst$1(iteratee, (...args) => {
|
|
const cb = args.pop();
|
|
_test(...args, (err, truth) => cb (err, !truth));
|
|
}, callback);
|
|
}
|
|
|
|
function _withoutIndex(iteratee) {
|
|
return (value, index, callback) => iteratee(value, callback);
|
|
}
|
|
|
|
/**
|
|
* Applies the function `iteratee` to each item in `coll`, in parallel.
|
|
* The `iteratee` is called with an item from the list, and a callback for when
|
|
* it has finished. If the `iteratee` passes an error to its `callback`, the
|
|
* main `callback` (for the `each` function) is immediately called with the
|
|
* error.
|
|
*
|
|
* Note, that since this function applies `iteratee` to each item in parallel,
|
|
* there is no guarantee that the iteratee functions will complete in order.
|
|
*
|
|
* @name each
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias forEach
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to
|
|
* each item in `coll`. Invoked with (item, callback).
|
|
* The array index is not passed to the iteratee.
|
|
* If you need the index, use `eachOf`.
|
|
* @param {Function} [callback] - A callback which is called when all
|
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
|
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
|
*
|
|
* // asynchronous function that deletes a file
|
|
* const deleteFile = function(file, callback) {
|
|
* fs.unlink(file, callback);
|
|
* };
|
|
*
|
|
* // Using callbacks
|
|
* async.each(fileList, deleteFile, function(err) {
|
|
* if( err ) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log('All files have been deleted successfully');
|
|
* }
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.each(withMissingFileList, deleteFile, function(err){
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4/file2.txt does not exist
|
|
* // dir1/file1.txt could have been deleted
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.each(fileList, deleteFile)
|
|
* .then( () => {
|
|
* console.log('All files have been deleted successfully');
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.each(fileList, deleteFile)
|
|
* .then( () => {
|
|
* console.log('All files have been deleted successfully');
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4/file2.txt does not exist
|
|
* // dir1/file1.txt could have been deleted
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* await async.each(files, deleteFile);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // Error Handling
|
|
* async () => {
|
|
* try {
|
|
* await async.each(withMissingFileList, deleteFile);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* // since dir4/file2.txt does not exist
|
|
* // dir1/file1.txt could have been deleted
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function eachLimit$2(coll, iteratee, callback) {
|
|
return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
|
}
|
|
|
|
var each = awaitify(eachLimit$2, 3);
|
|
|
|
/**
|
|
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name eachLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.each]{@link module:Collections.each}
|
|
* @alias forEachLimit
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The array index is not passed to the iteratee.
|
|
* If you need the index, use `eachOfLimit`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called when all
|
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function eachLimit(coll, limit, iteratee, callback) {
|
|
return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
|
}
|
|
var eachLimit$1 = awaitify(eachLimit, 4);
|
|
|
|
/**
|
|
* The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
|
|
*
|
|
* Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item
|
|
* in series and therefore the iteratee functions will complete in order.
|
|
|
|
* @name eachSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.each]{@link module:Collections.each}
|
|
* @alias forEachSeries
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each
|
|
* item in `coll`.
|
|
* The array index is not passed to the iteratee.
|
|
* If you need the index, use `eachOfSeries`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called when all
|
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
*/
|
|
function eachSeries(coll, iteratee, callback) {
|
|
return eachLimit$1(coll, 1, iteratee, callback)
|
|
}
|
|
var eachSeries$1 = awaitify(eachSeries, 3);
|
|
|
|
/**
|
|
* Wrap an async function and ensure it calls its callback on a later tick of
|
|
* the event loop. If the function already calls its callback on a next tick,
|
|
* no extra deferral is added. This is useful for preventing stack overflows
|
|
* (`RangeError: Maximum call stack size exceeded`) and generally keeping
|
|
* [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
|
|
* contained. ES2017 `async` functions are returned as-is -- they are immune
|
|
* to Zalgo's corrupting influences, as they always resolve on a later tick.
|
|
*
|
|
* @name ensureAsync
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} fn - an async function, one that expects a node-style
|
|
* callback as its last argument.
|
|
* @returns {AsyncFunction} Returns a wrapped function with the exact same call
|
|
* signature as the function passed in.
|
|
* @example
|
|
*
|
|
* function sometimesAsync(arg, callback) {
|
|
* if (cache[arg]) {
|
|
* return callback(null, cache[arg]); // this would be synchronous!!
|
|
* } else {
|
|
* doSomeIO(arg, callback); // this IO would be asynchronous
|
|
* }
|
|
* }
|
|
*
|
|
* // this has a risk of stack overflows if many results are cached in a row
|
|
* async.mapSeries(args, sometimesAsync, done);
|
|
*
|
|
* // this will defer sometimesAsync's callback if necessary,
|
|
* // preventing stack overflows
|
|
* async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
|
|
*/
|
|
function ensureAsync(fn) {
|
|
if (isAsync(fn)) return fn;
|
|
return function (...args/*, callback*/) {
|
|
var callback = args.pop();
|
|
var sync = true;
|
|
args.push((...innerArgs) => {
|
|
if (sync) {
|
|
setImmediate$1(() => callback(...innerArgs));
|
|
} else {
|
|
callback(...innerArgs);
|
|
}
|
|
});
|
|
fn.apply(this, args);
|
|
sync = false;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Returns `true` if every element in `coll` satisfies an async test. If any
|
|
* iteratee call returns `false`, the main `callback` is immediately called.
|
|
*
|
|
* @name every
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias all
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collection in parallel.
|
|
* The iteratee must complete with a boolean result value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
* depending on the values of the async tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
|
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
*
|
|
* // asynchronous function that checks if a file exists
|
|
* function fileExists(file, callback) {
|
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
* callback(null, !err);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.every(fileList, fileExists, function(err, result) {
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since every file exists
|
|
* });
|
|
*
|
|
* async.every(withMissingFileList, fileExists, function(err, result) {
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since NOT every file exists
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.every(fileList, fileExists)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since every file exists
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* async.every(withMissingFileList, fileExists)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since NOT every file exists
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.every(fileList, fileExists);
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since every file exists
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.every(withMissingFileList, fileExists);
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since NOT every file exists
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function every(coll, iteratee, callback) {
|
|
return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var every$1 = awaitify(every, 3);
|
|
|
|
/**
|
|
* The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name everyLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.every]{@link module:Collections.every}
|
|
* @alias allLimit
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collection in parallel.
|
|
* The iteratee must complete with a boolean result value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
* depending on the values of the async tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function everyLimit(coll, limit, iteratee, callback) {
|
|
return _createTester(bool => !bool, res => !res)(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var everyLimit$1 = awaitify(everyLimit, 4);
|
|
|
|
/**
|
|
* The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
|
|
*
|
|
* @name everySeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.every]{@link module:Collections.every}
|
|
* @alias allSeries
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collection in series.
|
|
* The iteratee must complete with a boolean result value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
* depending on the values of the async tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function everySeries(coll, iteratee, callback) {
|
|
return _createTester(bool => !bool, res => !res)(eachOfSeries$1, coll, iteratee, callback)
|
|
}
|
|
var everySeries$1 = awaitify(everySeries, 3);
|
|
|
|
function filterArray(eachfn, arr, iteratee, callback) {
|
|
var truthValues = new Array(arr.length);
|
|
eachfn(arr, (x, index, iterCb) => {
|
|
iteratee(x, (err, v) => {
|
|
truthValues[index] = !!v;
|
|
iterCb(err);
|
|
});
|
|
}, err => {
|
|
if (err) return callback(err);
|
|
var results = [];
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (truthValues[i]) results.push(arr[i]);
|
|
}
|
|
callback(null, results);
|
|
});
|
|
}
|
|
|
|
function filterGeneric(eachfn, coll, iteratee, callback) {
|
|
var results = [];
|
|
eachfn(coll, (x, index, iterCb) => {
|
|
iteratee(x, (err, v) => {
|
|
if (err) return iterCb(err);
|
|
if (v) {
|
|
results.push({index, value: x});
|
|
}
|
|
iterCb(err);
|
|
});
|
|
}, err => {
|
|
if (err) return callback(err);
|
|
callback(null, results
|
|
.sort((a, b) => a.index - b.index)
|
|
.map(v => v.value));
|
|
});
|
|
}
|
|
|
|
function _filter(eachfn, coll, iteratee, callback) {
|
|
var filter = isArrayLike(coll) ? filterArray : filterGeneric;
|
|
return filter(eachfn, coll, wrapAsync(iteratee), callback);
|
|
}
|
|
|
|
/**
|
|
* Returns a new array of all the values in `coll` which pass an async truth
|
|
* test. This operation is performed in parallel, but the results array will be
|
|
* in the same order as the original.
|
|
*
|
|
* @name filter
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias select
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
|
|
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
|
* with a boolean argument once it has completed. Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
*
|
|
* const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
*
|
|
* // asynchronous function that checks if a file exists
|
|
* function fileExists(file, callback) {
|
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
* callback(null, !err);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.filter(files, fileExists, function(err, results) {
|
|
* if(err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
* // results is now an array of the existing files
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.filter(files, fileExists)
|
|
* .then(results => {
|
|
* console.log(results);
|
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
* // results is now an array of the existing files
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.filter(files, fileExists);
|
|
* console.log(results);
|
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
* // results is now an array of the existing files
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function filter (coll, iteratee, callback) {
|
|
return _filter(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var filter$1 = awaitify(filter, 3);
|
|
|
|
/**
|
|
* The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name filterLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.filter]{@link module:Collections.filter}
|
|
* @alias selectLimit
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
|
|
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
|
* with a boolean argument once it has completed. Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function filterLimit (coll, limit, iteratee, callback) {
|
|
return _filter(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var filterLimit$1 = awaitify(filterLimit, 4);
|
|
|
|
/**
|
|
* The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
|
|
*
|
|
* @name filterSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.filter]{@link module:Collections.filter}
|
|
* @alias selectSeries
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
|
|
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
|
* with a boolean argument once it has completed. Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results)
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function filterSeries (coll, iteratee, callback) {
|
|
return _filter(eachOfSeries$1, coll, iteratee, callback)
|
|
}
|
|
var filterSeries$1 = awaitify(filterSeries, 3);
|
|
|
|
/**
|
|
* Calls the asynchronous function `fn` with a callback parameter that allows it
|
|
* to call itself again, in series, indefinitely.
|
|
|
|
* If an error is passed to the callback then `errback` is called with the
|
|
* error, and execution stops, otherwise it will never be called.
|
|
*
|
|
* @name forever
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} fn - an async function to call repeatedly.
|
|
* Invoked with (next).
|
|
* @param {Function} [errback] - when `fn` passes an error to it's callback,
|
|
* this function will be called, and execution stops. Invoked with (err).
|
|
* @returns {Promise} a promise that rejects if an error occurs and an errback
|
|
* is not passed
|
|
* @example
|
|
*
|
|
* async.forever(
|
|
* function(next) {
|
|
* // next is suitable for passing to things that need a callback(err [, whatever]);
|
|
* // it will result in this function being called again.
|
|
* },
|
|
* function(err) {
|
|
* // if next is called with a value in its first parameter, it will appear
|
|
* // in here as 'err', and execution will stop.
|
|
* }
|
|
* );
|
|
*/
|
|
function forever(fn, errback) {
|
|
var done = onlyOnce(errback);
|
|
var task = wrapAsync(ensureAsync(fn));
|
|
|
|
function next(err) {
|
|
if (err) return done(err);
|
|
if (err === false) return;
|
|
task(next);
|
|
}
|
|
return next();
|
|
}
|
|
var forever$1 = awaitify(forever, 2);
|
|
|
|
/**
|
|
* The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name groupByLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.groupBy]{@link module:Collections.groupBy}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with a `key` to group the value under.
|
|
* Invoked with (value, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Result is an `Object` whoses
|
|
* properties are arrays of values which returned the corresponding key.
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function groupByLimit(coll, limit, iteratee, callback) {
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return mapLimit$1(coll, limit, (val, iterCb) => {
|
|
_iteratee(val, (err, key) => {
|
|
if (err) return iterCb(err);
|
|
return iterCb(err, {key, val});
|
|
});
|
|
}, (err, mapResults) => {
|
|
var result = {};
|
|
// from MDN, handle object having an `hasOwnProperty` prop
|
|
var {hasOwnProperty} = Object.prototype;
|
|
|
|
for (var i = 0; i < mapResults.length; i++) {
|
|
if (mapResults[i]) {
|
|
var {key} = mapResults[i];
|
|
var {val} = mapResults[i];
|
|
|
|
if (hasOwnProperty.call(result, key)) {
|
|
result[key].push(val);
|
|
} else {
|
|
result[key] = [val];
|
|
}
|
|
}
|
|
}
|
|
|
|
return callback(err, result);
|
|
});
|
|
}
|
|
|
|
var groupByLimit$1 = awaitify(groupByLimit, 4);
|
|
|
|
/**
|
|
* Returns a new object, where each value corresponds to an array of items, from
|
|
* `coll`, that returned the corresponding key. That is, the keys of the object
|
|
* correspond to the values passed to the `iteratee` callback.
|
|
*
|
|
* Note: Since this function applies the `iteratee` to each item in parallel,
|
|
* there is no guarantee that the `iteratee` functions will complete in order.
|
|
* However, the values for each key in the `result` will be in the same order as
|
|
* the original `coll`. For Objects, the values will roughly be in the order of
|
|
* the original Objects' keys (but this can vary across JavaScript engines).
|
|
*
|
|
* @name groupBy
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with a `key` to group the value under.
|
|
* Invoked with (value, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Result is an `Object` whoses
|
|
* properties are arrays of values which returned the corresponding key.
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* const files = ['dir1/file1.txt','dir2','dir4']
|
|
*
|
|
* // asynchronous function that detects file type as none, file, or directory
|
|
* function detectFile(file, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(null, 'none');
|
|
* }
|
|
* callback(null, stat.isDirectory() ? 'directory' : 'file');
|
|
* });
|
|
* }
|
|
*
|
|
* //Using callbacks
|
|
* async.groupBy(files, detectFile, function(err, result) {
|
|
* if(err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.groupBy(files, detectFile)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.groupBy(files, detectFile);
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function groupBy (coll, iteratee, callback) {
|
|
return groupByLimit$1(coll, Infinity, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
|
|
*
|
|
* @name groupBySeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.groupBy]{@link module:Collections.groupBy}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with a `key` to group the value under.
|
|
* Invoked with (value, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Result is an `Object` whose
|
|
* properties are arrays of values which returned the corresponding key.
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function groupBySeries (coll, iteratee, callback) {
|
|
return groupByLimit$1(coll, 1, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* Logs the result of an `async` function to the `console`. Only works in
|
|
* Node.js or in browsers that support `console.log` and `console.error` (such
|
|
* as FF and Chrome). If multiple arguments are returned from the async
|
|
* function, `console.log` is called on each argument in order.
|
|
*
|
|
* @name log
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} function - The function you want to eventually apply
|
|
* all arguments to.
|
|
* @param {...*} arguments... - Any number of arguments to apply to the function.
|
|
* @example
|
|
*
|
|
* // in a module
|
|
* var hello = function(name, callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'hello ' + name);
|
|
* }, 1000);
|
|
* };
|
|
*
|
|
* // in the node repl
|
|
* node> async.log(hello, 'world');
|
|
* 'hello world'
|
|
*/
|
|
var log = consoleFunc('log');
|
|
|
|
/**
|
|
* The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name mapValuesLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.mapValues]{@link module:Collections.mapValues}
|
|
* @category Collection
|
|
* @param {Object} obj - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each value and key
|
|
* in `coll`.
|
|
* The iteratee should complete with the transformed value as its result.
|
|
* Invoked with (value, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. `result` is a new object consisting
|
|
* of each key from `obj`, with each transformed value on the right-hand side.
|
|
* Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function mapValuesLimit(obj, limit, iteratee, callback) {
|
|
callback = once(callback);
|
|
var newObj = {};
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return eachOfLimit$2(limit)(obj, (val, key, next) => {
|
|
_iteratee(val, key, (err, result) => {
|
|
if (err) return next(err);
|
|
newObj[key] = result;
|
|
next(err);
|
|
});
|
|
}, err => callback(err, newObj));
|
|
}
|
|
|
|
var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
|
|
|
|
/**
|
|
* A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
|
|
*
|
|
* Produces a new Object by mapping each value of `obj` through the `iteratee`
|
|
* function. The `iteratee` is called each `value` and `key` from `obj` and a
|
|
* callback for when it has finished processing. Each of these callbacks takes
|
|
* two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
|
|
* passes an error to its callback, the main `callback` (for the `mapValues`
|
|
* function) is immediately called with the error.
|
|
*
|
|
* Note, the order of the keys in the result is not guaranteed. The keys will
|
|
* be roughly in the order they complete, (but this is very engine-specific)
|
|
*
|
|
* @name mapValues
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Object} obj - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each value and key
|
|
* in `coll`.
|
|
* The iteratee should complete with the transformed value as its result.
|
|
* Invoked with (value, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. `result` is a new object consisting
|
|
* of each key from `obj`, with each transformed value on the right-hand side.
|
|
* Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // file1.txt is a file that is 1000 bytes in size
|
|
* // file2.txt is a file that is 2000 bytes in size
|
|
* // file3.txt is a file that is 3000 bytes in size
|
|
* // file4.txt does not exist
|
|
*
|
|
* const fileMap = {
|
|
* f1: 'file1.txt',
|
|
* f2: 'file2.txt',
|
|
* f3: 'file3.txt'
|
|
* };
|
|
*
|
|
* const withMissingFileMap = {
|
|
* f1: 'file1.txt',
|
|
* f2: 'file2.txt',
|
|
* f3: 'file4.txt'
|
|
* };
|
|
*
|
|
* // asynchronous function that returns the file size in bytes
|
|
* function getFileSizeInBytes(file, key, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* callback(null, stat.size);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // result is now a map of file size in bytes for each file, e.g.
|
|
* // {
|
|
* // f1: 1000,
|
|
* // f2: 2000,
|
|
* // f3: 3000
|
|
* // }
|
|
* }
|
|
* });
|
|
*
|
|
* // Error handling
|
|
* async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* } else {
|
|
* console.log(result);
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.mapValues(fileMap, getFileSizeInBytes)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // result is now a map of file size in bytes for each file, e.g.
|
|
* // {
|
|
* // f1: 1000,
|
|
* // f2: 2000,
|
|
* // f3: 3000
|
|
* // }
|
|
* }).catch (err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error Handling
|
|
* async.mapValues(withMissingFileMap, getFileSizeInBytes)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* }).catch (err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.mapValues(fileMap, getFileSizeInBytes);
|
|
* console.log(result);
|
|
* // result is now a map of file size in bytes for each file, e.g.
|
|
* // {
|
|
* // f1: 1000,
|
|
* // f2: 2000,
|
|
* // f3: 3000
|
|
* // }
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // Error Handling
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
|
|
* console.log(result);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function mapValues(obj, iteratee, callback) {
|
|
return mapValuesLimit$1(obj, Infinity, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
|
|
*
|
|
* @name mapValuesSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.mapValues]{@link module:Collections.mapValues}
|
|
* @category Collection
|
|
* @param {Object} obj - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - A function to apply to each value and key
|
|
* in `coll`.
|
|
* The iteratee should complete with the transformed value as its result.
|
|
* Invoked with (value, key, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. `result` is a new object consisting
|
|
* of each key from `obj`, with each transformed value on the right-hand side.
|
|
* Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function mapValuesSeries(obj, iteratee, callback) {
|
|
return mapValuesLimit$1(obj, 1, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* Caches the results of an async function. When creating a hash to store
|
|
* function results against, the callback is omitted from the hash and an
|
|
* optional hash function can be used.
|
|
*
|
|
* **Note: if the async function errs, the result will not be cached and
|
|
* subsequent calls will call the wrapped function.**
|
|
*
|
|
* If no hash function is specified, the first argument is used as a hash key,
|
|
* which may work reasonably if it is a string or a data type that converts to a
|
|
* distinct string. Note that objects and arrays will not behave reasonably.
|
|
* Neither will cases where the other arguments are significant. In such cases,
|
|
* specify your own hash function.
|
|
*
|
|
* The cache of results is exposed as the `memo` property of the function
|
|
* returned by `memoize`.
|
|
*
|
|
* @name memoize
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} fn - The async function to proxy and cache results from.
|
|
* @param {Function} hasher - An optional function for generating a custom hash
|
|
* for storing results. It has all the arguments applied to it apart from the
|
|
* callback, and must be synchronous.
|
|
* @returns {AsyncFunction} a memoized version of `fn`
|
|
* @example
|
|
*
|
|
* var slow_fn = function(name, callback) {
|
|
* // do something
|
|
* callback(null, result);
|
|
* };
|
|
* var fn = async.memoize(slow_fn);
|
|
*
|
|
* // fn can now be used as if it were slow_fn
|
|
* fn('some name', function() {
|
|
* // callback
|
|
* });
|
|
*/
|
|
function memoize(fn, hasher = v => v) {
|
|
var memo = Object.create(null);
|
|
var queues = Object.create(null);
|
|
var _fn = wrapAsync(fn);
|
|
var memoized = initialParams((args, callback) => {
|
|
var key = hasher(...args);
|
|
if (key in memo) {
|
|
setImmediate$1(() => callback(null, ...memo[key]));
|
|
} else if (key in queues) {
|
|
queues[key].push(callback);
|
|
} else {
|
|
queues[key] = [callback];
|
|
_fn(...args, (err, ...resultArgs) => {
|
|
// #1465 don't memoize if an error occurred
|
|
if (!err) {
|
|
memo[key] = resultArgs;
|
|
}
|
|
var q = queues[key];
|
|
delete queues[key];
|
|
for (var i = 0, l = q.length; i < l; i++) {
|
|
q[i](err, ...resultArgs);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
memoized.memo = memo;
|
|
memoized.unmemoized = fn;
|
|
return memoized;
|
|
}
|
|
|
|
/* istanbul ignore file */
|
|
|
|
/**
|
|
* Calls `callback` on a later loop around the event loop. In Node.js this just
|
|
* calls `process.nextTick`. In the browser it will use `setImmediate` if
|
|
* available, otherwise `setTimeout(callback, 0)`, which means other higher
|
|
* priority events may precede the execution of `callback`.
|
|
*
|
|
* This is used internally for browser-compatibility purposes.
|
|
*
|
|
* @name nextTick
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @see [async.setImmediate]{@link module:Utils.setImmediate}
|
|
* @category Util
|
|
* @param {Function} callback - The function to call on a later loop around
|
|
* the event loop. Invoked with (args...).
|
|
* @param {...*} args... - any number of additional arguments to pass to the
|
|
* callback on the next tick.
|
|
* @example
|
|
*
|
|
* var call_order = [];
|
|
* async.nextTick(function() {
|
|
* call_order.push('two');
|
|
* // call_order now equals ['one','two']
|
|
* });
|
|
* call_order.push('one');
|
|
*
|
|
* async.setImmediate(function (a, b, c) {
|
|
* // a, b, and c equal 1, 2, and 3
|
|
* }, 1, 2, 3);
|
|
*/
|
|
var _defer;
|
|
|
|
if (hasNextTick) {
|
|
_defer = process.nextTick;
|
|
} else if (hasSetImmediate) {
|
|
_defer = setImmediate;
|
|
} else {
|
|
_defer = fallback;
|
|
}
|
|
|
|
var nextTick = wrap(_defer);
|
|
|
|
var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
var results = isArrayLike(tasks) ? [] : {};
|
|
|
|
eachfn(tasks, (task, key, taskCb) => {
|
|
wrapAsync(task)((err, ...result) => {
|
|
if (result.length < 2) {
|
|
[result] = result;
|
|
}
|
|
results[key] = result;
|
|
taskCb(err);
|
|
});
|
|
}, err => callback(err, results));
|
|
}, 3);
|
|
|
|
/**
|
|
* Run the `tasks` collection of functions in parallel, without waiting until
|
|
* the previous function has completed. If any of the functions pass an error to
|
|
* its callback, the main `callback` is immediately called with the value of the
|
|
* error. Once the `tasks` have completed, the results are passed to the final
|
|
* `callback` as an array.
|
|
*
|
|
* **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about
|
|
* parallel execution of code. If your tasks do not use any timers or perform
|
|
* any I/O, they will actually be executed in series. Any synchronous setup
|
|
* sections for each task will happen one after the other. JavaScript remains
|
|
* single-threaded.
|
|
*
|
|
* **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the
|
|
* execution of other tasks when a task fails.
|
|
*
|
|
* It is also possible to use an object instead of an array. Each property will
|
|
* be run as a function and the results will be passed to the final `callback`
|
|
* as an object instead of an array. This can be a more readable way of handling
|
|
* results from {@link async.parallel}.
|
|
*
|
|
* @name parallel
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
|
|
* [async functions]{@link AsyncFunction} to run.
|
|
* Each async function can complete with any number of optional `result` values.
|
|
* @param {Function} [callback] - An optional callback to run once all the
|
|
* functions have completed successfully. This function gets a results array
|
|
* (or object) containing all the result arguments passed to the task callbacks.
|
|
* Invoked with (err, results).
|
|
* @returns {Promise} a promise, if a callback is not passed
|
|
*
|
|
* @example
|
|
*
|
|
* //Using Callbacks
|
|
* async.parallel([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ], function(err, results) {
|
|
* console.log(results);
|
|
* // results is equal to ['one','two'] even though
|
|
* // the second function had a shorter timeout.
|
|
* });
|
|
*
|
|
* // an example using an object instead of an array
|
|
* async.parallel({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* }, function(err, results) {
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* });
|
|
*
|
|
* //Using Promises
|
|
* async.parallel([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ]).then(results => {
|
|
* console.log(results);
|
|
* // results is equal to ['one','two'] even though
|
|
* // the second function had a shorter timeout.
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // an example using an object instead of an array
|
|
* async.parallel({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* }).then(results => {
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* //Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.parallel([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ]);
|
|
* console.log(results);
|
|
* // results is equal to ['one','two'] even though
|
|
* // the second function had a shorter timeout.
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // an example using an object instead of an array
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.parallel({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* });
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function parallel(tasks, callback) {
|
|
return _parallel(eachOf$1, tasks, callback);
|
|
}
|
|
|
|
/**
|
|
* The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name parallelLimit
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.parallel]{@link module:ControlFlow.parallel}
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
|
|
* [async functions]{@link AsyncFunction} to run.
|
|
* Each async function can complete with any number of optional `result` values.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {Function} [callback] - An optional callback to run once all the
|
|
* functions have completed successfully. This function gets a results array
|
|
* (or object) containing all the result arguments passed to the task callbacks.
|
|
* Invoked with (err, results).
|
|
* @returns {Promise} a promise, if a callback is not passed
|
|
*/
|
|
function parallelLimit(tasks, limit, callback) {
|
|
return _parallel(eachOfLimit$2(limit), tasks, callback);
|
|
}
|
|
|
|
/**
|
|
* A queue of tasks for the worker function to complete.
|
|
* @typedef {Iterable} QueueObject
|
|
* @memberOf module:ControlFlow
|
|
* @property {Function} length - a function returning the number of items
|
|
* waiting to be processed. Invoke with `queue.length()`.
|
|
* @property {boolean} started - a boolean indicating whether or not any
|
|
* items have been pushed and processed by the queue.
|
|
* @property {Function} running - a function returning the number of items
|
|
* currently being processed. Invoke with `queue.running()`.
|
|
* @property {Function} workersList - a function returning the array of items
|
|
* currently being processed. Invoke with `queue.workersList()`.
|
|
* @property {Function} idle - a function returning false if there are items
|
|
* waiting or being processed, or true if not. Invoke with `queue.idle()`.
|
|
* @property {number} concurrency - an integer for determining how many `worker`
|
|
* functions should be run in parallel. This property can be changed after a
|
|
* `queue` is created to alter the concurrency on-the-fly.
|
|
* @property {number} payload - an integer that specifies how many items are
|
|
* passed to the worker function at a time. only applies if this is a
|
|
* [cargo]{@link module:ControlFlow.cargo} object
|
|
* @property {AsyncFunction} push - add a new task to the `queue`. Calls `callback`
|
|
* once the `worker` has finished processing the task. Instead of a single task,
|
|
* a `tasks` array can be submitted. The respective callback is used for every
|
|
* task in the list. Invoke with `queue.push(task, [callback])`,
|
|
* @property {AsyncFunction} unshift - add a new task to the front of the `queue`.
|
|
* Invoke with `queue.unshift(task, [callback])`.
|
|
* @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns
|
|
* a promise that rejects if an error occurs.
|
|
* @property {AsyncFunction} unshiftAsync - the same as `q.unshift`, except this returns
|
|
* a promise that rejects if an error occurs.
|
|
* @property {Function} remove - remove items from the queue that match a test
|
|
* function. The test function will be passed an object with a `data` property,
|
|
* and a `priority` property, if this is a
|
|
* [priorityQueue]{@link module:ControlFlow.priorityQueue} object.
|
|
* Invoked with `queue.remove(testFn)`, where `testFn` is of the form
|
|
* `function ({data, priority}) {}` and returns a Boolean.
|
|
* @property {Function} saturated - a function that sets a callback that is
|
|
* called when the number of running workers hits the `concurrency` limit, and
|
|
* further tasks will be queued. If the callback is omitted, `q.saturated()`
|
|
* returns a promise for the next occurrence.
|
|
* @property {Function} unsaturated - a function that sets a callback that is
|
|
* called when the number of running workers is less than the `concurrency` &
|
|
* `buffer` limits, and further tasks will not be queued. If the callback is
|
|
* omitted, `q.unsaturated()` returns a promise for the next occurrence.
|
|
* @property {number} buffer - A minimum threshold buffer in order to say that
|
|
* the `queue` is `unsaturated`.
|
|
* @property {Function} empty - a function that sets a callback that is called
|
|
* when the last item from the `queue` is given to a `worker`. If the callback
|
|
* is omitted, `q.empty()` returns a promise for the next occurrence.
|
|
* @property {Function} drain - a function that sets a callback that is called
|
|
* when the last item from the `queue` has returned from the `worker`. If the
|
|
* callback is omitted, `q.drain()` returns a promise for the next occurrence.
|
|
* @property {Function} error - a function that sets a callback that is called
|
|
* when a task errors. Has the signature `function(error, task)`. If the
|
|
* callback is omitted, `error()` returns a promise that rejects on the next
|
|
* error.
|
|
* @property {boolean} paused - a boolean for determining whether the queue is
|
|
* in a paused state.
|
|
* @property {Function} pause - a function that pauses the processing of tasks
|
|
* until `resume()` is called. Invoke with `queue.pause()`.
|
|
* @property {Function} resume - a function that resumes the processing of
|
|
* queued tasks when the queue is paused. Invoke with `queue.resume()`.
|
|
* @property {Function} kill - a function that removes the `drain` callback and
|
|
* empties remaining tasks from the queue forcing it to go idle. No more tasks
|
|
* should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
|
|
*
|
|
* @example
|
|
* const q = async.queue(worker, 2)
|
|
* q.push(item1)
|
|
* q.push(item2)
|
|
* q.push(item3)
|
|
* // queues are iterable, spread into an array to inspect
|
|
* const items = [...q] // [item1, item2, item3]
|
|
* // or use for of
|
|
* for (let item of q) {
|
|
* console.log(item)
|
|
* }
|
|
*
|
|
* q.drain(() => {
|
|
* console.log('all done')
|
|
* })
|
|
* // or
|
|
* await q.drain()
|
|
*/
|
|
|
|
/**
|
|
* Creates a `queue` object with the specified `concurrency`. Tasks added to the
|
|
* `queue` are processed in parallel (up to the `concurrency` limit). If all
|
|
* `worker`s are in progress, the task is queued until one becomes available.
|
|
* Once a `worker` completes a `task`, that `task`'s callback is called.
|
|
*
|
|
* @name queue
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} worker - An async function for processing a queued task.
|
|
* If you want to handle errors from an individual task, pass a callback to
|
|
* `q.push()`. Invoked with (task, callback).
|
|
* @param {number} [concurrency=1] - An `integer` for determining how many
|
|
* `worker` functions should be run in parallel. If omitted, the concurrency
|
|
* defaults to `1`. If the concurrency is `0`, an error is thrown.
|
|
* @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can be
|
|
* attached as certain properties to listen for specific events during the
|
|
* lifecycle of the queue.
|
|
* @example
|
|
*
|
|
* // create a queue object with concurrency 2
|
|
* var q = async.queue(function(task, callback) {
|
|
* console.log('hello ' + task.name);
|
|
* callback();
|
|
* }, 2);
|
|
*
|
|
* // assign a callback
|
|
* q.drain(function() {
|
|
* console.log('all items have been processed');
|
|
* });
|
|
* // or await the end
|
|
* await q.drain()
|
|
*
|
|
* // assign an error callback
|
|
* q.error(function(err, task) {
|
|
* console.error('task experienced an error');
|
|
* });
|
|
*
|
|
* // add some items to the queue
|
|
* q.push({name: 'foo'}, function(err) {
|
|
* console.log('finished processing foo');
|
|
* });
|
|
* // callback is optional
|
|
* q.push({name: 'bar'});
|
|
*
|
|
* // add some items to the queue (batch-wise)
|
|
* q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) {
|
|
* console.log('finished processing item');
|
|
* });
|
|
*
|
|
* // add some items to the front of the queue
|
|
* q.unshift({name: 'bar'}, function (err) {
|
|
* console.log('finished processing bar');
|
|
* });
|
|
*/
|
|
function queue (worker, concurrency) {
|
|
var _worker = wrapAsync(worker);
|
|
return queue$1((items, cb) => {
|
|
_worker(items[0], cb);
|
|
}, concurrency, 1);
|
|
}
|
|
|
|
// Binary min-heap implementation used for priority queue.
|
|
// Implementation is stable, i.e. push time is considered for equal priorities
|
|
class Heap {
|
|
constructor() {
|
|
this.heap = [];
|
|
this.pushCount = Number.MIN_SAFE_INTEGER;
|
|
}
|
|
|
|
get length() {
|
|
return this.heap.length;
|
|
}
|
|
|
|
empty () {
|
|
this.heap = [];
|
|
return this;
|
|
}
|
|
|
|
percUp(index) {
|
|
let p;
|
|
|
|
while (index > 0 && smaller(this.heap[index], this.heap[p=parent(index)])) {
|
|
let t = this.heap[index];
|
|
this.heap[index] = this.heap[p];
|
|
this.heap[p] = t;
|
|
|
|
index = p;
|
|
}
|
|
}
|
|
|
|
percDown(index) {
|
|
let l;
|
|
|
|
while ((l=leftChi(index)) < this.heap.length) {
|
|
if (l+1 < this.heap.length && smaller(this.heap[l+1], this.heap[l])) {
|
|
l = l+1;
|
|
}
|
|
|
|
if (smaller(this.heap[index], this.heap[l])) {
|
|
break;
|
|
}
|
|
|
|
let t = this.heap[index];
|
|
this.heap[index] = this.heap[l];
|
|
this.heap[l] = t;
|
|
|
|
index = l;
|
|
}
|
|
}
|
|
|
|
push(node) {
|
|
node.pushCount = ++this.pushCount;
|
|
this.heap.push(node);
|
|
this.percUp(this.heap.length-1);
|
|
}
|
|
|
|
unshift(node) {
|
|
return this.heap.push(node);
|
|
}
|
|
|
|
shift() {
|
|
let [top] = this.heap;
|
|
|
|
this.heap[0] = this.heap[this.heap.length-1];
|
|
this.heap.pop();
|
|
this.percDown(0);
|
|
|
|
return top;
|
|
}
|
|
|
|
toArray() {
|
|
return [...this];
|
|
}
|
|
|
|
*[Symbol.iterator] () {
|
|
for (let i = 0; i < this.heap.length; i++) {
|
|
yield this.heap[i].data;
|
|
}
|
|
}
|
|
|
|
remove (testFn) {
|
|
let j = 0;
|
|
for (let i = 0; i < this.heap.length; i++) {
|
|
if (!testFn(this.heap[i])) {
|
|
this.heap[j] = this.heap[i];
|
|
j++;
|
|
}
|
|
}
|
|
|
|
this.heap.splice(j);
|
|
|
|
for (let i = parent(this.heap.length-1); i >= 0; i--) {
|
|
this.percDown(i);
|
|
}
|
|
|
|
return this;
|
|
}
|
|
}
|
|
|
|
function leftChi(i) {
|
|
return (i<<1)+1;
|
|
}
|
|
|
|
function parent(i) {
|
|
return ((i+1)>>1)-1;
|
|
}
|
|
|
|
function smaller(x, y) {
|
|
if (x.priority !== y.priority) {
|
|
return x.priority < y.priority;
|
|
}
|
|
else {
|
|
return x.pushCount < y.pushCount;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and
|
|
* completed in ascending priority order.
|
|
*
|
|
* @name priorityQueue
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.queue]{@link module:ControlFlow.queue}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} worker - An async function for processing a queued task.
|
|
* If you want to handle errors from an individual task, pass a callback to
|
|
* `q.push()`.
|
|
* Invoked with (task, callback).
|
|
* @param {number} concurrency - An `integer` for determining how many `worker`
|
|
* functions should be run in parallel. If omitted, the concurrency defaults to
|
|
* `1`. If the concurrency is `0`, an error is thrown.
|
|
* @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are three
|
|
* differences between `queue` and `priorityQueue` objects:
|
|
* * `push(task, priority, [callback])` - `priority` should be a number. If an
|
|
* array of `tasks` is given, all tasks will be assigned the same priority.
|
|
* * `pushAsync(task, priority, [callback])` - the same as `priorityQueue.push`,
|
|
* except this returns a promise that rejects if an error occurs.
|
|
* * The `unshift` and `unshiftAsync` methods were removed.
|
|
*/
|
|
function priorityQueue(worker, concurrency) {
|
|
// Start with a normal queue
|
|
var q = queue(worker, concurrency);
|
|
|
|
var {
|
|
push,
|
|
pushAsync
|
|
} = q;
|
|
|
|
q._tasks = new Heap();
|
|
q._createTaskItem = ({data, priority}, callback) => {
|
|
return {
|
|
data,
|
|
priority,
|
|
callback
|
|
};
|
|
};
|
|
|
|
function createDataItems(tasks, priority) {
|
|
if (!Array.isArray(tasks)) {
|
|
return {data: tasks, priority};
|
|
}
|
|
return tasks.map(data => { return {data, priority}; });
|
|
}
|
|
|
|
// Override push to accept second parameter representing priority
|
|
q.push = function(data, priority = 0, callback) {
|
|
return push(createDataItems(data, priority), callback);
|
|
};
|
|
|
|
q.pushAsync = function(data, priority = 0, callback) {
|
|
return pushAsync(createDataItems(data, priority), callback);
|
|
};
|
|
|
|
// Remove unshift functions
|
|
delete q.unshift;
|
|
delete q.unshiftAsync;
|
|
|
|
return q;
|
|
}
|
|
|
|
/**
|
|
* Runs the `tasks` array of functions in parallel, without waiting until the
|
|
* previous function has completed. Once any of the `tasks` complete or pass an
|
|
* error to its callback, the main `callback` is immediately called. It's
|
|
* equivalent to `Promise.race()`.
|
|
*
|
|
* @name race
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
|
|
* to run. Each function can complete with an optional `result` value.
|
|
* @param {Function} callback - A callback to run once any of the functions have
|
|
* completed. This function gets an error or result from the first function that
|
|
* completed. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
* @example
|
|
*
|
|
* async.race([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ],
|
|
* // main callback
|
|
* function(err, result) {
|
|
* // the result will be equal to 'two' as it finishes earlier
|
|
* });
|
|
*/
|
|
function race(tasks, callback) {
|
|
callback = once(callback);
|
|
if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
|
|
if (!tasks.length) return callback();
|
|
for (var i = 0, l = tasks.length; i < l; i++) {
|
|
wrapAsync(tasks[i])(callback);
|
|
}
|
|
}
|
|
|
|
var race$1 = awaitify(race, 2);
|
|
|
|
/**
|
|
* Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
|
|
*
|
|
* @name reduceRight
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.reduce]{@link module:Collections.reduce}
|
|
* @alias foldr
|
|
* @category Collection
|
|
* @param {Array} array - A collection to iterate over.
|
|
* @param {*} memo - The initial state of the reduction.
|
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
* array to produce the next step in the reduction.
|
|
* The `iteratee` should complete with the next state of the reduction.
|
|
* If the iteratee completes with an error, the reduction is stopped and the
|
|
* main `callback` is immediately called with the error.
|
|
* Invoked with (memo, item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result is the reduced value. Invoked with
|
|
* (err, result).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function reduceRight (array, memo, iteratee, callback) {
|
|
var reversed = [...array].reverse();
|
|
return reduce$1(reversed, memo, iteratee, callback);
|
|
}
|
|
|
|
/**
|
|
* Wraps the async function in another function that always completes with a
|
|
* result object, even when it errors.
|
|
*
|
|
* The result object has either the property `error` or `value`.
|
|
*
|
|
* @name reflect
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} fn - The async function you want to wrap
|
|
* @returns {Function} - A function that always passes null to it's callback as
|
|
* the error. The second argument to the callback will be an `object` with
|
|
* either an `error` or a `value` property.
|
|
* @example
|
|
*
|
|
* async.parallel([
|
|
* async.reflect(function(callback) {
|
|
* // do some stuff ...
|
|
* callback(null, 'one');
|
|
* }),
|
|
* async.reflect(function(callback) {
|
|
* // do some more stuff but error ...
|
|
* callback('bad stuff happened');
|
|
* }),
|
|
* async.reflect(function(callback) {
|
|
* // do some more stuff ...
|
|
* callback(null, 'two');
|
|
* })
|
|
* ],
|
|
* // optional callback
|
|
* function(err, results) {
|
|
* // values
|
|
* // results[0].value = 'one'
|
|
* // results[1].error = 'bad stuff happened'
|
|
* // results[2].value = 'two'
|
|
* });
|
|
*/
|
|
function reflect(fn) {
|
|
var _fn = wrapAsync(fn);
|
|
return initialParams(function reflectOn(args, reflectCallback) {
|
|
args.push((error, ...cbArgs) => {
|
|
let retVal = {};
|
|
if (error) {
|
|
retVal.error = error;
|
|
}
|
|
if (cbArgs.length > 0){
|
|
var value = cbArgs;
|
|
if (cbArgs.length <= 1) {
|
|
[value] = cbArgs;
|
|
}
|
|
retVal.value = value;
|
|
}
|
|
reflectCallback(null, retVal);
|
|
});
|
|
|
|
return _fn.apply(this, args);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* A helper function that wraps an array or an object of functions with `reflect`.
|
|
*
|
|
* @name reflectAll
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @see [async.reflect]{@link module:Utils.reflect}
|
|
* @category Util
|
|
* @param {Array|Object|Iterable} tasks - The collection of
|
|
* [async functions]{@link AsyncFunction} to wrap in `async.reflect`.
|
|
* @returns {Array} Returns an array of async functions, each wrapped in
|
|
* `async.reflect`
|
|
* @example
|
|
*
|
|
* let tasks = [
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* // do some more stuff but error ...
|
|
* callback(new Error('bad stuff happened'));
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ];
|
|
*
|
|
* async.parallel(async.reflectAll(tasks),
|
|
* // optional callback
|
|
* function(err, results) {
|
|
* // values
|
|
* // results[0].value = 'one'
|
|
* // results[1].error = Error('bad stuff happened')
|
|
* // results[2].value = 'two'
|
|
* });
|
|
*
|
|
* // an example using an object instead of an array
|
|
* let tasks = {
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* callback('two');
|
|
* },
|
|
* three: function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'three');
|
|
* }, 100);
|
|
* }
|
|
* };
|
|
*
|
|
* async.parallel(async.reflectAll(tasks),
|
|
* // optional callback
|
|
* function(err, results) {
|
|
* // values
|
|
* // results.one.value = 'one'
|
|
* // results.two.error = 'two'
|
|
* // results.three.value = 'three'
|
|
* });
|
|
*/
|
|
function reflectAll(tasks) {
|
|
var results;
|
|
if (Array.isArray(tasks)) {
|
|
results = tasks.map(reflect);
|
|
} else {
|
|
results = {};
|
|
Object.keys(tasks).forEach(key => {
|
|
results[key] = reflect.call(this, tasks[key]);
|
|
});
|
|
}
|
|
return results;
|
|
}
|
|
|
|
function reject$2(eachfn, arr, _iteratee, callback) {
|
|
const iteratee = wrapAsync(_iteratee);
|
|
return _filter(eachfn, arr, (value, cb) => {
|
|
iteratee(value, (err, v) => {
|
|
cb(err, !v);
|
|
});
|
|
}, callback);
|
|
}
|
|
|
|
/**
|
|
* The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.
|
|
*
|
|
* @name reject
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.filter]{@link module:Collections.filter}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {Function} iteratee - An async truth test to apply to each item in
|
|
* `coll`.
|
|
* The should complete with a boolean value as its `result`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
*
|
|
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
*
|
|
* // asynchronous function that checks if a file exists
|
|
* function fileExists(file, callback) {
|
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
* callback(null, !err);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.reject(fileList, fileExists, function(err, results) {
|
|
* // [ 'dir3/file6.txt' ]
|
|
* // results now equals an array of the non-existing files
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.reject(fileList, fileExists)
|
|
* .then( results => {
|
|
* console.log(results);
|
|
* // [ 'dir3/file6.txt' ]
|
|
* // results now equals an array of the non-existing files
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.reject(fileList, fileExists);
|
|
* console.log(results);
|
|
* // [ 'dir3/file6.txt' ]
|
|
* // results now equals an array of the non-existing files
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function reject (coll, iteratee, callback) {
|
|
return reject$2(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var reject$1 = awaitify(reject, 3);
|
|
|
|
/**
|
|
* The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name rejectLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.reject]{@link module:Collections.reject}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {Function} iteratee - An async truth test to apply to each item in
|
|
* `coll`.
|
|
* The should complete with a boolean value as its `result`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function rejectLimit (coll, limit, iteratee, callback) {
|
|
return reject$2(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var rejectLimit$1 = awaitify(rejectLimit, 4);
|
|
|
|
/**
|
|
* The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.
|
|
*
|
|
* @name rejectSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.reject]{@link module:Collections.reject}
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {Function} iteratee - An async truth test to apply to each item in
|
|
* `coll`.
|
|
* The should complete with a boolean value as its `result`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
*/
|
|
function rejectSeries (coll, iteratee, callback) {
|
|
return reject$2(eachOfSeries$1, coll, iteratee, callback)
|
|
}
|
|
var rejectSeries$1 = awaitify(rejectSeries, 3);
|
|
|
|
function constant(value) {
|
|
return function () {
|
|
return value;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Attempts to get a successful response from `task` no more than `times` times
|
|
* before returning an error. If the task is successful, the `callback` will be
|
|
* passed the result of the successful task. If all attempts fail, the callback
|
|
* will be passed the error and result (if any) of the final attempt.
|
|
*
|
|
* @name retry
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @see [async.retryable]{@link module:ControlFlow.retryable}
|
|
* @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an
|
|
* object with `times` and `interval` or a number.
|
|
* * `times` - The number of attempts to make before giving up. The default
|
|
* is `5`.
|
|
* * `interval` - The time to wait between retries, in milliseconds. The
|
|
* default is `0`. The interval may also be specified as a function of the
|
|
* retry count (see example).
|
|
* * `errorFilter` - An optional synchronous function that is invoked on
|
|
* erroneous result. If it returns `true` the retry attempts will continue;
|
|
* if the function returns `false` the retry flow is aborted with the current
|
|
* attempt's error and result being returned to the final callback.
|
|
* Invoked with (err).
|
|
* * If `opts` is a number, the number specifies the number of times to retry,
|
|
* with the default interval of `0`.
|
|
* @param {AsyncFunction} task - An async function to retry.
|
|
* Invoked with (callback).
|
|
* @param {Function} [callback] - An optional callback which is called when the
|
|
* task has succeeded, or after the final failed attempt. It receives the `err`
|
|
* and `result` arguments of the last attempt at completing the `task`. Invoked
|
|
* with (err, results).
|
|
* @returns {Promise} a promise if no callback provided
|
|
*
|
|
* @example
|
|
*
|
|
* // The `retry` function can be used as a stand-alone control flow by passing
|
|
* // a callback, as shown below:
|
|
*
|
|
* // try calling apiMethod 3 times
|
|
* async.retry(3, apiMethod, function(err, result) {
|
|
* // do something with the result
|
|
* });
|
|
*
|
|
* // try calling apiMethod 3 times, waiting 200 ms between each retry
|
|
* async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
|
|
* // do something with the result
|
|
* });
|
|
*
|
|
* // try calling apiMethod 10 times with exponential backoff
|
|
* // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds)
|
|
* async.retry({
|
|
* times: 10,
|
|
* interval: function(retryCount) {
|
|
* return 50 * Math.pow(2, retryCount);
|
|
* }
|
|
* }, apiMethod, function(err, result) {
|
|
* // do something with the result
|
|
* });
|
|
*
|
|
* // try calling apiMethod the default 5 times no delay between each retry
|
|
* async.retry(apiMethod, function(err, result) {
|
|
* // do something with the result
|
|
* });
|
|
*
|
|
* // try calling apiMethod only when error condition satisfies, all other
|
|
* // errors will abort the retry control flow and return to final callback
|
|
* async.retry({
|
|
* errorFilter: function(err) {
|
|
* return err.message === 'Temporary error'; // only retry on a specific error
|
|
* }
|
|
* }, apiMethod, function(err, result) {
|
|
* // do something with the result
|
|
* });
|
|
*
|
|
* // to retry individual methods that are not as reliable within other
|
|
* // control flow functions, use the `retryable` wrapper:
|
|
* async.auto({
|
|
* users: api.getUsers.bind(api),
|
|
* payments: async.retryable(3, api.getPayments.bind(api))
|
|
* }, function(err, results) {
|
|
* // do something with the results
|
|
* });
|
|
*
|
|
*/
|
|
const DEFAULT_TIMES = 5;
|
|
const DEFAULT_INTERVAL = 0;
|
|
|
|
function retry(opts, task, callback) {
|
|
var options = {
|
|
times: DEFAULT_TIMES,
|
|
intervalFunc: constant(DEFAULT_INTERVAL)
|
|
};
|
|
|
|
if (arguments.length < 3 && typeof opts === 'function') {
|
|
callback = task || promiseCallback();
|
|
task = opts;
|
|
} else {
|
|
parseTimes(options, opts);
|
|
callback = callback || promiseCallback();
|
|
}
|
|
|
|
if (typeof task !== 'function') {
|
|
throw new Error("Invalid arguments for async.retry");
|
|
}
|
|
|
|
var _task = wrapAsync(task);
|
|
|
|
var attempt = 1;
|
|
function retryAttempt() {
|
|
_task((err, ...args) => {
|
|
if (err === false) return
|
|
if (err && attempt++ < options.times &&
|
|
(typeof options.errorFilter != 'function' ||
|
|
options.errorFilter(err))) {
|
|
setTimeout(retryAttempt, options.intervalFunc(attempt - 1));
|
|
} else {
|
|
callback(err, ...args);
|
|
}
|
|
});
|
|
}
|
|
|
|
retryAttempt();
|
|
return callback[PROMISE_SYMBOL]
|
|
}
|
|
|
|
function parseTimes(acc, t) {
|
|
if (typeof t === 'object') {
|
|
acc.times = +t.times || DEFAULT_TIMES;
|
|
|
|
acc.intervalFunc = typeof t.interval === 'function' ?
|
|
t.interval :
|
|
constant(+t.interval || DEFAULT_INTERVAL);
|
|
|
|
acc.errorFilter = t.errorFilter;
|
|
} else if (typeof t === 'number' || typeof t === 'string') {
|
|
acc.times = +t || DEFAULT_TIMES;
|
|
} else {
|
|
throw new Error("Invalid arguments for async.retry");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* A close relative of [`retry`]{@link module:ControlFlow.retry}. This method
|
|
* wraps a task and makes it retryable, rather than immediately calling it
|
|
* with retries.
|
|
*
|
|
* @name retryable
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.retry]{@link module:ControlFlow.retry}
|
|
* @category Control Flow
|
|
* @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional
|
|
* options, exactly the same as from `retry`, except for a `opts.arity` that
|
|
* is the arity of the `task` function, defaulting to `task.length`
|
|
* @param {AsyncFunction} task - the asynchronous function to wrap.
|
|
* This function will be passed any arguments passed to the returned wrapper.
|
|
* Invoked with (...args, callback).
|
|
* @returns {AsyncFunction} The wrapped function, which when invoked, will
|
|
* retry on an error, based on the parameters specified in `opts`.
|
|
* This function will accept the same parameters as `task`.
|
|
* @example
|
|
*
|
|
* async.auto({
|
|
* dep1: async.retryable(3, getFromFlakyService),
|
|
* process: ["dep1", async.retryable(3, function (results, cb) {
|
|
* maybeProcessData(results.dep1, cb);
|
|
* })]
|
|
* }, callback);
|
|
*/
|
|
function retryable (opts, task) {
|
|
if (!task) {
|
|
task = opts;
|
|
opts = null;
|
|
}
|
|
let arity = (opts && opts.arity) || task.length;
|
|
if (isAsync(task)) {
|
|
arity += 1;
|
|
}
|
|
var _task = wrapAsync(task);
|
|
return initialParams((args, callback) => {
|
|
if (args.length < arity - 1 || callback == null) {
|
|
args.push(callback);
|
|
callback = promiseCallback();
|
|
}
|
|
function taskFn(cb) {
|
|
_task(...args, cb);
|
|
}
|
|
|
|
if (opts) retry(opts, taskFn, callback);
|
|
else retry(taskFn, callback);
|
|
|
|
return callback[PROMISE_SYMBOL]
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Run the functions in the `tasks` collection in series, each one running once
|
|
* the previous function has completed. If any functions in the series pass an
|
|
* error to its callback, no more functions are run, and `callback` is
|
|
* immediately called with the value of the error. Otherwise, `callback`
|
|
* receives an array of results when `tasks` have completed.
|
|
*
|
|
* It is also possible to use an object instead of an array. Each property will
|
|
* be run as a function, and the results will be passed to the final `callback`
|
|
* as an object instead of an array. This can be a more readable way of handling
|
|
* results from {@link async.series}.
|
|
*
|
|
* **Note** that while many implementations preserve the order of object
|
|
* properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
|
|
* explicitly states that
|
|
*
|
|
* > The mechanics and order of enumerating the properties is not specified.
|
|
*
|
|
* So if you rely on the order in which your series of functions are executed,
|
|
* and want this to work on all platforms, consider using an array.
|
|
*
|
|
* @name series
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing
|
|
* [async functions]{@link AsyncFunction} to run in series.
|
|
* Each function can complete with any number of optional `result` values.
|
|
* @param {Function} [callback] - An optional callback to run once all the
|
|
* functions have completed. This function gets a results array (or object)
|
|
* containing all the result arguments passed to the `task` callbacks. Invoked
|
|
* with (err, result).
|
|
* @return {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* //Using Callbacks
|
|
* async.series([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* // do some async task
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* // then do another async task
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ], function(err, results) {
|
|
* console.log(results);
|
|
* // results is equal to ['one','two']
|
|
* });
|
|
*
|
|
* // an example using objects instead of arrays
|
|
* async.series({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* // do some async task
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* // then do another async task
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* }, function(err, results) {
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* });
|
|
*
|
|
* //Using Promises
|
|
* async.series([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ]).then(results => {
|
|
* console.log(results);
|
|
* // results is equal to ['one','two']
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // an example using an object instead of an array
|
|
* async.series({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* // do some async task
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* // then do another async task
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* }).then(results => {
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* //Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.series([
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* // do some async task
|
|
* callback(null, 'one');
|
|
* }, 200);
|
|
* },
|
|
* function(callback) {
|
|
* setTimeout(function() {
|
|
* // then do another async task
|
|
* callback(null, 'two');
|
|
* }, 100);
|
|
* }
|
|
* ]);
|
|
* console.log(results);
|
|
* // results is equal to ['one','two']
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* // an example using an object instead of an array
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.parallel({
|
|
* one: function(callback) {
|
|
* setTimeout(function() {
|
|
* // do some async task
|
|
* callback(null, 1);
|
|
* }, 200);
|
|
* },
|
|
* two: function(callback) {
|
|
* setTimeout(function() {
|
|
* // then do another async task
|
|
* callback(null, 2);
|
|
* }, 100);
|
|
* }
|
|
* });
|
|
* console.log(results);
|
|
* // results is equal to: { one: 1, two: 2 }
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function series(tasks, callback) {
|
|
return _parallel(eachOfSeries$1, tasks, callback);
|
|
}
|
|
|
|
/**
|
|
* Returns `true` if at least one element in the `coll` satisfies an async test.
|
|
* If any iteratee call returns `true`, the main `callback` is immediately
|
|
* called.
|
|
*
|
|
* @name some
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @alias any
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collections in parallel.
|
|
* The iteratee should complete with a boolean `result` value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
* Result will be either `true` or `false` depending on the values of the async
|
|
* tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* // asynchronous function that checks if a file exists
|
|
* function fileExists(file, callback) {
|
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
* callback(null, !err);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
|
* function(err, result) {
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since some file in the list exists
|
|
* }
|
|
*);
|
|
*
|
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
|
* function(err, result) {
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since none of the files exists
|
|
* }
|
|
*);
|
|
*
|
|
* // Using Promises
|
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since some file in the list exists
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since none of the files exists
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
|
* console.log(result);
|
|
* // true
|
|
* // result is true since some file in the list exists
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
|
* console.log(result);
|
|
* // false
|
|
* // result is false since none of the files exists
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function some(coll, iteratee, callback) {
|
|
return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback)
|
|
}
|
|
var some$1 = awaitify(some, 3);
|
|
|
|
/**
|
|
* The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
|
|
*
|
|
* @name someLimit
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.some]{@link module:Collections.some}
|
|
* @alias anyLimit
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collections in parallel.
|
|
* The iteratee should complete with a boolean `result` value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
* Result will be either `true` or `false` depending on the values of the async
|
|
* tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function someLimit(coll, limit, iteratee, callback) {
|
|
return _createTester(Boolean, res => res)(eachOfLimit$2(limit), coll, iteratee, callback)
|
|
}
|
|
var someLimit$1 = awaitify(someLimit, 4);
|
|
|
|
/**
|
|
* The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
|
|
*
|
|
* @name someSeries
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @see [async.some]{@link module:Collections.some}
|
|
* @alias anySeries
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
* in the collections in series.
|
|
* The iteratee should complete with a boolean `result` value.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} [callback] - A callback which is called as soon as any
|
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
* Result will be either `true` or `false` depending on the values of the async
|
|
* tests. Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
*/
|
|
function someSeries(coll, iteratee, callback) {
|
|
return _createTester(Boolean, res => res)(eachOfSeries$1, coll, iteratee, callback)
|
|
}
|
|
var someSeries$1 = awaitify(someSeries, 3);
|
|
|
|
/**
|
|
* Sorts a list by the results of running each `coll` value through an async
|
|
* `iteratee`.
|
|
*
|
|
* @name sortBy
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with a value to use as the sort criteria as
|
|
* its `result`.
|
|
* Invoked with (item, callback).
|
|
* @param {Function} callback - A callback which is called after all the
|
|
* `iteratee` functions have finished, or an error occurs. Results is the items
|
|
* from the original `coll` sorted by the values returned by the `iteratee`
|
|
* calls. Invoked with (err, results).
|
|
* @returns {Promise} a promise, if no callback passed
|
|
* @example
|
|
*
|
|
* // bigfile.txt is a file that is 251100 bytes in size
|
|
* // mediumfile.txt is a file that is 11000 bytes in size
|
|
* // smallfile.txt is a file that is 121 bytes in size
|
|
*
|
|
* // asynchronous function that returns the file size in bytes
|
|
* function getFileSizeInBytes(file, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* callback(null, stat.size);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
|
|
* function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // results is now the original array of files sorted by
|
|
* // file size (ascending by default), e.g.
|
|
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
* }
|
|
* }
|
|
* );
|
|
*
|
|
* // By modifying the callback parameter the
|
|
* // sorting order can be influenced:
|
|
*
|
|
* // ascending order
|
|
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
|
|
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
* if (getFileSizeErr) return callback(getFileSizeErr);
|
|
* callback(null, fileSize);
|
|
* });
|
|
* }, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // results is now the original array of files sorted by
|
|
* // file size (ascending by default), e.g.
|
|
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
* }
|
|
* }
|
|
* );
|
|
*
|
|
* // descending order
|
|
* async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
|
|
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
* if (getFileSizeErr) {
|
|
* return callback(getFileSizeErr);
|
|
* }
|
|
* callback(null, fileSize * -1);
|
|
* });
|
|
* }, function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(results);
|
|
* // results is now the original array of files sorted by
|
|
* // file size (ascending by default), e.g.
|
|
* // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt']
|
|
* }
|
|
* }
|
|
* );
|
|
*
|
|
* // Error handling
|
|
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
|
|
* function(err, results) {
|
|
* if (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* } else {
|
|
* console.log(results);
|
|
* }
|
|
* }
|
|
* );
|
|
*
|
|
* // Using Promises
|
|
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
|
|
* .then( results => {
|
|
* console.log(results);
|
|
* // results is now the original array of files sorted by
|
|
* // file size (ascending by default), e.g.
|
|
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Error handling
|
|
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
|
|
* .then( results => {
|
|
* console.log(results);
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* (async () => {
|
|
* try {
|
|
* let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
* console.log(results);
|
|
* // results is now the original array of files sorted by
|
|
* // file size (ascending by default), e.g.
|
|
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* })();
|
|
*
|
|
* // Error handling
|
|
* async () => {
|
|
* try {
|
|
* let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
* console.log(results);
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* // [ Error: ENOENT: no such file or directory ]
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function sortBy (coll, iteratee, callback) {
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return map$1(coll, (x, iterCb) => {
|
|
_iteratee(x, (err, criteria) => {
|
|
if (err) return iterCb(err);
|
|
iterCb(err, {value: x, criteria});
|
|
});
|
|
}, (err, results) => {
|
|
if (err) return callback(err);
|
|
callback(null, results.sort(comparator).map(v => v.value));
|
|
});
|
|
|
|
function comparator(left, right) {
|
|
var a = left.criteria, b = right.criteria;
|
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
}
|
|
}
|
|
var sortBy$1 = awaitify(sortBy, 3);
|
|
|
|
/**
|
|
* Sets a time limit on an asynchronous function. If the function does not call
|
|
* its callback within the specified milliseconds, it will be called with a
|
|
* timeout error. The code property for the error object will be `'ETIMEDOUT'`.
|
|
*
|
|
* @name timeout
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @category Util
|
|
* @param {AsyncFunction} asyncFn - The async function to limit in time.
|
|
* @param {number} milliseconds - The specified time limit.
|
|
* @param {*} [info] - Any variable you want attached (`string`, `object`, etc)
|
|
* to timeout Error for more information..
|
|
* @returns {AsyncFunction} Returns a wrapped function that can be used with any
|
|
* of the control flow functions.
|
|
* Invoke this function with the same parameters as you would `asyncFunc`.
|
|
* @example
|
|
*
|
|
* function myFunction(foo, callback) {
|
|
* doAsyncTask(foo, function(err, data) {
|
|
* // handle errors
|
|
* if (err) return callback(err);
|
|
*
|
|
* // do some stuff ...
|
|
*
|
|
* // return processed data
|
|
* return callback(null, data);
|
|
* });
|
|
* }
|
|
*
|
|
* var wrapped = async.timeout(myFunction, 1000);
|
|
*
|
|
* // call `wrapped` as you would `myFunction`
|
|
* wrapped({ bar: 'bar' }, function(err, data) {
|
|
* // if `myFunction` takes < 1000 ms to execute, `err`
|
|
* // and `data` will have their expected values
|
|
*
|
|
* // else `err` will be an Error with the code 'ETIMEDOUT'
|
|
* });
|
|
*/
|
|
function timeout(asyncFn, milliseconds, info) {
|
|
var fn = wrapAsync(asyncFn);
|
|
|
|
return initialParams((args, callback) => {
|
|
var timedOut = false;
|
|
var timer;
|
|
|
|
function timeoutCallback() {
|
|
var name = asyncFn.name || 'anonymous';
|
|
var error = new Error('Callback function "' + name + '" timed out.');
|
|
error.code = 'ETIMEDOUT';
|
|
if (info) {
|
|
error.info = info;
|
|
}
|
|
timedOut = true;
|
|
callback(error);
|
|
}
|
|
|
|
args.push((...cbArgs) => {
|
|
if (!timedOut) {
|
|
callback(...cbArgs);
|
|
clearTimeout(timer);
|
|
}
|
|
});
|
|
|
|
// setup timer and call original function
|
|
timer = setTimeout(timeoutCallback, milliseconds);
|
|
fn(...args);
|
|
});
|
|
}
|
|
|
|
function range(size) {
|
|
var result = Array(size);
|
|
while (size--) {
|
|
result[size] = size;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a
|
|
* time.
|
|
*
|
|
* @name timesLimit
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.times]{@link module:ControlFlow.times}
|
|
* @category Control Flow
|
|
* @param {number} count - The number of times to run the function.
|
|
* @param {number} limit - The maximum number of async operations at a time.
|
|
* @param {AsyncFunction} iteratee - The async function to call `n` times.
|
|
* Invoked with the iteration index and a callback: (n, next).
|
|
* @param {Function} callback - see [async.map]{@link module:Collections.map}.
|
|
* @returns {Promise} a promise, if no callback is provided
|
|
*/
|
|
function timesLimit(count, limit, iteratee, callback) {
|
|
var _iteratee = wrapAsync(iteratee);
|
|
return mapLimit$1(range(count), limit, _iteratee, callback);
|
|
}
|
|
|
|
/**
|
|
* Calls the `iteratee` function `n` times, and accumulates results in the same
|
|
* manner you would use with [map]{@link module:Collections.map}.
|
|
*
|
|
* @name times
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.map]{@link module:Collections.map}
|
|
* @category Control Flow
|
|
* @param {number} n - The number of times to run the function.
|
|
* @param {AsyncFunction} iteratee - The async function to call `n` times.
|
|
* Invoked with the iteration index and a callback: (n, next).
|
|
* @param {Function} callback - see {@link module:Collections.map}.
|
|
* @returns {Promise} a promise, if no callback is provided
|
|
* @example
|
|
*
|
|
* // Pretend this is some complicated async factory
|
|
* var createUser = function(id, callback) {
|
|
* callback(null, {
|
|
* id: 'user' + id
|
|
* });
|
|
* };
|
|
*
|
|
* // generate 5 users
|
|
* async.times(5, function(n, next) {
|
|
* createUser(n, function(err, user) {
|
|
* next(err, user);
|
|
* });
|
|
* }, function(err, users) {
|
|
* // we should now have 5 users
|
|
* });
|
|
*/
|
|
function times (n, iteratee, callback) {
|
|
return timesLimit(n, Infinity, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.
|
|
*
|
|
* @name timesSeries
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.times]{@link module:ControlFlow.times}
|
|
* @category Control Flow
|
|
* @param {number} n - The number of times to run the function.
|
|
* @param {AsyncFunction} iteratee - The async function to call `n` times.
|
|
* Invoked with the iteration index and a callback: (n, next).
|
|
* @param {Function} callback - see {@link module:Collections.map}.
|
|
* @returns {Promise} a promise, if no callback is provided
|
|
*/
|
|
function timesSeries (n, iteratee, callback) {
|
|
return timesLimit(n, 1, iteratee, callback)
|
|
}
|
|
|
|
/**
|
|
* A relative of `reduce`. Takes an Object or Array, and iterates over each
|
|
* element in parallel, each step potentially mutating an `accumulator` value.
|
|
* The type of the accumulator defaults to the type of collection passed in.
|
|
*
|
|
* @name transform
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {*} [accumulator] - The initial state of the transform. If omitted,
|
|
* it will default to an empty Object or Array, depending on the type of `coll`
|
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
* collection that potentially modifies the accumulator.
|
|
* Invoked with (accumulator, item, key, callback).
|
|
* @param {Function} [callback] - A callback which is called after all the
|
|
* `iteratee` functions have finished. Result is the transformed accumulator.
|
|
* Invoked with (err, result).
|
|
* @returns {Promise} a promise, if no callback provided
|
|
* @example
|
|
*
|
|
* // file1.txt is a file that is 1000 bytes in size
|
|
* // file2.txt is a file that is 2000 bytes in size
|
|
* // file3.txt is a file that is 3000 bytes in size
|
|
*
|
|
* // helper function that returns human-readable size format from bytes
|
|
* function formatBytes(bytes, decimals = 2) {
|
|
* // implementation not included for brevity
|
|
* return humanReadbleFilesize;
|
|
* }
|
|
*
|
|
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
*
|
|
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
* function transformFileSize(acc, value, key, callback) {
|
|
* fs.stat(value, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* acc[key] = formatBytes(stat.size);
|
|
* callback(null);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.transform(fileList, transformFileSize, function(err, result) {
|
|
* if(err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.transform(fileList, transformFileSize)
|
|
* .then(result => {
|
|
* console.log(result);
|
|
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* (async () => {
|
|
* try {
|
|
* let result = await async.transform(fileList, transformFileSize);
|
|
* console.log(result);
|
|
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* })();
|
|
*
|
|
* @example
|
|
*
|
|
* // file1.txt is a file that is 1000 bytes in size
|
|
* // file2.txt is a file that is 2000 bytes in size
|
|
* // file3.txt is a file that is 3000 bytes in size
|
|
*
|
|
* // helper function that returns human-readable size format from bytes
|
|
* function formatBytes(bytes, decimals = 2) {
|
|
* // implementation not included for brevity
|
|
* return humanReadbleFilesize;
|
|
* }
|
|
*
|
|
* const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' };
|
|
*
|
|
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
* function transformFileSize(acc, value, key, callback) {
|
|
* fs.stat(value, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(err);
|
|
* }
|
|
* acc[key] = formatBytes(stat.size);
|
|
* callback(null);
|
|
* });
|
|
* }
|
|
*
|
|
* // Using callbacks
|
|
* async.transform(fileMap, transformFileSize, function(err, result) {
|
|
* if(err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.transform(fileMap, transformFileSize)
|
|
* .then(result => {
|
|
* console.log(result);
|
|
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
* }).catch(err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.transform(fileMap, transformFileSize);
|
|
* console.log(result);
|
|
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function transform (coll, accumulator, iteratee, callback) {
|
|
if (arguments.length <= 3 && typeof accumulator === 'function') {
|
|
callback = iteratee;
|
|
iteratee = accumulator;
|
|
accumulator = Array.isArray(coll) ? [] : {};
|
|
}
|
|
callback = once(callback || promiseCallback());
|
|
var _iteratee = wrapAsync(iteratee);
|
|
|
|
eachOf$1(coll, (v, k, cb) => {
|
|
_iteratee(accumulator, v, k, cb);
|
|
}, err => callback(err, accumulator));
|
|
return callback[PROMISE_SYMBOL]
|
|
}
|
|
|
|
/**
|
|
* It runs each task in series but stops whenever any of the functions were
|
|
* successful. If one of the tasks were successful, the `callback` will be
|
|
* passed the result of the successful task. If all tasks fail, the callback
|
|
* will be passed the error and result (if any) of the final attempt.
|
|
*
|
|
* @name tryEach
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to
|
|
* run, each function is passed a `callback(err, result)` it must call on
|
|
* completion with an error `err` (which can be `null`) and an optional `result`
|
|
* value.
|
|
* @param {Function} [callback] - An optional callback which is called when one
|
|
* of the tasks has succeeded, or all have failed. It receives the `err` and
|
|
* `result` arguments of the last attempt at completing the `task`. Invoked with
|
|
* (err, results).
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
* async.tryEach([
|
|
* function getDataFromFirstWebsite(callback) {
|
|
* // Try getting the data from the first website
|
|
* callback(err, data);
|
|
* },
|
|
* function getDataFromSecondWebsite(callback) {
|
|
* // First website failed,
|
|
* // Try getting the data from the backup website
|
|
* callback(err, data);
|
|
* }
|
|
* ],
|
|
* // optional callback
|
|
* function(err, results) {
|
|
* Now do something with the data.
|
|
* });
|
|
*
|
|
*/
|
|
function tryEach(tasks, callback) {
|
|
var error = null;
|
|
var result;
|
|
return eachSeries$1(tasks, (task, taskCb) => {
|
|
wrapAsync(task)((err, ...args) => {
|
|
if (err === false) return taskCb(err);
|
|
|
|
if (args.length < 2) {
|
|
[result] = args;
|
|
} else {
|
|
result = args;
|
|
}
|
|
error = err;
|
|
taskCb(err ? null : {});
|
|
});
|
|
}, () => callback(error, result));
|
|
}
|
|
|
|
var tryEach$1 = awaitify(tryEach);
|
|
|
|
/**
|
|
* Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
|
|
* unmemoized form. Handy for testing.
|
|
*
|
|
* @name unmemoize
|
|
* @static
|
|
* @memberOf module:Utils
|
|
* @method
|
|
* @see [async.memoize]{@link module:Utils.memoize}
|
|
* @category Util
|
|
* @param {AsyncFunction} fn - the memoized function
|
|
* @returns {AsyncFunction} a function that calls the original unmemoized function
|
|
*/
|
|
function unmemoize(fn) {
|
|
return (...args) => {
|
|
return (fn.unmemoized || fn)(...args);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
|
|
* stopped, or an error occurs.
|
|
*
|
|
* @name whilst
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} test - asynchronous truth test to perform before each
|
|
* execution of `iteratee`. Invoked with (callback).
|
|
* @param {AsyncFunction} iteratee - An async function which is called each time
|
|
* `test` passes. Invoked with (callback).
|
|
* @param {Function} [callback] - A callback which is called after the test
|
|
* function has failed and repeated execution of `iteratee` has stopped. `callback`
|
|
* will be passed an error and any arguments passed to the final `iteratee`'s
|
|
* callback. Invoked with (err, [results]);
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* var count = 0;
|
|
* async.whilst(
|
|
* function test(cb) { cb(null, count < 5); },
|
|
* function iter(callback) {
|
|
* count++;
|
|
* setTimeout(function() {
|
|
* callback(null, count);
|
|
* }, 1000);
|
|
* },
|
|
* function (err, n) {
|
|
* // 5 seconds have passed, n = 5
|
|
* }
|
|
* );
|
|
*/
|
|
function whilst(test, iteratee, callback) {
|
|
callback = onlyOnce(callback);
|
|
var _fn = wrapAsync(iteratee);
|
|
var _test = wrapAsync(test);
|
|
var results = [];
|
|
|
|
function next(err, ...rest) {
|
|
if (err) return callback(err);
|
|
results = rest;
|
|
if (err === false) return;
|
|
_test(check);
|
|
}
|
|
|
|
function check(err, truth) {
|
|
if (err) return callback(err);
|
|
if (err === false) return;
|
|
if (!truth) return callback(null, ...results);
|
|
_fn(next);
|
|
}
|
|
|
|
return _test(check);
|
|
}
|
|
var whilst$1 = awaitify(whilst, 3);
|
|
|
|
/**
|
|
* Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
|
|
* stopped, or an error occurs. `callback` will be passed an error and any
|
|
* arguments passed to the final `iteratee`'s callback.
|
|
*
|
|
* The inverse of [whilst]{@link module:ControlFlow.whilst}.
|
|
*
|
|
* @name until
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
|
* @category Control Flow
|
|
* @param {AsyncFunction} test - asynchronous truth test to perform before each
|
|
* execution of `iteratee`. Invoked with (callback).
|
|
* @param {AsyncFunction} iteratee - An async function which is called each time
|
|
* `test` fails. Invoked with (callback).
|
|
* @param {Function} [callback] - A callback which is called after the test
|
|
* function has passed and repeated execution of `iteratee` has stopped. `callback`
|
|
* will be passed an error and any arguments passed to the final `iteratee`'s
|
|
* callback. Invoked with (err, [results]);
|
|
* @returns {Promise} a promise, if a callback is not passed
|
|
*
|
|
* @example
|
|
* const results = []
|
|
* let finished = false
|
|
* async.until(function test(cb) {
|
|
* cb(null, finished)
|
|
* }, function iter(next) {
|
|
* fetchPage(url, (err, body) => {
|
|
* if (err) return next(err)
|
|
* results = results.concat(body.objects)
|
|
* finished = !!body.next
|
|
* next(err)
|
|
* })
|
|
* }, function done (err) {
|
|
* // all pages have been fetched
|
|
* })
|
|
*/
|
|
function until(test, iteratee, callback) {
|
|
const _test = wrapAsync(test);
|
|
return whilst$1((cb) => _test((err, truth) => cb (err, !truth)), iteratee, callback);
|
|
}
|
|
|
|
/**
|
|
* Runs the `tasks` array of functions in series, each passing their results to
|
|
* the next in the array. However, if any of the `tasks` pass an error to their
|
|
* own callback, the next function is not executed, and the main `callback` is
|
|
* immediately called with the error.
|
|
*
|
|
* @name waterfall
|
|
* @static
|
|
* @memberOf module:ControlFlow
|
|
* @method
|
|
* @category Control Flow
|
|
* @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
|
|
* to run.
|
|
* Each function should complete with any number of `result` values.
|
|
* The `result` values will be passed as arguments, in order, to the next task.
|
|
* @param {Function} [callback] - An optional callback to run once all the
|
|
* functions have completed. This will be passed the results of the last task's
|
|
* callback. Invoked with (err, [results]).
|
|
* @returns {Promise} a promise, if a callback is omitted
|
|
* @example
|
|
*
|
|
* async.waterfall([
|
|
* function(callback) {
|
|
* callback(null, 'one', 'two');
|
|
* },
|
|
* function(arg1, arg2, callback) {
|
|
* // arg1 now equals 'one' and arg2 now equals 'two'
|
|
* callback(null, 'three');
|
|
* },
|
|
* function(arg1, callback) {
|
|
* // arg1 now equals 'three'
|
|
* callback(null, 'done');
|
|
* }
|
|
* ], function (err, result) {
|
|
* // result now equals 'done'
|
|
* });
|
|
*
|
|
* // Or, with named functions:
|
|
* async.waterfall([
|
|
* myFirstFunction,
|
|
* mySecondFunction,
|
|
* myLastFunction,
|
|
* ], function (err, result) {
|
|
* // result now equals 'done'
|
|
* });
|
|
* function myFirstFunction(callback) {
|
|
* callback(null, 'one', 'two');
|
|
* }
|
|
* function mySecondFunction(arg1, arg2, callback) {
|
|
* // arg1 now equals 'one' and arg2 now equals 'two'
|
|
* callback(null, 'three');
|
|
* }
|
|
* function myLastFunction(arg1, callback) {
|
|
* // arg1 now equals 'three'
|
|
* callback(null, 'done');
|
|
* }
|
|
*/
|
|
function waterfall (tasks, callback) {
|
|
callback = once(callback);
|
|
if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
|
|
if (!tasks.length) return callback();
|
|
var taskIndex = 0;
|
|
|
|
function nextTask(args) {
|
|
var task = wrapAsync(tasks[taskIndex++]);
|
|
task(...args, onlyOnce(next));
|
|
}
|
|
|
|
function next(err, ...args) {
|
|
if (err === false) return
|
|
if (err || taskIndex === tasks.length) {
|
|
return callback(err, ...args);
|
|
}
|
|
nextTask(args);
|
|
}
|
|
|
|
nextTask([]);
|
|
}
|
|
|
|
var waterfall$1 = awaitify(waterfall);
|
|
|
|
/**
|
|
* An "async function" in the context of Async is an asynchronous function with
|
|
* a variable number of parameters, with the final parameter being a callback.
|
|
* (`function (arg1, arg2, ..., callback) {}`)
|
|
* The final callback is of the form `callback(err, results...)`, which must be
|
|
* called once the function is completed. The callback should be called with a
|
|
* Error as its first argument to signal that an error occurred.
|
|
* Otherwise, if no error occurred, it should be called with `null` as the first
|
|
* argument, and any additional `result` arguments that may apply, to signal
|
|
* successful completion.
|
|
* The callback must be called exactly once, ideally on a later tick of the
|
|
* JavaScript event loop.
|
|
*
|
|
* This type of function is also referred to as a "Node-style async function",
|
|
* or a "continuation passing-style function" (CPS). Most of the methods of this
|
|
* library are themselves CPS/Node-style async functions, or functions that
|
|
* return CPS/Node-style async functions.
|
|
*
|
|
* Wherever we accept a Node-style async function, we also directly accept an
|
|
* [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
|
|
* In this case, the `async` function will not be passed a final callback
|
|
* argument, and any thrown error will be used as the `err` argument of the
|
|
* implicit callback, and the return value will be used as the `result` value.
|
|
* (i.e. a `rejected` of the returned Promise becomes the `err` callback
|
|
* argument, and a `resolved` value becomes the `result`.)
|
|
*
|
|
* Note, due to JavaScript limitations, we can only detect native `async`
|
|
* functions and not transpilied implementations.
|
|
* Your environment must have `async`/`await` support for this to work.
|
|
* (e.g. Node > v7.6, or a recent version of a modern browser).
|
|
* If you are using `async` functions through a transpiler (e.g. Babel), you
|
|
* must still wrap the function with [asyncify]{@link module:Utils.asyncify},
|
|
* because the `async function` will be compiled to an ordinary function that
|
|
* returns a promise.
|
|
*
|
|
* @typedef {Function} AsyncFunction
|
|
* @static
|
|
*/
|
|
|
|
|
|
var index = {
|
|
apply,
|
|
applyEach,
|
|
applyEachSeries,
|
|
asyncify,
|
|
auto,
|
|
autoInject,
|
|
cargo: cargo$1,
|
|
cargoQueue: cargo,
|
|
compose,
|
|
concat: concat$1,
|
|
concatLimit: concatLimit$1,
|
|
concatSeries: concatSeries$1,
|
|
constant: constant$1,
|
|
detect: detect$1,
|
|
detectLimit: detectLimit$1,
|
|
detectSeries: detectSeries$1,
|
|
dir,
|
|
doUntil,
|
|
doWhilst: doWhilst$1,
|
|
each,
|
|
eachLimit: eachLimit$1,
|
|
eachOf: eachOf$1,
|
|
eachOfLimit: eachOfLimit$1,
|
|
eachOfSeries: eachOfSeries$1,
|
|
eachSeries: eachSeries$1,
|
|
ensureAsync,
|
|
every: every$1,
|
|
everyLimit: everyLimit$1,
|
|
everySeries: everySeries$1,
|
|
filter: filter$1,
|
|
filterLimit: filterLimit$1,
|
|
filterSeries: filterSeries$1,
|
|
forever: forever$1,
|
|
groupBy,
|
|
groupByLimit: groupByLimit$1,
|
|
groupBySeries,
|
|
log,
|
|
map: map$1,
|
|
mapLimit: mapLimit$1,
|
|
mapSeries: mapSeries$1,
|
|
mapValues,
|
|
mapValuesLimit: mapValuesLimit$1,
|
|
mapValuesSeries,
|
|
memoize,
|
|
nextTick,
|
|
parallel,
|
|
parallelLimit,
|
|
priorityQueue,
|
|
queue,
|
|
race: race$1,
|
|
reduce: reduce$1,
|
|
reduceRight,
|
|
reflect,
|
|
reflectAll,
|
|
reject: reject$1,
|
|
rejectLimit: rejectLimit$1,
|
|
rejectSeries: rejectSeries$1,
|
|
retry,
|
|
retryable,
|
|
seq,
|
|
series,
|
|
setImmediate: setImmediate$1,
|
|
some: some$1,
|
|
someLimit: someLimit$1,
|
|
someSeries: someSeries$1,
|
|
sortBy: sortBy$1,
|
|
timeout,
|
|
times,
|
|
timesLimit,
|
|
timesSeries,
|
|
transform,
|
|
tryEach: tryEach$1,
|
|
unmemoize,
|
|
until,
|
|
waterfall: waterfall$1,
|
|
whilst: whilst$1,
|
|
|
|
// aliases
|
|
all: every$1,
|
|
allLimit: everyLimit$1,
|
|
allSeries: everySeries$1,
|
|
any: some$1,
|
|
anyLimit: someLimit$1,
|
|
anySeries: someSeries$1,
|
|
find: detect$1,
|
|
findLimit: detectLimit$1,
|
|
findSeries: detectSeries$1,
|
|
flatMap: concat$1,
|
|
flatMapLimit: concatLimit$1,
|
|
flatMapSeries: concatSeries$1,
|
|
forEach: each,
|
|
forEachSeries: eachSeries$1,
|
|
forEachLimit: eachLimit$1,
|
|
forEachOf: eachOf$1,
|
|
forEachOfSeries: eachOfSeries$1,
|
|
forEachOfLimit: eachOfLimit$1,
|
|
inject: reduce$1,
|
|
foldl: reduce$1,
|
|
foldr: reduceRight,
|
|
select: filter$1,
|
|
selectLimit: filterLimit$1,
|
|
selectSeries: filterSeries$1,
|
|
wrapSync: asyncify,
|
|
during: whilst$1,
|
|
doDuring: doWhilst$1
|
|
};
|
|
|
|
exports.all = every$1;
|
|
exports.allLimit = everyLimit$1;
|
|
exports.allSeries = everySeries$1;
|
|
exports.any = some$1;
|
|
exports.anyLimit = someLimit$1;
|
|
exports.anySeries = someSeries$1;
|
|
exports.apply = apply;
|
|
exports.applyEach = applyEach;
|
|
exports.applyEachSeries = applyEachSeries;
|
|
exports.asyncify = asyncify;
|
|
exports.auto = auto;
|
|
exports.autoInject = autoInject;
|
|
exports.cargo = cargo$1;
|
|
exports.cargoQueue = cargo;
|
|
exports.compose = compose;
|
|
exports.concat = concat$1;
|
|
exports.concatLimit = concatLimit$1;
|
|
exports.concatSeries = concatSeries$1;
|
|
exports.constant = constant$1;
|
|
exports.default = index;
|
|
exports.detect = detect$1;
|
|
exports.detectLimit = detectLimit$1;
|
|
exports.detectSeries = detectSeries$1;
|
|
exports.dir = dir;
|
|
exports.doDuring = doWhilst$1;
|
|
exports.doUntil = doUntil;
|
|
exports.doWhilst = doWhilst$1;
|
|
exports.during = whilst$1;
|
|
exports.each = each;
|
|
exports.eachLimit = eachLimit$1;
|
|
exports.eachOf = eachOf$1;
|
|
exports.eachOfLimit = eachOfLimit$1;
|
|
exports.eachOfSeries = eachOfSeries$1;
|
|
exports.eachSeries = eachSeries$1;
|
|
exports.ensureAsync = ensureAsync;
|
|
exports.every = every$1;
|
|
exports.everyLimit = everyLimit$1;
|
|
exports.everySeries = everySeries$1;
|
|
exports.filter = filter$1;
|
|
exports.filterLimit = filterLimit$1;
|
|
exports.filterSeries = filterSeries$1;
|
|
exports.find = detect$1;
|
|
exports.findLimit = detectLimit$1;
|
|
exports.findSeries = detectSeries$1;
|
|
exports.flatMap = concat$1;
|
|
exports.flatMapLimit = concatLimit$1;
|
|
exports.flatMapSeries = concatSeries$1;
|
|
exports.foldl = reduce$1;
|
|
exports.foldr = reduceRight;
|
|
exports.forEach = each;
|
|
exports.forEachLimit = eachLimit$1;
|
|
exports.forEachOf = eachOf$1;
|
|
exports.forEachOfLimit = eachOfLimit$1;
|
|
exports.forEachOfSeries = eachOfSeries$1;
|
|
exports.forEachSeries = eachSeries$1;
|
|
exports.forever = forever$1;
|
|
exports.groupBy = groupBy;
|
|
exports.groupByLimit = groupByLimit$1;
|
|
exports.groupBySeries = groupBySeries;
|
|
exports.inject = reduce$1;
|
|
exports.log = log;
|
|
exports.map = map$1;
|
|
exports.mapLimit = mapLimit$1;
|
|
exports.mapSeries = mapSeries$1;
|
|
exports.mapValues = mapValues;
|
|
exports.mapValuesLimit = mapValuesLimit$1;
|
|
exports.mapValuesSeries = mapValuesSeries;
|
|
exports.memoize = memoize;
|
|
exports.nextTick = nextTick;
|
|
exports.parallel = parallel;
|
|
exports.parallelLimit = parallelLimit;
|
|
exports.priorityQueue = priorityQueue;
|
|
exports.queue = queue;
|
|
exports.race = race$1;
|
|
exports.reduce = reduce$1;
|
|
exports.reduceRight = reduceRight;
|
|
exports.reflect = reflect;
|
|
exports.reflectAll = reflectAll;
|
|
exports.reject = reject$1;
|
|
exports.rejectLimit = rejectLimit$1;
|
|
exports.rejectSeries = rejectSeries$1;
|
|
exports.retry = retry;
|
|
exports.retryable = retryable;
|
|
exports.select = filter$1;
|
|
exports.selectLimit = filterLimit$1;
|
|
exports.selectSeries = filterSeries$1;
|
|
exports.seq = seq;
|
|
exports.series = series;
|
|
exports.setImmediate = setImmediate$1;
|
|
exports.some = some$1;
|
|
exports.someLimit = someLimit$1;
|
|
exports.someSeries = someSeries$1;
|
|
exports.sortBy = sortBy$1;
|
|
exports.timeout = timeout;
|
|
exports.times = times;
|
|
exports.timesLimit = timesLimit;
|
|
exports.timesSeries = timesSeries;
|
|
exports.transform = transform;
|
|
exports.tryEach = tryEach$1;
|
|
exports.unmemoize = unmemoize;
|
|
exports.until = until;
|
|
exports.waterfall = waterfall$1;
|
|
exports.whilst = whilst$1;
|
|
exports.wrapSync = asyncify;
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9417:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
module.exports = balanced;
|
|
function balanced(a, b, str) {
|
|
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
|
|
var r = range(a, b, str);
|
|
|
|
return r && {
|
|
start: r[0],
|
|
end: r[1],
|
|
pre: str.slice(0, r[0]),
|
|
body: str.slice(r[0] + a.length, r[1]),
|
|
post: str.slice(r[1] + b.length)
|
|
};
|
|
}
|
|
|
|
function maybeMatch(reg, str) {
|
|
var m = str.match(reg);
|
|
return m ? m[0] : null;
|
|
}
|
|
|
|
balanced.range = range;
|
|
function range(a, b, str) {
|
|
var begs, beg, left, right, result;
|
|
var ai = str.indexOf(a);
|
|
var bi = str.indexOf(b, ai + 1);
|
|
var i = ai;
|
|
|
|
if (ai >= 0 && bi > 0) {
|
|
if(a===b) {
|
|
return [ai, bi];
|
|
}
|
|
begs = [];
|
|
left = str.length;
|
|
|
|
while (i >= 0 && !result) {
|
|
if (i == ai) {
|
|
begs.push(i);
|
|
ai = str.indexOf(a, i + 1);
|
|
} else if (begs.length == 1) {
|
|
result = [ begs.pop(), bi ];
|
|
} else {
|
|
beg = begs.pop();
|
|
if (beg < left) {
|
|
left = beg;
|
|
right = bi;
|
|
}
|
|
|
|
bi = str.indexOf(b, i + 1);
|
|
}
|
|
|
|
i = ai < bi && ai >= 0 ? ai : bi;
|
|
}
|
|
|
|
if (begs.length) {
|
|
result = [ left, right ];
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7124:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
const { Transform } = __nccwpck_require__(1642)
|
|
|
|
class Block extends Transform {
|
|
constructor (size, opts = {}) {
|
|
super(opts)
|
|
|
|
if (typeof size === 'object') {
|
|
opts = size
|
|
size = opts.size
|
|
}
|
|
|
|
this.size = size || 512
|
|
|
|
const { nopad, zeroPadding = true } = opts
|
|
|
|
if (nopad) this._zeroPadding = false
|
|
else this._zeroPadding = !!zeroPadding
|
|
|
|
this._buffered = []
|
|
this._bufferedBytes = 0
|
|
}
|
|
|
|
_transform (buf, enc, next) {
|
|
this._bufferedBytes += buf.length
|
|
this._buffered.push(buf)
|
|
|
|
while (this._bufferedBytes >= this.size) {
|
|
this._bufferedBytes -= this.size
|
|
|
|
// Assemble the buffers that will compose the final block
|
|
const blockBufs = []
|
|
let blockBufsBytes = 0
|
|
while (blockBufsBytes < this.size) {
|
|
const b = this._buffered.shift()
|
|
|
|
if (blockBufsBytes + b.length <= this.size) {
|
|
blockBufs.push(b)
|
|
blockBufsBytes += b.length
|
|
} else {
|
|
// If the last buffer is larger than needed for the block, just
|
|
// use the needed part
|
|
const neededSize = this.size - blockBufsBytes
|
|
blockBufs.push(b.slice(0, neededSize))
|
|
blockBufsBytes += neededSize
|
|
this._buffered.unshift(b.slice(neededSize))
|
|
}
|
|
}
|
|
|
|
// Then concat just those buffers, leaving the rest untouched in _buffered
|
|
this.push(Buffer.concat(blockBufs, this.size))
|
|
}
|
|
next()
|
|
}
|
|
|
|
_flush () {
|
|
if (this._bufferedBytes && this._zeroPadding) {
|
|
const zeroes = Buffer.alloc(this.size - this._bufferedBytes)
|
|
this._buffered.push(zeroes)
|
|
this.push(Buffer.concat(this._buffered))
|
|
this._buffered = null
|
|
} else if (this._bufferedBytes) {
|
|
this.push(Buffer.concat(this._buffered))
|
|
this._buffered = null
|
|
}
|
|
this.push(null)
|
|
}
|
|
}
|
|
|
|
module.exports = Block
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3717:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var concatMap = __nccwpck_require__(6891);
|
|
var balanced = __nccwpck_require__(9417);
|
|
|
|
module.exports = expandTop;
|
|
|
|
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
|
|
function numeric(str) {
|
|
return parseInt(str, 10) == str
|
|
? parseInt(str, 10)
|
|
: str.charCodeAt(0);
|
|
}
|
|
|
|
function escapeBraces(str) {
|
|
return str.split('\\\\').join(escSlash)
|
|
.split('\\{').join(escOpen)
|
|
.split('\\}').join(escClose)
|
|
.split('\\,').join(escComma)
|
|
.split('\\.').join(escPeriod);
|
|
}
|
|
|
|
function unescapeBraces(str) {
|
|
return str.split(escSlash).join('\\')
|
|
.split(escOpen).join('{')
|
|
.split(escClose).join('}')
|
|
.split(escComma).join(',')
|
|
.split(escPeriod).join('.');
|
|
}
|
|
|
|
|
|
// Basically just str.split(","), but handling cases
|
|
// where we have nested braced sections, which should be
|
|
// treated as individual members, like {a,{b,c},d}
|
|
function parseCommaParts(str) {
|
|
if (!str)
|
|
return [''];
|
|
|
|
var parts = [];
|
|
var m = balanced('{', '}', str);
|
|
|
|
if (!m)
|
|
return str.split(',');
|
|
|
|
var pre = m.pre;
|
|
var body = m.body;
|
|
var post = m.post;
|
|
var p = pre.split(',');
|
|
|
|
p[p.length-1] += '{' + body + '}';
|
|
var postParts = parseCommaParts(post);
|
|
if (post.length) {
|
|
p[p.length-1] += postParts.shift();
|
|
p.push.apply(p, postParts);
|
|
}
|
|
|
|
parts.push.apply(parts, p);
|
|
|
|
return parts;
|
|
}
|
|
|
|
function expandTop(str) {
|
|
if (!str)
|
|
return [];
|
|
|
|
// I don't know why Bash 4.3 does this, but it does.
|
|
// Anything starting with {} will have the first two bytes preserved
|
|
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
// but a{},b}c will be expanded to [a}c,abc].
|
|
// One could argue that this is a bug in Bash, but since the goal of
|
|
// this module is to match Bash's rules, we escape a leading {}
|
|
if (str.substr(0, 2) === '{}') {
|
|
str = '\\{\\}' + str.substr(2);
|
|
}
|
|
|
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
}
|
|
|
|
function identity(e) {
|
|
return e;
|
|
}
|
|
|
|
function embrace(str) {
|
|
return '{' + str + '}';
|
|
}
|
|
function isPadded(el) {
|
|
return /^-?0\d/.test(el);
|
|
}
|
|
|
|
function lte(i, y) {
|
|
return i <= y;
|
|
}
|
|
function gte(i, y) {
|
|
return i >= y;
|
|
}
|
|
|
|
function expand(str, isTop) {
|
|
var expansions = [];
|
|
|
|
var m = balanced('{', '}', str);
|
|
if (!m || /\$$/.test(m.pre)) return [str];
|
|
|
|
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
var isSequence = isNumericSequence || isAlphaSequence;
|
|
var isOptions = m.body.indexOf(',') >= 0;
|
|
if (!isSequence && !isOptions) {
|
|
// {a},b}
|
|
if (m.post.match(/,.*\}/)) {
|
|
str = m.pre + '{' + m.body + escClose + m.post;
|
|
return expand(str);
|
|
}
|
|
return [str];
|
|
}
|
|
|
|
var n;
|
|
if (isSequence) {
|
|
n = m.body.split(/\.\./);
|
|
} else {
|
|
n = parseCommaParts(m.body);
|
|
if (n.length === 1) {
|
|
// x{{a,b}}y ==> x{a}y x{b}y
|
|
n = expand(n[0], false).map(embrace);
|
|
if (n.length === 1) {
|
|
var post = m.post.length
|
|
? expand(m.post, false)
|
|
: [''];
|
|
return post.map(function(p) {
|
|
return m.pre + n[0] + p;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
// at this point, n is the parts, and we know it's not a comma set
|
|
// with a single entry.
|
|
|
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
var pre = m.pre;
|
|
var post = m.post.length
|
|
? expand(m.post, false)
|
|
: [''];
|
|
|
|
var N;
|
|
|
|
if (isSequence) {
|
|
var x = numeric(n[0]);
|
|
var y = numeric(n[1]);
|
|
var width = Math.max(n[0].length, n[1].length)
|
|
var incr = n.length == 3
|
|
? Math.abs(numeric(n[2]))
|
|
: 1;
|
|
var test = lte;
|
|
var reverse = y < x;
|
|
if (reverse) {
|
|
incr *= -1;
|
|
test = gte;
|
|
}
|
|
var pad = n.some(isPadded);
|
|
|
|
N = [];
|
|
|
|
for (var i = x; test(i, y); i += incr) {
|
|
var c;
|
|
if (isAlphaSequence) {
|
|
c = String.fromCharCode(i);
|
|
if (c === '\\')
|
|
c = '';
|
|
} else {
|
|
c = String(i);
|
|
if (pad) {
|
|
var need = width - c.length;
|
|
if (need > 0) {
|
|
var z = new Array(need + 1).join('0');
|
|
if (i < 0)
|
|
c = '-' + z + c.slice(1);
|
|
else
|
|
c = z + c;
|
|
}
|
|
}
|
|
}
|
|
N.push(c);
|
|
}
|
|
} else {
|
|
N = concatMap(n, function(el) { return expand(el, false) });
|
|
}
|
|
|
|
for (var j = 0; j < N.length; j++) {
|
|
for (var k = 0; k < post.length; k++) {
|
|
var expansion = pre + N[j] + post[k];
|
|
if (!isTop || isSequence || expansion)
|
|
expansions.push(expansion);
|
|
}
|
|
}
|
|
|
|
return expansions;
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9107:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
|
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
|
|
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
|
|
var isWebWorker = (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
|
|
|
|
/**
|
|
* @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
|
|
* @see https://github.com/jsdom/jsdom/issues/1537
|
|
*/
|
|
var isJsDom = typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
|
|
var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
|
|
exports.isBrowser = isBrowser;
|
|
exports.isWebWorker = isWebWorker;
|
|
exports.isNode = isNode;
|
|
exports.isJsDom = isJsDom;
|
|
exports.isDeno = isDeno;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4794:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var Buffer = (__nccwpck_require__(4300).Buffer);
|
|
|
|
var CRC_TABLE = [
|
|
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
|
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
|
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
|
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
|
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
|
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
|
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
|
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
|
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
|
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
|
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
|
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
|
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
|
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
|
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
|
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
|
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
|
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
|
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
|
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
|
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
|
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
|
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
|
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
|
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
|
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
|
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
|
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
|
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
|
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
|
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
|
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
|
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
|
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
|
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
|
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
|
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
|
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
|
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
|
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
|
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
|
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
|
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
|
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
|
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
|
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
|
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
|
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
|
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
|
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
|
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
|
0x2d02ef8d
|
|
];
|
|
|
|
if (typeof Int32Array !== 'undefined') {
|
|
CRC_TABLE = new Int32Array(CRC_TABLE);
|
|
}
|
|
|
|
function ensureBuffer(input) {
|
|
if (Buffer.isBuffer(input)) {
|
|
return input;
|
|
}
|
|
|
|
var hasNewBufferAPI =
|
|
typeof Buffer.alloc === "function" &&
|
|
typeof Buffer.from === "function";
|
|
|
|
if (typeof input === "number") {
|
|
return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
|
|
}
|
|
else if (typeof input === "string") {
|
|
return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
|
|
}
|
|
else {
|
|
throw new Error("input must be buffer, number, or string, received " +
|
|
typeof input);
|
|
}
|
|
}
|
|
|
|
function bufferizeInt(num) {
|
|
var tmp = ensureBuffer(4);
|
|
tmp.writeInt32BE(num, 0);
|
|
return tmp;
|
|
}
|
|
|
|
function _crc32(buf, previous) {
|
|
buf = ensureBuffer(buf);
|
|
if (Buffer.isBuffer(previous)) {
|
|
previous = previous.readUInt32BE(0);
|
|
}
|
|
var crc = ~~previous ^ -1;
|
|
for (var n = 0; n < buf.length; n++) {
|
|
crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
|
|
}
|
|
return (crc ^ -1);
|
|
}
|
|
|
|
function crc32() {
|
|
return bufferizeInt(_crc32.apply(null, arguments));
|
|
}
|
|
crc32.signed = function () {
|
|
return _crc32.apply(null, arguments);
|
|
};
|
|
crc32.unsigned = function () {
|
|
return _crc32.apply(null, arguments) >>> 0;
|
|
};
|
|
|
|
module.exports = crc32;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6891:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = function (xs, fn) {
|
|
var res = [];
|
|
for (var i = 0; i < xs.length; i++) {
|
|
var x = fn(xs[i], i);
|
|
if (isArray(x)) res.push.apply(res, x);
|
|
else res.push(x);
|
|
}
|
|
return res;
|
|
};
|
|
|
|
var isArray = Array.isArray || function (xs) {
|
|
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3186:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
var token = '%[a-f0-9]{2}';
|
|
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');
|
|
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
|
|
function decodeComponents(components, split) {
|
|
try {
|
|
// Try to decode the entire string first
|
|
return [decodeURIComponent(components.join(''))];
|
|
} catch (err) {
|
|
// Do nothing
|
|
}
|
|
|
|
if (components.length === 1) {
|
|
return components;
|
|
}
|
|
|
|
split = split || 1;
|
|
|
|
// Split the array in 2 parts
|
|
var left = components.slice(0, split);
|
|
var right = components.slice(split);
|
|
|
|
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
}
|
|
|
|
function decode(input) {
|
|
try {
|
|
return decodeURIComponent(input);
|
|
} catch (err) {
|
|
var tokens = input.match(singleMatcher) || [];
|
|
|
|
for (var i = 1; i < tokens.length; i++) {
|
|
input = decodeComponents(tokens, i).join('');
|
|
|
|
tokens = input.match(singleMatcher) || [];
|
|
}
|
|
|
|
return input;
|
|
}
|
|
}
|
|
|
|
function customDecodeURIComponent(input) {
|
|
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
var replaceMap = {
|
|
'%FE%FF': '\uFFFD\uFFFD',
|
|
'%FF%FE': '\uFFFD\uFFFD'
|
|
};
|
|
|
|
var match = multiMatcher.exec(input);
|
|
while (match) {
|
|
try {
|
|
// Decode as big chunks as possible
|
|
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
} catch (err) {
|
|
var result = decode(match[0]);
|
|
|
|
if (result !== match[0]) {
|
|
replaceMap[match[0]] = result;
|
|
}
|
|
}
|
|
|
|
match = multiMatcher.exec(input);
|
|
}
|
|
|
|
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
replaceMap['%C2'] = '\uFFFD';
|
|
|
|
var entries = Object.keys(replaceMap);
|
|
|
|
for (var i = 0; i < entries.length; i++) {
|
|
// Replace all decoded components
|
|
var key = entries[i];
|
|
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
module.exports = function (encodedURI) {
|
|
if (typeof encodedURI !== 'string') {
|
|
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
}
|
|
|
|
try {
|
|
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
|
|
// Try the built in decoder first
|
|
return decodeURIComponent(encodedURI);
|
|
} catch (err) {
|
|
// Fallback to a more advanced decoder
|
|
return customDecodeURIComponent(encodedURI);
|
|
}
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2603:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
const validator = __nccwpck_require__(1739);
|
|
const XMLParser = __nccwpck_require__(2380);
|
|
const XMLBuilder = __nccwpck_require__(660);
|
|
|
|
module.exports = {
|
|
XMLParser: XMLParser,
|
|
XMLValidator: validator,
|
|
XMLBuilder: XMLBuilder
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8280:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
|
|
const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
|
const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*'
|
|
const regexName = new RegExp('^' + nameRegexp + '$');
|
|
|
|
const getAllMatches = function(string, regex) {
|
|
const matches = [];
|
|
let match = regex.exec(string);
|
|
while (match) {
|
|
const allmatches = [];
|
|
allmatches.startIndex = regex.lastIndex - match[0].length;
|
|
const len = match.length;
|
|
for (let index = 0; index < len; index++) {
|
|
allmatches.push(match[index]);
|
|
}
|
|
matches.push(allmatches);
|
|
match = regex.exec(string);
|
|
}
|
|
return matches;
|
|
};
|
|
|
|
const isName = function(string) {
|
|
const match = regexName.exec(string);
|
|
return !(match === null || typeof match === 'undefined');
|
|
};
|
|
|
|
exports.isExist = function(v) {
|
|
return typeof v !== 'undefined';
|
|
};
|
|
|
|
exports.isEmptyObject = function(obj) {
|
|
return Object.keys(obj).length === 0;
|
|
};
|
|
|
|
/**
|
|
* Copy all the properties of a into b.
|
|
* @param {*} target
|
|
* @param {*} a
|
|
*/
|
|
exports.merge = function(target, a, arrayMode) {
|
|
if (a) {
|
|
const keys = Object.keys(a); // will return an array of own properties
|
|
const len = keys.length; //don't make it inline
|
|
for (let i = 0; i < len; i++) {
|
|
if (arrayMode === 'strict') {
|
|
target[keys[i]] = [ a[keys[i]] ];
|
|
} else {
|
|
target[keys[i]] = a[keys[i]];
|
|
}
|
|
}
|
|
}
|
|
};
|
|
/* exports.merge =function (b,a){
|
|
return Object.assign(b,a);
|
|
} */
|
|
|
|
exports.getValue = function(v) {
|
|
if (exports.isExist(v)) {
|
|
return v;
|
|
} else {
|
|
return '';
|
|
}
|
|
};
|
|
|
|
// const fakeCall = function(a) {return a;};
|
|
// const fakeCallNoReturn = function() {};
|
|
|
|
exports.isName = isName;
|
|
exports.getAllMatches = getAllMatches;
|
|
exports.nameRegexp = nameRegexp;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1739:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
const util = __nccwpck_require__(8280);
|
|
|
|
const defaultOptions = {
|
|
allowBooleanAttributes: false, //A tag can have attributes without any value
|
|
unpairedTags: []
|
|
};
|
|
|
|
//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
|
|
exports.validate = function (xmlData, options) {
|
|
options = Object.assign({}, defaultOptions, options);
|
|
|
|
//xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
|
|
//xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
|
|
//xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
|
|
const tags = [];
|
|
let tagFound = false;
|
|
|
|
//indicates that the root tag has been closed (aka. depth 0 has been reached)
|
|
let reachedRoot = false;
|
|
|
|
if (xmlData[0] === '\ufeff') {
|
|
// check for byte order mark (BOM)
|
|
xmlData = xmlData.substr(1);
|
|
}
|
|
|
|
for (let i = 0; i < xmlData.length; i++) {
|
|
|
|
if (xmlData[i] === '<' && xmlData[i+1] === '?') {
|
|
i+=2;
|
|
i = readPI(xmlData,i);
|
|
if (i.err) return i;
|
|
}else if (xmlData[i] === '<') {
|
|
//starting of tag
|
|
//read until you reach to '>' avoiding any '>' in attribute value
|
|
let tagStartPos = i;
|
|
i++;
|
|
|
|
if (xmlData[i] === '!') {
|
|
i = readCommentAndCDATA(xmlData, i);
|
|
continue;
|
|
} else {
|
|
let closingTag = false;
|
|
if (xmlData[i] === '/') {
|
|
//closing tag
|
|
closingTag = true;
|
|
i++;
|
|
}
|
|
//read tagname
|
|
let tagName = '';
|
|
for (; i < xmlData.length &&
|
|
xmlData[i] !== '>' &&
|
|
xmlData[i] !== ' ' &&
|
|
xmlData[i] !== '\t' &&
|
|
xmlData[i] !== '\n' &&
|
|
xmlData[i] !== '\r'; i++
|
|
) {
|
|
tagName += xmlData[i];
|
|
}
|
|
tagName = tagName.trim();
|
|
//console.log(tagName);
|
|
|
|
if (tagName[tagName.length - 1] === '/') {
|
|
//self closing tag without attributes
|
|
tagName = tagName.substring(0, tagName.length - 1);
|
|
//continue;
|
|
i--;
|
|
}
|
|
if (!validateTagName(tagName)) {
|
|
let msg;
|
|
if (tagName.trim().length === 0) {
|
|
msg = "Invalid space after '<'.";
|
|
} else {
|
|
msg = "Tag '"+tagName+"' is an invalid name.";
|
|
}
|
|
return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
|
|
}
|
|
|
|
const result = readAttributeStr(xmlData, i);
|
|
if (result === false) {
|
|
return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i));
|
|
}
|
|
let attrStr = result.value;
|
|
i = result.index;
|
|
|
|
if (attrStr[attrStr.length - 1] === '/') {
|
|
//self closing tag
|
|
const attrStrStart = i - attrStr.length;
|
|
attrStr = attrStr.substring(0, attrStr.length - 1);
|
|
const isValid = validateAttributeString(attrStr, options);
|
|
if (isValid === true) {
|
|
tagFound = true;
|
|
//continue; //text may presents after self closing tag
|
|
} else {
|
|
//the result from the nested function returns the position of the error within the attribute
|
|
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
|
|
}
|
|
} else if (closingTag) {
|
|
if (!result.tagClosed) {
|
|
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
|
|
} else if (attrStr.trim().length > 0) {
|
|
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
} else {
|
|
const otg = tags.pop();
|
|
if (tagName !== otg.tagName) {
|
|
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
|
|
return getErrorObject('InvalidTag',
|
|
"Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
|
|
getLineNumberForPosition(xmlData, tagStartPos));
|
|
}
|
|
|
|
//when there are no more tags, we reached the root level.
|
|
if (tags.length == 0) {
|
|
reachedRoot = true;
|
|
}
|
|
}
|
|
} else {
|
|
const isValid = validateAttributeString(attrStr, options);
|
|
if (isValid !== true) {
|
|
//the result from the nested function returns the position of the error within the attribute
|
|
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
|
}
|
|
|
|
//if the root level has been reached before ...
|
|
if (reachedRoot === true) {
|
|
return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
|
|
} else if(options.unpairedTags.indexOf(tagName) !== -1){
|
|
//don't push into stack
|
|
} else {
|
|
tags.push({tagName, tagStartPos});
|
|
}
|
|
tagFound = true;
|
|
}
|
|
|
|
//skip tag text value
|
|
//It may include comments and CDATA value
|
|
for (i++; i < xmlData.length; i++) {
|
|
if (xmlData[i] === '<') {
|
|
if (xmlData[i + 1] === '!') {
|
|
//comment or CADATA
|
|
i++;
|
|
i = readCommentAndCDATA(xmlData, i);
|
|
continue;
|
|
} else if (xmlData[i+1] === '?') {
|
|
i = readPI(xmlData, ++i);
|
|
if (i.err) return i;
|
|
} else{
|
|
break;
|
|
}
|
|
} else if (xmlData[i] === '&') {
|
|
const afterAmp = validateAmpersand(xmlData, i);
|
|
if (afterAmp == -1)
|
|
return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
i = afterAmp;
|
|
}else{
|
|
if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
|
|
return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i));
|
|
}
|
|
}
|
|
} //end of reading tag text value
|
|
if (xmlData[i] === '<') {
|
|
i--;
|
|
}
|
|
}
|
|
} else {
|
|
if ( isWhiteSpace(xmlData[i])) {
|
|
continue;
|
|
}
|
|
return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
}
|
|
}
|
|
|
|
if (!tagFound) {
|
|
return getErrorObject('InvalidXml', 'Start tag expected.', 1);
|
|
}else if (tags.length == 1) {
|
|
return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
}else if (tags.length > 0) {
|
|
return getErrorObject('InvalidXml', "Invalid '"+
|
|
JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+
|
|
"' found.", {line: 1, col: 1});
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
function isWhiteSpace(char){
|
|
return char === ' ' || char === '\t' || char === '\n' || char === '\r';
|
|
}
|
|
/**
|
|
* Read Processing insstructions and skip
|
|
* @param {*} xmlData
|
|
* @param {*} i
|
|
*/
|
|
function readPI(xmlData, i) {
|
|
const start = i;
|
|
for (; i < xmlData.length; i++) {
|
|
if (xmlData[i] == '?' || xmlData[i] == ' ') {
|
|
//tagname
|
|
const tagname = xmlData.substr(start, i - start);
|
|
if (i > 5 && tagname === 'xml') {
|
|
return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
|
|
} else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
|
|
//check if valid attribut string
|
|
i++;
|
|
break;
|
|
} else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
return i;
|
|
}
|
|
|
|
function readCommentAndCDATA(xmlData, i) {
|
|
if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
|
|
//comment
|
|
for (i += 3; i < xmlData.length; i++) {
|
|
if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
|
|
i += 2;
|
|
break;
|
|
}
|
|
}
|
|
} else if (
|
|
xmlData.length > i + 8 &&
|
|
xmlData[i + 1] === 'D' &&
|
|
xmlData[i + 2] === 'O' &&
|
|
xmlData[i + 3] === 'C' &&
|
|
xmlData[i + 4] === 'T' &&
|
|
xmlData[i + 5] === 'Y' &&
|
|
xmlData[i + 6] === 'P' &&
|
|
xmlData[i + 7] === 'E'
|
|
) {
|
|
let angleBracketsCount = 1;
|
|
for (i += 8; i < xmlData.length; i++) {
|
|
if (xmlData[i] === '<') {
|
|
angleBracketsCount++;
|
|
} else if (xmlData[i] === '>') {
|
|
angleBracketsCount--;
|
|
if (angleBracketsCount === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if (
|
|
xmlData.length > i + 9 &&
|
|
xmlData[i + 1] === '[' &&
|
|
xmlData[i + 2] === 'C' &&
|
|
xmlData[i + 3] === 'D' &&
|
|
xmlData[i + 4] === 'A' &&
|
|
xmlData[i + 5] === 'T' &&
|
|
xmlData[i + 6] === 'A' &&
|
|
xmlData[i + 7] === '['
|
|
) {
|
|
for (i += 8; i < xmlData.length; i++) {
|
|
if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
|
|
i += 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return i;
|
|
}
|
|
|
|
const doubleQuote = '"';
|
|
const singleQuote = "'";
|
|
|
|
/**
|
|
* Keep reading xmlData until '<' is found outside the attribute value.
|
|
* @param {string} xmlData
|
|
* @param {number} i
|
|
*/
|
|
function readAttributeStr(xmlData, i) {
|
|
let attrStr = '';
|
|
let startChar = '';
|
|
let tagClosed = false;
|
|
for (; i < xmlData.length; i++) {
|
|
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
if (startChar === '') {
|
|
startChar = xmlData[i];
|
|
} else if (startChar !== xmlData[i]) {
|
|
//if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa
|
|
} else {
|
|
startChar = '';
|
|
}
|
|
} else if (xmlData[i] === '>') {
|
|
if (startChar === '') {
|
|
tagClosed = true;
|
|
break;
|
|
}
|
|
}
|
|
attrStr += xmlData[i];
|
|
}
|
|
if (startChar !== '') {
|
|
return false;
|
|
}
|
|
|
|
return {
|
|
value: attrStr,
|
|
index: i,
|
|
tagClosed: tagClosed
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Select all the attributes whether valid or invalid.
|
|
*/
|
|
const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
|
|
|
|
//attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
|
|
|
|
function validateAttributeString(attrStr, options) {
|
|
//console.log("start:"+attrStr+":end");
|
|
|
|
//if(attrStr.trim().length === 0) return true; //empty string
|
|
|
|
const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
|
|
const attrNames = {};
|
|
|
|
for (let i = 0; i < matches.length; i++) {
|
|
if (matches[i][1].length === 0) {
|
|
//nospace before attribute name: a="sd"b="saf"
|
|
return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i]))
|
|
} else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
|
|
return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' is without value.", getPositionFromMatch(matches[i]));
|
|
} else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
|
|
//independent attribute: ab
|
|
return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i]));
|
|
}
|
|
/* else if(matches[i][6] === undefined){//attribute without value: ab=
|
|
return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
|
|
} */
|
|
const attrName = matches[i][2];
|
|
if (!validateAttrName(attrName)) {
|
|
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i]));
|
|
}
|
|
if (!attrNames.hasOwnProperty(attrName)) {
|
|
//check for duplicate attribute.
|
|
attrNames[attrName] = 1;
|
|
} else {
|
|
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i]));
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function validateNumberAmpersand(xmlData, i) {
|
|
let re = /\d/;
|
|
if (xmlData[i] === 'x') {
|
|
i++;
|
|
re = /[\da-fA-F]/;
|
|
}
|
|
for (; i < xmlData.length; i++) {
|
|
if (xmlData[i] === ';')
|
|
return i;
|
|
if (!xmlData[i].match(re))
|
|
break;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function validateAmpersand(xmlData, i) {
|
|
// https://www.w3.org/TR/xml/#dt-charref
|
|
i++;
|
|
if (xmlData[i] === ';')
|
|
return -1;
|
|
if (xmlData[i] === '#') {
|
|
i++;
|
|
return validateNumberAmpersand(xmlData, i);
|
|
}
|
|
let count = 0;
|
|
for (; i < xmlData.length; i++, count++) {
|
|
if (xmlData[i].match(/\w/) && count < 20)
|
|
continue;
|
|
if (xmlData[i] === ';')
|
|
break;
|
|
return -1;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
function getErrorObject(code, message, lineNumber) {
|
|
return {
|
|
err: {
|
|
code: code,
|
|
msg: message,
|
|
line: lineNumber.line || lineNumber,
|
|
col: lineNumber.col,
|
|
},
|
|
};
|
|
}
|
|
|
|
function validateAttrName(attrName) {
|
|
return util.isName(attrName);
|
|
}
|
|
|
|
// const startsWithXML = /^xml/i;
|
|
|
|
function validateTagName(tagname) {
|
|
return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
|
|
}
|
|
|
|
//this function returns the line number for the character at the given index
|
|
function getLineNumberForPosition(xmlData, index) {
|
|
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
return {
|
|
line: lines.length,
|
|
|
|
// column number is last line's length + 1, because column numbering starts at 1:
|
|
col: lines[lines.length - 1].length + 1
|
|
};
|
|
}
|
|
|
|
//this function returns the position of the first character of match within attrStr
|
|
function getPositionFromMatch(match) {
|
|
return match.startIndex + match[1].length;
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 660:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
//parse Empty Node as self closing node
|
|
const buildFromOrderedJs = __nccwpck_require__(2462);
|
|
|
|
const defaultOptions = {
|
|
attributeNamePrefix: '@_',
|
|
attributesGroupName: false,
|
|
textNodeName: '#text',
|
|
ignoreAttributes: true,
|
|
cdataPropName: false,
|
|
format: false,
|
|
indentBy: ' ',
|
|
suppressEmptyNode: false,
|
|
suppressUnpairedNode: true,
|
|
suppressBooleanAttributes: true,
|
|
tagValueProcessor: function(key, a) {
|
|
return a;
|
|
},
|
|
attributeValueProcessor: function(attrName, a) {
|
|
return a;
|
|
},
|
|
preserveOrder: false,
|
|
commentPropName: false,
|
|
unpairedTags: [],
|
|
entities: [
|
|
{ regex: new RegExp("&", "g"), val: "&" },//it must be on top
|
|
{ regex: new RegExp(">", "g"), val: ">" },
|
|
{ regex: new RegExp("<", "g"), val: "<" },
|
|
{ regex: new RegExp("\'", "g"), val: "'" },
|
|
{ regex: new RegExp("\"", "g"), val: """ }
|
|
],
|
|
processEntities: true,
|
|
stopNodes: [],
|
|
// transformTagName: false,
|
|
// transformAttributeName: false,
|
|
oneListGroup: false
|
|
};
|
|
|
|
function Builder(options) {
|
|
this.options = Object.assign({}, defaultOptions, options);
|
|
if (this.options.ignoreAttributes || this.options.attributesGroupName) {
|
|
this.isAttribute = function(/*a*/) {
|
|
return false;
|
|
};
|
|
} else {
|
|
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
this.isAttribute = isAttribute;
|
|
}
|
|
|
|
this.processTextOrObjNode = processTextOrObjNode
|
|
|
|
if (this.options.format) {
|
|
this.indentate = indentate;
|
|
this.tagEndChar = '>\n';
|
|
this.newLine = '\n';
|
|
} else {
|
|
this.indentate = function() {
|
|
return '';
|
|
};
|
|
this.tagEndChar = '>';
|
|
this.newLine = '';
|
|
}
|
|
}
|
|
|
|
Builder.prototype.build = function(jObj) {
|
|
if(this.options.preserveOrder){
|
|
return buildFromOrderedJs(jObj, this.options);
|
|
}else {
|
|
if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){
|
|
jObj = {
|
|
[this.options.arrayNodeName] : jObj
|
|
}
|
|
}
|
|
return this.j2x(jObj, 0).val;
|
|
}
|
|
};
|
|
|
|
Builder.prototype.j2x = function(jObj, level) {
|
|
let attrStr = '';
|
|
let val = '';
|
|
for (let key in jObj) {
|
|
if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
if (typeof jObj[key] === 'undefined') {
|
|
// supress undefined node only if it is not an attribute
|
|
if (this.isAttribute(key)) {
|
|
val += '';
|
|
}
|
|
} else if (jObj[key] === null) {
|
|
// null attribute should be ignored by the attribute list, but should not cause the tag closing
|
|
if (this.isAttribute(key)) {
|
|
val += '';
|
|
} else if (key[0] === '?') {
|
|
val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
|
|
} else {
|
|
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
}
|
|
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
} else if (jObj[key] instanceof Date) {
|
|
val += this.buildTextValNode(jObj[key], key, '', level);
|
|
} else if (typeof jObj[key] !== 'object') {
|
|
//premitive type
|
|
const attr = this.isAttribute(key);
|
|
if (attr) {
|
|
attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
|
|
}else {
|
|
//tag value
|
|
if (key === this.options.textNodeName) {
|
|
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
|
|
val += this.replaceEntitiesValue(newval);
|
|
} else {
|
|
val += this.buildTextValNode(jObj[key], key, '', level);
|
|
}
|
|
}
|
|
} else if (Array.isArray(jObj[key])) {
|
|
//repeated nodes
|
|
const arrLen = jObj[key].length;
|
|
let listTagVal = "";
|
|
for (let j = 0; j < arrLen; j++) {
|
|
const item = jObj[key][j];
|
|
if (typeof item === 'undefined') {
|
|
// supress undefined node
|
|
} else if (item === null) {
|
|
if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
|
|
else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
} else if (typeof item === 'object') {
|
|
if(this.options.oneListGroup ){
|
|
listTagVal += this.j2x(item, level + 1).val;
|
|
}else{
|
|
listTagVal += this.processTextOrObjNode(item, key, level)
|
|
}
|
|
} else {
|
|
listTagVal += this.buildTextValNode(item, key, '', level);
|
|
}
|
|
}
|
|
if(this.options.oneListGroup){
|
|
listTagVal = this.buildObjectNode(listTagVal, key, '', level);
|
|
}
|
|
val += listTagVal;
|
|
} else {
|
|
//nested node
|
|
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
|
const Ks = Object.keys(jObj[key]);
|
|
const L = Ks.length;
|
|
for (let j = 0; j < L; j++) {
|
|
attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
|
|
}
|
|
} else {
|
|
val += this.processTextOrObjNode(jObj[key], key, level)
|
|
}
|
|
}
|
|
}
|
|
return {attrStr: attrStr, val: val};
|
|
};
|
|
|
|
Builder.prototype.buildAttrPairStr = function(attrName, val){
|
|
val = this.options.attributeValueProcessor(attrName, '' + val);
|
|
val = this.replaceEntitiesValue(val);
|
|
if (this.options.suppressBooleanAttributes && val === "true") {
|
|
return ' ' + attrName;
|
|
} else return ' ' + attrName + '="' + val + '"';
|
|
}
|
|
|
|
function processTextOrObjNode (object, key, level) {
|
|
const result = this.j2x(object, level + 1);
|
|
if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
|
|
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
|
|
} else {
|
|
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
|
}
|
|
}
|
|
|
|
Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
|
if(val === ""){
|
|
if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
|
else {
|
|
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
}
|
|
}else{
|
|
|
|
let tagEndExp = '</' + key + this.tagEndChar;
|
|
let piClosingChar = "";
|
|
|
|
if(key[0] === "?") {
|
|
piClosingChar = "?";
|
|
tagEndExp = "";
|
|
}
|
|
|
|
// attrStr is an empty string in case the attribute came as undefined or null
|
|
if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
|
|
return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
|
|
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
}else {
|
|
return (
|
|
this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +
|
|
val +
|
|
this.indentate(level) + tagEndExp );
|
|
}
|
|
}
|
|
}
|
|
|
|
Builder.prototype.closeTag = function(key){
|
|
let closeTag = "";
|
|
if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
|
|
if(!this.options.suppressUnpairedNode) closeTag = "/"
|
|
}else if(this.options.suppressEmptyNode){ //empty
|
|
closeTag = "/";
|
|
}else{
|
|
closeTag = `></${key}`
|
|
}
|
|
return closeTag;
|
|
}
|
|
|
|
function buildEmptyObjNode(val, key, attrStr, level) {
|
|
if (val !== '') {
|
|
return this.buildObjectNode(val, key, attrStr, level);
|
|
} else {
|
|
if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
|
else {
|
|
return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
|
|
// return this.buildTagStr(level,key, attrStr);
|
|
}
|
|
}
|
|
}
|
|
|
|
Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
|
|
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
|
|
return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
|
|
}else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
|
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
}else if(key[0] === "?") {//PI tag
|
|
return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
|
}else{
|
|
let textValue = this.options.tagValueProcessor(key, val);
|
|
textValue = this.replaceEntitiesValue(textValue);
|
|
|
|
if( textValue === ''){
|
|
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
}else{
|
|
return this.indentate(level) + '<' + key + attrStr + '>' +
|
|
textValue +
|
|
'</' + key + this.tagEndChar;
|
|
}
|
|
}
|
|
}
|
|
|
|
Builder.prototype.replaceEntitiesValue = function(textValue){
|
|
if(textValue && textValue.length > 0 && this.options.processEntities){
|
|
for (let i=0; i<this.options.entities.length; i++) {
|
|
const entity = this.options.entities[i];
|
|
textValue = textValue.replace(entity.regex, entity.val);
|
|
}
|
|
}
|
|
return textValue;
|
|
}
|
|
|
|
function indentate(level) {
|
|
return this.options.indentBy.repeat(level);
|
|
}
|
|
|
|
function isAttribute(name /*, options*/) {
|
|
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
|
|
return name.substr(this.attrPrefixLen);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
module.exports = Builder;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2462:
|
|
/***/ ((module) => {
|
|
|
|
const EOL = "\n";
|
|
|
|
/**
|
|
*
|
|
* @param {array} jArray
|
|
* @param {any} options
|
|
* @returns
|
|
*/
|
|
function toXml(jArray, options) {
|
|
let indentation = "";
|
|
if (options.format && options.indentBy.length > 0) {
|
|
indentation = EOL;
|
|
}
|
|
return arrToStr(jArray, options, "", indentation);
|
|
}
|
|
|
|
function arrToStr(arr, options, jPath, indentation) {
|
|
let xmlStr = "";
|
|
let isPreviousElementTag = false;
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
const tagObj = arr[i];
|
|
const tagName = propName(tagObj);
|
|
if(tagName === undefined) continue;
|
|
|
|
let newJPath = "";
|
|
if (jPath.length === 0) newJPath = tagName
|
|
else newJPath = `${jPath}.${tagName}`;
|
|
|
|
if (tagName === options.textNodeName) {
|
|
let tagText = tagObj[tagName];
|
|
if (!isStopNode(newJPath, options)) {
|
|
tagText = options.tagValueProcessor(tagName, tagText);
|
|
tagText = replaceEntitiesValue(tagText, options);
|
|
}
|
|
if (isPreviousElementTag) {
|
|
xmlStr += indentation;
|
|
}
|
|
xmlStr += tagText;
|
|
isPreviousElementTag = false;
|
|
continue;
|
|
} else if (tagName === options.cdataPropName) {
|
|
if (isPreviousElementTag) {
|
|
xmlStr += indentation;
|
|
}
|
|
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
|
isPreviousElementTag = false;
|
|
continue;
|
|
} else if (tagName === options.commentPropName) {
|
|
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
|
|
isPreviousElementTag = true;
|
|
continue;
|
|
} else if (tagName[0] === "?") {
|
|
const attStr = attr_to_str(tagObj[":@"], options);
|
|
const tempInd = tagName === "?xml" ? "" : indentation;
|
|
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
|
|
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
|
|
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
|
|
isPreviousElementTag = true;
|
|
continue;
|
|
}
|
|
let newIdentation = indentation;
|
|
if (newIdentation !== "") {
|
|
newIdentation += options.indentBy;
|
|
}
|
|
const attStr = attr_to_str(tagObj[":@"], options);
|
|
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
else xmlStr += tagStart + "/>";
|
|
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
xmlStr += tagStart + "/>";
|
|
} else if (tagValue && tagValue.endsWith(">")) {
|
|
xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
|
|
} else {
|
|
xmlStr += tagStart + ">";
|
|
if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
|
|
xmlStr += indentation + options.indentBy + tagValue + indentation;
|
|
} else {
|
|
xmlStr += tagValue;
|
|
}
|
|
xmlStr += `</${tagName}>`;
|
|
}
|
|
isPreviousElementTag = true;
|
|
}
|
|
|
|
return xmlStr;
|
|
}
|
|
|
|
function propName(obj) {
|
|
const keys = Object.keys(obj);
|
|
for (let i = 0; i < keys.length; i++) {
|
|
const key = keys[i];
|
|
if(!obj.hasOwnProperty(key)) continue;
|
|
if (key !== ":@") return key;
|
|
}
|
|
}
|
|
|
|
function attr_to_str(attrMap, options) {
|
|
let attrStr = "";
|
|
if (attrMap && !options.ignoreAttributes) {
|
|
for (let attr in attrMap) {
|
|
if(!attrMap.hasOwnProperty(attr)) continue;
|
|
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
attrVal = replaceEntitiesValue(attrVal, options);
|
|
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
|
} else {
|
|
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
|
}
|
|
}
|
|
}
|
|
return attrStr;
|
|
}
|
|
|
|
function isStopNode(jPath, options) {
|
|
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
for (let index in options.stopNodes) {
|
|
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function replaceEntitiesValue(textValue, options) {
|
|
if (textValue && textValue.length > 0 && options.processEntities) {
|
|
for (let i = 0; i < options.entities.length; i++) {
|
|
const entity = options.entities[i];
|
|
textValue = textValue.replace(entity.regex, entity.val);
|
|
}
|
|
}
|
|
return textValue;
|
|
}
|
|
module.exports = toXml;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6072:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
const util = __nccwpck_require__(8280);
|
|
|
|
//TODO: handle comments
|
|
function readDocType(xmlData, i){
|
|
|
|
const entities = {};
|
|
if( xmlData[i + 3] === 'O' &&
|
|
xmlData[i + 4] === 'C' &&
|
|
xmlData[i + 5] === 'T' &&
|
|
xmlData[i + 6] === 'Y' &&
|
|
xmlData[i + 7] === 'P' &&
|
|
xmlData[i + 8] === 'E')
|
|
{
|
|
i = i+9;
|
|
let angleBracketsCount = 1;
|
|
let hasBody = false, comment = false;
|
|
let exp = "";
|
|
for(;i<xmlData.length;i++){
|
|
if (xmlData[i] === '<' && !comment) { //Determine the tag type
|
|
if( hasBody && isEntity(xmlData, i)){
|
|
i += 7;
|
|
[entityName, val,i] = readEntityExp(xmlData,i+1);
|
|
if(val.indexOf("&") === -1) //Parameter entities are not supported
|
|
entities[ validateEntityName(entityName) ] = {
|
|
regx : RegExp( `&${entityName};`,"g"),
|
|
val: val
|
|
};
|
|
}
|
|
else if( hasBody && isElement(xmlData, i)) i += 8;//Not supported
|
|
else if( hasBody && isAttlist(xmlData, i)) i += 8;//Not supported
|
|
else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported
|
|
else if( isComment) comment = true;
|
|
else throw new Error("Invalid DOCTYPE");
|
|
|
|
angleBracketsCount++;
|
|
exp = "";
|
|
} else if (xmlData[i] === '>') { //Read tag content
|
|
if(comment){
|
|
if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
|
|
comment = false;
|
|
angleBracketsCount--;
|
|
}
|
|
}else{
|
|
angleBracketsCount--;
|
|
}
|
|
if (angleBracketsCount === 0) {
|
|
break;
|
|
}
|
|
}else if( xmlData[i] === '['){
|
|
hasBody = true;
|
|
}else{
|
|
exp += xmlData[i];
|
|
}
|
|
}
|
|
if(angleBracketsCount !== 0){
|
|
throw new Error(`Unclosed DOCTYPE`);
|
|
}
|
|
}else{
|
|
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
}
|
|
return {entities, i};
|
|
}
|
|
|
|
function readEntityExp(xmlData,i){
|
|
//External entities are not supported
|
|
// <!ENTITY ext SYSTEM "http://normal-website.com" >
|
|
|
|
//Parameter entities are not supported
|
|
// <!ENTITY entityname "&anotherElement;">
|
|
|
|
//Internal entities are supported
|
|
// <!ENTITY entityname "replacement text">
|
|
|
|
//read EntityName
|
|
let entityName = "";
|
|
for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) {
|
|
// if(xmlData[i] === " ") continue;
|
|
// else
|
|
entityName += xmlData[i];
|
|
}
|
|
entityName = entityName.trim();
|
|
if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
|
|
//read Entity Value
|
|
const startChar = xmlData[i++];
|
|
let val = ""
|
|
for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {
|
|
val += xmlData[i];
|
|
}
|
|
return [entityName, val, i];
|
|
}
|
|
|
|
function isComment(xmlData, i){
|
|
if(xmlData[i+1] === '!' &&
|
|
xmlData[i+2] === '-' &&
|
|
xmlData[i+3] === '-') return true
|
|
return false
|
|
}
|
|
function isEntity(xmlData, i){
|
|
if(xmlData[i+1] === '!' &&
|
|
xmlData[i+2] === 'E' &&
|
|
xmlData[i+3] === 'N' &&
|
|
xmlData[i+4] === 'T' &&
|
|
xmlData[i+5] === 'I' &&
|
|
xmlData[i+6] === 'T' &&
|
|
xmlData[i+7] === 'Y') return true
|
|
return false
|
|
}
|
|
function isElement(xmlData, i){
|
|
if(xmlData[i+1] === '!' &&
|
|
xmlData[i+2] === 'E' &&
|
|
xmlData[i+3] === 'L' &&
|
|
xmlData[i+4] === 'E' &&
|
|
xmlData[i+5] === 'M' &&
|
|
xmlData[i+6] === 'E' &&
|
|
xmlData[i+7] === 'N' &&
|
|
xmlData[i+8] === 'T') return true
|
|
return false
|
|
}
|
|
|
|
function isAttlist(xmlData, i){
|
|
if(xmlData[i+1] === '!' &&
|
|
xmlData[i+2] === 'A' &&
|
|
xmlData[i+3] === 'T' &&
|
|
xmlData[i+4] === 'T' &&
|
|
xmlData[i+5] === 'L' &&
|
|
xmlData[i+6] === 'I' &&
|
|
xmlData[i+7] === 'S' &&
|
|
xmlData[i+8] === 'T') return true
|
|
return false
|
|
}
|
|
function isNotation(xmlData, i){
|
|
if(xmlData[i+1] === '!' &&
|
|
xmlData[i+2] === 'N' &&
|
|
xmlData[i+3] === 'O' &&
|
|
xmlData[i+4] === 'T' &&
|
|
xmlData[i+5] === 'A' &&
|
|
xmlData[i+6] === 'T' &&
|
|
xmlData[i+7] === 'I' &&
|
|
xmlData[i+8] === 'O' &&
|
|
xmlData[i+9] === 'N') return true
|
|
return false
|
|
}
|
|
|
|
function validateEntityName(name){
|
|
if (util.isName(name))
|
|
return name;
|
|
else
|
|
throw new Error(`Invalid entity name ${name}`);
|
|
}
|
|
|
|
module.exports = readDocType;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2821:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
|
|
const defaultOptions = {
|
|
preserveOrder: false,
|
|
attributeNamePrefix: '@_',
|
|
attributesGroupName: false,
|
|
textNodeName: '#text',
|
|
ignoreAttributes: true,
|
|
removeNSPrefix: false, // remove NS from tag name or attribute name if true
|
|
allowBooleanAttributes: false, //a tag can have attributes without any value
|
|
//ignoreRootElement : false,
|
|
parseTagValue: true,
|
|
parseAttributeValue: false,
|
|
trimValues: true, //Trim string values of tag and attributes
|
|
cdataPropName: false,
|
|
numberParseOptions: {
|
|
hex: true,
|
|
leadingZeros: true,
|
|
eNotation: true
|
|
},
|
|
tagValueProcessor: function(tagName, val) {
|
|
return val;
|
|
},
|
|
attributeValueProcessor: function(attrName, val) {
|
|
return val;
|
|
},
|
|
stopNodes: [], //nested tags will not be parsed even for errors
|
|
alwaysCreateTextNode: false,
|
|
isArray: () => false,
|
|
commentPropName: false,
|
|
unpairedTags: [],
|
|
processEntities: true,
|
|
htmlEntities: false,
|
|
ignoreDeclaration: false,
|
|
ignorePiTags: false,
|
|
transformTagName: false,
|
|
transformAttributeName: false,
|
|
updateTag: function(tagName, jPath, attrs){
|
|
return tagName
|
|
},
|
|
// skipEmptyListItem: false
|
|
};
|
|
|
|
const buildOptions = function(options) {
|
|
return Object.assign({}, defaultOptions, options);
|
|
};
|
|
|
|
exports.buildOptions = buildOptions;
|
|
exports.defaultOptions = defaultOptions;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5832:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
///@ts-check
|
|
|
|
const util = __nccwpck_require__(8280);
|
|
const xmlNode = __nccwpck_require__(7462);
|
|
const readDocType = __nccwpck_require__(6072);
|
|
const toNumber = __nccwpck_require__(4526);
|
|
|
|
// const regx =
|
|
// '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
|
|
// .replace(/NAME/g, util.nameRegexp);
|
|
|
|
//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
|
|
//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
|
|
|
|
class OrderedObjParser{
|
|
constructor(options){
|
|
this.options = options;
|
|
this.currentNode = null;
|
|
this.tagsNodeStack = [];
|
|
this.docTypeEntities = {};
|
|
this.lastEntities = {
|
|
"apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
|
|
"gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
|
|
"lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
|
|
"quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
|
|
};
|
|
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
|
|
this.htmlEntities = {
|
|
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
|
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
"cent" : { regex: /&(cent|#162);/g, val: "¢" },
|
|
"pound" : { regex: /&(pound|#163);/g, val: "£" },
|
|
"yen" : { regex: /&(yen|#165);/g, val: "¥" },
|
|
"euro" : { regex: /&(euro|#8364);/g, val: "€" },
|
|
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
|
|
"reg" : { regex: /&(reg|#174);/g, val: "®" },
|
|
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
|
|
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
|
|
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
|
|
};
|
|
this.addExternalEntities = addExternalEntities;
|
|
this.parseXml = parseXml;
|
|
this.parseTextData = parseTextData;
|
|
this.resolveNameSpace = resolveNameSpace;
|
|
this.buildAttributesMap = buildAttributesMap;
|
|
this.isItStopNode = isItStopNode;
|
|
this.replaceEntitiesValue = replaceEntitiesValue;
|
|
this.readStopNodeData = readStopNodeData;
|
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
this.addChild = addChild;
|
|
}
|
|
|
|
}
|
|
|
|
function addExternalEntities(externalEntities){
|
|
const entKeys = Object.keys(externalEntities);
|
|
for (let i = 0; i < entKeys.length; i++) {
|
|
const ent = entKeys[i];
|
|
this.lastEntities[ent] = {
|
|
regex: new RegExp("&"+ent+";","g"),
|
|
val : externalEntities[ent]
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} val
|
|
* @param {string} tagName
|
|
* @param {string} jPath
|
|
* @param {boolean} dontTrim
|
|
* @param {boolean} hasAttributes
|
|
* @param {boolean} isLeafNode
|
|
* @param {boolean} escapeEntities
|
|
*/
|
|
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
if (val !== undefined) {
|
|
if (this.options.trimValues && !dontTrim) {
|
|
val = val.trim();
|
|
}
|
|
if(val.length > 0){
|
|
if(!escapeEntities) val = this.replaceEntitiesValue(val);
|
|
|
|
const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
|
|
if(newval === null || newval === undefined){
|
|
//don't parse
|
|
return val;
|
|
}else if(typeof newval !== typeof val || newval !== val){
|
|
//overwrite
|
|
return newval;
|
|
}else if(this.options.trimValues){
|
|
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
}else{
|
|
const trimmedVal = val.trim();
|
|
if(trimmedVal === val){
|
|
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
}else{
|
|
return val;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function resolveNameSpace(tagname) {
|
|
if (this.options.removeNSPrefix) {
|
|
const tags = tagname.split(':');
|
|
const prefix = tagname.charAt(0) === '/' ? '/' : '';
|
|
if (tags[0] === 'xmlns') {
|
|
return '';
|
|
}
|
|
if (tags.length === 2) {
|
|
tagname = prefix + tags[1];
|
|
}
|
|
}
|
|
return tagname;
|
|
}
|
|
|
|
//TODO: change regex to capture NS
|
|
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
|
|
|
|
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
|
|
// attrStr = attrStr.replace(/\r?\n/g, ' ');
|
|
//attrStr = attrStr || attrStr.trim();
|
|
|
|
const matches = util.getAllMatches(attrStr, attrsRegx);
|
|
const len = matches.length; //don't make it inline
|
|
const attrs = {};
|
|
for (let i = 0; i < len; i++) {
|
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
let oldVal = matches[i][4];
|
|
let aName = this.options.attributeNamePrefix + attrName;
|
|
if (attrName.length) {
|
|
if (this.options.transformAttributeName) {
|
|
aName = this.options.transformAttributeName(aName);
|
|
}
|
|
if(aName === "__proto__") aName = "#__proto__";
|
|
if (oldVal !== undefined) {
|
|
if (this.options.trimValues) {
|
|
oldVal = oldVal.trim();
|
|
}
|
|
oldVal = this.replaceEntitiesValue(oldVal);
|
|
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
|
|
if(newVal === null || newVal === undefined){
|
|
//don't parse
|
|
attrs[aName] = oldVal;
|
|
}else if(typeof newVal !== typeof oldVal || newVal !== oldVal){
|
|
//overwrite
|
|
attrs[aName] = newVal;
|
|
}else{
|
|
//parse
|
|
attrs[aName] = parseValue(
|
|
oldVal,
|
|
this.options.parseAttributeValue,
|
|
this.options.numberParseOptions
|
|
);
|
|
}
|
|
} else if (this.options.allowBooleanAttributes) {
|
|
attrs[aName] = true;
|
|
}
|
|
}
|
|
}
|
|
if (!Object.keys(attrs).length) {
|
|
return;
|
|
}
|
|
if (this.options.attributesGroupName) {
|
|
const attrCollection = {};
|
|
attrCollection[this.options.attributesGroupName] = attrs;
|
|
return attrCollection;
|
|
}
|
|
return attrs
|
|
}
|
|
}
|
|
|
|
const parseXml = function(xmlData) {
|
|
xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
|
|
const xmlObj = new xmlNode('!xml');
|
|
let currentNode = xmlObj;
|
|
let textData = "";
|
|
let jPath = "";
|
|
for(let i=0; i< xmlData.length; i++){//for each char in XML data
|
|
const ch = xmlData[i];
|
|
if(ch === '<'){
|
|
// const nextIndex = i+1;
|
|
// const _2ndChar = xmlData[nextIndex];
|
|
if( xmlData[i+1] === '/') {//Closing Tag
|
|
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.")
|
|
let tagName = xmlData.substring(i+2,closeIndex).trim();
|
|
|
|
if(this.options.removeNSPrefix){
|
|
const colonIndex = tagName.indexOf(":");
|
|
if(colonIndex !== -1){
|
|
tagName = tagName.substr(colonIndex+1);
|
|
}
|
|
}
|
|
|
|
if(this.options.transformTagName) {
|
|
tagName = this.options.transformTagName(tagName);
|
|
}
|
|
|
|
if(currentNode){
|
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
}
|
|
|
|
//check if last tag of nested tag was unpaired tag
|
|
const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
|
|
if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
|
|
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
}
|
|
let propIndex = 0
|
|
if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
|
|
propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
|
|
this.tagsNodeStack.pop();
|
|
}else{
|
|
propIndex = jPath.lastIndexOf(".");
|
|
}
|
|
jPath = jPath.substring(0, propIndex);
|
|
|
|
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
|
|
textData = "";
|
|
i = closeIndex;
|
|
} else if( xmlData[i+1] === '?') {
|
|
|
|
let tagData = readTagExp(xmlData,i, false, "?>");
|
|
if(!tagData) throw new Error("Pi Tag is not closed.");
|
|
|
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){
|
|
|
|
}else{
|
|
|
|
const childNode = new xmlNode(tagData.tagName);
|
|
childNode.add(this.options.textNodeName, "");
|
|
|
|
if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
|
|
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
}
|
|
this.addChild(currentNode, childNode, jPath)
|
|
|
|
}
|
|
|
|
|
|
i = tagData.closeIndex + 1;
|
|
} else if(xmlData.substr(i + 1, 3) === '!--') {
|
|
const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.")
|
|
if(this.options.commentPropName){
|
|
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
|
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
|
|
currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);
|
|
}
|
|
i = endIndex;
|
|
} else if( xmlData.substr(i + 1, 2) === '!D') {
|
|
const result = readDocType(xmlData, i);
|
|
this.docTypeEntities = result.entities;
|
|
i = result.i;
|
|
}else if(xmlData.substr(i + 1, 2) === '![') {
|
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
const tagExp = xmlData.substring(i + 9,closeIndex);
|
|
|
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
|
|
let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
if(val == undefined) val = "";
|
|
|
|
//cdata should be set even if it is 0 length string
|
|
if(this.options.cdataPropName){
|
|
currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
|
|
}else{
|
|
currentNode.add(this.options.textNodeName, val);
|
|
}
|
|
|
|
i = closeIndex + 2;
|
|
}else {//Opening tag
|
|
let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
|
|
let tagName= result.tagName;
|
|
const rawTagName = result.rawTagName;
|
|
let tagExp = result.tagExp;
|
|
let attrExpPresent = result.attrExpPresent;
|
|
let closeIndex = result.closeIndex;
|
|
|
|
if (this.options.transformTagName) {
|
|
tagName = this.options.transformTagName(tagName);
|
|
}
|
|
|
|
//save text as child node
|
|
if (currentNode && textData) {
|
|
if(currentNode.tagname !== '!xml'){
|
|
//when nested tag is found
|
|
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
|
|
}
|
|
}
|
|
|
|
//check if last tag was unpaired tag
|
|
const lastTag = currentNode;
|
|
if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
|
|
currentNode = this.tagsNodeStack.pop();
|
|
jPath = jPath.substring(0, jPath.lastIndexOf("."));
|
|
}
|
|
if(tagName !== xmlObj.tagname){
|
|
jPath += jPath ? "." + tagName : tagName;
|
|
}
|
|
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
|
|
let tagContent = "";
|
|
//self-closing tag
|
|
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
i = result.closeIndex;
|
|
}
|
|
//unpaired tag
|
|
else if(this.options.unpairedTags.indexOf(tagName) !== -1){
|
|
i = result.closeIndex;
|
|
}
|
|
//normal tag
|
|
else{
|
|
//read until closing tag is found
|
|
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
i = result.i;
|
|
tagContent = result.tagContent;
|
|
}
|
|
|
|
const childNode = new xmlNode(tagName);
|
|
if(tagName !== tagExp && attrExpPresent){
|
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
}
|
|
if(tagContent) {
|
|
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
}
|
|
|
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
childNode.add(this.options.textNodeName, tagContent);
|
|
|
|
this.addChild(currentNode, childNode, jPath)
|
|
}else{
|
|
//selfClosing tag
|
|
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
|
|
tagName = tagName.substr(0, tagName.length - 1);
|
|
jPath = jPath.substr(0, jPath.length - 1);
|
|
tagExp = tagName;
|
|
}else{
|
|
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
}
|
|
|
|
if(this.options.transformTagName) {
|
|
tagName = this.options.transformTagName(tagName);
|
|
}
|
|
|
|
const childNode = new xmlNode(tagName);
|
|
if(tagName !== tagExp && attrExpPresent){
|
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
}
|
|
this.addChild(currentNode, childNode, jPath)
|
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
}
|
|
//opening tag
|
|
else{
|
|
const childNode = new xmlNode( tagName);
|
|
this.tagsNodeStack.push(currentNode);
|
|
|
|
if(tagName !== tagExp && attrExpPresent){
|
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
}
|
|
this.addChild(currentNode, childNode, jPath)
|
|
currentNode = childNode;
|
|
}
|
|
textData = "";
|
|
i = closeIndex;
|
|
}
|
|
}
|
|
}else{
|
|
textData += xmlData[i];
|
|
}
|
|
}
|
|
return xmlObj.child;
|
|
}
|
|
|
|
function addChild(currentNode, childNode, jPath){
|
|
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
|
|
if(result === false){
|
|
}else if(typeof result === "string"){
|
|
childNode.tagname = result
|
|
currentNode.addChild(childNode);
|
|
}else{
|
|
currentNode.addChild(childNode);
|
|
}
|
|
}
|
|
|
|
const replaceEntitiesValue = function(val){
|
|
|
|
if(this.options.processEntities){
|
|
for(let entityName in this.docTypeEntities){
|
|
const entity = this.docTypeEntities[entityName];
|
|
val = val.replace( entity.regx, entity.val);
|
|
}
|
|
for(let entityName in this.lastEntities){
|
|
const entity = this.lastEntities[entityName];
|
|
val = val.replace( entity.regex, entity.val);
|
|
}
|
|
if(this.options.htmlEntities){
|
|
for(let entityName in this.htmlEntities){
|
|
const entity = this.htmlEntities[entityName];
|
|
val = val.replace( entity.regex, entity.val);
|
|
}
|
|
}
|
|
val = val.replace( this.ampEntity.regex, this.ampEntity.val);
|
|
}
|
|
return val;
|
|
}
|
|
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
if (textData) { //store previously collected data as textNode
|
|
if(isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0
|
|
|
|
textData = this.parseTextData(textData,
|
|
currentNode.tagname,
|
|
jPath,
|
|
false,
|
|
currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
|
|
isLeafNode);
|
|
|
|
if (textData !== undefined && textData !== "")
|
|
currentNode.add(this.options.textNodeName, textData);
|
|
textData = "";
|
|
}
|
|
return textData;
|
|
}
|
|
|
|
//TODO: use jPath to simplify the logic
|
|
/**
|
|
*
|
|
* @param {string[]} stopNodes
|
|
* @param {string} jPath
|
|
* @param {string} currentTagName
|
|
*/
|
|
function isItStopNode(stopNodes, jPath, currentTagName){
|
|
const allNodesExp = "*." + currentTagName;
|
|
for (const stopNodePath in stopNodes) {
|
|
const stopNodeExp = stopNodes[stopNodePath];
|
|
if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Returns the tag Expression and where it is ending handling single-double quotes situation
|
|
* @param {string} xmlData
|
|
* @param {number} i starting index
|
|
* @returns
|
|
*/
|
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){
|
|
let attrBoundary;
|
|
let tagExp = "";
|
|
for (let index = i; index < xmlData.length; index++) {
|
|
let ch = xmlData[index];
|
|
if (attrBoundary) {
|
|
if (ch === attrBoundary) attrBoundary = "";//reset
|
|
} else if (ch === '"' || ch === "'") {
|
|
attrBoundary = ch;
|
|
} else if (ch === closingChar[0]) {
|
|
if(closingChar[1]){
|
|
if(xmlData[index + 1] === closingChar[1]){
|
|
return {
|
|
data: tagExp,
|
|
index: index
|
|
}
|
|
}
|
|
}else{
|
|
return {
|
|
data: tagExp,
|
|
index: index
|
|
}
|
|
}
|
|
} else if (ch === '\t') {
|
|
ch = " "
|
|
}
|
|
tagExp += ch;
|
|
}
|
|
}
|
|
|
|
function findClosingIndex(xmlData, str, i, errMsg){
|
|
const closingIndex = xmlData.indexOf(str, i);
|
|
if(closingIndex === -1){
|
|
throw new Error(errMsg)
|
|
}else{
|
|
return closingIndex + str.length - 1;
|
|
}
|
|
}
|
|
|
|
function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
|
|
const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);
|
|
if(!result) return;
|
|
let tagExp = result.data;
|
|
const closeIndex = result.index;
|
|
const separatorIndex = tagExp.search(/\s/);
|
|
let tagName = tagExp;
|
|
let attrExpPresent = true;
|
|
if(separatorIndex !== -1){//separate tag name and attributes expression
|
|
tagName = tagExp.substring(0, separatorIndex);
|
|
tagExp = tagExp.substring(separatorIndex + 1).trimStart();
|
|
}
|
|
|
|
const rawTagName = tagName;
|
|
if(removeNSPrefix){
|
|
const colonIndex = tagName.indexOf(":");
|
|
if(colonIndex !== -1){
|
|
tagName = tagName.substr(colonIndex+1);
|
|
attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
|
|
}
|
|
}
|
|
|
|
return {
|
|
tagName: tagName,
|
|
tagExp: tagExp,
|
|
closeIndex: closeIndex,
|
|
attrExpPresent: attrExpPresent,
|
|
rawTagName: rawTagName,
|
|
}
|
|
}
|
|
/**
|
|
* find paired tag for a stop node
|
|
* @param {string} xmlData
|
|
* @param {string} tagName
|
|
* @param {number} i
|
|
*/
|
|
function readStopNodeData(xmlData, tagName, i){
|
|
const startIndex = i;
|
|
// Starting at 1 since we already have an open tag
|
|
let openTagCount = 1;
|
|
|
|
for (; i < xmlData.length; i++) {
|
|
if( xmlData[i] === "<"){
|
|
if (xmlData[i+1] === "/") {//close tag
|
|
const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
|
|
let closeTagName = xmlData.substring(i+2,closeIndex).trim();
|
|
if(closeTagName === tagName){
|
|
openTagCount--;
|
|
if (openTagCount === 0) {
|
|
return {
|
|
tagContent: xmlData.substring(startIndex, i),
|
|
i : closeIndex
|
|
}
|
|
}
|
|
}
|
|
i=closeIndex;
|
|
} else if(xmlData[i+1] === '?') {
|
|
const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.")
|
|
i=closeIndex;
|
|
} else if(xmlData.substr(i + 1, 3) === '!--') {
|
|
const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.")
|
|
i=closeIndex;
|
|
} else if(xmlData.substr(i + 1, 2) === '![') {
|
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
i=closeIndex;
|
|
} else {
|
|
const tagData = readTagExp(xmlData, i, '>')
|
|
|
|
if (tagData) {
|
|
const openTagName = tagData && tagData.tagName;
|
|
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
|
|
openTagCount++;
|
|
}
|
|
i=tagData.closeIndex;
|
|
}
|
|
}
|
|
}
|
|
}//end for loop
|
|
}
|
|
|
|
function parseValue(val, shouldParse, options) {
|
|
if (shouldParse && typeof val === 'string') {
|
|
//console.log(options)
|
|
const newval = val.trim();
|
|
if(newval === 'true' ) return true;
|
|
else if(newval === 'false' ) return false;
|
|
else return toNumber(val, options);
|
|
} else {
|
|
if (util.isExist(val)) {
|
|
return val;
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = OrderedObjParser;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2380:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
const { buildOptions} = __nccwpck_require__(2821);
|
|
const OrderedObjParser = __nccwpck_require__(5832);
|
|
const { prettify} = __nccwpck_require__(2882);
|
|
const validator = __nccwpck_require__(1739);
|
|
|
|
class XMLParser{
|
|
|
|
constructor(options){
|
|
this.externalEntities = {};
|
|
this.options = buildOptions(options);
|
|
|
|
}
|
|
/**
|
|
* Parse XML dats to JS object
|
|
* @param {string|Buffer} xmlData
|
|
* @param {boolean|Object} validationOption
|
|
*/
|
|
parse(xmlData,validationOption){
|
|
if(typeof xmlData === "string"){
|
|
}else if( xmlData.toString){
|
|
xmlData = xmlData.toString();
|
|
}else{
|
|
throw new Error("XML data is accepted in String or Bytes[] form.")
|
|
}
|
|
if( validationOption){
|
|
if(validationOption === true) validationOption = {}; //validate with default options
|
|
|
|
const result = validator.validate(xmlData, validationOption);
|
|
if (result !== true) {
|
|
throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
|
|
}
|
|
}
|
|
const orderedObjParser = new OrderedObjParser(this.options);
|
|
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
if(this.options.preserveOrder || orderedResult === undefined) return orderedResult;
|
|
else return prettify(orderedResult, this.options);
|
|
}
|
|
|
|
/**
|
|
* Add Entity which is not by default supported by this library
|
|
* @param {string} key
|
|
* @param {string} value
|
|
*/
|
|
addEntity(key, value){
|
|
if(value.indexOf("&") !== -1){
|
|
throw new Error("Entity value can't have '&'")
|
|
}else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
|
|
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
|
|
}else if(value === "&"){
|
|
throw new Error("An entity with value '&' is not permitted");
|
|
}else{
|
|
this.externalEntities[key] = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = XMLParser;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2882:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
*
|
|
* @param {array} node
|
|
* @param {any} options
|
|
* @returns
|
|
*/
|
|
function prettify(node, options){
|
|
return compress( node, options);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {array} arr
|
|
* @param {object} options
|
|
* @param {string} jPath
|
|
* @returns object
|
|
*/
|
|
function compress(arr, options, jPath){
|
|
let text;
|
|
const compressedObj = {};
|
|
for (let i = 0; i < arr.length; i++) {
|
|
const tagObj = arr[i];
|
|
const property = propName(tagObj);
|
|
let newJpath = "";
|
|
if(jPath === undefined) newJpath = property;
|
|
else newJpath = jPath + "." + property;
|
|
|
|
if(property === options.textNodeName){
|
|
if(text === undefined) text = tagObj[property];
|
|
else text += "" + tagObj[property];
|
|
}else if(property === undefined){
|
|
continue;
|
|
}else if(tagObj[property]){
|
|
|
|
let val = compress(tagObj[property], options, newJpath);
|
|
const isLeaf = isLeafTag(val, options);
|
|
|
|
if(tagObj[":@"]){
|
|
assignAttributes( val, tagObj[":@"], newJpath, options);
|
|
}else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){
|
|
val = val[options.textNodeName];
|
|
}else if(Object.keys(val).length === 0){
|
|
if(options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
else val = "";
|
|
}
|
|
|
|
if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
|
|
if(!Array.isArray(compressedObj[property])) {
|
|
compressedObj[property] = [ compressedObj[property] ];
|
|
}
|
|
compressedObj[property].push(val);
|
|
}else{
|
|
//TODO: if a node is not an array, then check if it should be an array
|
|
//also determine if it is a leaf node
|
|
if (options.isArray(property, newJpath, isLeaf )) {
|
|
compressedObj[property] = [val];
|
|
}else{
|
|
compressedObj[property] = val;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
// if(text && text.length > 0) compressedObj[options.textNodeName] = text;
|
|
if(typeof text === "string"){
|
|
if(text.length > 0) compressedObj[options.textNodeName] = text;
|
|
}else if(text !== undefined) compressedObj[options.textNodeName] = text;
|
|
return compressedObj;
|
|
}
|
|
|
|
function propName(obj){
|
|
const keys = Object.keys(obj);
|
|
for (let i = 0; i < keys.length; i++) {
|
|
const key = keys[i];
|
|
if(key !== ":@") return key;
|
|
}
|
|
}
|
|
|
|
function assignAttributes(obj, attrMap, jpath, options){
|
|
if (attrMap) {
|
|
const keys = Object.keys(attrMap);
|
|
const len = keys.length; //don't make it inline
|
|
for (let i = 0; i < len; i++) {
|
|
const atrrName = keys[i];
|
|
if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
|
|
obj[atrrName] = [ attrMap[atrrName] ];
|
|
} else {
|
|
obj[atrrName] = attrMap[atrrName];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function isLeafTag(obj, options){
|
|
const { textNodeName } = options;
|
|
const propCount = Object.keys(obj).length;
|
|
|
|
if (propCount === 0) {
|
|
return true;
|
|
}
|
|
|
|
if (
|
|
propCount === 1 &&
|
|
(obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)
|
|
) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
exports.prettify = prettify;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7462:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
class XmlNode{
|
|
constructor(tagname) {
|
|
this.tagname = tagname;
|
|
this.child = []; //nested tags, text, cdata, comments in order
|
|
this[":@"] = {}; //attributes map
|
|
}
|
|
add(key,val){
|
|
// this.child.push( {name : key, val: val, isCdata: isCdata });
|
|
if(key === "__proto__") key = "#__proto__";
|
|
this.child.push( {[key]: val });
|
|
}
|
|
addChild(node) {
|
|
if(node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
if(node[":@"] && Object.keys(node[":@"]).length > 0){
|
|
this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
}else{
|
|
this.child.push( { [node.tagname]: node.child });
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
module.exports = XmlNode;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4940:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
module.exports = function (obj, predicate) {
|
|
var ret = {};
|
|
var keys = Object.keys(obj);
|
|
var isArr = Array.isArray(predicate);
|
|
|
|
for (var i = 0; i < keys.length; i++) {
|
|
var key = keys[i];
|
|
var val = obj[key];
|
|
|
|
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {
|
|
ret[key] = val;
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4124:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
try {
|
|
var util = __nccwpck_require__(3837);
|
|
/* istanbul ignore next */
|
|
if (typeof util.inherits !== 'function') throw '';
|
|
module.exports = util.inherits;
|
|
} catch (e) {
|
|
/* istanbul ignore next */
|
|
module.exports = __nccwpck_require__(8544);
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8544:
|
|
/***/ ((module) => {
|
|
|
|
if (typeof Object.create === 'function') {
|
|
// implementation from standard node.js 'util' module
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor
|
|
ctor.prototype = Object.create(superCtor.prototype, {
|
|
constructor: {
|
|
value: ctor,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
})
|
|
}
|
|
};
|
|
} else {
|
|
// old school shim for old browsers
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor
|
|
var TempCtor = function () {}
|
|
TempCtor.prototype = superCtor.prototype
|
|
ctor.prototype = new TempCtor()
|
|
ctor.prototype.constructor = ctor
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7263:
|
|
/***/ (function(module) {
|
|
|
|
(function (root) {
|
|
'use strict';
|
|
// A list of regular expressions that match arbitrary IPv4 addresses,
|
|
// for which a number of weird notations exist.
|
|
// Note that an address like 0010.0xa5.1.1 is considered legal.
|
|
const ipv4Part = '(0?\\d+|0x[a-f0-9]+)';
|
|
const ipv4Regexes = {
|
|
fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'),
|
|
threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'),
|
|
twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, 'i'),
|
|
longValue: new RegExp(`^${ipv4Part}$`, 'i')
|
|
};
|
|
|
|
// Regular Expression for checking Octal numbers
|
|
const octalRegex = new RegExp(`^0[0-7]+$`, 'i');
|
|
const hexRegex = new RegExp(`^0x[a-f0-9]+$`, 'i');
|
|
|
|
const zoneIndex = '%[0-9a-z]{1,}';
|
|
|
|
// IPv6-matching regular expressions.
|
|
// For IPv6, the task is simpler: it is enough to match the colon-delimited
|
|
// hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at
|
|
// the end.
|
|
const ipv6Part = '(?:[0-9a-f]+::?)+';
|
|
const ipv6Regexes = {
|
|
zoneIndex: new RegExp(zoneIndex, 'i'),
|
|
'native': new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, 'i'),
|
|
deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, 'i'),
|
|
transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, 'i')
|
|
};
|
|
|
|
// Expand :: in an IPv6 address or address part consisting of `parts` groups.
|
|
function expandIPv6 (string, parts) {
|
|
// More than one '::' means invalid adddress
|
|
if (string.indexOf('::') !== string.lastIndexOf('::')) {
|
|
return null;
|
|
}
|
|
|
|
let colonCount = 0;
|
|
let lastColon = -1;
|
|
let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];
|
|
let replacement, replacementCount;
|
|
|
|
// Remove zone index and save it for later
|
|
if (zoneId) {
|
|
zoneId = zoneId.substring(1);
|
|
string = string.replace(/%.+$/, '');
|
|
}
|
|
|
|
// How many parts do we already have?
|
|
while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) {
|
|
colonCount++;
|
|
}
|
|
|
|
// 0::0 is two parts more than ::
|
|
if (string.substr(0, 2) === '::') {
|
|
colonCount--;
|
|
}
|
|
|
|
if (string.substr(-2, 2) === '::') {
|
|
colonCount--;
|
|
}
|
|
|
|
// The following loop would hang if colonCount > parts
|
|
if (colonCount > parts) {
|
|
return null;
|
|
}
|
|
|
|
// replacement = ':' + '0:' * (parts - colonCount)
|
|
replacementCount = parts - colonCount;
|
|
replacement = ':';
|
|
while (replacementCount--) {
|
|
replacement += '0:';
|
|
}
|
|
|
|
// Insert the missing zeroes
|
|
string = string.replace('::', replacement);
|
|
|
|
// Trim any garbage which may be hanging around if :: was at the edge in
|
|
// the source strin
|
|
if (string[0] === ':') {
|
|
string = string.slice(1);
|
|
}
|
|
|
|
if (string[string.length - 1] === ':') {
|
|
string = string.slice(0, -1);
|
|
}
|
|
|
|
parts = (function () {
|
|
const ref = string.split(':');
|
|
const results = [];
|
|
|
|
for (let i = 0; i < ref.length; i++) {
|
|
results.push(parseInt(ref[i], 16));
|
|
}
|
|
|
|
return results;
|
|
})();
|
|
|
|
return {
|
|
parts: parts,
|
|
zoneId: zoneId
|
|
};
|
|
}
|
|
|
|
// A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher.
|
|
function matchCIDR (first, second, partSize, cidrBits) {
|
|
if (first.length !== second.length) {
|
|
throw new Error('ipaddr: cannot match CIDR for objects with different lengths');
|
|
}
|
|
|
|
let part = 0;
|
|
let shift;
|
|
|
|
while (cidrBits > 0) {
|
|
shift = partSize - cidrBits;
|
|
if (shift < 0) {
|
|
shift = 0;
|
|
}
|
|
|
|
if (first[part] >> shift !== second[part] >> shift) {
|
|
return false;
|
|
}
|
|
|
|
cidrBits -= partSize;
|
|
part += 1;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function parseIntAuto (string) {
|
|
// Hexadedimal base 16 (0x#)
|
|
if (hexRegex.test(string)) {
|
|
return parseInt(string, 16);
|
|
}
|
|
// While octal representation is discouraged by ECMAScript 3
|
|
// and forbidden by ECMAScript 5, we silently allow it to
|
|
// work only if the rest of the string has numbers less than 8.
|
|
if (string[0] === '0' && !isNaN(parseInt(string[1], 10))) {
|
|
if (octalRegex.test(string)) {
|
|
return parseInt(string, 8);
|
|
}
|
|
throw new Error(`ipaddr: cannot parse ${string} as octal`);
|
|
}
|
|
// Always include the base 10 radix!
|
|
return parseInt(string, 10);
|
|
}
|
|
|
|
function padPart (part, length) {
|
|
while (part.length < length) {
|
|
part = `0${part}`;
|
|
}
|
|
|
|
return part;
|
|
}
|
|
|
|
const ipaddr = {};
|
|
|
|
// An IPv4 address (RFC791).
|
|
ipaddr.IPv4 = (function () {
|
|
// Constructs a new IPv4 address from an array of four octets
|
|
// in network order (MSB first)
|
|
// Verifies the input.
|
|
function IPv4 (octets) {
|
|
if (octets.length !== 4) {
|
|
throw new Error('ipaddr: ipv4 octet count should be 4');
|
|
}
|
|
|
|
let i, octet;
|
|
|
|
for (i = 0; i < octets.length; i++) {
|
|
octet = octets[i];
|
|
if (!((0 <= octet && octet <= 255))) {
|
|
throw new Error('ipaddr: ipv4 octet should fit in 8 bits');
|
|
}
|
|
}
|
|
|
|
this.octets = octets;
|
|
}
|
|
|
|
// Special IPv4 address ranges.
|
|
// See also https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
|
IPv4.prototype.SpecialRanges = {
|
|
unspecified: [[new IPv4([0, 0, 0, 0]), 8]],
|
|
broadcast: [[new IPv4([255, 255, 255, 255]), 32]],
|
|
// RFC3171
|
|
multicast: [[new IPv4([224, 0, 0, 0]), 4]],
|
|
// RFC3927
|
|
linkLocal: [[new IPv4([169, 254, 0, 0]), 16]],
|
|
// RFC5735
|
|
loopback: [[new IPv4([127, 0, 0, 0]), 8]],
|
|
// RFC6598
|
|
carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]],
|
|
// RFC1918
|
|
'private': [
|
|
[new IPv4([10, 0, 0, 0]), 8],
|
|
[new IPv4([172, 16, 0, 0]), 12],
|
|
[new IPv4([192, 168, 0, 0]), 16]
|
|
],
|
|
// Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700
|
|
reserved: [
|
|
[new IPv4([192, 0, 0, 0]), 24],
|
|
[new IPv4([192, 0, 2, 0]), 24],
|
|
[new IPv4([192, 88, 99, 0]), 24],
|
|
[new IPv4([198, 18, 0, 0]), 15],
|
|
[new IPv4([198, 51, 100, 0]), 24],
|
|
[new IPv4([203, 0, 113, 0]), 24],
|
|
[new IPv4([240, 0, 0, 0]), 4]
|
|
]
|
|
};
|
|
|
|
// The 'kind' method exists on both IPv4 and IPv6 classes.
|
|
IPv4.prototype.kind = function () {
|
|
return 'ipv4';
|
|
};
|
|
|
|
// Checks if this address matches other one within given CIDR range.
|
|
IPv4.prototype.match = function (other, cidrRange) {
|
|
let ref;
|
|
if (cidrRange === undefined) {
|
|
ref = other;
|
|
other = ref[0];
|
|
cidrRange = ref[1];
|
|
}
|
|
|
|
if (other.kind() !== 'ipv4') {
|
|
throw new Error('ipaddr: cannot match ipv4 address with non-ipv4 one');
|
|
}
|
|
|
|
return matchCIDR(this.octets, other.octets, 8, cidrRange);
|
|
};
|
|
|
|
// returns a number of leading ones in IPv4 address, making sure that
|
|
// the rest is a solid sequence of 0's (valid netmask)
|
|
// returns either the CIDR length or null if mask is not valid
|
|
IPv4.prototype.prefixLengthFromSubnetMask = function () {
|
|
let cidr = 0;
|
|
// non-zero encountered stop scanning for zeroes
|
|
let stop = false;
|
|
// number of zeroes in octet
|
|
const zerotable = {
|
|
0: 8,
|
|
128: 7,
|
|
192: 6,
|
|
224: 5,
|
|
240: 4,
|
|
248: 3,
|
|
252: 2,
|
|
254: 1,
|
|
255: 0
|
|
};
|
|
let i, octet, zeros;
|
|
|
|
for (i = 3; i >= 0; i -= 1) {
|
|
octet = this.octets[i];
|
|
if (octet in zerotable) {
|
|
zeros = zerotable[octet];
|
|
if (stop && zeros !== 0) {
|
|
return null;
|
|
}
|
|
|
|
if (zeros !== 8) {
|
|
stop = true;
|
|
}
|
|
|
|
cidr += zeros;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return 32 - cidr;
|
|
};
|
|
|
|
// Checks if the address corresponds to one of the special ranges.
|
|
IPv4.prototype.range = function () {
|
|
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
};
|
|
|
|
// Returns an array of byte-sized values in network order (MSB first)
|
|
IPv4.prototype.toByteArray = function () {
|
|
return this.octets.slice(0);
|
|
};
|
|
|
|
// Converts this IPv4 address to an IPv4-mapped IPv6 address.
|
|
IPv4.prototype.toIPv4MappedAddress = function () {
|
|
return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);
|
|
};
|
|
|
|
// Symmetrical method strictly for aligning with the IPv6 methods.
|
|
IPv4.prototype.toNormalizedString = function () {
|
|
return this.toString();
|
|
};
|
|
|
|
// Returns the address in convenient, decimal-dotted format.
|
|
IPv4.prototype.toString = function () {
|
|
return this.octets.join('.');
|
|
};
|
|
|
|
return IPv4;
|
|
})();
|
|
|
|
// A utility function to return broadcast address given the IPv4 interface and prefix length in CIDR notation
|
|
ipaddr.IPv4.broadcastAddressFromCIDR = function (string) {
|
|
|
|
try {
|
|
const cidr = this.parseCIDR(string);
|
|
const ipInterfaceOctets = cidr[0].toByteArray();
|
|
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
const octets = [];
|
|
let i = 0;
|
|
while (i < 4) {
|
|
// Broadcast address is bitwise OR between ip interface and inverted mask
|
|
octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
|
|
i++;
|
|
}
|
|
|
|
return new this(octets);
|
|
} catch (e) {
|
|
throw new Error('ipaddr: the address does not have IPv4 CIDR format');
|
|
}
|
|
};
|
|
|
|
// Checks if a given string is formatted like IPv4 address.
|
|
ipaddr.IPv4.isIPv4 = function (string) {
|
|
return this.parser(string) !== null;
|
|
};
|
|
|
|
// Checks if a given string is a valid IPv4 address.
|
|
ipaddr.IPv4.isValid = function (string) {
|
|
try {
|
|
new this(this.parser(string));
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// Checks if a given string is a full four-part IPv4 Address.
|
|
ipaddr.IPv4.isValidFourPartDecimal = function (string) {
|
|
if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// A utility function to return network address given the IPv4 interface and prefix length in CIDR notation
|
|
ipaddr.IPv4.networkAddressFromCIDR = function (string) {
|
|
let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
|
|
try {
|
|
cidr = this.parseCIDR(string);
|
|
ipInterfaceOctets = cidr[0].toByteArray();
|
|
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
octets = [];
|
|
i = 0;
|
|
while (i < 4) {
|
|
// Network address is bitwise AND between ip interface and mask
|
|
octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
|
|
i++;
|
|
}
|
|
|
|
return new this(octets);
|
|
} catch (e) {
|
|
throw new Error('ipaddr: the address does not have IPv4 CIDR format');
|
|
}
|
|
};
|
|
|
|
// Tries to parse and validate a string with IPv4 address.
|
|
// Throws an error if it fails.
|
|
ipaddr.IPv4.parse = function (string) {
|
|
const parts = this.parser(string);
|
|
|
|
if (parts === null) {
|
|
throw new Error('ipaddr: string is not formatted like an IPv4 Address');
|
|
}
|
|
|
|
return new this(parts);
|
|
};
|
|
|
|
// Parses the string as an IPv4 Address with CIDR Notation.
|
|
ipaddr.IPv4.parseCIDR = function (string) {
|
|
let match;
|
|
|
|
if ((match = string.match(/^(.+)\/(\d+)$/))) {
|
|
const maskLength = parseInt(match[2]);
|
|
if (maskLength >= 0 && maskLength <= 32) {
|
|
const parsed = [this.parse(match[1]), maskLength];
|
|
Object.defineProperty(parsed, 'toString', {
|
|
value: function () {
|
|
return this.join('/');
|
|
}
|
|
});
|
|
return parsed;
|
|
}
|
|
}
|
|
|
|
throw new Error('ipaddr: string is not formatted like an IPv4 CIDR range');
|
|
};
|
|
|
|
// Classful variants (like a.b, where a is an octet, and b is a 24-bit
|
|
// value representing last three octets; this corresponds to a class C
|
|
// address) are omitted due to classless nature of modern Internet.
|
|
ipaddr.IPv4.parser = function (string) {
|
|
let match, part, value;
|
|
|
|
// parseInt recognizes all that octal & hexadecimal weirdness for us
|
|
if ((match = string.match(ipv4Regexes.fourOctet))) {
|
|
return (function () {
|
|
const ref = match.slice(1, 6);
|
|
const results = [];
|
|
|
|
for (let i = 0; i < ref.length; i++) {
|
|
part = ref[i];
|
|
results.push(parseIntAuto(part));
|
|
}
|
|
|
|
return results;
|
|
})();
|
|
} else if ((match = string.match(ipv4Regexes.longValue))) {
|
|
value = parseIntAuto(match[1]);
|
|
if (value > 0xffffffff || value < 0) {
|
|
throw new Error('ipaddr: address outside defined range');
|
|
}
|
|
|
|
return ((function () {
|
|
const results = [];
|
|
let shift;
|
|
|
|
for (shift = 0; shift <= 24; shift += 8) {
|
|
results.push((value >> shift) & 0xff);
|
|
}
|
|
|
|
return results;
|
|
})()).reverse();
|
|
} else if ((match = string.match(ipv4Regexes.twoOctet))) {
|
|
return (function () {
|
|
const ref = match.slice(1, 4);
|
|
const results = [];
|
|
|
|
value = parseIntAuto(ref[1]);
|
|
if (value > 0xffffff || value < 0) {
|
|
throw new Error('ipaddr: address outside defined range');
|
|
}
|
|
|
|
results.push(parseIntAuto(ref[0]));
|
|
results.push((value >> 16) & 0xff);
|
|
results.push((value >> 8) & 0xff);
|
|
results.push( value & 0xff);
|
|
|
|
return results;
|
|
})();
|
|
} else if ((match = string.match(ipv4Regexes.threeOctet))) {
|
|
return (function () {
|
|
const ref = match.slice(1, 5);
|
|
const results = [];
|
|
|
|
value = parseIntAuto(ref[2]);
|
|
if (value > 0xffff || value < 0) {
|
|
throw new Error('ipaddr: address outside defined range');
|
|
}
|
|
|
|
results.push(parseIntAuto(ref[0]));
|
|
results.push(parseIntAuto(ref[1]));
|
|
results.push((value >> 8) & 0xff);
|
|
results.push( value & 0xff);
|
|
|
|
return results;
|
|
})();
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
// A utility function to return subnet mask in IPv4 format given the prefix length
|
|
ipaddr.IPv4.subnetMaskFromPrefixLength = function (prefix) {
|
|
prefix = parseInt(prefix);
|
|
if (prefix < 0 || prefix > 32) {
|
|
throw new Error('ipaddr: invalid IPv4 prefix length');
|
|
}
|
|
|
|
const octets = [0, 0, 0, 0];
|
|
let j = 0;
|
|
const filledOctetCount = Math.floor(prefix / 8);
|
|
|
|
while (j < filledOctetCount) {
|
|
octets[j] = 255;
|
|
j++;
|
|
}
|
|
|
|
if (filledOctetCount < 4) {
|
|
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8);
|
|
}
|
|
|
|
return new this(octets);
|
|
};
|
|
|
|
// An IPv6 address (RFC2460)
|
|
ipaddr.IPv6 = (function () {
|
|
// Constructs an IPv6 address from an array of eight 16 - bit parts
|
|
// or sixteen 8 - bit parts in network order(MSB first).
|
|
// Throws an error if the input is invalid.
|
|
function IPv6 (parts, zoneId) {
|
|
let i, part;
|
|
|
|
if (parts.length === 16) {
|
|
this.parts = [];
|
|
for (i = 0; i <= 14; i += 2) {
|
|
this.parts.push((parts[i] << 8) | parts[i + 1]);
|
|
}
|
|
} else if (parts.length === 8) {
|
|
this.parts = parts;
|
|
} else {
|
|
throw new Error('ipaddr: ipv6 part count should be 8 or 16');
|
|
}
|
|
|
|
for (i = 0; i < this.parts.length; i++) {
|
|
part = this.parts[i];
|
|
if (!((0 <= part && part <= 0xffff))) {
|
|
throw new Error('ipaddr: ipv6 part should fit in 16 bits');
|
|
}
|
|
}
|
|
|
|
if (zoneId) {
|
|
this.zoneId = zoneId;
|
|
}
|
|
}
|
|
|
|
// Special IPv6 ranges
|
|
IPv6.prototype.SpecialRanges = {
|
|
// RFC4291, here and after
|
|
unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128],
|
|
linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10],
|
|
multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8],
|
|
loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],
|
|
uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7],
|
|
ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96],
|
|
// RFC6145
|
|
rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96],
|
|
// RFC6052
|
|
rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96],
|
|
// RFC3056
|
|
'6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16],
|
|
// RFC6052, RFC6146
|
|
teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32],
|
|
// RFC4291
|
|
reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]],
|
|
benchmarking: [new IPv6([0x2001, 0x2, 0, 0, 0, 0, 0, 0]), 48],
|
|
amt: [new IPv6([0x2001, 0x3, 0, 0, 0, 0, 0, 0]), 32],
|
|
as112v6: [new IPv6([0x2001, 0x4, 0x112, 0, 0, 0, 0, 0]), 48],
|
|
deprecated: [new IPv6([0x2001, 0x10, 0, 0, 0, 0, 0, 0]), 28],
|
|
orchid2: [new IPv6([0x2001, 0x20, 0, 0, 0, 0, 0, 0]), 28]
|
|
};
|
|
|
|
// Checks if this address is an IPv4-mapped IPv6 address.
|
|
IPv6.prototype.isIPv4MappedAddress = function () {
|
|
return this.range() === 'ipv4Mapped';
|
|
};
|
|
|
|
// The 'kind' method exists on both IPv4 and IPv6 classes.
|
|
IPv6.prototype.kind = function () {
|
|
return 'ipv6';
|
|
};
|
|
|
|
// Checks if this address matches other one within given CIDR range.
|
|
IPv6.prototype.match = function (other, cidrRange) {
|
|
let ref;
|
|
|
|
if (cidrRange === undefined) {
|
|
ref = other;
|
|
other = ref[0];
|
|
cidrRange = ref[1];
|
|
}
|
|
|
|
if (other.kind() !== 'ipv6') {
|
|
throw new Error('ipaddr: cannot match ipv6 address with non-ipv6 one');
|
|
}
|
|
|
|
return matchCIDR(this.parts, other.parts, 16, cidrRange);
|
|
};
|
|
|
|
// returns a number of leading ones in IPv6 address, making sure that
|
|
// the rest is a solid sequence of 0's (valid netmask)
|
|
// returns either the CIDR length or null if mask is not valid
|
|
IPv6.prototype.prefixLengthFromSubnetMask = function () {
|
|
let cidr = 0;
|
|
// non-zero encountered stop scanning for zeroes
|
|
let stop = false;
|
|
// number of zeroes in octet
|
|
const zerotable = {
|
|
0: 16,
|
|
32768: 15,
|
|
49152: 14,
|
|
57344: 13,
|
|
61440: 12,
|
|
63488: 11,
|
|
64512: 10,
|
|
65024: 9,
|
|
65280: 8,
|
|
65408: 7,
|
|
65472: 6,
|
|
65504: 5,
|
|
65520: 4,
|
|
65528: 3,
|
|
65532: 2,
|
|
65534: 1,
|
|
65535: 0
|
|
};
|
|
let part, zeros;
|
|
|
|
for (let i = 7; i >= 0; i -= 1) {
|
|
part = this.parts[i];
|
|
if (part in zerotable) {
|
|
zeros = zerotable[part];
|
|
if (stop && zeros !== 0) {
|
|
return null;
|
|
}
|
|
|
|
if (zeros !== 16) {
|
|
stop = true;
|
|
}
|
|
|
|
cidr += zeros;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return 128 - cidr;
|
|
};
|
|
|
|
|
|
// Checks if the address corresponds to one of the special ranges.
|
|
IPv6.prototype.range = function () {
|
|
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
};
|
|
|
|
// Returns an array of byte-sized values in network order (MSB first)
|
|
IPv6.prototype.toByteArray = function () {
|
|
let part;
|
|
const bytes = [];
|
|
const ref = this.parts;
|
|
for (let i = 0; i < ref.length; i++) {
|
|
part = ref[i];
|
|
bytes.push(part >> 8);
|
|
bytes.push(part & 0xff);
|
|
}
|
|
|
|
return bytes;
|
|
};
|
|
|
|
// Returns the address in expanded format with all zeroes included, like
|
|
// 2001:0db8:0008:0066:0000:0000:0000:0001
|
|
IPv6.prototype.toFixedLengthString = function () {
|
|
const addr = ((function () {
|
|
const results = [];
|
|
for (let i = 0; i < this.parts.length; i++) {
|
|
results.push(padPart(this.parts[i].toString(16), 4));
|
|
}
|
|
|
|
return results;
|
|
}).call(this)).join(':');
|
|
|
|
let suffix = '';
|
|
|
|
if (this.zoneId) {
|
|
suffix = `%${this.zoneId}`;
|
|
}
|
|
|
|
return addr + suffix;
|
|
};
|
|
|
|
// Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address.
|
|
// Throws an error otherwise.
|
|
IPv6.prototype.toIPv4Address = function () {
|
|
if (!this.isIPv4MappedAddress()) {
|
|
throw new Error('ipaddr: trying to convert a generic ipv6 address to ipv4');
|
|
}
|
|
|
|
const ref = this.parts.slice(-2);
|
|
const high = ref[0];
|
|
const low = ref[1];
|
|
|
|
return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]);
|
|
};
|
|
|
|
// Returns the address in expanded format with all zeroes included, like
|
|
// 2001:db8:8:66:0:0:0:1
|
|
//
|
|
// Deprecated: use toFixedLengthString() instead.
|
|
IPv6.prototype.toNormalizedString = function () {
|
|
const addr = ((function () {
|
|
const results = [];
|
|
|
|
for (let i = 0; i < this.parts.length; i++) {
|
|
results.push(this.parts[i].toString(16));
|
|
}
|
|
|
|
return results;
|
|
}).call(this)).join(':');
|
|
|
|
let suffix = '';
|
|
|
|
if (this.zoneId) {
|
|
suffix = `%${this.zoneId}`;
|
|
}
|
|
|
|
return addr + suffix;
|
|
};
|
|
|
|
// Returns the address in compact, human-readable format like
|
|
// 2001:db8:8:66::1
|
|
// in line with RFC 5952 (see https://tools.ietf.org/html/rfc5952#section-4)
|
|
IPv6.prototype.toRFC5952String = function () {
|
|
const regex = /((^|:)(0(:|$)){2,})/g;
|
|
const string = this.toNormalizedString();
|
|
let bestMatchIndex = 0;
|
|
let bestMatchLength = -1;
|
|
let match;
|
|
|
|
while ((match = regex.exec(string))) {
|
|
if (match[0].length > bestMatchLength) {
|
|
bestMatchIndex = match.index;
|
|
bestMatchLength = match[0].length;
|
|
}
|
|
}
|
|
|
|
if (bestMatchLength < 0) {
|
|
return string;
|
|
}
|
|
|
|
return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;
|
|
};
|
|
|
|
// Returns the address in compact, human-readable format like
|
|
// 2001:db8:8:66::1
|
|
// Calls toRFC5952String under the hood.
|
|
IPv6.prototype.toString = function () {
|
|
return this.toRFC5952String();
|
|
};
|
|
|
|
return IPv6;
|
|
|
|
})();
|
|
|
|
// A utility function to return broadcast address given the IPv6 interface and prefix length in CIDR notation
|
|
ipaddr.IPv6.broadcastAddressFromCIDR = function (string) {
|
|
try {
|
|
const cidr = this.parseCIDR(string);
|
|
const ipInterfaceOctets = cidr[0].toByteArray();
|
|
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
const octets = [];
|
|
let i = 0;
|
|
while (i < 16) {
|
|
// Broadcast address is bitwise OR between ip interface and inverted mask
|
|
octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
|
|
i++;
|
|
}
|
|
|
|
return new this(octets);
|
|
} catch (e) {
|
|
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
|
|
}
|
|
};
|
|
|
|
// Checks if a given string is formatted like IPv6 address.
|
|
ipaddr.IPv6.isIPv6 = function (string) {
|
|
return this.parser(string) !== null;
|
|
};
|
|
|
|
// Checks to see if string is a valid IPv6 Address
|
|
ipaddr.IPv6.isValid = function (string) {
|
|
|
|
// Since IPv6.isValid is always called first, this shortcut
|
|
// provides a substantial performance gain.
|
|
if (typeof string === 'string' && string.indexOf(':') === -1) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
const addr = this.parser(string);
|
|
new this(addr.parts, addr.zoneId);
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// A utility function to return network address given the IPv6 interface and prefix length in CIDR notation
|
|
ipaddr.IPv6.networkAddressFromCIDR = function (string) {
|
|
let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
|
|
try {
|
|
cidr = this.parseCIDR(string);
|
|
ipInterfaceOctets = cidr[0].toByteArray();
|
|
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
octets = [];
|
|
i = 0;
|
|
while (i < 16) {
|
|
// Network address is bitwise AND between ip interface and mask
|
|
octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
|
|
i++;
|
|
}
|
|
|
|
return new this(octets);
|
|
} catch (e) {
|
|
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
|
|
}
|
|
};
|
|
|
|
// Tries to parse and validate a string with IPv6 address.
|
|
// Throws an error if it fails.
|
|
ipaddr.IPv6.parse = function (string) {
|
|
const addr = this.parser(string);
|
|
|
|
if (addr.parts === null) {
|
|
throw new Error('ipaddr: string is not formatted like an IPv6 Address');
|
|
}
|
|
|
|
return new this(addr.parts, addr.zoneId);
|
|
};
|
|
|
|
ipaddr.IPv6.parseCIDR = function (string) {
|
|
let maskLength, match, parsed;
|
|
|
|
if ((match = string.match(/^(.+)\/(\d+)$/))) {
|
|
maskLength = parseInt(match[2]);
|
|
if (maskLength >= 0 && maskLength <= 128) {
|
|
parsed = [this.parse(match[1]), maskLength];
|
|
Object.defineProperty(parsed, 'toString', {
|
|
value: function () {
|
|
return this.join('/');
|
|
}
|
|
});
|
|
return parsed;
|
|
}
|
|
}
|
|
|
|
throw new Error('ipaddr: string is not formatted like an IPv6 CIDR range');
|
|
};
|
|
|
|
// Parse an IPv6 address.
|
|
ipaddr.IPv6.parser = function (string) {
|
|
let addr, i, match, octet, octets, zoneId;
|
|
|
|
if ((match = string.match(ipv6Regexes.deprecatedTransitional))) {
|
|
return this.parser(`::ffff:${match[1]}`);
|
|
}
|
|
if (ipv6Regexes.native.test(string)) {
|
|
return expandIPv6(string, 8);
|
|
}
|
|
if ((match = string.match(ipv6Regexes.transitional))) {
|
|
zoneId = match[6] || '';
|
|
addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6);
|
|
if (addr.parts) {
|
|
octets = [
|
|
parseInt(match[2]),
|
|
parseInt(match[3]),
|
|
parseInt(match[4]),
|
|
parseInt(match[5])
|
|
];
|
|
for (i = 0; i < octets.length; i++) {
|
|
octet = octets[i];
|
|
if (!((0 <= octet && octet <= 255))) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
addr.parts.push(octets[0] << 8 | octets[1]);
|
|
addr.parts.push(octets[2] << 8 | octets[3]);
|
|
return {
|
|
parts: addr.parts,
|
|
zoneId: addr.zoneId
|
|
};
|
|
}
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
// A utility function to return subnet mask in IPv6 format given the prefix length
|
|
ipaddr.IPv6.subnetMaskFromPrefixLength = function (prefix) {
|
|
prefix = parseInt(prefix);
|
|
if (prefix < 0 || prefix > 128) {
|
|
throw new Error('ipaddr: invalid IPv6 prefix length');
|
|
}
|
|
|
|
const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
let j = 0;
|
|
const filledOctetCount = Math.floor(prefix / 8);
|
|
|
|
while (j < filledOctetCount) {
|
|
octets[j] = 255;
|
|
j++;
|
|
}
|
|
|
|
if (filledOctetCount < 16) {
|
|
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8);
|
|
}
|
|
|
|
return new this(octets);
|
|
};
|
|
|
|
// Try to parse an array in network order (MSB first) for IPv4 and IPv6
|
|
ipaddr.fromByteArray = function (bytes) {
|
|
const length = bytes.length;
|
|
|
|
if (length === 4) {
|
|
return new ipaddr.IPv4(bytes);
|
|
} else if (length === 16) {
|
|
return new ipaddr.IPv6(bytes);
|
|
} else {
|
|
throw new Error('ipaddr: the binary input is neither an IPv6 nor IPv4 address');
|
|
}
|
|
};
|
|
|
|
// Checks if the address is valid IP address
|
|
ipaddr.isValid = function (string) {
|
|
return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
|
|
};
|
|
|
|
|
|
// Attempts to parse an IP Address, first through IPv6 then IPv4.
|
|
// Throws an error if it could not be parsed.
|
|
ipaddr.parse = function (string) {
|
|
if (ipaddr.IPv6.isValid(string)) {
|
|
return ipaddr.IPv6.parse(string);
|
|
} else if (ipaddr.IPv4.isValid(string)) {
|
|
return ipaddr.IPv4.parse(string);
|
|
} else {
|
|
throw new Error('ipaddr: the address has neither IPv6 nor IPv4 format');
|
|
}
|
|
};
|
|
|
|
// Attempt to parse CIDR notation, first through IPv6 then IPv4.
|
|
// Throws an error if it could not be parsed.
|
|
ipaddr.parseCIDR = function (string) {
|
|
try {
|
|
return ipaddr.IPv6.parseCIDR(string);
|
|
} catch (e) {
|
|
try {
|
|
return ipaddr.IPv4.parseCIDR(string);
|
|
} catch (e2) {
|
|
throw new Error('ipaddr: the address has neither IPv6 nor IPv4 CIDR format');
|
|
}
|
|
}
|
|
};
|
|
|
|
// Parse an address and return plain IPv4 address if it is an IPv4-mapped address
|
|
ipaddr.process = function (string) {
|
|
const addr = this.parse(string);
|
|
|
|
if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) {
|
|
return addr.toIPv4Address();
|
|
} else {
|
|
return addr;
|
|
}
|
|
};
|
|
|
|
// An utility function to ease named range matching. See examples below.
|
|
// rangeList can contain both IPv4 and IPv6 subnet entries and will not throw errors
|
|
// on matching IPv4 addresses to IPv6 ranges or vice versa.
|
|
ipaddr.subnetMatch = function (address, rangeList, defaultName) {
|
|
let i, rangeName, rangeSubnets, subnet;
|
|
|
|
if (defaultName === undefined || defaultName === null) {
|
|
defaultName = 'unicast';
|
|
}
|
|
|
|
for (rangeName in rangeList) {
|
|
if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {
|
|
rangeSubnets = rangeList[rangeName];
|
|
// ECMA5 Array.isArray isn't available everywhere
|
|
if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {
|
|
rangeSubnets = [rangeSubnets];
|
|
}
|
|
|
|
for (i = 0; i < rangeSubnets.length; i++) {
|
|
subnet = rangeSubnets[i];
|
|
if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) {
|
|
return rangeName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return defaultName;
|
|
};
|
|
|
|
// Export for both the CommonJS and browser-like environment
|
|
if ( true && module.exports) {
|
|
module.exports = ipaddr;
|
|
|
|
} else {
|
|
root.ipaddr = ipaddr;
|
|
}
|
|
|
|
}(this));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1676:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var util = __nccwpck_require__(3837),
|
|
TransformStream = (__nccwpck_require__(2781).Transform);
|
|
|
|
module.exports = function (options) {
|
|
return new JSONStream(options);
|
|
};
|
|
|
|
var JSONStream = module.exports.JSONStream = function (options) {
|
|
options = options || {};
|
|
TransformStream.call(this, options);
|
|
this._writableState.objectMode = false;
|
|
this._readableState.objectMode = true;
|
|
this._async = options.async || false;
|
|
};
|
|
util.inherits(JSONStream, TransformStream);
|
|
|
|
JSONStream.prototype._transform = function (data, encoding, callback) {
|
|
if (!Buffer.isBuffer(data)) data = new Buffer(data);
|
|
if (this._buffer) {
|
|
data = Buffer.concat([this._buffer, data]);
|
|
}
|
|
|
|
var ptr = 0, start = 0;
|
|
while (++ptr <= data.length) {
|
|
if (data[ptr] === 10 || ptr === data.length) {
|
|
var line;
|
|
try {
|
|
line = JSON.parse(data.slice(start, ptr));
|
|
}
|
|
catch (ex) { }
|
|
if (line) {
|
|
this.push(line);
|
|
line = null;
|
|
}
|
|
if (data[ptr] === 10) start = ++ptr;
|
|
}
|
|
}
|
|
|
|
this._buffer = data.slice(start);
|
|
return this._async
|
|
? void setImmediate(callback)
|
|
: void callback();
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 250:
|
|
/***/ (function(module, exports, __nccwpck_require__) {
|
|
|
|
/* module decorator */ module = __nccwpck_require__.nmd(module);
|
|
/**
|
|
* @license
|
|
* Lodash <https://lodash.com/>
|
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
* Released under MIT license <https://lodash.com/license>
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
*/
|
|
;(function() {
|
|
|
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
var undefined;
|
|
|
|
/** Used as the semantic version number. */
|
|
var VERSION = '4.17.21';
|
|
|
|
/** Used as the size to enable large array optimizations. */
|
|
var LARGE_ARRAY_SIZE = 200;
|
|
|
|
/** Error message constants. */
|
|
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
|
|
FUNC_ERROR_TEXT = 'Expected a function',
|
|
INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
|
|
|
|
/** Used to stand-in for `undefined` hash values. */
|
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
|
|
/** Used as the maximum memoize cache size. */
|
|
var MAX_MEMOIZE_SIZE = 500;
|
|
|
|
/** Used as the internal argument placeholder. */
|
|
var PLACEHOLDER = '__lodash_placeholder__';
|
|
|
|
/** Used to compose bitmasks for cloning. */
|
|
var CLONE_DEEP_FLAG = 1,
|
|
CLONE_FLAT_FLAG = 2,
|
|
CLONE_SYMBOLS_FLAG = 4;
|
|
|
|
/** Used to compose bitmasks for value comparisons. */
|
|
var COMPARE_PARTIAL_FLAG = 1,
|
|
COMPARE_UNORDERED_FLAG = 2;
|
|
|
|
/** Used to compose bitmasks for function metadata. */
|
|
var WRAP_BIND_FLAG = 1,
|
|
WRAP_BIND_KEY_FLAG = 2,
|
|
WRAP_CURRY_BOUND_FLAG = 4,
|
|
WRAP_CURRY_FLAG = 8,
|
|
WRAP_CURRY_RIGHT_FLAG = 16,
|
|
WRAP_PARTIAL_FLAG = 32,
|
|
WRAP_PARTIAL_RIGHT_FLAG = 64,
|
|
WRAP_ARY_FLAG = 128,
|
|
WRAP_REARG_FLAG = 256,
|
|
WRAP_FLIP_FLAG = 512;
|
|
|
|
/** Used as default options for `_.truncate`. */
|
|
var DEFAULT_TRUNC_LENGTH = 30,
|
|
DEFAULT_TRUNC_OMISSION = '...';
|
|
|
|
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
var HOT_COUNT = 800,
|
|
HOT_SPAN = 16;
|
|
|
|
/** Used to indicate the type of lazy iteratees. */
|
|
var LAZY_FILTER_FLAG = 1,
|
|
LAZY_MAP_FLAG = 2,
|
|
LAZY_WHILE_FLAG = 3;
|
|
|
|
/** Used as references for various `Number` constants. */
|
|
var INFINITY = 1 / 0,
|
|
MAX_SAFE_INTEGER = 9007199254740991,
|
|
MAX_INTEGER = 1.7976931348623157e+308,
|
|
NAN = 0 / 0;
|
|
|
|
/** Used as references for the maximum length and index of an array. */
|
|
var MAX_ARRAY_LENGTH = 4294967295,
|
|
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
|
|
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
|
|
|
/** Used to associate wrap methods with their bit flags. */
|
|
var wrapFlags = [
|
|
['ary', WRAP_ARY_FLAG],
|
|
['bind', WRAP_BIND_FLAG],
|
|
['bindKey', WRAP_BIND_KEY_FLAG],
|
|
['curry', WRAP_CURRY_FLAG],
|
|
['curryRight', WRAP_CURRY_RIGHT_FLAG],
|
|
['flip', WRAP_FLIP_FLAG],
|
|
['partial', WRAP_PARTIAL_FLAG],
|
|
['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
|
|
['rearg', WRAP_REARG_FLAG]
|
|
];
|
|
|
|
/** `Object#toString` result references. */
|
|
var argsTag = '[object Arguments]',
|
|
arrayTag = '[object Array]',
|
|
asyncTag = '[object AsyncFunction]',
|
|
boolTag = '[object Boolean]',
|
|
dateTag = '[object Date]',
|
|
domExcTag = '[object DOMException]',
|
|
errorTag = '[object Error]',
|
|
funcTag = '[object Function]',
|
|
genTag = '[object GeneratorFunction]',
|
|
mapTag = '[object Map]',
|
|
numberTag = '[object Number]',
|
|
nullTag = '[object Null]',
|
|
objectTag = '[object Object]',
|
|
promiseTag = '[object Promise]',
|
|
proxyTag = '[object Proxy]',
|
|
regexpTag = '[object RegExp]',
|
|
setTag = '[object Set]',
|
|
stringTag = '[object String]',
|
|
symbolTag = '[object Symbol]',
|
|
undefinedTag = '[object Undefined]',
|
|
weakMapTag = '[object WeakMap]',
|
|
weakSetTag = '[object WeakSet]';
|
|
|
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
dataViewTag = '[object DataView]',
|
|
float32Tag = '[object Float32Array]',
|
|
float64Tag = '[object Float64Array]',
|
|
int8Tag = '[object Int8Array]',
|
|
int16Tag = '[object Int16Array]',
|
|
int32Tag = '[object Int32Array]',
|
|
uint8Tag = '[object Uint8Array]',
|
|
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
uint16Tag = '[object Uint16Array]',
|
|
uint32Tag = '[object Uint32Array]';
|
|
|
|
/** Used to match empty string literals in compiled template source. */
|
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
|
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
|
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
|
|
|
/** Used to match HTML entities and HTML characters. */
|
|
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
|
|
reUnescapedHtml = /[&<>"']/g,
|
|
reHasEscapedHtml = RegExp(reEscapedHtml.source),
|
|
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
|
|
|
/** Used to match template delimiters. */
|
|
var reEscape = /<%-([\s\S]+?)%>/g,
|
|
reEvaluate = /<%([\s\S]+?)%>/g,
|
|
reInterpolate = /<%=([\s\S]+?)%>/g;
|
|
|
|
/** Used to match property names within property paths. */
|
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
reIsPlainProp = /^\w*$/,
|
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
|
|
/**
|
|
* Used to match `RegExp`
|
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
*/
|
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
|
reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
|
|
/** Used to match leading whitespace. */
|
|
var reTrimStart = /^\s+/;
|
|
|
|
/** Used to match a single whitespace character. */
|
|
var reWhitespace = /\s/;
|
|
|
|
/** Used to match wrap detail comments. */
|
|
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
|
|
reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
|
|
reSplitDetails = /,? & /;
|
|
|
|
/** Used to match words composed of alphanumeric characters. */
|
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
|
|
/**
|
|
* Used to validate the `validate` option in `_.template` variable.
|
|
*
|
|
* Forbids characters which could potentially change the meaning of the function argument definition:
|
|
* - "()," (modification of function parameters)
|
|
* - "=" (default value)
|
|
* - "[]{}" (destructuring of function parameters)
|
|
* - "/" (beginning of a comment)
|
|
* - whitespace
|
|
*/
|
|
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
|
|
|
|
/** Used to match backslashes in property paths. */
|
|
var reEscapeChar = /\\(\\)?/g;
|
|
|
|
/**
|
|
* Used to match
|
|
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
|
*/
|
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
|
|
|
/** Used to match `RegExp` flags from their coerced string values. */
|
|
var reFlags = /\w*$/;
|
|
|
|
/** Used to detect bad signed hexadecimal string values. */
|
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
|
|
/** Used to detect binary string values. */
|
|
var reIsBinary = /^0b[01]+$/i;
|
|
|
|
/** Used to detect host constructors (Safari). */
|
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
|
|
/** Used to detect octal string values. */
|
|
var reIsOctal = /^0o[0-7]+$/i;
|
|
|
|
/** Used to detect unsigned integer values. */
|
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
|
|
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
|
|
/** Used to ensure capturing order of template delimiters. */
|
|
var reNoMatch = /($^)/;
|
|
|
|
/** Used to match unescaped characters in compiled string literals. */
|
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
|
|
|
/** Used to compose unicode character classes. */
|
|
var rsAstralRange = '\\ud800-\\udfff',
|
|
rsComboMarksRange = '\\u0300-\\u036f',
|
|
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
|
rsDingbatRange = '\\u2700-\\u27bf',
|
|
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
|
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
|
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
|
rsPunctuationRange = '\\u2000-\\u206f',
|
|
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
|
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
|
rsVarRange = '\\ufe0e\\ufe0f',
|
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
|
|
/** Used to compose unicode capture groups. */
|
|
var rsApos = "['\u2019]",
|
|
rsAstral = '[' + rsAstralRange + ']',
|
|
rsBreak = '[' + rsBreakRange + ']',
|
|
rsCombo = '[' + rsComboRange + ']',
|
|
rsDigits = '\\d+',
|
|
rsDingbat = '[' + rsDingbatRange + ']',
|
|
rsLower = '[' + rsLowerRange + ']',
|
|
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
rsUpper = '[' + rsUpperRange + ']',
|
|
rsZWJ = '\\u200d';
|
|
|
|
/** Used to compose unicode regexes. */
|
|
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
|
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
|
rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
|
rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
|
reOptMod = rsModifier + '?',
|
|
rsOptVar = '[' + rsVarRange + ']?',
|
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
|
|
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
|
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
|
|
/** Used to match apostrophes. */
|
|
var reApos = RegExp(rsApos, 'g');
|
|
|
|
/**
|
|
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
*/
|
|
var reComboMark = RegExp(rsCombo, 'g');
|
|
|
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
|
|
/** Used to match complex or compound words. */
|
|
var reUnicodeWord = RegExp([
|
|
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
|
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
|
|
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
|
rsUpper + '+' + rsOptContrUpper,
|
|
rsOrdUpper,
|
|
rsOrdLower,
|
|
rsDigits,
|
|
rsEmoji
|
|
].join('|'), 'g');
|
|
|
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
|
|
|
/** Used to detect strings that need a more robust regexp to match words. */
|
|
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
|
|
/** Used to assign default `context` object properties. */
|
|
var contextProps = [
|
|
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
|
'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
|
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
|
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
|
];
|
|
|
|
/** Used to make template sourceURLs easier to identify. */
|
|
var templateCounter = -1;
|
|
|
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
var typedArrayTags = {};
|
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
typedArrayTags[uint32Tag] = true;
|
|
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
|
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
|
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
|
typedArrayTags[weakMapTag] = false;
|
|
|
|
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
var cloneableTags = {};
|
|
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
cloneableTags[weakMapTag] = false;
|
|
|
|
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
var deburredLetters = {
|
|
// Latin-1 Supplement block.
|
|
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
|
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
|
'\xc7': 'C', '\xe7': 'c',
|
|
'\xd0': 'D', '\xf0': 'd',
|
|
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
|
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
|
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
|
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
|
'\xd1': 'N', '\xf1': 'n',
|
|
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
|
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
|
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
|
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
|
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
|
'\xc6': 'Ae', '\xe6': 'ae',
|
|
'\xde': 'Th', '\xfe': 'th',
|
|
'\xdf': 'ss',
|
|
// Latin Extended-A block.
|
|
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
|
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
|
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
|
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
|
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
|
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
|
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
|
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
|
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
|
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
|
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
|
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
|
'\u0134': 'J', '\u0135': 'j',
|
|
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
|
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
|
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
|
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
|
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
|
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
|
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
|
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
|
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
|
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
|
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
|
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
|
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
|
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
|
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
|
'\u0174': 'W', '\u0175': 'w',
|
|
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
|
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
|
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
|
'\u0132': 'IJ', '\u0133': 'ij',
|
|
'\u0152': 'Oe', '\u0153': 'oe',
|
|
'\u0149': "'n", '\u017f': 's'
|
|
};
|
|
|
|
/** Used to map characters to HTML entities. */
|
|
var htmlEscapes = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
"'": '''
|
|
};
|
|
|
|
/** Used to map HTML entities to characters. */
|
|
var htmlUnescapes = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
''': "'"
|
|
};
|
|
|
|
/** Used to escape characters for inclusion in compiled string literals. */
|
|
var stringEscapes = {
|
|
'\\': '\\',
|
|
"'": "'",
|
|
'\n': 'n',
|
|
'\r': 'r',
|
|
'\u2028': 'u2028',
|
|
'\u2029': 'u2029'
|
|
};
|
|
|
|
/** Built-in method references without a dependency on `root`. */
|
|
var freeParseFloat = parseFloat,
|
|
freeParseInt = parseInt;
|
|
|
|
/** Detect free variable `global` from Node.js. */
|
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
|
|
/** Detect free variable `self`. */
|
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
|
|
/** Used as a reference to the global object. */
|
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
|
|
/** Detect free variable `exports`. */
|
|
var freeExports = true && exports && !exports.nodeType && exports;
|
|
|
|
/** Detect free variable `module`. */
|
|
var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
|
|
|
|
/** Detect the popular CommonJS extension `module.exports`. */
|
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
|
|
/** Detect free variable `process` from Node.js. */
|
|
var freeProcess = moduleExports && freeGlobal.process;
|
|
|
|
/** Used to access faster Node.js helpers. */
|
|
var nodeUtil = (function() {
|
|
try {
|
|
// Use `util.types` for Node.js 10+.
|
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
|
|
if (types) {
|
|
return types;
|
|
}
|
|
|
|
// Legacy `process.binding('util')` for Node.js < 10.
|
|
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
} catch (e) {}
|
|
}());
|
|
|
|
/* Node.js helper references. */
|
|
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
|
|
nodeIsDate = nodeUtil && nodeUtil.isDate,
|
|
nodeIsMap = nodeUtil && nodeUtil.isMap,
|
|
nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
|
|
nodeIsSet = nodeUtil && nodeUtil.isSet,
|
|
nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to invoke.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {Array} args The arguments to invoke `func` with.
|
|
* @returns {*} Returns the result of `func`.
|
|
*/
|
|
function apply(func, thisArg, args) {
|
|
switch (args.length) {
|
|
case 0: return func.call(thisArg);
|
|
case 1: return func.call(thisArg, args[0]);
|
|
case 2: return func.call(thisArg, args[0], args[1]);
|
|
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
}
|
|
return func.apply(thisArg, args);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseAggregator` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
setter(accumulator, value, iteratee(value), array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.forEach` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayEach(array, iteratee) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (iteratee(array[index], index, array) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.forEachRight` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayEachRight(array, iteratee) {
|
|
var length = array == null ? 0 : array.length;
|
|
|
|
while (length--) {
|
|
if (iteratee(array[length], length, array) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.every` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function arrayEvery(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (!predicate(array[index], index, array)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.filter` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
*/
|
|
function arrayFilter(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (predicate(value, index, array)) {
|
|
result[resIndex++] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.includes` for arrays without support for
|
|
* specifying an index to search from.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to inspect.
|
|
* @param {*} target The value to search for.
|
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
*/
|
|
function arrayIncludes(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
return !!length && baseIndexOf(array, value, 0) > -1;
|
|
}
|
|
|
|
/**
|
|
* This function is like `arrayIncludes` except that it accepts a comparator.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to inspect.
|
|
* @param {*} target The value to search for.
|
|
* @param {Function} comparator The comparator invoked per element.
|
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
*/
|
|
function arrayIncludesWith(array, value, comparator) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (comparator(value, array[index])) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.map` for arrays without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function arrayMap(array, iteratee) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
result = Array(length);
|
|
|
|
while (++index < length) {
|
|
result[index] = iteratee(array[index], index, array);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Appends the elements of `values` to `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to append.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayPush(array, values) {
|
|
var index = -1,
|
|
length = values.length,
|
|
offset = array.length;
|
|
|
|
while (++index < length) {
|
|
array[offset + index] = values[index];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.reduce` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
* the initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
if (initAccum && length) {
|
|
accumulator = array[++index];
|
|
}
|
|
while (++index < length) {
|
|
accumulator = iteratee(accumulator, array[index], index, array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.reduceRight` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
|
* the initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (initAccum && length) {
|
|
accumulator = array[--length];
|
|
}
|
|
while (length--) {
|
|
accumulator = iteratee(accumulator, array[length], length, array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.some` for arrays without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function arraySome(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (predicate(array[index], index, array)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Gets the size of an ASCII `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
var asciiSize = baseProperty('length');
|
|
|
|
/**
|
|
* Converts an ASCII `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function asciiToArray(string) {
|
|
return string.split('');
|
|
}
|
|
|
|
/**
|
|
* Splits an ASCII `string` into an array of its words.
|
|
*
|
|
* @private
|
|
* @param {string} The string to inspect.
|
|
* @returns {Array} Returns the words of `string`.
|
|
*/
|
|
function asciiWords(string) {
|
|
return string.match(reAsciiWord) || [];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
|
* without support for iteratee shorthands, which iterates over `collection`
|
|
* using `eachFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
|
*/
|
|
function baseFindKey(collection, predicate, eachFunc) {
|
|
var result;
|
|
eachFunc(collection, function(value, key, collection) {
|
|
if (predicate(value, key, collection)) {
|
|
result = key;
|
|
return false;
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
* support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
var length = array.length,
|
|
index = fromIndex + (fromRight ? 1 : -1);
|
|
|
|
while ((fromRight ? index-- : ++index < length)) {
|
|
if (predicate(array[index], index, array)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseIndexOf(array, value, fromIndex) {
|
|
return value === value
|
|
? strictIndexOf(array, value, fromIndex)
|
|
: baseFindIndex(array, baseIsNaN, fromIndex);
|
|
}
|
|
|
|
/**
|
|
* This function is like `baseIndexOf` except that it accepts a comparator.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @param {Function} comparator The comparator invoked per element.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseIndexOfWith(array, value, fromIndex, comparator) {
|
|
var index = fromIndex - 1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
if (comparator(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isNaN` without support for number objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
*/
|
|
function baseIsNaN(value) {
|
|
return value !== value;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.mean` and `_.meanBy` without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {number} Returns the mean.
|
|
*/
|
|
function baseMean(array, iteratee) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? (baseSum(array, iteratee) / length) : NAN;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.property` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {string} key The key of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function baseProperty(key) {
|
|
return function(object) {
|
|
return object == null ? undefined : object[key];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function basePropertyOf(object) {
|
|
return function(key) {
|
|
return object == null ? undefined : object[key];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
|
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} accumulator The initial value.
|
|
* @param {boolean} initAccum Specify using the first or last element of
|
|
* `collection` as the initial value.
|
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
|
eachFunc(collection, function(value, index, collection) {
|
|
accumulator = initAccum
|
|
? (initAccum = false, value)
|
|
: iteratee(accumulator, value, index, collection);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
* sort order of `array` and replaces criteria objects with their corresponding
|
|
* values.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sort.
|
|
* @param {Function} comparer The function to define sort order.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function baseSortBy(array, comparer) {
|
|
var length = array.length;
|
|
|
|
array.sort(comparer);
|
|
while (length--) {
|
|
array[length] = array[length].value;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sum` and `_.sumBy` without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {number} Returns the sum.
|
|
*/
|
|
function baseSum(array, iteratee) {
|
|
var result,
|
|
index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
var current = iteratee(array[index]);
|
|
if (current !== undefined) {
|
|
result = result === undefined ? current : (result + current);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.times` without support for iteratee shorthands
|
|
* or max array length checks.
|
|
*
|
|
* @private
|
|
* @param {number} n The number of times to invoke `iteratee`.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the array of results.
|
|
*/
|
|
function baseTimes(n, iteratee) {
|
|
var index = -1,
|
|
result = Array(n);
|
|
|
|
while (++index < n) {
|
|
result[index] = iteratee(index);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
|
|
* of key-value pairs for `object` corresponding to the property names of `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} props The property names to get values for.
|
|
* @returns {Object} Returns the key-value pairs.
|
|
*/
|
|
function baseToPairs(object, props) {
|
|
return arrayMap(props, function(key) {
|
|
return [key, object[key]];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.trim`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to trim.
|
|
* @returns {string} Returns the trimmed string.
|
|
*/
|
|
function baseTrim(string) {
|
|
return string
|
|
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.unary` without support for storing metadata.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @returns {Function} Returns the new capped function.
|
|
*/
|
|
function baseUnary(func) {
|
|
return function(value) {
|
|
return func(value);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
|
* array of `object` property values corresponding to the property names
|
|
* of `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} props The property names to get values for.
|
|
* @returns {Object} Returns the array of property values.
|
|
*/
|
|
function baseValues(object, props) {
|
|
return arrayMap(props, function(key) {
|
|
return object[key];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Checks if a `cache` value for `key` exists.
|
|
*
|
|
* @private
|
|
* @param {Object} cache The cache to query.
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function cacheHas(cache, key) {
|
|
return cache.has(key);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
|
|
* that is not found in the character symbols.
|
|
*
|
|
* @private
|
|
* @param {Array} strSymbols The string symbols to inspect.
|
|
* @param {Array} chrSymbols The character symbols to find.
|
|
* @returns {number} Returns the index of the first unmatched string symbol.
|
|
*/
|
|
function charsStartIndex(strSymbols, chrSymbols) {
|
|
var index = -1,
|
|
length = strSymbols.length;
|
|
|
|
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
|
|
* that is not found in the character symbols.
|
|
*
|
|
* @private
|
|
* @param {Array} strSymbols The string symbols to inspect.
|
|
* @param {Array} chrSymbols The character symbols to find.
|
|
* @returns {number} Returns the index of the last unmatched string symbol.
|
|
*/
|
|
function charsEndIndex(strSymbols, chrSymbols) {
|
|
var index = strSymbols.length;
|
|
|
|
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Gets the number of `placeholder` occurrences in `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} placeholder The placeholder to search for.
|
|
* @returns {number} Returns the placeholder count.
|
|
*/
|
|
function countHolders(array, placeholder) {
|
|
var length = array.length,
|
|
result = 0;
|
|
|
|
while (length--) {
|
|
if (array[length] === placeholder) {
|
|
++result;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
* letters to basic Latin letters.
|
|
*
|
|
* @private
|
|
* @param {string} letter The matched letter to deburr.
|
|
* @returns {string} Returns the deburred letter.
|
|
*/
|
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
|
|
/**
|
|
* Used by `_.escape` to convert characters to HTML entities.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to escape.
|
|
* @returns {string} Returns the escaped character.
|
|
*/
|
|
var escapeHtmlChar = basePropertyOf(htmlEscapes);
|
|
|
|
/**
|
|
* Used by `_.template` to escape characters for inclusion in compiled string literals.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to escape.
|
|
* @returns {string} Returns the escaped character.
|
|
*/
|
|
function escapeStringChar(chr) {
|
|
return '\\' + stringEscapes[chr];
|
|
}
|
|
|
|
/**
|
|
* Gets the value at `key` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {string} key The key of the property to get.
|
|
* @returns {*} Returns the property value.
|
|
*/
|
|
function getValue(object, key) {
|
|
return object == null ? undefined : object[key];
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` contains Unicode symbols.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
*/
|
|
function hasUnicode(string) {
|
|
return reHasUnicode.test(string);
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` contains a word composed of Unicode symbols.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
*/
|
|
function hasUnicodeWord(string) {
|
|
return reHasUnicodeWord.test(string);
|
|
}
|
|
|
|
/**
|
|
* Converts `iterator` to an array.
|
|
*
|
|
* @private
|
|
* @param {Object} iterator The iterator to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function iteratorToArray(iterator) {
|
|
var data,
|
|
result = [];
|
|
|
|
while (!(data = iterator.next()).done) {
|
|
result.push(data.value);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `map` to its key-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to convert.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
*/
|
|
function mapToArray(map) {
|
|
var index = -1,
|
|
result = Array(map.size);
|
|
|
|
map.forEach(function(value, key) {
|
|
result[++index] = [key, value];
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a unary function that invokes `func` with its argument transformed.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {Function} transform The argument transform.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function overArg(func, transform) {
|
|
return function(arg) {
|
|
return func(transform(arg));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Replaces all `placeholder` elements in `array` with an internal placeholder
|
|
* and returns an array of their indexes.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {*} placeholder The placeholder to replace.
|
|
* @returns {Array} Returns the new array of placeholder indexes.
|
|
*/
|
|
function replaceHolders(array, placeholder) {
|
|
var index = -1,
|
|
length = array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (value === placeholder || value === PLACEHOLDER) {
|
|
array[index] = PLACEHOLDER;
|
|
result[resIndex++] = index;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `set` to an array of its values.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to convert.
|
|
* @returns {Array} Returns the values.
|
|
*/
|
|
function setToArray(set) {
|
|
var index = -1,
|
|
result = Array(set.size);
|
|
|
|
set.forEach(function(value) {
|
|
result[++index] = value;
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `set` to its value-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to convert.
|
|
* @returns {Array} Returns the value-value pairs.
|
|
*/
|
|
function setToPairs(set) {
|
|
var index = -1,
|
|
result = Array(set.size);
|
|
|
|
set.forEach(function(value) {
|
|
result[++index] = [value, value];
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.indexOf` which performs strict equality
|
|
* comparisons of values, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function strictIndexOf(array, value, fromIndex) {
|
|
var index = fromIndex - 1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
if (array[index] === value) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.lastIndexOf` which performs strict equality
|
|
* comparisons of values, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function strictLastIndexOf(array, value, fromIndex) {
|
|
var index = fromIndex + 1;
|
|
while (index--) {
|
|
if (array[index] === value) {
|
|
return index;
|
|
}
|
|
}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Gets the number of symbols in `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function stringSize(string) {
|
|
return hasUnicode(string)
|
|
? unicodeSize(string)
|
|
: asciiSize(string);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function stringToArray(string) {
|
|
return hasUnicode(string)
|
|
? unicodeToArray(string)
|
|
: asciiToArray(string);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
* character of `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {number} Returns the index of the last non-whitespace character.
|
|
*/
|
|
function trimmedEndIndex(string) {
|
|
var index = string.length;
|
|
|
|
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.unescape` to convert HTML entities to characters.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to unescape.
|
|
* @returns {string} Returns the unescaped character.
|
|
*/
|
|
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
|
|
|
|
/**
|
|
* Gets the size of a Unicode `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function unicodeSize(string) {
|
|
var result = reUnicode.lastIndex = 0;
|
|
while (reUnicode.test(string)) {
|
|
++result;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts a Unicode `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function unicodeToArray(string) {
|
|
return string.match(reUnicode) || [];
|
|
}
|
|
|
|
/**
|
|
* Splits a Unicode `string` into an array of its words.
|
|
*
|
|
* @private
|
|
* @param {string} The string to inspect.
|
|
* @returns {Array} Returns the words of `string`.
|
|
*/
|
|
function unicodeWords(string) {
|
|
return string.match(reUnicodeWord) || [];
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Create a new pristine `lodash` function using the `context` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Util
|
|
* @param {Object} [context=root] The context object.
|
|
* @returns {Function} Returns a new `lodash` function.
|
|
* @example
|
|
*
|
|
* _.mixin({ 'foo': _.constant('foo') });
|
|
*
|
|
* var lodash = _.runInContext();
|
|
* lodash.mixin({ 'bar': lodash.constant('bar') });
|
|
*
|
|
* _.isFunction(_.foo);
|
|
* // => true
|
|
* _.isFunction(_.bar);
|
|
* // => false
|
|
*
|
|
* lodash.isFunction(lodash.foo);
|
|
* // => false
|
|
* lodash.isFunction(lodash.bar);
|
|
* // => true
|
|
*
|
|
* // Create a suped-up `defer` in Node.js.
|
|
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
|
|
*/
|
|
var runInContext = (function runInContext(context) {
|
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
|
|
/** Built-in constructor references. */
|
|
var Array = context.Array,
|
|
Date = context.Date,
|
|
Error = context.Error,
|
|
Function = context.Function,
|
|
Math = context.Math,
|
|
Object = context.Object,
|
|
RegExp = context.RegExp,
|
|
String = context.String,
|
|
TypeError = context.TypeError;
|
|
|
|
/** Used for built-in method references. */
|
|
var arrayProto = Array.prototype,
|
|
funcProto = Function.prototype,
|
|
objectProto = Object.prototype;
|
|
|
|
/** Used to detect overreaching core-js shims. */
|
|
var coreJsData = context['__core-js_shared__'];
|
|
|
|
/** Used to resolve the decompiled source of functions. */
|
|
var funcToString = funcProto.toString;
|
|
|
|
/** Used to check objects for own properties. */
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
/** Used to generate unique IDs. */
|
|
var idCounter = 0;
|
|
|
|
/** Used to detect methods masquerading as native. */
|
|
var maskSrcKey = (function() {
|
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
}());
|
|
|
|
/**
|
|
* Used to resolve the
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
* of values.
|
|
*/
|
|
var nativeObjectToString = objectProto.toString;
|
|
|
|
/** Used to infer the `Object` constructor. */
|
|
var objectCtorString = funcToString.call(Object);
|
|
|
|
/** Used to restore the original `_` reference in `_.noConflict`. */
|
|
var oldDash = root._;
|
|
|
|
/** Used to detect if a method is native. */
|
|
var reIsNative = RegExp('^' +
|
|
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
);
|
|
|
|
/** Built-in value references. */
|
|
var Buffer = moduleExports ? context.Buffer : undefined,
|
|
Symbol = context.Symbol,
|
|
Uint8Array = context.Uint8Array,
|
|
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
|
|
getPrototype = overArg(Object.getPrototypeOf, Object),
|
|
objectCreate = Object.create,
|
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
|
splice = arrayProto.splice,
|
|
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
|
|
symIterator = Symbol ? Symbol.iterator : undefined,
|
|
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
|
|
var defineProperty = (function() {
|
|
try {
|
|
var func = getNative(Object, 'defineProperty');
|
|
func({}, '', {});
|
|
return func;
|
|
} catch (e) {}
|
|
}());
|
|
|
|
/** Mocked built-ins. */
|
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
|
|
ctxNow = Date && Date.now !== root.Date.now && Date.now,
|
|
ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
var nativeCeil = Math.ceil,
|
|
nativeFloor = Math.floor,
|
|
nativeGetSymbols = Object.getOwnPropertySymbols,
|
|
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
|
nativeIsFinite = context.isFinite,
|
|
nativeJoin = arrayProto.join,
|
|
nativeKeys = overArg(Object.keys, Object),
|
|
nativeMax = Math.max,
|
|
nativeMin = Math.min,
|
|
nativeNow = Date.now,
|
|
nativeParseInt = context.parseInt,
|
|
nativeRandom = Math.random,
|
|
nativeReverse = arrayProto.reverse;
|
|
|
|
/* Built-in method references that are verified to be native. */
|
|
var DataView = getNative(context, 'DataView'),
|
|
Map = getNative(context, 'Map'),
|
|
Promise = getNative(context, 'Promise'),
|
|
Set = getNative(context, 'Set'),
|
|
WeakMap = getNative(context, 'WeakMap'),
|
|
nativeCreate = getNative(Object, 'create');
|
|
|
|
/** Used to store function metadata. */
|
|
var metaMap = WeakMap && new WeakMap;
|
|
|
|
/** Used to lookup unminified function names. */
|
|
var realNames = {};
|
|
|
|
/** Used to detect maps, sets, and weakmaps. */
|
|
var dataViewCtorString = toSource(DataView),
|
|
mapCtorString = toSource(Map),
|
|
promiseCtorString = toSource(Promise),
|
|
setCtorString = toSource(Set),
|
|
weakMapCtorString = toSource(WeakMap);
|
|
|
|
/** Used to convert symbols to primitives and strings. */
|
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
|
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a `lodash` object which wraps `value` to enable implicit method
|
|
* chain sequences. Methods that operate on and return arrays, collections,
|
|
* and functions can be chained together. Methods that retrieve a single value
|
|
* or may return a primitive value will automatically end the chain sequence
|
|
* and return the unwrapped value. Otherwise, the value must be unwrapped
|
|
* with `_#value`.
|
|
*
|
|
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
|
|
* enabled using `_.chain`.
|
|
*
|
|
* The execution of chained methods is lazy, that is, it's deferred until
|
|
* `_#value` is implicitly or explicitly called.
|
|
*
|
|
* Lazy evaluation allows several methods to support shortcut fusion.
|
|
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
|
* the creation of intermediate arrays and can greatly reduce the number of
|
|
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
|
* fusion if the section is applied to an array and iteratees accept only
|
|
* one argument. The heuristic for whether a section qualifies for shortcut
|
|
* fusion is subject to change.
|
|
*
|
|
* Chaining is supported in custom builds as long as the `_#value` method is
|
|
* directly or indirectly included in the build.
|
|
*
|
|
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
|
*
|
|
* The wrapper `Array` methods are:
|
|
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
|
|
*
|
|
* The wrapper `String` methods are:
|
|
* `replace` and `split`
|
|
*
|
|
* The wrapper methods that support shortcut fusion are:
|
|
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
|
|
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
|
|
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
|
|
*
|
|
* The chainable wrapper methods are:
|
|
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
|
|
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
|
|
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
|
|
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
|
|
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
|
|
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
|
|
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
|
|
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
|
|
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
|
|
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
|
|
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
|
|
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
|
|
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
|
|
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
|
|
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
|
|
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
|
|
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
|
|
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
|
|
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
|
|
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
|
|
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
|
|
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
|
|
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
|
|
* `zipObject`, `zipObjectDeep`, and `zipWith`
|
|
*
|
|
* The wrapper methods that are **not** chainable by default are:
|
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
|
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
|
|
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
|
|
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
|
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
|
|
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
|
|
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
|
|
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
|
|
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
|
|
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
|
|
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
|
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
|
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
|
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
|
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
|
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
|
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
|
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
|
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
|
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
|
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
|
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
|
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
|
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
|
* `upperFirst`, `value`, and `words`
|
|
*
|
|
* @name _
|
|
* @constructor
|
|
* @category Seq
|
|
* @param {*} value The value to wrap in a `lodash` instance.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var wrapped = _([1, 2, 3]);
|
|
*
|
|
* // Returns an unwrapped value.
|
|
* wrapped.reduce(_.add);
|
|
* // => 6
|
|
*
|
|
* // Returns a wrapped value.
|
|
* var squares = wrapped.map(square);
|
|
*
|
|
* _.isArray(squares);
|
|
* // => false
|
|
*
|
|
* _.isArray(squares.value());
|
|
* // => true
|
|
*/
|
|
function lodash(value) {
|
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
if (value instanceof LodashWrapper) {
|
|
return value;
|
|
}
|
|
if (hasOwnProperty.call(value, '__wrapped__')) {
|
|
return wrapperClone(value);
|
|
}
|
|
}
|
|
return new LodashWrapper(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.create` without support for assigning
|
|
* properties to the created object.
|
|
*
|
|
* @private
|
|
* @param {Object} proto The object to inherit from.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
var baseCreate = (function() {
|
|
function object() {}
|
|
return function(proto) {
|
|
if (!isObject(proto)) {
|
|
return {};
|
|
}
|
|
if (objectCreate) {
|
|
return objectCreate(proto);
|
|
}
|
|
object.prototype = proto;
|
|
var result = new object;
|
|
object.prototype = undefined;
|
|
return result;
|
|
};
|
|
}());
|
|
|
|
/**
|
|
* The function whose prototype chain sequence wrappers inherit from.
|
|
*
|
|
* @private
|
|
*/
|
|
function baseLodash() {
|
|
// No operation performed.
|
|
}
|
|
|
|
/**
|
|
* The base constructor for creating `lodash` wrapper objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to wrap.
|
|
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
|
*/
|
|
function LodashWrapper(value, chainAll) {
|
|
this.__wrapped__ = value;
|
|
this.__actions__ = [];
|
|
this.__chain__ = !!chainAll;
|
|
this.__index__ = 0;
|
|
this.__values__ = undefined;
|
|
}
|
|
|
|
/**
|
|
* By default, the template delimiters used by lodash are like those in
|
|
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
|
* following template settings to use alternative delimiters.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @type {Object}
|
|
*/
|
|
lodash.templateSettings = {
|
|
|
|
/**
|
|
* Used to detect `data` property values to be HTML-escaped.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'escape': reEscape,
|
|
|
|
/**
|
|
* Used to detect code to be evaluated.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'evaluate': reEvaluate,
|
|
|
|
/**
|
|
* Used to detect `data` property values to inject.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'interpolate': reInterpolate,
|
|
|
|
/**
|
|
* Used to reference the data object in the template text.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {string}
|
|
*/
|
|
'variable': '',
|
|
|
|
/**
|
|
* Used to import variables into the compiled template.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {Object}
|
|
*/
|
|
'imports': {
|
|
|
|
/**
|
|
* A reference to the `lodash` function.
|
|
*
|
|
* @memberOf _.templateSettings.imports
|
|
* @type {Function}
|
|
*/
|
|
'_': lodash
|
|
}
|
|
};
|
|
|
|
// Ensure wrappers are instances of `baseLodash`.
|
|
lodash.prototype = baseLodash.prototype;
|
|
lodash.prototype.constructor = lodash;
|
|
|
|
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
|
|
LodashWrapper.prototype.constructor = LodashWrapper;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {*} value The value to wrap.
|
|
*/
|
|
function LazyWrapper(value) {
|
|
this.__wrapped__ = value;
|
|
this.__actions__ = [];
|
|
this.__dir__ = 1;
|
|
this.__filtered__ = false;
|
|
this.__iteratees__ = [];
|
|
this.__takeCount__ = MAX_ARRAY_LENGTH;
|
|
this.__views__ = [];
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the lazy wrapper object.
|
|
*
|
|
* @private
|
|
* @name clone
|
|
* @memberOf LazyWrapper
|
|
* @returns {Object} Returns the cloned `LazyWrapper` object.
|
|
*/
|
|
function lazyClone() {
|
|
var result = new LazyWrapper(this.__wrapped__);
|
|
result.__actions__ = copyArray(this.__actions__);
|
|
result.__dir__ = this.__dir__;
|
|
result.__filtered__ = this.__filtered__;
|
|
result.__iteratees__ = copyArray(this.__iteratees__);
|
|
result.__takeCount__ = this.__takeCount__;
|
|
result.__views__ = copyArray(this.__views__);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Reverses the direction of lazy iteration.
|
|
*
|
|
* @private
|
|
* @name reverse
|
|
* @memberOf LazyWrapper
|
|
* @returns {Object} Returns the new reversed `LazyWrapper` object.
|
|
*/
|
|
function lazyReverse() {
|
|
if (this.__filtered__) {
|
|
var result = new LazyWrapper(this);
|
|
result.__dir__ = -1;
|
|
result.__filtered__ = true;
|
|
} else {
|
|
result = this.clone();
|
|
result.__dir__ *= -1;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extracts the unwrapped value from its lazy wrapper.
|
|
*
|
|
* @private
|
|
* @name value
|
|
* @memberOf LazyWrapper
|
|
* @returns {*} Returns the unwrapped value.
|
|
*/
|
|
function lazyValue() {
|
|
var array = this.__wrapped__.value(),
|
|
dir = this.__dir__,
|
|
isArr = isArray(array),
|
|
isRight = dir < 0,
|
|
arrLength = isArr ? array.length : 0,
|
|
view = getView(0, arrLength, this.__views__),
|
|
start = view.start,
|
|
end = view.end,
|
|
length = end - start,
|
|
index = isRight ? end : (start - 1),
|
|
iteratees = this.__iteratees__,
|
|
iterLength = iteratees.length,
|
|
resIndex = 0,
|
|
takeCount = nativeMin(length, this.__takeCount__);
|
|
|
|
if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
|
|
return baseWrapperValue(array, this.__actions__);
|
|
}
|
|
var result = [];
|
|
|
|
outer:
|
|
while (length-- && resIndex < takeCount) {
|
|
index += dir;
|
|
|
|
var iterIndex = -1,
|
|
value = array[index];
|
|
|
|
while (++iterIndex < iterLength) {
|
|
var data = iteratees[iterIndex],
|
|
iteratee = data.iteratee,
|
|
type = data.type,
|
|
computed = iteratee(value);
|
|
|
|
if (type == LAZY_MAP_FLAG) {
|
|
value = computed;
|
|
} else if (!computed) {
|
|
if (type == LAZY_FILTER_FLAG) {
|
|
continue outer;
|
|
} else {
|
|
break outer;
|
|
}
|
|
}
|
|
}
|
|
result[resIndex++] = value;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Ensure `LazyWrapper` is an instance of `baseLodash`.
|
|
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
|
LazyWrapper.prototype.constructor = LazyWrapper;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a hash object.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function Hash(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the hash.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf Hash
|
|
*/
|
|
function hashClear() {
|
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the hash.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf Hash
|
|
* @param {Object} hash The hash to modify.
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function hashDelete(key) {
|
|
var result = this.has(key) && delete this.__data__[key];
|
|
this.size -= result ? 1 : 0;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the hash value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function hashGet(key) {
|
|
var data = this.__data__;
|
|
if (nativeCreate) {
|
|
var result = data[key];
|
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
}
|
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
}
|
|
|
|
/**
|
|
* Checks if a hash value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function hashHas(key) {
|
|
var data = this.__data__;
|
|
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
}
|
|
|
|
/**
|
|
* Sets the hash `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the hash instance.
|
|
*/
|
|
function hashSet(key, value) {
|
|
var data = this.__data__;
|
|
this.size += this.has(key) ? 0 : 1;
|
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `Hash`.
|
|
Hash.prototype.clear = hashClear;
|
|
Hash.prototype['delete'] = hashDelete;
|
|
Hash.prototype.get = hashGet;
|
|
Hash.prototype.has = hashHas;
|
|
Hash.prototype.set = hashSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an list cache object.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function ListCache(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the list cache.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf ListCache
|
|
*/
|
|
function listCacheClear() {
|
|
this.__data__ = [];
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the list cache.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function listCacheDelete(key) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
if (index < 0) {
|
|
return false;
|
|
}
|
|
var lastIndex = data.length - 1;
|
|
if (index == lastIndex) {
|
|
data.pop();
|
|
} else {
|
|
splice.call(data, index, 1);
|
|
}
|
|
--this.size;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Gets the list cache value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function listCacheGet(key) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
return index < 0 ? undefined : data[index][1];
|
|
}
|
|
|
|
/**
|
|
* Checks if a list cache value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function listCacheHas(key) {
|
|
return assocIndexOf(this.__data__, key) > -1;
|
|
}
|
|
|
|
/**
|
|
* Sets the list cache `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the list cache instance.
|
|
*/
|
|
function listCacheSet(key, value) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
if (index < 0) {
|
|
++this.size;
|
|
data.push([key, value]);
|
|
} else {
|
|
data[index][1] = value;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `ListCache`.
|
|
ListCache.prototype.clear = listCacheClear;
|
|
ListCache.prototype['delete'] = listCacheDelete;
|
|
ListCache.prototype.get = listCacheGet;
|
|
ListCache.prototype.has = listCacheHas;
|
|
ListCache.prototype.set = listCacheSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a map cache object to store key-value pairs.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function MapCache(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the map.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf MapCache
|
|
*/
|
|
function mapCacheClear() {
|
|
this.size = 0;
|
|
this.__data__ = {
|
|
'hash': new Hash,
|
|
'map': new (Map || ListCache),
|
|
'string': new Hash
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the map.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function mapCacheDelete(key) {
|
|
var result = getMapData(this, key)['delete'](key);
|
|
this.size -= result ? 1 : 0;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the map value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function mapCacheGet(key) {
|
|
return getMapData(this, key).get(key);
|
|
}
|
|
|
|
/**
|
|
* Checks if a map value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function mapCacheHas(key) {
|
|
return getMapData(this, key).has(key);
|
|
}
|
|
|
|
/**
|
|
* Sets the map `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the map cache instance.
|
|
*/
|
|
function mapCacheSet(key, value) {
|
|
var data = getMapData(this, key),
|
|
size = data.size;
|
|
|
|
data.set(key, value);
|
|
this.size += data.size == size ? 0 : 1;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `MapCache`.
|
|
MapCache.prototype.clear = mapCacheClear;
|
|
MapCache.prototype['delete'] = mapCacheDelete;
|
|
MapCache.prototype.get = mapCacheGet;
|
|
MapCache.prototype.has = mapCacheHas;
|
|
MapCache.prototype.set = mapCacheSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
*
|
|
* Creates an array cache object to store unique values.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [values] The values to cache.
|
|
*/
|
|
function SetCache(values) {
|
|
var index = -1,
|
|
length = values == null ? 0 : values.length;
|
|
|
|
this.__data__ = new MapCache;
|
|
while (++index < length) {
|
|
this.add(values[index]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Adds `value` to the array cache.
|
|
*
|
|
* @private
|
|
* @name add
|
|
* @memberOf SetCache
|
|
* @alias push
|
|
* @param {*} value The value to cache.
|
|
* @returns {Object} Returns the cache instance.
|
|
*/
|
|
function setCacheAdd(value) {
|
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is in the array cache.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf SetCache
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
*/
|
|
function setCacheHas(value) {
|
|
return this.__data__.has(value);
|
|
}
|
|
|
|
// Add methods to `SetCache`.
|
|
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
SetCache.prototype.has = setCacheHas;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a stack cache object to store key-value pairs.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function Stack(entries) {
|
|
var data = this.__data__ = new ListCache(entries);
|
|
this.size = data.size;
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the stack.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf Stack
|
|
*/
|
|
function stackClear() {
|
|
this.__data__ = new ListCache;
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the stack.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function stackDelete(key) {
|
|
var data = this.__data__,
|
|
result = data['delete'](key);
|
|
|
|
this.size = data.size;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the stack value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function stackGet(key) {
|
|
return this.__data__.get(key);
|
|
}
|
|
|
|
/**
|
|
* Checks if a stack value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function stackHas(key) {
|
|
return this.__data__.has(key);
|
|
}
|
|
|
|
/**
|
|
* Sets the stack `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the stack cache instance.
|
|
*/
|
|
function stackSet(key, value) {
|
|
var data = this.__data__;
|
|
if (data instanceof ListCache) {
|
|
var pairs = data.__data__;
|
|
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
pairs.push([key, value]);
|
|
this.size = ++data.size;
|
|
return this;
|
|
}
|
|
data = this.__data__ = new MapCache(pairs);
|
|
}
|
|
data.set(key, value);
|
|
this.size = data.size;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `Stack`.
|
|
Stack.prototype.clear = stackClear;
|
|
Stack.prototype['delete'] = stackDelete;
|
|
Stack.prototype.get = stackGet;
|
|
Stack.prototype.has = stackHas;
|
|
Stack.prototype.set = stackSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @param {boolean} inherited Specify returning inherited property names.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function arrayLikeKeys(value, inherited) {
|
|
var isArr = isArray(value),
|
|
isArg = !isArr && isArguments(value),
|
|
isBuff = !isArr && !isArg && isBuffer(value),
|
|
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
skipIndexes = isArr || isArg || isBuff || isType,
|
|
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
length = result.length;
|
|
|
|
for (var key in value) {
|
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
!(skipIndexes && (
|
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
key == 'length' ||
|
|
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
// Skip index properties.
|
|
isIndex(key, length)
|
|
))) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.sample` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sample.
|
|
* @returns {*} Returns the random element.
|
|
*/
|
|
function arraySample(array) {
|
|
var length = array.length;
|
|
return length ? array[baseRandom(0, length - 1)] : undefined;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.sampleSize` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sample.
|
|
* @param {number} n The number of elements to sample.
|
|
* @returns {Array} Returns the random elements.
|
|
*/
|
|
function arraySampleSize(array, n) {
|
|
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.shuffle` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
*/
|
|
function arrayShuffle(array) {
|
|
return shuffleSelf(copyArray(array));
|
|
}
|
|
|
|
/**
|
|
* This function is like `assignValue` except that it doesn't assign
|
|
* `undefined` values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function assignMergeValue(object, key, value) {
|
|
if ((value !== undefined && !eq(object[key], value)) ||
|
|
(value === undefined && !(key in object))) {
|
|
baseAssignValue(object, key, value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function assignValue(object, key, value) {
|
|
var objValue = object[key];
|
|
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
|
(value === undefined && !(key in object))) {
|
|
baseAssignValue(object, key, value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} key The key to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function assocIndexOf(array, key) {
|
|
var length = array.length;
|
|
while (length--) {
|
|
if (eq(array[length][0], key)) {
|
|
return length;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
|
* by `iteratee` and values set by `setter`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function baseAggregator(collection, setter, iteratee, accumulator) {
|
|
baseEach(collection, function(value, key, collection) {
|
|
setter(accumulator, value, iteratee(value), collection);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.assign` without support for multiple sources
|
|
* or `customizer` functions.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseAssign(object, source) {
|
|
return object && copyObject(source, keys(source), object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.assignIn` without support for multiple sources
|
|
* or `customizer` functions.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseAssignIn(object, source) {
|
|
return object && copyObject(source, keysIn(source), object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
* value checks.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function baseAssignValue(object, key, value) {
|
|
if (key == '__proto__' && defineProperty) {
|
|
defineProperty(object, key, {
|
|
'configurable': true,
|
|
'enumerable': true,
|
|
'value': value,
|
|
'writable': true
|
|
});
|
|
} else {
|
|
object[key] = value;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.at` without support for individual paths.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @returns {Array} Returns the picked elements.
|
|
*/
|
|
function baseAt(object, paths) {
|
|
var index = -1,
|
|
length = paths.length,
|
|
result = Array(length),
|
|
skip = object == null;
|
|
|
|
while (++index < length) {
|
|
result[index] = skip ? undefined : get(object, paths[index]);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} number The number to clamp.
|
|
* @param {number} [lower] The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the clamped number.
|
|
*/
|
|
function baseClamp(number, lower, upper) {
|
|
if (number === number) {
|
|
if (upper !== undefined) {
|
|
number = number <= upper ? number : upper;
|
|
}
|
|
if (lower !== undefined) {
|
|
number = number >= lower ? number : lower;
|
|
}
|
|
}
|
|
return number;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
* traversed objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to clone.
|
|
* @param {boolean} bitmask The bitmask flags.
|
|
* 1 - Deep clone
|
|
* 2 - Flatten inherited properties
|
|
* 4 - Clone symbols
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @param {string} [key] The key of `value`.
|
|
* @param {Object} [object] The parent object of `value`.
|
|
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
* @returns {*} Returns the cloned value.
|
|
*/
|
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
var result,
|
|
isDeep = bitmask & CLONE_DEEP_FLAG,
|
|
isFlat = bitmask & CLONE_FLAT_FLAG,
|
|
isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
|
|
|
if (customizer) {
|
|
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
}
|
|
if (result !== undefined) {
|
|
return result;
|
|
}
|
|
if (!isObject(value)) {
|
|
return value;
|
|
}
|
|
var isArr = isArray(value);
|
|
if (isArr) {
|
|
result = initCloneArray(value);
|
|
if (!isDeep) {
|
|
return copyArray(value, result);
|
|
}
|
|
} else {
|
|
var tag = getTag(value),
|
|
isFunc = tag == funcTag || tag == genTag;
|
|
|
|
if (isBuffer(value)) {
|
|
return cloneBuffer(value, isDeep);
|
|
}
|
|
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
result = (isFlat || isFunc) ? {} : initCloneObject(value);
|
|
if (!isDeep) {
|
|
return isFlat
|
|
? copySymbolsIn(value, baseAssignIn(result, value))
|
|
: copySymbols(value, baseAssign(result, value));
|
|
}
|
|
} else {
|
|
if (!cloneableTags[tag]) {
|
|
return object ? value : {};
|
|
}
|
|
result = initCloneByTag(value, tag, isDeep);
|
|
}
|
|
}
|
|
// Check for circular references and return its corresponding clone.
|
|
stack || (stack = new Stack);
|
|
var stacked = stack.get(value);
|
|
if (stacked) {
|
|
return stacked;
|
|
}
|
|
stack.set(value, result);
|
|
|
|
if (isSet(value)) {
|
|
value.forEach(function(subValue) {
|
|
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
});
|
|
} else if (isMap(value)) {
|
|
value.forEach(function(subValue, key) {
|
|
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
});
|
|
}
|
|
|
|
var keysFunc = isFull
|
|
? (isFlat ? getAllKeysIn : getAllKeys)
|
|
: (isFlat ? keysIn : keys);
|
|
|
|
var props = isArr ? undefined : keysFunc(value);
|
|
arrayEach(props || value, function(subValue, key) {
|
|
if (props) {
|
|
key = subValue;
|
|
subValue = value[key];
|
|
}
|
|
// Recursively populate clone (susceptible to call stack limits).
|
|
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.conforms` which doesn't clone `source`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseConforms(source) {
|
|
var props = keys(source);
|
|
return function(object) {
|
|
return baseConformsTo(object, source, props);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
|
*/
|
|
function baseConformsTo(object, source, props) {
|
|
var length = props.length;
|
|
if (object == null) {
|
|
return !length;
|
|
}
|
|
object = Object(object);
|
|
while (length--) {
|
|
var key = props[length],
|
|
predicate = source[key],
|
|
value = object[key];
|
|
|
|
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.delay` and `_.defer` which accepts `args`
|
|
* to provide to `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @param {Array} args The arguments to provide to `func`.
|
|
* @returns {number|Object} Returns the timer id or timeout object.
|
|
*/
|
|
function baseDelay(func, wait, args) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return setTimeout(function() { func.apply(undefined, args); }, wait);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.difference` without support
|
|
* for excluding multiple arrays or iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Array} values The values to exclude.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
*/
|
|
function baseDifference(array, values, iteratee, comparator) {
|
|
var index = -1,
|
|
includes = arrayIncludes,
|
|
isCommon = true,
|
|
length = array.length,
|
|
result = [],
|
|
valuesLength = values.length;
|
|
|
|
if (!length) {
|
|
return result;
|
|
}
|
|
if (iteratee) {
|
|
values = arrayMap(values, baseUnary(iteratee));
|
|
}
|
|
if (comparator) {
|
|
includes = arrayIncludesWith;
|
|
isCommon = false;
|
|
}
|
|
else if (values.length >= LARGE_ARRAY_SIZE) {
|
|
includes = cacheHas;
|
|
isCommon = false;
|
|
values = new SetCache(values);
|
|
}
|
|
outer:
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee == null ? value : iteratee(value);
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (isCommon && computed === computed) {
|
|
var valuesIndex = valuesLength;
|
|
while (valuesIndex--) {
|
|
if (values[valuesIndex] === computed) {
|
|
continue outer;
|
|
}
|
|
}
|
|
result.push(value);
|
|
}
|
|
else if (!includes(values, computed, comparator)) {
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
*/
|
|
var baseEach = createBaseEach(baseForOwn);
|
|
|
|
/**
|
|
* The base implementation of `_.forEachRight` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
*/
|
|
var baseEachRight = createBaseEach(baseForOwnRight, true);
|
|
|
|
/**
|
|
* The base implementation of `_.every` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`
|
|
*/
|
|
function baseEvery(collection, predicate) {
|
|
var result = true;
|
|
baseEach(collection, function(value, index, collection) {
|
|
result = !!predicate(value, index, collection);
|
|
return result;
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
|
* `comparator` to determine the extremum value.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The iteratee invoked per iteration.
|
|
* @param {Function} comparator The comparator used to compare values.
|
|
* @returns {*} Returns the extremum value.
|
|
*/
|
|
function baseExtremum(array, iteratee, comparator) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
current = iteratee(value);
|
|
|
|
if (current != null && (computed === undefined
|
|
? (current === current && !isSymbol(current))
|
|
: comparator(current, computed)
|
|
)) {
|
|
var computed = current,
|
|
result = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.fill` without an iteratee call guard.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to fill.
|
|
* @param {*} value The value to fill `array` with.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function baseFill(array, value, start, end) {
|
|
var length = array.length;
|
|
|
|
start = toInteger(start);
|
|
if (start < 0) {
|
|
start = -start > length ? 0 : (length + start);
|
|
}
|
|
end = (end === undefined || end > length) ? length : toInteger(end);
|
|
if (end < 0) {
|
|
end += length;
|
|
}
|
|
end = start > end ? 0 : toLength(end);
|
|
while (start < end) {
|
|
array[start++] = value;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.filter` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
*/
|
|
function baseFilter(collection, predicate) {
|
|
var result = [];
|
|
baseEach(collection, function(value, index, collection) {
|
|
if (predicate(value, index, collection)) {
|
|
result.push(value);
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to flatten.
|
|
* @param {number} depth The maximum recursion depth.
|
|
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
* @param {Array} [result=[]] The initial result value.
|
|
* @returns {Array} Returns the new flattened array.
|
|
*/
|
|
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
predicate || (predicate = isFlattenable);
|
|
result || (result = []);
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (depth > 0 && predicate(value)) {
|
|
if (depth > 1) {
|
|
// Recursively flatten arrays (susceptible to call stack limits).
|
|
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
} else {
|
|
arrayPush(result, value);
|
|
}
|
|
} else if (!isStrict) {
|
|
result[result.length] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `baseForOwn` which iterates over `object`
|
|
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
var baseFor = createBaseFor();
|
|
|
|
/**
|
|
* This function is like `baseFor` except that it iterates over properties
|
|
* in the opposite order.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
var baseForRight = createBaseFor(true);
|
|
|
|
/**
|
|
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseForOwn(object, iteratee) {
|
|
return object && baseFor(object, iteratee, keys);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.forOwnRight` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseForOwnRight(object, iteratee) {
|
|
return object && baseForRight(object, iteratee, keys);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.functions` which creates an array of
|
|
* `object` function property names filtered from `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Array} props The property names to filter.
|
|
* @returns {Array} Returns the function names.
|
|
*/
|
|
function baseFunctions(object, props) {
|
|
return arrayFilter(props, function(key) {
|
|
return isFunction(object[key]);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.get` without support for default values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {*} Returns the resolved value.
|
|
*/
|
|
function baseGet(object, path) {
|
|
path = castPath(path, object);
|
|
|
|
var index = 0,
|
|
length = path.length;
|
|
|
|
while (object != null && index < length) {
|
|
object = object[toKey(path[index++])];
|
|
}
|
|
return (index && index == length) ? object : undefined;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
* symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
var result = keysFunc(object);
|
|
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the `toStringTag`.
|
|
*/
|
|
function baseGetTag(value) {
|
|
if (value == null) {
|
|
return value === undefined ? undefinedTag : nullTag;
|
|
}
|
|
return (symToStringTag && symToStringTag in Object(value))
|
|
? getRawTag(value)
|
|
: objectToString(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.gt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseGt(value, other) {
|
|
return value > other;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.has` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {Array|string} key The key to check.
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
*/
|
|
function baseHas(object, key) {
|
|
return object != null && hasOwnProperty.call(object, key);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.hasIn` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {Array|string} key The key to check.
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
*/
|
|
function baseHasIn(object, key) {
|
|
return object != null && key in Object(object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.inRange` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} number The number to check.
|
|
* @param {number} start The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
|
|
*/
|
|
function baseInRange(number, start, end) {
|
|
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.intersection`, without support
|
|
* for iteratee shorthands, that accepts an array of arrays to inspect.
|
|
*
|
|
* @private
|
|
* @param {Array} arrays The arrays to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of shared values.
|
|
*/
|
|
function baseIntersection(arrays, iteratee, comparator) {
|
|
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
|
length = arrays[0].length,
|
|
othLength = arrays.length,
|
|
othIndex = othLength,
|
|
caches = Array(othLength),
|
|
maxLength = Infinity,
|
|
result = [];
|
|
|
|
while (othIndex--) {
|
|
var array = arrays[othIndex];
|
|
if (othIndex && iteratee) {
|
|
array = arrayMap(array, baseUnary(iteratee));
|
|
}
|
|
maxLength = nativeMin(array.length, maxLength);
|
|
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
|
? new SetCache(othIndex && array)
|
|
: undefined;
|
|
}
|
|
array = arrays[0];
|
|
|
|
var index = -1,
|
|
seen = caches[0];
|
|
|
|
outer:
|
|
while (++index < length && result.length < maxLength) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (!(seen
|
|
? cacheHas(seen, computed)
|
|
: includes(result, computed, comparator)
|
|
)) {
|
|
othIndex = othLength;
|
|
while (--othIndex) {
|
|
var cache = caches[othIndex];
|
|
if (!(cache
|
|
? cacheHas(cache, computed)
|
|
: includes(arrays[othIndex], computed, comparator))
|
|
) {
|
|
continue outer;
|
|
}
|
|
}
|
|
if (seen) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.invert` and `_.invertBy` which inverts
|
|
* `object` with values transformed by `iteratee` and set by `setter`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform values.
|
|
* @param {Object} accumulator The initial inverted object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function baseInverter(object, setter, iteratee, accumulator) {
|
|
baseForOwn(object, function(value, key, object) {
|
|
setter(accumulator, iteratee(value), key, object);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.invoke` without support for individual
|
|
* method arguments.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {Array} args The arguments to invoke the method with.
|
|
* @returns {*} Returns the result of the invoked method.
|
|
*/
|
|
function baseInvoke(object, path, args) {
|
|
path = castPath(path, object);
|
|
object = parent(object, path);
|
|
var func = object == null ? object : object[toKey(last(path))];
|
|
return func == null ? undefined : apply(func, object, args);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isArguments`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
*/
|
|
function baseIsArguments(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
|
*/
|
|
function baseIsArrayBuffer(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isDate` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
|
*/
|
|
function baseIsDate(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == dateTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
* and tracks traversed objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @param {boolean} bitmask The bitmask flags.
|
|
* 1 - Unordered comparison
|
|
* 2 - Partial comparison
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
*/
|
|
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
if (value === other) {
|
|
return true;
|
|
}
|
|
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
return value !== value && other !== other;
|
|
}
|
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
* references to be compared.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var objIsArr = isArray(object),
|
|
othIsArr = isArray(other),
|
|
objTag = objIsArr ? arrayTag : getTag(object),
|
|
othTag = othIsArr ? arrayTag : getTag(other);
|
|
|
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
|
|
var objIsObj = objTag == objectTag,
|
|
othIsObj = othTag == objectTag,
|
|
isSameTag = objTag == othTag;
|
|
|
|
if (isSameTag && isBuffer(object)) {
|
|
if (!isBuffer(other)) {
|
|
return false;
|
|
}
|
|
objIsArr = true;
|
|
objIsObj = false;
|
|
}
|
|
if (isSameTag && !objIsObj) {
|
|
stack || (stack = new Stack);
|
|
return (objIsArr || isTypedArray(object))
|
|
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
|
|
if (objIsWrapped || othIsWrapped) {
|
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
|
|
stack || (stack = new Stack);
|
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
}
|
|
}
|
|
if (!isSameTag) {
|
|
return false;
|
|
}
|
|
stack || (stack = new Stack);
|
|
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
*/
|
|
function baseIsMap(value) {
|
|
return isObjectLike(value) && getTag(value) == mapTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
*/
|
|
function baseIsMatch(object, source, matchData, customizer) {
|
|
var index = matchData.length,
|
|
length = index,
|
|
noCustomizer = !customizer;
|
|
|
|
if (object == null) {
|
|
return !length;
|
|
}
|
|
object = Object(object);
|
|
while (index--) {
|
|
var data = matchData[index];
|
|
if ((noCustomizer && data[2])
|
|
? data[1] !== object[data[0]]
|
|
: !(data[0] in object)
|
|
) {
|
|
return false;
|
|
}
|
|
}
|
|
while (++index < length) {
|
|
data = matchData[index];
|
|
var key = data[0],
|
|
objValue = object[key],
|
|
srcValue = data[1];
|
|
|
|
if (noCustomizer && data[2]) {
|
|
if (objValue === undefined && !(key in object)) {
|
|
return false;
|
|
}
|
|
} else {
|
|
var stack = new Stack;
|
|
if (customizer) {
|
|
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
}
|
|
if (!(result === undefined
|
|
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
|
: result
|
|
)) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isNative` without bad shim checks.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
* else `false`.
|
|
*/
|
|
function baseIsNative(value) {
|
|
if (!isObject(value) || isMasked(value)) {
|
|
return false;
|
|
}
|
|
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
return pattern.test(toSource(value));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isRegExp` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
|
*/
|
|
function baseIsRegExp(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == regexpTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
*/
|
|
function baseIsSet(value) {
|
|
return isObjectLike(value) && getTag(value) == setTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
*/
|
|
function baseIsTypedArray(value) {
|
|
return isObjectLike(value) &&
|
|
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.iteratee`.
|
|
*
|
|
* @private
|
|
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
* @returns {Function} Returns the iteratee.
|
|
*/
|
|
function baseIteratee(value) {
|
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
if (typeof value == 'function') {
|
|
return value;
|
|
}
|
|
if (value == null) {
|
|
return identity;
|
|
}
|
|
if (typeof value == 'object') {
|
|
return isArray(value)
|
|
? baseMatchesProperty(value[0], value[1])
|
|
: baseMatches(value);
|
|
}
|
|
return property(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function baseKeys(object) {
|
|
if (!isPrototype(object)) {
|
|
return nativeKeys(object);
|
|
}
|
|
var result = [];
|
|
for (var key in Object(object)) {
|
|
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function baseKeysIn(object) {
|
|
if (!isObject(object)) {
|
|
return nativeKeysIn(object);
|
|
}
|
|
var isProto = isPrototype(object),
|
|
result = [];
|
|
|
|
for (var key in object) {
|
|
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.lt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseLt(value, other) {
|
|
return value < other;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function baseMap(collection, iteratee) {
|
|
var index = -1,
|
|
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
|
|
baseEach(collection, function(value, key, collection) {
|
|
result[++index] = iteratee(value, key, collection);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseMatches(source) {
|
|
var matchData = getMatchData(source);
|
|
if (matchData.length == 1 && matchData[0][2]) {
|
|
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
}
|
|
return function(object) {
|
|
return object === source || baseIsMatch(object, source, matchData);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
*
|
|
* @private
|
|
* @param {string} path The path of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseMatchesProperty(path, srcValue) {
|
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
return matchesStrictComparable(toKey(path), srcValue);
|
|
}
|
|
return function(object) {
|
|
var objValue = get(object, path);
|
|
return (objValue === undefined && objValue === srcValue)
|
|
? hasIn(object, path)
|
|
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.merge` without support for multiple sources.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @param {number} srcIndex The index of `source`.
|
|
* @param {Function} [customizer] The function to customize merged values.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
*/
|
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
if (object === source) {
|
|
return;
|
|
}
|
|
baseFor(source, function(srcValue, key) {
|
|
stack || (stack = new Stack);
|
|
if (isObject(srcValue)) {
|
|
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
}
|
|
else {
|
|
var newValue = customizer
|
|
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
|
: undefined;
|
|
|
|
if (newValue === undefined) {
|
|
newValue = srcValue;
|
|
}
|
|
assignMergeValue(object, key, newValue);
|
|
}
|
|
}, keysIn);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
* deep merges and tracks traversed objects enabling objects with circular
|
|
* references to be merged.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @param {string} key The key of the value to merge.
|
|
* @param {number} srcIndex The index of `source`.
|
|
* @param {Function} mergeFunc The function to merge values.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
*/
|
|
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
var objValue = safeGet(object, key),
|
|
srcValue = safeGet(source, key),
|
|
stacked = stack.get(srcValue);
|
|
|
|
if (stacked) {
|
|
assignMergeValue(object, key, stacked);
|
|
return;
|
|
}
|
|
var newValue = customizer
|
|
? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
|
: undefined;
|
|
|
|
var isCommon = newValue === undefined;
|
|
|
|
if (isCommon) {
|
|
var isArr = isArray(srcValue),
|
|
isBuff = !isArr && isBuffer(srcValue),
|
|
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
|
|
newValue = srcValue;
|
|
if (isArr || isBuff || isTyped) {
|
|
if (isArray(objValue)) {
|
|
newValue = objValue;
|
|
}
|
|
else if (isArrayLikeObject(objValue)) {
|
|
newValue = copyArray(objValue);
|
|
}
|
|
else if (isBuff) {
|
|
isCommon = false;
|
|
newValue = cloneBuffer(srcValue, true);
|
|
}
|
|
else if (isTyped) {
|
|
isCommon = false;
|
|
newValue = cloneTypedArray(srcValue, true);
|
|
}
|
|
else {
|
|
newValue = [];
|
|
}
|
|
}
|
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
newValue = objValue;
|
|
if (isArguments(objValue)) {
|
|
newValue = toPlainObject(objValue);
|
|
}
|
|
else if (!isObject(objValue) || isFunction(objValue)) {
|
|
newValue = initCloneObject(srcValue);
|
|
}
|
|
}
|
|
else {
|
|
isCommon = false;
|
|
}
|
|
}
|
|
if (isCommon) {
|
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
stack.set(srcValue, newValue);
|
|
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
stack['delete'](srcValue);
|
|
}
|
|
assignMergeValue(object, key, newValue);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.nth` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to query.
|
|
* @param {number} n The index of the element to return.
|
|
* @returns {*} Returns the nth element of `array`.
|
|
*/
|
|
function baseNth(array, n) {
|
|
var length = array.length;
|
|
if (!length) {
|
|
return;
|
|
}
|
|
n += n < 0 ? length : 0;
|
|
return isIndex(n, length) ? array[n] : undefined;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.orderBy` without param guards.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
* @param {string[]} orders The sort orders of `iteratees`.
|
|
* @returns {Array} Returns the new sorted array.
|
|
*/
|
|
function baseOrderBy(collection, iteratees, orders) {
|
|
if (iteratees.length) {
|
|
iteratees = arrayMap(iteratees, function(iteratee) {
|
|
if (isArray(iteratee)) {
|
|
return function(value) {
|
|
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
}
|
|
}
|
|
return iteratee;
|
|
});
|
|
} else {
|
|
iteratees = [identity];
|
|
}
|
|
|
|
var index = -1;
|
|
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
|
|
|
|
var result = baseMap(collection, function(value, key, collection) {
|
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
|
return iteratee(value);
|
|
});
|
|
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
});
|
|
|
|
return baseSortBy(result, function(object, other) {
|
|
return compareMultiple(object, other, orders);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pick` without support for individual
|
|
* property identifiers.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePick(object, paths) {
|
|
return basePickBy(object, paths, function(value, path) {
|
|
return hasIn(object, path);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @param {Function} predicate The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePickBy(object, paths, predicate) {
|
|
var index = -1,
|
|
length = paths.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var path = paths[index],
|
|
value = baseGet(object, path);
|
|
|
|
if (predicate(value, path)) {
|
|
baseSet(result, castPath(path, object), value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseProperty` which supports deep paths.
|
|
*
|
|
* @private
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function basePropertyDeep(path) {
|
|
return function(object) {
|
|
return baseGet(object, path);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pullAllBy` without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function basePullAll(array, values, iteratee, comparator) {
|
|
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
|
|
index = -1,
|
|
length = values.length,
|
|
seen = array;
|
|
|
|
if (array === values) {
|
|
values = copyArray(values);
|
|
}
|
|
if (iteratee) {
|
|
seen = arrayMap(array, baseUnary(iteratee));
|
|
}
|
|
while (++index < length) {
|
|
var fromIndex = 0,
|
|
value = values[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
|
if (seen !== array) {
|
|
splice.call(seen, fromIndex, 1);
|
|
}
|
|
splice.call(array, fromIndex, 1);
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pullAt` without support for individual
|
|
* indexes or capturing the removed elements.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {number[]} indexes The indexes of elements to remove.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function basePullAt(array, indexes) {
|
|
var length = array ? indexes.length : 0,
|
|
lastIndex = length - 1;
|
|
|
|
while (length--) {
|
|
var index = indexes[length];
|
|
if (length == lastIndex || index !== previous) {
|
|
var previous = index;
|
|
if (isIndex(index)) {
|
|
splice.call(array, index, 1);
|
|
} else {
|
|
baseUnset(array, index);
|
|
}
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.random` without support for returning
|
|
* floating-point numbers.
|
|
*
|
|
* @private
|
|
* @param {number} lower The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the random number.
|
|
*/
|
|
function baseRandom(lower, upper) {
|
|
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
|
* coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} start The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} step The value to increment or decrement by.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Array} Returns the range of numbers.
|
|
*/
|
|
function baseRange(start, end, step, fromRight) {
|
|
var index = -1,
|
|
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
|
result = Array(length);
|
|
|
|
while (length--) {
|
|
result[fromRight ? length : ++index] = start;
|
|
start += step;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.repeat` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to repeat.
|
|
* @param {number} n The number of times to repeat the string.
|
|
* @returns {string} Returns the repeated string.
|
|
*/
|
|
function baseRepeat(string, n) {
|
|
var result = '';
|
|
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
|
|
return result;
|
|
}
|
|
// Leverage the exponentiation by squaring algorithm for a faster repeat.
|
|
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
|
|
do {
|
|
if (n % 2) {
|
|
result += string;
|
|
}
|
|
n = nativeFloor(n / 2);
|
|
if (n) {
|
|
string += string;
|
|
}
|
|
} while (n);
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function baseRest(func, start) {
|
|
return setToString(overRest(func, start, identity), func + '');
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sample`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @returns {*} Returns the random element.
|
|
*/
|
|
function baseSample(collection) {
|
|
return arraySample(values(collection));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sampleSize` without param guards.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @param {number} n The number of elements to sample.
|
|
* @returns {Array} Returns the random elements.
|
|
*/
|
|
function baseSampleSize(collection, n) {
|
|
var array = values(collection);
|
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.set`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @param {Function} [customizer] The function to customize path creation.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseSet(object, path, value, customizer) {
|
|
if (!isObject(object)) {
|
|
return object;
|
|
}
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length,
|
|
lastIndex = length - 1,
|
|
nested = object;
|
|
|
|
while (nested != null && ++index < length) {
|
|
var key = toKey(path[index]),
|
|
newValue = value;
|
|
|
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
return object;
|
|
}
|
|
|
|
if (index != lastIndex) {
|
|
var objValue = nested[key];
|
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
if (newValue === undefined) {
|
|
newValue = isObject(objValue)
|
|
? objValue
|
|
: (isIndex(path[index + 1]) ? [] : {});
|
|
}
|
|
}
|
|
assignValue(nested, key, newValue);
|
|
nested = nested[key];
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `setData` without support for hot loop shorting.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to associate metadata with.
|
|
* @param {*} data The metadata.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var baseSetData = !metaMap ? identity : function(func, data) {
|
|
metaMap.set(func, data);
|
|
return func;
|
|
};
|
|
|
|
/**
|
|
* The base implementation of `setToString` without support for hot loop shorting.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to modify.
|
|
* @param {Function} string The `toString` result.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
return defineProperty(func, 'toString', {
|
|
'configurable': true,
|
|
'enumerable': false,
|
|
'value': constant(string),
|
|
'writable': true
|
|
});
|
|
};
|
|
|
|
/**
|
|
* The base implementation of `_.shuffle`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
*/
|
|
function baseShuffle(collection) {
|
|
return shuffleSelf(values(collection));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.slice` without an iteratee call guard.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to slice.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function baseSlice(array, start, end) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
if (start < 0) {
|
|
start = -start > length ? 0 : (length + start);
|
|
}
|
|
end = end > length ? length : end;
|
|
if (end < 0) {
|
|
end += length;
|
|
}
|
|
length = start > end ? 0 : ((end - start) >>> 0);
|
|
start >>>= 0;
|
|
|
|
var result = Array(length);
|
|
while (++index < length) {
|
|
result[index] = array[index + start];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.some` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function baseSome(collection, predicate) {
|
|
var result;
|
|
|
|
baseEach(collection, function(value, index, collection) {
|
|
result = predicate(value, index, collection);
|
|
return !result;
|
|
});
|
|
return !!result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
|
* performs a binary search of `array` to determine the index at which `value`
|
|
* should be inserted into `array` in order to maintain its sort order.
|
|
*
|
|
* @private
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
*/
|
|
function baseSortedIndex(array, value, retHighest) {
|
|
var low = 0,
|
|
high = array == null ? low : array.length;
|
|
|
|
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
while (low < high) {
|
|
var mid = (low + high) >>> 1,
|
|
computed = array[mid];
|
|
|
|
if (computed !== null && !isSymbol(computed) &&
|
|
(retHighest ? (computed <= value) : (computed < value))) {
|
|
low = mid + 1;
|
|
} else {
|
|
high = mid;
|
|
}
|
|
}
|
|
return high;
|
|
}
|
|
return baseSortedIndexBy(array, value, identity, retHighest);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
|
* which invokes `iteratee` for `value` and each element of `array` to compute
|
|
* their sort ranking. The iteratee is invoked with one argument; (value).
|
|
*
|
|
* @private
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} iteratee The iteratee invoked per element.
|
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
*/
|
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
var low = 0,
|
|
high = array == null ? 0 : array.length;
|
|
if (high === 0) {
|
|
return 0;
|
|
}
|
|
|
|
value = iteratee(value);
|
|
var valIsNaN = value !== value,
|
|
valIsNull = value === null,
|
|
valIsSymbol = isSymbol(value),
|
|
valIsUndefined = value === undefined;
|
|
|
|
while (low < high) {
|
|
var mid = nativeFloor((low + high) / 2),
|
|
computed = iteratee(array[mid]),
|
|
othIsDefined = computed !== undefined,
|
|
othIsNull = computed === null,
|
|
othIsReflexive = computed === computed,
|
|
othIsSymbol = isSymbol(computed);
|
|
|
|
if (valIsNaN) {
|
|
var setLow = retHighest || othIsReflexive;
|
|
} else if (valIsUndefined) {
|
|
setLow = othIsReflexive && (retHighest || othIsDefined);
|
|
} else if (valIsNull) {
|
|
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
|
|
} else if (valIsSymbol) {
|
|
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
|
|
} else if (othIsNull || othIsSymbol) {
|
|
setLow = false;
|
|
} else {
|
|
setLow = retHighest ? (computed <= value) : (computed < value);
|
|
}
|
|
if (setLow) {
|
|
low = mid + 1;
|
|
} else {
|
|
high = mid;
|
|
}
|
|
}
|
|
return nativeMin(high, MAX_ARRAY_INDEX);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
|
* support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
*/
|
|
function baseSortedUniq(array, iteratee) {
|
|
var index = -1,
|
|
length = array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
if (!index || !eq(computed, seen)) {
|
|
var seen = computed;
|
|
result[resIndex++] = value === 0 ? 0 : value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toNumber` which doesn't ensure correct
|
|
* conversions of binary, hexadecimal, or octal string values.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to process.
|
|
* @returns {number} Returns the number.
|
|
*/
|
|
function baseToNumber(value) {
|
|
if (typeof value == 'number') {
|
|
return value;
|
|
}
|
|
if (isSymbol(value)) {
|
|
return NAN;
|
|
}
|
|
return +value;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toString` which doesn't convert nullish
|
|
* values to empty strings.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to process.
|
|
* @returns {string} Returns the string.
|
|
*/
|
|
function baseToString(value) {
|
|
// Exit early for strings to avoid a performance hit in some environments.
|
|
if (typeof value == 'string') {
|
|
return value;
|
|
}
|
|
if (isArray(value)) {
|
|
// Recursively convert values (susceptible to call stack limits).
|
|
return arrayMap(value, baseToString) + '';
|
|
}
|
|
if (isSymbol(value)) {
|
|
return symbolToString ? symbolToString.call(value) : '';
|
|
}
|
|
var result = (value + '');
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
*/
|
|
function baseUniq(array, iteratee, comparator) {
|
|
var index = -1,
|
|
includes = arrayIncludes,
|
|
length = array.length,
|
|
isCommon = true,
|
|
result = [],
|
|
seen = result;
|
|
|
|
if (comparator) {
|
|
isCommon = false;
|
|
includes = arrayIncludesWith;
|
|
}
|
|
else if (length >= LARGE_ARRAY_SIZE) {
|
|
var set = iteratee ? null : createSet(array);
|
|
if (set) {
|
|
return setToArray(set);
|
|
}
|
|
isCommon = false;
|
|
includes = cacheHas;
|
|
seen = new SetCache;
|
|
}
|
|
else {
|
|
seen = iteratee ? [] : result;
|
|
}
|
|
outer:
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (isCommon && computed === computed) {
|
|
var seenIndex = seen.length;
|
|
while (seenIndex--) {
|
|
if (seen[seenIndex] === computed) {
|
|
continue outer;
|
|
}
|
|
}
|
|
if (iteratee) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
else if (!includes(seen, computed, comparator)) {
|
|
if (seen !== result) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.unset`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The property path to unset.
|
|
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
*/
|
|
function baseUnset(object, path) {
|
|
path = castPath(path, object);
|
|
object = parent(object, path);
|
|
return object == null || delete object[toKey(last(path))];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.update`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to update.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @param {Function} [customizer] The function to customize path creation.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseUpdate(object, path, updater, customizer) {
|
|
return baseSet(object, path, updater(baseGet(object, path)), customizer);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.dropWhile` and `_.takeWhile`
|
|
* without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {boolean} [isDrop] Specify dropping elements instead of taking them.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function baseWhile(array, predicate, isDrop, fromRight) {
|
|
var length = array.length,
|
|
index = fromRight ? length : -1;
|
|
|
|
while ((fromRight ? index-- : ++index < length) &&
|
|
predicate(array[index], index, array)) {}
|
|
|
|
return isDrop
|
|
? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
|
|
: baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `wrapperValue` which returns the result of
|
|
* performing a sequence of actions on the unwrapped `value`, where each
|
|
* successive action is supplied the return value of the previous.
|
|
*
|
|
* @private
|
|
* @param {*} value The unwrapped value.
|
|
* @param {Array} actions Actions to perform to resolve the unwrapped value.
|
|
* @returns {*} Returns the resolved value.
|
|
*/
|
|
function baseWrapperValue(value, actions) {
|
|
var result = value;
|
|
if (result instanceof LazyWrapper) {
|
|
result = result.value();
|
|
}
|
|
return arrayReduce(actions, function(result, action) {
|
|
return action.func.apply(action.thisArg, arrayPush([result], action.args));
|
|
}, result);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.xor`, without support for
|
|
* iteratee shorthands, that accepts an array of arrays to inspect.
|
|
*
|
|
* @private
|
|
* @param {Array} arrays The arrays to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of values.
|
|
*/
|
|
function baseXor(arrays, iteratee, comparator) {
|
|
var length = arrays.length;
|
|
if (length < 2) {
|
|
return length ? baseUniq(arrays[0]) : [];
|
|
}
|
|
var index = -1,
|
|
result = Array(length);
|
|
|
|
while (++index < length) {
|
|
var array = arrays[index],
|
|
othIndex = -1;
|
|
|
|
while (++othIndex < length) {
|
|
if (othIndex != index) {
|
|
result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
|
|
}
|
|
}
|
|
}
|
|
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
|
|
}
|
|
|
|
/**
|
|
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array} props The property identifiers.
|
|
* @param {Array} values The property values.
|
|
* @param {Function} assignFunc The function to assign values.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function baseZipObject(props, values, assignFunc) {
|
|
var index = -1,
|
|
length = props.length,
|
|
valsLength = values.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var value = index < valsLength ? values[index] : undefined;
|
|
assignFunc(result, props[index], value);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to an empty array if it's not an array like object.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Array|Object} Returns the cast array-like object.
|
|
*/
|
|
function castArrayLikeObject(value) {
|
|
return isArrayLikeObject(value) ? value : [];
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to `identity` if it's not a function.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Function} Returns cast function.
|
|
*/
|
|
function castFunction(value) {
|
|
return typeof value == 'function' ? value : identity;
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to a path array if it's not one.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @param {Object} [object] The object to query keys on.
|
|
* @returns {Array} Returns the cast property path array.
|
|
*/
|
|
function castPath(value, object) {
|
|
if (isArray(value)) {
|
|
return value;
|
|
}
|
|
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
}
|
|
|
|
/**
|
|
* A `baseRest` alias which can be replaced with `identity` by module
|
|
* replacement plugins.
|
|
*
|
|
* @private
|
|
* @type {Function}
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
var castRest = baseRest;
|
|
|
|
/**
|
|
* Casts `array` to a slice if it's needed.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {number} start The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the cast slice.
|
|
*/
|
|
function castSlice(array, start, end) {
|
|
var length = array.length;
|
|
end = end === undefined ? length : end;
|
|
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
|
}
|
|
|
|
/**
|
|
* A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
|
|
*
|
|
* @private
|
|
* @param {number|Object} id The timer id or timeout object of the timer to clear.
|
|
*/
|
|
var clearTimeout = ctxClearTimeout || function(id) {
|
|
return root.clearTimeout(id);
|
|
};
|
|
|
|
/**
|
|
* Creates a clone of `buffer`.
|
|
*
|
|
* @private
|
|
* @param {Buffer} buffer The buffer to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Buffer} Returns the cloned buffer.
|
|
*/
|
|
function cloneBuffer(buffer, isDeep) {
|
|
if (isDeep) {
|
|
return buffer.slice();
|
|
}
|
|
var length = buffer.length,
|
|
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
|
|
buffer.copy(result);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `arrayBuffer`.
|
|
*
|
|
* @private
|
|
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
*/
|
|
function cloneArrayBuffer(arrayBuffer) {
|
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `dataView`.
|
|
*
|
|
* @private
|
|
* @param {Object} dataView The data view to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned data view.
|
|
*/
|
|
function cloneDataView(dataView, isDeep) {
|
|
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `regexp`.
|
|
*
|
|
* @private
|
|
* @param {Object} regexp The regexp to clone.
|
|
* @returns {Object} Returns the cloned regexp.
|
|
*/
|
|
function cloneRegExp(regexp) {
|
|
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
result.lastIndex = regexp.lastIndex;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the `symbol` object.
|
|
*
|
|
* @private
|
|
* @param {Object} symbol The symbol object to clone.
|
|
* @returns {Object} Returns the cloned symbol object.
|
|
*/
|
|
function cloneSymbol(symbol) {
|
|
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `typedArray`.
|
|
*
|
|
* @private
|
|
* @param {Object} typedArray The typed array to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned typed array.
|
|
*/
|
|
function cloneTypedArray(typedArray, isDeep) {
|
|
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
}
|
|
|
|
/**
|
|
* Compares values to sort them in ascending order.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {number} Returns the sort order indicator for `value`.
|
|
*/
|
|
function compareAscending(value, other) {
|
|
if (value !== other) {
|
|
var valIsDefined = value !== undefined,
|
|
valIsNull = value === null,
|
|
valIsReflexive = value === value,
|
|
valIsSymbol = isSymbol(value);
|
|
|
|
var othIsDefined = other !== undefined,
|
|
othIsNull = other === null,
|
|
othIsReflexive = other === other,
|
|
othIsSymbol = isSymbol(other);
|
|
|
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
(!valIsDefined && othIsReflexive) ||
|
|
!valIsReflexive) {
|
|
return 1;
|
|
}
|
|
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
(!othIsDefined && valIsReflexive) ||
|
|
!othIsReflexive) {
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
* and stable sort them.
|
|
*
|
|
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
* of corresponding values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
* @returns {number} Returns the sort order indicator for `object`.
|
|
*/
|
|
function compareMultiple(object, other, orders) {
|
|
var index = -1,
|
|
objCriteria = object.criteria,
|
|
othCriteria = other.criteria,
|
|
length = objCriteria.length,
|
|
ordersLength = orders.length;
|
|
|
|
while (++index < length) {
|
|
var result = compareAscending(objCriteria[index], othCriteria[index]);
|
|
if (result) {
|
|
if (index >= ordersLength) {
|
|
return result;
|
|
}
|
|
var order = orders[index];
|
|
return result * (order == 'desc' ? -1 : 1);
|
|
}
|
|
}
|
|
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
// that causes it, under certain circumstances, to provide the same value for
|
|
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
// for more details.
|
|
//
|
|
// This also ensures a stable sort in V8 and other engines.
|
|
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
return object.index - other.index;
|
|
}
|
|
|
|
/**
|
|
* Creates an array that is the composition of partially applied arguments,
|
|
* placeholders, and provided arguments into a single array of arguments.
|
|
*
|
|
* @private
|
|
* @param {Array} args The provided arguments.
|
|
* @param {Array} partials The arguments to prepend to those provided.
|
|
* @param {Array} holders The `partials` placeholder indexes.
|
|
* @params {boolean} [isCurried] Specify composing for a curried function.
|
|
* @returns {Array} Returns the new array of composed arguments.
|
|
*/
|
|
function composeArgs(args, partials, holders, isCurried) {
|
|
var argsIndex = -1,
|
|
argsLength = args.length,
|
|
holdersLength = holders.length,
|
|
leftIndex = -1,
|
|
leftLength = partials.length,
|
|
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
|
result = Array(leftLength + rangeLength),
|
|
isUncurried = !isCurried;
|
|
|
|
while (++leftIndex < leftLength) {
|
|
result[leftIndex] = partials[leftIndex];
|
|
}
|
|
while (++argsIndex < holdersLength) {
|
|
if (isUncurried || argsIndex < argsLength) {
|
|
result[holders[argsIndex]] = args[argsIndex];
|
|
}
|
|
}
|
|
while (rangeLength--) {
|
|
result[leftIndex++] = args[argsIndex++];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This function is like `composeArgs` except that the arguments composition
|
|
* is tailored for `_.partialRight`.
|
|
*
|
|
* @private
|
|
* @param {Array} args The provided arguments.
|
|
* @param {Array} partials The arguments to append to those provided.
|
|
* @param {Array} holders The `partials` placeholder indexes.
|
|
* @params {boolean} [isCurried] Specify composing for a curried function.
|
|
* @returns {Array} Returns the new array of composed arguments.
|
|
*/
|
|
function composeArgsRight(args, partials, holders, isCurried) {
|
|
var argsIndex = -1,
|
|
argsLength = args.length,
|
|
holdersIndex = -1,
|
|
holdersLength = holders.length,
|
|
rightIndex = -1,
|
|
rightLength = partials.length,
|
|
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
|
result = Array(rangeLength + rightLength),
|
|
isUncurried = !isCurried;
|
|
|
|
while (++argsIndex < rangeLength) {
|
|
result[argsIndex] = args[argsIndex];
|
|
}
|
|
var offset = argsIndex;
|
|
while (++rightIndex < rightLength) {
|
|
result[offset + rightIndex] = partials[rightIndex];
|
|
}
|
|
while (++holdersIndex < holdersLength) {
|
|
if (isUncurried || argsIndex < argsLength) {
|
|
result[offset + holders[holdersIndex]] = args[argsIndex++];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Copies the values of `source` to `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} source The array to copy values from.
|
|
* @param {Array} [array=[]] The array to copy values to.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function copyArray(source, array) {
|
|
var index = -1,
|
|
length = source.length;
|
|
|
|
array || (array = Array(length));
|
|
while (++index < length) {
|
|
array[index] = source[index];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Copies properties of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy properties from.
|
|
* @param {Array} props The property identifiers to copy.
|
|
* @param {Object} [object={}] The object to copy properties to.
|
|
* @param {Function} [customizer] The function to customize copied values.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copyObject(source, props, object, customizer) {
|
|
var isNew = !object;
|
|
object || (object = {});
|
|
|
|
var index = -1,
|
|
length = props.length;
|
|
|
|
while (++index < length) {
|
|
var key = props[index];
|
|
|
|
var newValue = customizer
|
|
? customizer(object[key], source[key], key, object, source)
|
|
: undefined;
|
|
|
|
if (newValue === undefined) {
|
|
newValue = source[key];
|
|
}
|
|
if (isNew) {
|
|
baseAssignValue(object, key, newValue);
|
|
} else {
|
|
assignValue(object, key, newValue);
|
|
}
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Copies own symbols of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy symbols from.
|
|
* @param {Object} [object={}] The object to copy symbols to.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copySymbols(source, object) {
|
|
return copyObject(source, getSymbols(source), object);
|
|
}
|
|
|
|
/**
|
|
* Copies own and inherited symbols of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy symbols from.
|
|
* @param {Object} [object={}] The object to copy symbols to.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copySymbolsIn(source, object) {
|
|
return copyObject(source, getSymbolsIn(source), object);
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.groupBy`.
|
|
*
|
|
* @private
|
|
* @param {Function} setter The function to set accumulator values.
|
|
* @param {Function} [initializer] The accumulator object initializer.
|
|
* @returns {Function} Returns the new aggregator function.
|
|
*/
|
|
function createAggregator(setter, initializer) {
|
|
return function(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
|
accumulator = initializer ? initializer() : {};
|
|
|
|
return func(collection, setter, getIteratee(iteratee, 2), accumulator);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.assign`.
|
|
*
|
|
* @private
|
|
* @param {Function} assigner The function to assign values.
|
|
* @returns {Function} Returns the new assigner function.
|
|
*/
|
|
function createAssigner(assigner) {
|
|
return baseRest(function(object, sources) {
|
|
var index = -1,
|
|
length = sources.length,
|
|
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
guard = length > 2 ? sources[2] : undefined;
|
|
|
|
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
|
? (length--, customizer)
|
|
: undefined;
|
|
|
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
customizer = length < 3 ? undefined : customizer;
|
|
length = 1;
|
|
}
|
|
object = Object(object);
|
|
while (++index < length) {
|
|
var source = sources[index];
|
|
if (source) {
|
|
assigner(object, source, index, customizer);
|
|
}
|
|
}
|
|
return object;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a `baseEach` or `baseEachRight` function.
|
|
*
|
|
* @private
|
|
* @param {Function} eachFunc The function to iterate over a collection.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new base function.
|
|
*/
|
|
function createBaseEach(eachFunc, fromRight) {
|
|
return function(collection, iteratee) {
|
|
if (collection == null) {
|
|
return collection;
|
|
}
|
|
if (!isArrayLike(collection)) {
|
|
return eachFunc(collection, iteratee);
|
|
}
|
|
var length = collection.length,
|
|
index = fromRight ? length : -1,
|
|
iterable = Object(collection);
|
|
|
|
while ((fromRight ? index-- : ++index < length)) {
|
|
if (iteratee(iterable[index], index, iterable) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return collection;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new base function.
|
|
*/
|
|
function createBaseFor(fromRight) {
|
|
return function(object, iteratee, keysFunc) {
|
|
var index = -1,
|
|
iterable = Object(object),
|
|
props = keysFunc(object),
|
|
length = props.length;
|
|
|
|
while (length--) {
|
|
var key = props[fromRight ? length : ++index];
|
|
if (iteratee(iterable[key], key, iterable) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return object;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with the optional `this`
|
|
* binding of `thisArg`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createBind(func, bitmask, thisArg) {
|
|
var isBind = bitmask & WRAP_BIND_FLAG,
|
|
Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
return fn.apply(isBind ? thisArg : this, arguments);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.lowerFirst`.
|
|
*
|
|
* @private
|
|
* @param {string} methodName The name of the `String` case method to use.
|
|
* @returns {Function} Returns the new case function.
|
|
*/
|
|
function createCaseFirst(methodName) {
|
|
return function(string) {
|
|
string = toString(string);
|
|
|
|
var strSymbols = hasUnicode(string)
|
|
? stringToArray(string)
|
|
: undefined;
|
|
|
|
var chr = strSymbols
|
|
? strSymbols[0]
|
|
: string.charAt(0);
|
|
|
|
var trailing = strSymbols
|
|
? castSlice(strSymbols, 1).join('')
|
|
: string.slice(1);
|
|
|
|
return chr[methodName]() + trailing;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.camelCase`.
|
|
*
|
|
* @private
|
|
* @param {Function} callback The function to combine each word.
|
|
* @returns {Function} Returns the new compounder function.
|
|
*/
|
|
function createCompounder(callback) {
|
|
return function(string) {
|
|
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that produces an instance of `Ctor` regardless of
|
|
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
|
|
*
|
|
* @private
|
|
* @param {Function} Ctor The constructor to wrap.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createCtor(Ctor) {
|
|
return function() {
|
|
// Use a `switch` statement to work with class constructors. See
|
|
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
|
// for more details.
|
|
var args = arguments;
|
|
switch (args.length) {
|
|
case 0: return new Ctor;
|
|
case 1: return new Ctor(args[0]);
|
|
case 2: return new Ctor(args[0], args[1]);
|
|
case 3: return new Ctor(args[0], args[1], args[2]);
|
|
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
|
|
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
|
|
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
}
|
|
var thisBinding = baseCreate(Ctor.prototype),
|
|
result = Ctor.apply(thisBinding, args);
|
|
|
|
// Mimic the constructor's `return` behavior.
|
|
// See https://es5.github.io/#x13.2.2 for more details.
|
|
return isObject(result) ? result : thisBinding;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to enable currying.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {number} arity The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createCurry(func, bitmask, arity) {
|
|
var Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var length = arguments.length,
|
|
args = Array(length),
|
|
index = length,
|
|
placeholder = getHolder(wrapper);
|
|
|
|
while (index--) {
|
|
args[index] = arguments[index];
|
|
}
|
|
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
|
|
? []
|
|
: replaceHolders(args, placeholder);
|
|
|
|
length -= holders.length;
|
|
if (length < arity) {
|
|
return createRecurry(
|
|
func, bitmask, createHybrid, wrapper.placeholder, undefined,
|
|
args, holders, undefined, undefined, arity - length);
|
|
}
|
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
return apply(fn, this, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.find` or `_.findLast` function.
|
|
*
|
|
* @private
|
|
* @param {Function} findIndexFunc The function to find the collection index.
|
|
* @returns {Function} Returns the new find function.
|
|
*/
|
|
function createFind(findIndexFunc) {
|
|
return function(collection, predicate, fromIndex) {
|
|
var iterable = Object(collection);
|
|
if (!isArrayLike(collection)) {
|
|
var iteratee = getIteratee(predicate, 3);
|
|
collection = keys(collection);
|
|
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
|
}
|
|
var index = findIndexFunc(collection, predicate, fromIndex);
|
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.flow` or `_.flowRight` function.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new flow function.
|
|
*/
|
|
function createFlow(fromRight) {
|
|
return flatRest(function(funcs) {
|
|
var length = funcs.length,
|
|
index = length,
|
|
prereq = LodashWrapper.prototype.thru;
|
|
|
|
if (fromRight) {
|
|
funcs.reverse();
|
|
}
|
|
while (index--) {
|
|
var func = funcs[index];
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
|
|
var wrapper = new LodashWrapper([], true);
|
|
}
|
|
}
|
|
index = wrapper ? index : length;
|
|
while (++index < length) {
|
|
func = funcs[index];
|
|
|
|
var funcName = getFuncName(func),
|
|
data = funcName == 'wrapper' ? getData(func) : undefined;
|
|
|
|
if (data && isLaziable(data[0]) &&
|
|
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
|
|
!data[4].length && data[9] == 1
|
|
) {
|
|
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
|
} else {
|
|
wrapper = (func.length == 1 && isLaziable(func))
|
|
? wrapper[funcName]()
|
|
: wrapper.thru(func);
|
|
}
|
|
}
|
|
return function() {
|
|
var args = arguments,
|
|
value = args[0];
|
|
|
|
if (wrapper && args.length == 1 && isArray(value)) {
|
|
return wrapper.plant(value).value();
|
|
}
|
|
var index = 0,
|
|
result = length ? funcs[index].apply(this, args) : value;
|
|
|
|
while (++index < length) {
|
|
result = funcs[index].call(this, result);
|
|
}
|
|
return result;
|
|
};
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with optional `this`
|
|
* binding of `thisArg`, partial application, and currying.
|
|
*
|
|
* @private
|
|
* @param {Function|string} func The function or method name to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [partialsRight] The arguments to append to those provided
|
|
* to the new function.
|
|
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
|
|
var isAry = bitmask & WRAP_ARY_FLAG,
|
|
isBind = bitmask & WRAP_BIND_FLAG,
|
|
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
|
|
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
|
|
isFlip = bitmask & WRAP_FLIP_FLAG,
|
|
Ctor = isBindKey ? undefined : createCtor(func);
|
|
|
|
function wrapper() {
|
|
var length = arguments.length,
|
|
args = Array(length),
|
|
index = length;
|
|
|
|
while (index--) {
|
|
args[index] = arguments[index];
|
|
}
|
|
if (isCurried) {
|
|
var placeholder = getHolder(wrapper),
|
|
holdersCount = countHolders(args, placeholder);
|
|
}
|
|
if (partials) {
|
|
args = composeArgs(args, partials, holders, isCurried);
|
|
}
|
|
if (partialsRight) {
|
|
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
|
|
}
|
|
length -= holdersCount;
|
|
if (isCurried && length < arity) {
|
|
var newHolders = replaceHolders(args, placeholder);
|
|
return createRecurry(
|
|
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
|
|
args, newHolders, argPos, ary, arity - length
|
|
);
|
|
}
|
|
var thisBinding = isBind ? thisArg : this,
|
|
fn = isBindKey ? thisBinding[func] : func;
|
|
|
|
length = args.length;
|
|
if (argPos) {
|
|
args = reorder(args, argPos);
|
|
} else if (isFlip && length > 1) {
|
|
args.reverse();
|
|
}
|
|
if (isAry && ary < length) {
|
|
args.length = ary;
|
|
}
|
|
if (this && this !== root && this instanceof wrapper) {
|
|
fn = Ctor || createCtor(fn);
|
|
}
|
|
return fn.apply(thisBinding, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.invertBy`.
|
|
*
|
|
* @private
|
|
* @param {Function} setter The function to set accumulator values.
|
|
* @param {Function} toIteratee The function to resolve iteratees.
|
|
* @returns {Function} Returns the new inverter function.
|
|
*/
|
|
function createInverter(setter, toIteratee) {
|
|
return function(object, iteratee) {
|
|
return baseInverter(object, setter, toIteratee(iteratee), {});
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a mathematical operation on two values.
|
|
*
|
|
* @private
|
|
* @param {Function} operator The function to perform the operation.
|
|
* @param {number} [defaultValue] The value used for `undefined` arguments.
|
|
* @returns {Function} Returns the new mathematical operation function.
|
|
*/
|
|
function createMathOperation(operator, defaultValue) {
|
|
return function(value, other) {
|
|
var result;
|
|
if (value === undefined && other === undefined) {
|
|
return defaultValue;
|
|
}
|
|
if (value !== undefined) {
|
|
result = value;
|
|
}
|
|
if (other !== undefined) {
|
|
if (result === undefined) {
|
|
return other;
|
|
}
|
|
if (typeof value == 'string' || typeof other == 'string') {
|
|
value = baseToString(value);
|
|
other = baseToString(other);
|
|
} else {
|
|
value = baseToNumber(value);
|
|
other = baseToNumber(other);
|
|
}
|
|
result = operator(value, other);
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.over`.
|
|
*
|
|
* @private
|
|
* @param {Function} arrayFunc The function to iterate over iteratees.
|
|
* @returns {Function} Returns the new over function.
|
|
*/
|
|
function createOver(arrayFunc) {
|
|
return flatRest(function(iteratees) {
|
|
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
|
|
return baseRest(function(args) {
|
|
var thisArg = this;
|
|
return arrayFunc(iteratees, function(iteratee) {
|
|
return apply(iteratee, thisArg, args);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates the padding for `string` based on `length`. The `chars` string
|
|
* is truncated if the number of characters exceeds `length`.
|
|
*
|
|
* @private
|
|
* @param {number} length The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padding for `string`.
|
|
*/
|
|
function createPadding(length, chars) {
|
|
chars = chars === undefined ? ' ' : baseToString(chars);
|
|
|
|
var charsLength = chars.length;
|
|
if (charsLength < 2) {
|
|
return charsLength ? baseRepeat(chars, length) : chars;
|
|
}
|
|
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
|
return hasUnicode(chars)
|
|
? castSlice(stringToArray(result), 0, length).join('')
|
|
: result.slice(0, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with the `this` binding
|
|
* of `thisArg` and `partials` prepended to the arguments it receives.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {Array} partials The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createPartial(func, bitmask, thisArg, partials) {
|
|
var isBind = bitmask & WRAP_BIND_FLAG,
|
|
Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var argsIndex = -1,
|
|
argsLength = arguments.length,
|
|
leftIndex = -1,
|
|
leftLength = partials.length,
|
|
args = Array(leftLength + argsLength),
|
|
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
|
|
while (++leftIndex < leftLength) {
|
|
args[leftIndex] = partials[leftIndex];
|
|
}
|
|
while (argsLength--) {
|
|
args[leftIndex++] = arguments[++argsIndex];
|
|
}
|
|
return apply(fn, isBind ? thisArg : this, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.range` or `_.rangeRight` function.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new range function.
|
|
*/
|
|
function createRange(fromRight) {
|
|
return function(start, end, step) {
|
|
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
|
|
end = step = undefined;
|
|
}
|
|
// Ensure the sign of `-0` is preserved.
|
|
start = toFinite(start);
|
|
if (end === undefined) {
|
|
end = start;
|
|
start = 0;
|
|
} else {
|
|
end = toFinite(end);
|
|
}
|
|
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
|
|
return baseRange(start, end, step, fromRight);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a relational operation on two values.
|
|
*
|
|
* @private
|
|
* @param {Function} operator The function to perform the operation.
|
|
* @returns {Function} Returns the new relational operation function.
|
|
*/
|
|
function createRelationalOperation(operator) {
|
|
return function(value, other) {
|
|
if (!(typeof value == 'string' && typeof other == 'string')) {
|
|
value = toNumber(value);
|
|
other = toNumber(other);
|
|
}
|
|
return operator(value, other);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to continue currying.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {Function} wrapFunc The function to create the `func` wrapper.
|
|
* @param {*} placeholder The placeholder value.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
|
var isCurry = bitmask & WRAP_CURRY_FLAG,
|
|
newHolders = isCurry ? holders : undefined,
|
|
newHoldersRight = isCurry ? undefined : holders,
|
|
newPartials = isCurry ? partials : undefined,
|
|
newPartialsRight = isCurry ? undefined : partials;
|
|
|
|
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
|
|
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
|
|
|
|
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
|
|
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
|
|
}
|
|
var newData = [
|
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
|
newHoldersRight, argPos, ary, arity
|
|
];
|
|
|
|
var result = wrapFunc.apply(undefined, newData);
|
|
if (isLaziable(func)) {
|
|
setData(result, newData);
|
|
}
|
|
result.placeholder = placeholder;
|
|
return setWrapToString(result, func, bitmask);
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.round`.
|
|
*
|
|
* @private
|
|
* @param {string} methodName The name of the `Math` method to use when rounding.
|
|
* @returns {Function} Returns the new round function.
|
|
*/
|
|
function createRound(methodName) {
|
|
var func = Math[methodName];
|
|
return function(number, precision) {
|
|
number = toNumber(number);
|
|
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
|
if (precision && nativeIsFinite(number)) {
|
|
// Shift with exponential notation to avoid floating-point issues.
|
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
var pair = (toString(number) + 'e').split('e'),
|
|
value = func(pair[0] + 'e' + (+pair[1] + precision));
|
|
|
|
pair = (toString(value) + 'e').split('e');
|
|
return +(pair[0] + 'e' + (+pair[1] - precision));
|
|
}
|
|
return func(number);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a set object of `values`.
|
|
*
|
|
* @private
|
|
* @param {Array} values The values to add to the set.
|
|
* @returns {Object} Returns the new set.
|
|
*/
|
|
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
|
|
return new Set(values);
|
|
};
|
|
|
|
/**
|
|
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
|
*
|
|
* @private
|
|
* @param {Function} keysFunc The function to get the keys of a given object.
|
|
* @returns {Function} Returns the new pairs function.
|
|
*/
|
|
function createToPairs(keysFunc) {
|
|
return function(object) {
|
|
var tag = getTag(object);
|
|
if (tag == mapTag) {
|
|
return mapToArray(object);
|
|
}
|
|
if (tag == setTag) {
|
|
return setToPairs(object);
|
|
}
|
|
return baseToPairs(object, keysFunc(object));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that either curries or invokes `func` with optional
|
|
* `this` binding and partially applied arguments.
|
|
*
|
|
* @private
|
|
* @param {Function|string} func The function or method name to wrap.
|
|
* @param {number} bitmask The bitmask flags.
|
|
* 1 - `_.bind`
|
|
* 2 - `_.bindKey`
|
|
* 4 - `_.curry` or `_.curryRight` of a bound function
|
|
* 8 - `_.curry`
|
|
* 16 - `_.curryRight`
|
|
* 32 - `_.partial`
|
|
* 64 - `_.partialRight`
|
|
* 128 - `_.rearg`
|
|
* 256 - `_.ary`
|
|
* 512 - `_.flip`
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to be partially applied.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
|
|
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
|
if (!isBindKey && typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
var length = partials ? partials.length : 0;
|
|
if (!length) {
|
|
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
|
|
partials = holders = undefined;
|
|
}
|
|
ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
|
|
arity = arity === undefined ? arity : toInteger(arity);
|
|
length -= holders ? holders.length : 0;
|
|
|
|
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
|
|
var partialsRight = partials,
|
|
holdersRight = holders;
|
|
|
|
partials = holders = undefined;
|
|
}
|
|
var data = isBindKey ? undefined : getData(func);
|
|
|
|
var newData = [
|
|
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
|
|
argPos, ary, arity
|
|
];
|
|
|
|
if (data) {
|
|
mergeData(newData, data);
|
|
}
|
|
func = newData[0];
|
|
bitmask = newData[1];
|
|
thisArg = newData[2];
|
|
partials = newData[3];
|
|
holders = newData[4];
|
|
arity = newData[9] = newData[9] === undefined
|
|
? (isBindKey ? 0 : func.length)
|
|
: nativeMax(newData[9] - length, 0);
|
|
|
|
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
|
|
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
|
|
}
|
|
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
|
|
var result = createBind(func, bitmask, thisArg);
|
|
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
|
|
result = createCurry(func, bitmask, arity);
|
|
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
|
|
result = createPartial(func, bitmask, thisArg, partials);
|
|
} else {
|
|
result = createHybrid.apply(undefined, newData);
|
|
}
|
|
var setter = data ? baseSetData : setData;
|
|
return setWrapToString(setter(result, newData), func, bitmask);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
|
* of source objects to the destination object for all destination properties
|
|
* that resolve to `undefined`.
|
|
*
|
|
* @private
|
|
* @param {*} objValue The destination value.
|
|
* @param {*} srcValue The source value.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {Object} object The parent object of `objValue`.
|
|
* @returns {*} Returns the value to assign.
|
|
*/
|
|
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
|
if (objValue === undefined ||
|
|
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
return srcValue;
|
|
}
|
|
return objValue;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
|
* objects into destination objects that are passed thru.
|
|
*
|
|
* @private
|
|
* @param {*} objValue The destination value.
|
|
* @param {*} srcValue The source value.
|
|
* @param {string} key The key of the property to merge.
|
|
* @param {Object} object The parent object of `objValue`.
|
|
* @param {Object} source The parent object of `srcValue`.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
* @returns {*} Returns the value to assign.
|
|
*/
|
|
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
if (isObject(objValue) && isObject(srcValue)) {
|
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
stack.set(srcValue, objValue);
|
|
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
|
stack['delete'](srcValue);
|
|
}
|
|
return objValue;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
* objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @param {string} key The key of the property to inspect.
|
|
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
*/
|
|
function customOmitClone(value) {
|
|
return isPlainObject(value) ? undefined : value;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
* partial deep comparisons.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to compare.
|
|
* @param {Array} other The other array to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
*/
|
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
arrLength = array.length,
|
|
othLength = other.length;
|
|
|
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
return false;
|
|
}
|
|
// Check that cyclic values are equal.
|
|
var arrStacked = stack.get(array);
|
|
var othStacked = stack.get(other);
|
|
if (arrStacked && othStacked) {
|
|
return arrStacked == other && othStacked == array;
|
|
}
|
|
var index = -1,
|
|
result = true,
|
|
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
|
|
|
stack.set(array, other);
|
|
stack.set(other, array);
|
|
|
|
// Ignore non-index properties.
|
|
while (++index < arrLength) {
|
|
var arrValue = array[index],
|
|
othValue = other[index];
|
|
|
|
if (customizer) {
|
|
var compared = isPartial
|
|
? customizer(othValue, arrValue, index, other, array, stack)
|
|
: customizer(arrValue, othValue, index, array, other, stack);
|
|
}
|
|
if (compared !== undefined) {
|
|
if (compared) {
|
|
continue;
|
|
}
|
|
result = false;
|
|
break;
|
|
}
|
|
// Recursively compare arrays (susceptible to call stack limits).
|
|
if (seen) {
|
|
if (!arraySome(other, function(othValue, othIndex) {
|
|
if (!cacheHas(seen, othIndex) &&
|
|
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
return seen.push(othIndex);
|
|
}
|
|
})) {
|
|
result = false;
|
|
break;
|
|
}
|
|
} else if (!(
|
|
arrValue === othValue ||
|
|
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
}
|
|
stack['delete'](array);
|
|
stack['delete'](other);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
* the same `toStringTag`.
|
|
*
|
|
* **Note:** This function only supports comparing values with tags of
|
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
switch (tag) {
|
|
case dataViewTag:
|
|
if ((object.byteLength != other.byteLength) ||
|
|
(object.byteOffset != other.byteOffset)) {
|
|
return false;
|
|
}
|
|
object = object.buffer;
|
|
other = other.buffer;
|
|
|
|
case arrayBufferTag:
|
|
if ((object.byteLength != other.byteLength) ||
|
|
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
case boolTag:
|
|
case dateTag:
|
|
case numberTag:
|
|
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
// Invalid dates are coerced to `NaN`.
|
|
return eq(+object, +other);
|
|
|
|
case errorTag:
|
|
return object.name == other.name && object.message == other.message;
|
|
|
|
case regexpTag:
|
|
case stringTag:
|
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
// for more details.
|
|
return object == (other + '');
|
|
|
|
case mapTag:
|
|
var convert = mapToArray;
|
|
|
|
case setTag:
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
convert || (convert = setToArray);
|
|
|
|
if (object.size != other.size && !isPartial) {
|
|
return false;
|
|
}
|
|
// Assume cyclic values are equal.
|
|
var stacked = stack.get(object);
|
|
if (stacked) {
|
|
return stacked == other;
|
|
}
|
|
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
stack.set(object, other);
|
|
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
stack['delete'](object);
|
|
return result;
|
|
|
|
case symbolTag:
|
|
if (symbolValueOf) {
|
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
* partial deep comparisons.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
objProps = getAllKeys(object),
|
|
objLength = objProps.length,
|
|
othProps = getAllKeys(other),
|
|
othLength = othProps.length;
|
|
|
|
if (objLength != othLength && !isPartial) {
|
|
return false;
|
|
}
|
|
var index = objLength;
|
|
while (index--) {
|
|
var key = objProps[index];
|
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
return false;
|
|
}
|
|
}
|
|
// Check that cyclic values are equal.
|
|
var objStacked = stack.get(object);
|
|
var othStacked = stack.get(other);
|
|
if (objStacked && othStacked) {
|
|
return objStacked == other && othStacked == object;
|
|
}
|
|
var result = true;
|
|
stack.set(object, other);
|
|
stack.set(other, object);
|
|
|
|
var skipCtor = isPartial;
|
|
while (++index < objLength) {
|
|
key = objProps[index];
|
|
var objValue = object[key],
|
|
othValue = other[key];
|
|
|
|
if (customizer) {
|
|
var compared = isPartial
|
|
? customizer(othValue, objValue, key, other, object, stack)
|
|
: customizer(objValue, othValue, key, object, other, stack);
|
|
}
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
if (!(compared === undefined
|
|
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
: compared
|
|
)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
skipCtor || (skipCtor = key == 'constructor');
|
|
}
|
|
if (result && !skipCtor) {
|
|
var objCtor = object.constructor,
|
|
othCtor = other.constructor;
|
|
|
|
// Non `Object` object instances with different constructors are not equal.
|
|
if (objCtor != othCtor &&
|
|
('constructor' in object && 'constructor' in other) &&
|
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
result = false;
|
|
}
|
|
}
|
|
stack['delete'](object);
|
|
stack['delete'](other);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseRest` which flattens the rest array.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function flatRest(func) {
|
|
return setToString(overRest(func, undefined, flatten), func + '');
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own enumerable property names and symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function getAllKeys(object) {
|
|
return baseGetAllKeys(object, keys, getSymbols);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own and inherited enumerable property names and
|
|
* symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function getAllKeysIn(object) {
|
|
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
}
|
|
|
|
/**
|
|
* Gets metadata for `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to query.
|
|
* @returns {*} Returns the metadata for `func`.
|
|
*/
|
|
var getData = !metaMap ? noop : function(func) {
|
|
return metaMap.get(func);
|
|
};
|
|
|
|
/**
|
|
* Gets the name of `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to query.
|
|
* @returns {string} Returns the function name.
|
|
*/
|
|
function getFuncName(func) {
|
|
var result = (func.name + ''),
|
|
array = realNames[result],
|
|
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
|
|
|
while (length--) {
|
|
var data = array[length],
|
|
otherFunc = data.func;
|
|
if (otherFunc == null || otherFunc == func) {
|
|
return data.name;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the argument placeholder value for `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to inspect.
|
|
* @returns {*} Returns the placeholder value.
|
|
*/
|
|
function getHolder(func) {
|
|
var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
|
|
return object.placeholder;
|
|
}
|
|
|
|
/**
|
|
* Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
|
|
* this function returns the custom method, otherwise it returns `baseIteratee`.
|
|
* If arguments are provided, the chosen function is invoked with them and
|
|
* its result is returned.
|
|
*
|
|
* @private
|
|
* @param {*} [value] The value to convert to an iteratee.
|
|
* @param {number} [arity] The arity of the created iteratee.
|
|
* @returns {Function} Returns the chosen function or its result.
|
|
*/
|
|
function getIteratee() {
|
|
var result = lodash.iteratee || iteratee;
|
|
result = result === iteratee ? baseIteratee : result;
|
|
return arguments.length ? result(arguments[0], arguments[1]) : result;
|
|
}
|
|
|
|
/**
|
|
* Gets the data for `map`.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to query.
|
|
* @param {string} key The reference key.
|
|
* @returns {*} Returns the map data.
|
|
*/
|
|
function getMapData(map, key) {
|
|
var data = map.__data__;
|
|
return isKeyable(key)
|
|
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
: data.map;
|
|
}
|
|
|
|
/**
|
|
* Gets the property names, values, and compare flags of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the match data of `object`.
|
|
*/
|
|
function getMatchData(object) {
|
|
var result = keys(object),
|
|
length = result.length;
|
|
|
|
while (length--) {
|
|
var key = result[length],
|
|
value = object[key];
|
|
|
|
result[length] = [key, value, isStrictComparable(value)];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the native function at `key` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {string} key The key of the method to get.
|
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
*/
|
|
function getNative(object, key) {
|
|
var value = getValue(object, key);
|
|
return baseIsNative(value) ? value : undefined;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the raw `toStringTag`.
|
|
*/
|
|
function getRawTag(value) {
|
|
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
tag = value[symToStringTag];
|
|
|
|
try {
|
|
value[symToStringTag] = undefined;
|
|
var unmasked = true;
|
|
} catch (e) {}
|
|
|
|
var result = nativeObjectToString.call(value);
|
|
if (unmasked) {
|
|
if (isOwn) {
|
|
value[symToStringTag] = tag;
|
|
} else {
|
|
delete value[symToStringTag];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own enumerable symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of symbols.
|
|
*/
|
|
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
if (object == null) {
|
|
return [];
|
|
}
|
|
object = Object(object);
|
|
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
return propertyIsEnumerable.call(object, symbol);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of symbols.
|
|
*/
|
|
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
|
var result = [];
|
|
while (object) {
|
|
arrayPush(result, getSymbols(object));
|
|
object = getPrototype(object);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
/**
|
|
* Gets the `toStringTag` of `value`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the `toStringTag`.
|
|
*/
|
|
var getTag = baseGetTag;
|
|
|
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
(Map && getTag(new Map) != mapTag) ||
|
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
|
(Set && getTag(new Set) != setTag) ||
|
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
getTag = function(value) {
|
|
var result = baseGetTag(value),
|
|
Ctor = result == objectTag ? value.constructor : undefined,
|
|
ctorString = Ctor ? toSource(Ctor) : '';
|
|
|
|
if (ctorString) {
|
|
switch (ctorString) {
|
|
case dataViewCtorString: return dataViewTag;
|
|
case mapCtorString: return mapTag;
|
|
case promiseCtorString: return promiseTag;
|
|
case setCtorString: return setTag;
|
|
case weakMapCtorString: return weakMapTag;
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
|
*
|
|
* @private
|
|
* @param {number} start The start of the view.
|
|
* @param {number} end The end of the view.
|
|
* @param {Array} transforms The transformations to apply to the view.
|
|
* @returns {Object} Returns an object containing the `start` and `end`
|
|
* positions of the view.
|
|
*/
|
|
function getView(start, end, transforms) {
|
|
var index = -1,
|
|
length = transforms.length;
|
|
|
|
while (++index < length) {
|
|
var data = transforms[index],
|
|
size = data.size;
|
|
|
|
switch (data.type) {
|
|
case 'drop': start += size; break;
|
|
case 'dropRight': end -= size; break;
|
|
case 'take': end = nativeMin(end, start + size); break;
|
|
case 'takeRight': start = nativeMax(start, end - size); break;
|
|
}
|
|
}
|
|
return { 'start': start, 'end': end };
|
|
}
|
|
|
|
/**
|
|
* Extracts wrapper details from the `source` body comment.
|
|
*
|
|
* @private
|
|
* @param {string} source The source to inspect.
|
|
* @returns {Array} Returns the wrapper details.
|
|
*/
|
|
function getWrapDetails(source) {
|
|
var match = source.match(reWrapDetails);
|
|
return match ? match[1].split(reSplitDetails) : [];
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` exists on `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @param {Function} hasFunc The function to check properties.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
*/
|
|
function hasPath(object, path, hasFunc) {
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length,
|
|
result = false;
|
|
|
|
while (++index < length) {
|
|
var key = toKey(path[index]);
|
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
break;
|
|
}
|
|
object = object[key];
|
|
}
|
|
if (result || ++index != length) {
|
|
return result;
|
|
}
|
|
length = object == null ? 0 : object.length;
|
|
return !!length && isLength(length) && isIndex(key, length) &&
|
|
(isArray(object) || isArguments(object));
|
|
}
|
|
|
|
/**
|
|
* Initializes an array clone.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to clone.
|
|
* @returns {Array} Returns the initialized clone.
|
|
*/
|
|
function initCloneArray(array) {
|
|
var length = array.length,
|
|
result = new array.constructor(length);
|
|
|
|
// Add properties assigned by `RegExp#exec`.
|
|
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
|
result.index = array.index;
|
|
result.input = array.input;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Initializes an object clone.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to clone.
|
|
* @returns {Object} Returns the initialized clone.
|
|
*/
|
|
function initCloneObject(object) {
|
|
return (typeof object.constructor == 'function' && !isPrototype(object))
|
|
? baseCreate(getPrototype(object))
|
|
: {};
|
|
}
|
|
|
|
/**
|
|
* Initializes an object clone based on its `toStringTag`.
|
|
*
|
|
* **Note:** This function only supports cloning values with tags of
|
|
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to clone.
|
|
* @param {string} tag The `toStringTag` of the object to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the initialized clone.
|
|
*/
|
|
function initCloneByTag(object, tag, isDeep) {
|
|
var Ctor = object.constructor;
|
|
switch (tag) {
|
|
case arrayBufferTag:
|
|
return cloneArrayBuffer(object);
|
|
|
|
case boolTag:
|
|
case dateTag:
|
|
return new Ctor(+object);
|
|
|
|
case dataViewTag:
|
|
return cloneDataView(object, isDeep);
|
|
|
|
case float32Tag: case float64Tag:
|
|
case int8Tag: case int16Tag: case int32Tag:
|
|
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
|
return cloneTypedArray(object, isDeep);
|
|
|
|
case mapTag:
|
|
return new Ctor;
|
|
|
|
case numberTag:
|
|
case stringTag:
|
|
return new Ctor(object);
|
|
|
|
case regexpTag:
|
|
return cloneRegExp(object);
|
|
|
|
case setTag:
|
|
return new Ctor;
|
|
|
|
case symbolTag:
|
|
return cloneSymbol(object);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Inserts wrapper `details` in a comment at the top of the `source` body.
|
|
*
|
|
* @private
|
|
* @param {string} source The source to modify.
|
|
* @returns {Array} details The details to insert.
|
|
* @returns {string} Returns the modified source.
|
|
*/
|
|
function insertWrapDetails(source, details) {
|
|
var length = details.length;
|
|
if (!length) {
|
|
return source;
|
|
}
|
|
var lastIndex = length - 1;
|
|
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
|
|
details = details.join(length > 2 ? ', ' : ' ');
|
|
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a flattenable `arguments` object or array.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
*/
|
|
function isFlattenable(value) {
|
|
return isArray(value) || isArguments(value) ||
|
|
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a valid array-like index.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
*/
|
|
function isIndex(value, length) {
|
|
var type = typeof value;
|
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
|
|
return !!length &&
|
|
(type == 'number' ||
|
|
(type != 'symbol' && reIsUint.test(value))) &&
|
|
(value > -1 && value % 1 == 0 && value < length);
|
|
}
|
|
|
|
/**
|
|
* Checks if the given arguments are from an iteratee call.
|
|
*
|
|
* @private
|
|
* @param {*} value The potential iteratee value argument.
|
|
* @param {*} index The potential iteratee index or key argument.
|
|
* @param {*} object The potential iteratee object argument.
|
|
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
* else `false`.
|
|
*/
|
|
function isIterateeCall(value, index, object) {
|
|
if (!isObject(object)) {
|
|
return false;
|
|
}
|
|
var type = typeof index;
|
|
if (type == 'number'
|
|
? (isArrayLike(object) && isIndex(index, object.length))
|
|
: (type == 'string' && index in object)
|
|
) {
|
|
return eq(object[index], value);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a property name and not a property path.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @param {Object} [object] The object to query keys on.
|
|
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
*/
|
|
function isKey(value, object) {
|
|
if (isArray(value)) {
|
|
return false;
|
|
}
|
|
var type = typeof value;
|
|
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
value == null || isSymbol(value)) {
|
|
return true;
|
|
}
|
|
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
(object != null && value in Object(object));
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is suitable for use as unique object key.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
*/
|
|
function isKeyable(value) {
|
|
var type = typeof value;
|
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
? (value !== '__proto__')
|
|
: (value === null);
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` has a lazy counterpart.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to check.
|
|
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
|
|
* else `false`.
|
|
*/
|
|
function isLaziable(func) {
|
|
var funcName = getFuncName(func),
|
|
other = lodash[funcName];
|
|
|
|
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
|
|
return false;
|
|
}
|
|
if (func === other) {
|
|
return true;
|
|
}
|
|
var data = getData(other);
|
|
return !!data && func === data[0];
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` has its source masked.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to check.
|
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
*/
|
|
function isMasked(func) {
|
|
return !!maskSrcKey && (maskSrcKey in func);
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` is capable of being masked.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
|
*/
|
|
var isMaskable = coreJsData ? isFunction : stubFalse;
|
|
|
|
/**
|
|
* Checks if `value` is likely a prototype object.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
*/
|
|
function isPrototype(value) {
|
|
var Ctor = value && value.constructor,
|
|
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
|
|
|
return value === proto;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
* equality comparisons, else `false`.
|
|
*/
|
|
function isStrictComparable(value) {
|
|
return value === value && !isObject(value);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `matchesProperty` for source values suitable
|
|
* for strict equality comparisons, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {string} key The key of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function matchesStrictComparable(key, srcValue) {
|
|
return function(object) {
|
|
if (object == null) {
|
|
return false;
|
|
}
|
|
return object[key] === srcValue &&
|
|
(srcValue !== undefined || (key in Object(object)));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.memoize` which clears the memoized function's
|
|
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to have its output memoized.
|
|
* @returns {Function} Returns the new memoized function.
|
|
*/
|
|
function memoizeCapped(func) {
|
|
var result = memoize(func, function(key) {
|
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
cache.clear();
|
|
}
|
|
return key;
|
|
});
|
|
|
|
var cache = result.cache;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Merges the function metadata of `source` into `data`.
|
|
*
|
|
* Merging metadata reduces the number of wrappers used to invoke a function.
|
|
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
|
|
* may be applied regardless of execution order. Methods like `_.ary` and
|
|
* `_.rearg` modify function arguments, making the order in which they are
|
|
* executed important, preventing the merging of metadata. However, we make
|
|
* an exception for a safe combined case where curried functions have `_.ary`
|
|
* and or `_.rearg` applied.
|
|
*
|
|
* @private
|
|
* @param {Array} data The destination metadata.
|
|
* @param {Array} source The source metadata.
|
|
* @returns {Array} Returns `data`.
|
|
*/
|
|
function mergeData(data, source) {
|
|
var bitmask = data[1],
|
|
srcBitmask = source[1],
|
|
newBitmask = bitmask | srcBitmask,
|
|
isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
|
|
|
|
var isCombo =
|
|
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
|
|
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
|
|
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
|
|
|
|
// Exit early if metadata can't be merged.
|
|
if (!(isCommon || isCombo)) {
|
|
return data;
|
|
}
|
|
// Use source `thisArg` if available.
|
|
if (srcBitmask & WRAP_BIND_FLAG) {
|
|
data[2] = source[2];
|
|
// Set when currying a bound function.
|
|
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
|
|
}
|
|
// Compose partial arguments.
|
|
var value = source[3];
|
|
if (value) {
|
|
var partials = data[3];
|
|
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
|
|
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
|
|
}
|
|
// Compose partial right arguments.
|
|
value = source[5];
|
|
if (value) {
|
|
partials = data[5];
|
|
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
|
|
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
|
|
}
|
|
// Use source `argPos` if available.
|
|
value = source[7];
|
|
if (value) {
|
|
data[7] = value;
|
|
}
|
|
// Use source `ary` if it's smaller.
|
|
if (srcBitmask & WRAP_ARY_FLAG) {
|
|
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
|
|
}
|
|
// Use source `arity` if one is not provided.
|
|
if (data[9] == null) {
|
|
data[9] = source[9];
|
|
}
|
|
// Use source `func` and merge bitmasks.
|
|
data[0] = source[0];
|
|
data[1] = newBitmask;
|
|
|
|
return data;
|
|
}
|
|
|
|
/**
|
|
* This function is like
|
|
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
* except that it includes inherited enumerable properties.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function nativeKeysIn(object) {
|
|
var result = [];
|
|
if (object != null) {
|
|
for (var key in Object(object)) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a string using `Object.prototype.toString`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to convert.
|
|
* @returns {string} Returns the converted string.
|
|
*/
|
|
function objectToString(value) {
|
|
return nativeObjectToString.call(value);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseRest` which transforms the rest array.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @param {Function} transform The rest array transform.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function overRest(func, start, transform) {
|
|
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
return function() {
|
|
var args = arguments,
|
|
index = -1,
|
|
length = nativeMax(args.length - start, 0),
|
|
array = Array(length);
|
|
|
|
while (++index < length) {
|
|
array[index] = args[start + index];
|
|
}
|
|
index = -1;
|
|
var otherArgs = Array(start + 1);
|
|
while (++index < start) {
|
|
otherArgs[index] = args[index];
|
|
}
|
|
otherArgs[start] = transform(array);
|
|
return apply(func, this, otherArgs);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets the parent value at `path` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} path The path to get the parent value of.
|
|
* @returns {*} Returns the parent value.
|
|
*/
|
|
function parent(object, path) {
|
|
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
|
|
}
|
|
|
|
/**
|
|
* Reorder `array` according to the specified indexes where the element at
|
|
* the first index is assigned as the first element, the element at
|
|
* the second index is assigned as the second element, and so on.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to reorder.
|
|
* @param {Array} indexes The arranged array indexes.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function reorder(array, indexes) {
|
|
var arrLength = array.length,
|
|
length = nativeMin(indexes.length, arrLength),
|
|
oldArray = copyArray(array);
|
|
|
|
while (length--) {
|
|
var index = indexes[length];
|
|
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {string} key The key of the property to get.
|
|
* @returns {*} Returns the property value.
|
|
*/
|
|
function safeGet(object, key) {
|
|
if (key === 'constructor' && typeof object[key] === 'function') {
|
|
return;
|
|
}
|
|
|
|
if (key == '__proto__') {
|
|
return;
|
|
}
|
|
|
|
return object[key];
|
|
}
|
|
|
|
/**
|
|
* Sets metadata for `func`.
|
|
*
|
|
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
|
|
* period of time, it will trip its breaker and transition to an identity
|
|
* function to avoid garbage collection pauses in V8. See
|
|
* [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
|
|
* for more details.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to associate metadata with.
|
|
* @param {*} data The metadata.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var setData = shortOut(baseSetData);
|
|
|
|
/**
|
|
* A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @returns {number|Object} Returns the timer id or timeout object.
|
|
*/
|
|
var setTimeout = ctxSetTimeout || function(func, wait) {
|
|
return root.setTimeout(func, wait);
|
|
};
|
|
|
|
/**
|
|
* Sets the `toString` method of `func` to return `string`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to modify.
|
|
* @param {Function} string The `toString` result.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var setToString = shortOut(baseSetToString);
|
|
|
|
/**
|
|
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
|
|
* with wrapper details in a comment at the top of the source body.
|
|
*
|
|
* @private
|
|
* @param {Function} wrapper The function to modify.
|
|
* @param {Function} reference The reference function.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @returns {Function} Returns `wrapper`.
|
|
*/
|
|
function setWrapToString(wrapper, reference, bitmask) {
|
|
var source = (reference + '');
|
|
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that'll short out and invoke `identity` instead
|
|
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
* milliseconds.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new shortable function.
|
|
*/
|
|
function shortOut(func) {
|
|
var count = 0,
|
|
lastCalled = 0;
|
|
|
|
return function() {
|
|
var stamp = nativeNow(),
|
|
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
|
|
lastCalled = stamp;
|
|
if (remaining > 0) {
|
|
if (++count >= HOT_COUNT) {
|
|
return arguments[0];
|
|
}
|
|
} else {
|
|
count = 0;
|
|
}
|
|
return func.apply(undefined, arguments);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.shuffle` which mutates and sets the size of `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to shuffle.
|
|
* @param {number} [size=array.length] The size of `array`.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function shuffleSelf(array, size) {
|
|
var index = -1,
|
|
length = array.length,
|
|
lastIndex = length - 1;
|
|
|
|
size = size === undefined ? length : size;
|
|
while (++index < size) {
|
|
var rand = baseRandom(index, lastIndex),
|
|
value = array[rand];
|
|
|
|
array[rand] = array[index];
|
|
array[index] = value;
|
|
}
|
|
array.length = size;
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to a property path array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the property path array.
|
|
*/
|
|
var stringToPath = memoizeCapped(function(string) {
|
|
var result = [];
|
|
if (string.charCodeAt(0) === 46 /* . */) {
|
|
result.push('');
|
|
}
|
|
string.replace(rePropName, function(match, number, quote, subString) {
|
|
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
});
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Converts `value` to a string key if it's not a string or symbol.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {string|symbol} Returns the key.
|
|
*/
|
|
function toKey(value) {
|
|
if (typeof value == 'string' || isSymbol(value)) {
|
|
return value;
|
|
}
|
|
var result = (value + '');
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
}
|
|
|
|
/**
|
|
* Converts `func` to its source code.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to convert.
|
|
* @returns {string} Returns the source code.
|
|
*/
|
|
function toSource(func) {
|
|
if (func != null) {
|
|
try {
|
|
return funcToString.call(func);
|
|
} catch (e) {}
|
|
try {
|
|
return (func + '');
|
|
} catch (e) {}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
/**
|
|
* Updates wrapper `details` based on `bitmask` flags.
|
|
*
|
|
* @private
|
|
* @returns {Array} details The details to modify.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @returns {Array} Returns `details`.
|
|
*/
|
|
function updateWrapDetails(details, bitmask) {
|
|
arrayEach(wrapFlags, function(pair) {
|
|
var value = '_.' + pair[0];
|
|
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
|
details.push(value);
|
|
}
|
|
});
|
|
return details.sort();
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `wrapper`.
|
|
*
|
|
* @private
|
|
* @param {Object} wrapper The wrapper to clone.
|
|
* @returns {Object} Returns the cloned wrapper.
|
|
*/
|
|
function wrapperClone(wrapper) {
|
|
if (wrapper instanceof LazyWrapper) {
|
|
return wrapper.clone();
|
|
}
|
|
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
|
|
result.__actions__ = copyArray(wrapper.__actions__);
|
|
result.__index__ = wrapper.__index__;
|
|
result.__values__ = wrapper.__values__;
|
|
return result;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an array of elements split into groups the length of `size`.
|
|
* If `array` can't be split evenly, the final chunk will be the remaining
|
|
* elements.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to process.
|
|
* @param {number} [size=1] The length of each chunk
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the new array of chunks.
|
|
* @example
|
|
*
|
|
* _.chunk(['a', 'b', 'c', 'd'], 2);
|
|
* // => [['a', 'b'], ['c', 'd']]
|
|
*
|
|
* _.chunk(['a', 'b', 'c', 'd'], 3);
|
|
* // => [['a', 'b', 'c'], ['d']]
|
|
*/
|
|
function chunk(array, size, guard) {
|
|
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
|
|
size = 1;
|
|
} else {
|
|
size = nativeMax(toInteger(size), 0);
|
|
}
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length || size < 1) {
|
|
return [];
|
|
}
|
|
var index = 0,
|
|
resIndex = 0,
|
|
result = Array(nativeCeil(length / size));
|
|
|
|
while (index < length) {
|
|
result[resIndex++] = baseSlice(array, index, (index += size));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an array with all falsey values removed. The values `false`, `null`,
|
|
* `0`, `""`, `undefined`, and `NaN` are falsey.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to compact.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.compact([0, 1, false, 2, '', 3]);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function compact(array) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (value) {
|
|
result[resIndex++] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a new array concatenating `array` with any additional arrays
|
|
* and/or values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to concatenate.
|
|
* @param {...*} [values] The values to concatenate.
|
|
* @returns {Array} Returns the new concatenated array.
|
|
* @example
|
|
*
|
|
* var array = [1];
|
|
* var other = _.concat(array, 2, [3], [[4]]);
|
|
*
|
|
* console.log(other);
|
|
* // => [1, 2, 3, [4]]
|
|
*
|
|
* console.log(array);
|
|
* // => [1]
|
|
*/
|
|
function concat() {
|
|
var length = arguments.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
var args = Array(length - 1),
|
|
array = arguments[0],
|
|
index = length;
|
|
|
|
while (index--) {
|
|
args[index - 1] = arguments[index];
|
|
}
|
|
return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of `array` values not included in the other given arrays
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. The order and references of result values are
|
|
* determined by the first array.
|
|
*
|
|
* **Note:** Unlike `_.pullAll`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.without, _.xor
|
|
* @example
|
|
*
|
|
* _.difference([2, 1], [2, 3]);
|
|
* // => [1]
|
|
*/
|
|
var difference = baseRest(function(array, values) {
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.difference` except that it accepts `iteratee` which
|
|
* is invoked for each element of `array` and `values` to generate the criterion
|
|
* by which they're compared. The order and references of result values are
|
|
* determined by the first array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* **Note:** Unlike `_.pullAllBy`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
var differenceBy = baseRest(function(array, values) {
|
|
var iteratee = last(values);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.difference` except that it accepts `comparator`
|
|
* which is invoked to compare elements of `array` to `values`. The order and
|
|
* references of result values are determined by the first array. The comparator
|
|
* is invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* **Note:** Unlike `_.pullAllWith`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
*
|
|
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
|
* // => [{ 'x': 2, 'y': 1 }]
|
|
*/
|
|
var differenceWith = baseRest(function(array, values) {
|
|
var comparator = last(values);
|
|
if (isArrayLikeObject(comparator)) {
|
|
comparator = undefined;
|
|
}
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements dropped from the beginning.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to drop.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.drop([1, 2, 3]);
|
|
* // => [2, 3]
|
|
*
|
|
* _.drop([1, 2, 3], 2);
|
|
* // => [3]
|
|
*
|
|
* _.drop([1, 2, 3], 5);
|
|
* // => []
|
|
*
|
|
* _.drop([1, 2, 3], 0);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function drop(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
return baseSlice(array, n < 0 ? 0 : n, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements dropped from the end.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to drop.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.dropRight([1, 2, 3]);
|
|
* // => [1, 2]
|
|
*
|
|
* _.dropRight([1, 2, 3], 2);
|
|
* // => [1]
|
|
*
|
|
* _.dropRight([1, 2, 3], 5);
|
|
* // => []
|
|
*
|
|
* _.dropRight([1, 2, 3], 0);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function dropRight(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
n = length - n;
|
|
return baseSlice(array, 0, n < 0 ? 0 : n);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` excluding elements dropped from the end.
|
|
* Elements are dropped until `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.dropRightWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.dropRightWhile(users, ['active', false]);
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.dropRightWhile(users, 'active');
|
|
* // => objects for ['barney', 'fred', 'pebbles']
|
|
*/
|
|
function dropRightWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), true, true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` excluding elements dropped from the beginning.
|
|
* Elements are dropped until `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.dropWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.dropWhile(users, { 'user': 'barney', 'active': false });
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.dropWhile(users, ['active', false]);
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.dropWhile(users, 'active');
|
|
* // => objects for ['barney', 'fred', 'pebbles']
|
|
*/
|
|
function dropWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Fills elements of `array` with `value` from `start` up to, but not
|
|
* including, `end`.
|
|
*
|
|
* **Note:** This method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Array
|
|
* @param {Array} array The array to fill.
|
|
* @param {*} value The value to fill `array` with.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _.fill(array, 'a');
|
|
* console.log(array);
|
|
* // => ['a', 'a', 'a']
|
|
*
|
|
* _.fill(Array(3), 2);
|
|
* // => [2, 2, 2]
|
|
*
|
|
* _.fill([4, 6, 8, 10], '*', 1, 3);
|
|
* // => [4, '*', '*', 10]
|
|
*/
|
|
function fill(array, value, start, end) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
|
|
start = 0;
|
|
end = length;
|
|
}
|
|
return baseFill(array, value, start, end);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.find` except that it returns the index of the first
|
|
* element `predicate` returns truthy for instead of the element itself.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {number} Returns the index of the found element, else `-1`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
|
* // => 0
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
|
* // => 1
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findIndex(users, ['active', false]);
|
|
* // => 0
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findIndex(users, 'active');
|
|
* // => 2
|
|
*/
|
|
function findIndex(array, predicate, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
|
if (index < 0) {
|
|
index = nativeMax(length + index, 0);
|
|
}
|
|
return baseFindIndex(array, getIteratee(predicate, 3), index);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.findIndex` except that it iterates over elements
|
|
* of `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
|
* @returns {number} Returns the index of the found element, else `-1`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
|
* // => 2
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
|
* // => 0
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findLastIndex(users, ['active', false]);
|
|
* // => 2
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findLastIndex(users, 'active');
|
|
* // => 0
|
|
*/
|
|
function findLastIndex(array, predicate, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = length - 1;
|
|
if (fromIndex !== undefined) {
|
|
index = toInteger(fromIndex);
|
|
index = fromIndex < 0
|
|
? nativeMax(length + index, 0)
|
|
: nativeMin(index, length - 1);
|
|
}
|
|
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
|
|
}
|
|
|
|
/**
|
|
* Flattens `array` a single level deep.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
* // => [1, 2, [3, [4]], 5]
|
|
*/
|
|
function flatten(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseFlatten(array, 1) : [];
|
|
}
|
|
|
|
/**
|
|
* Recursively flattens `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* _.flattenDeep([1, [2, [3, [4]], 5]]);
|
|
* // => [1, 2, 3, 4, 5]
|
|
*/
|
|
function flattenDeep(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseFlatten(array, INFINITY) : [];
|
|
}
|
|
|
|
/**
|
|
* Recursively flatten `array` up to `depth` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.4.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @param {number} [depth=1] The maximum recursion depth.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* var array = [1, [2, [3, [4]], 5]];
|
|
*
|
|
* _.flattenDepth(array, 1);
|
|
* // => [1, 2, [3, [4]], 5]
|
|
*
|
|
* _.flattenDepth(array, 2);
|
|
* // => [1, 2, 3, [4], 5]
|
|
*/
|
|
function flattenDepth(array, depth) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
depth = depth === undefined ? 1 : toInteger(depth);
|
|
return baseFlatten(array, depth);
|
|
}
|
|
|
|
/**
|
|
* The inverse of `_.toPairs`; this method returns an object composed
|
|
* from key-value `pairs`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} pairs The key-value pairs.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
function fromPairs(pairs) {
|
|
var index = -1,
|
|
length = pairs == null ? 0 : pairs.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var pair = pairs[index];
|
|
result[pair[0]] = pair[1];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the first element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias first
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {*} Returns the first element of `array`.
|
|
* @example
|
|
*
|
|
* _.head([1, 2, 3]);
|
|
* // => 1
|
|
*
|
|
* _.head([]);
|
|
* // => undefined
|
|
*/
|
|
function head(array) {
|
|
return (array && array.length) ? array[0] : undefined;
|
|
}
|
|
|
|
/**
|
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
|
* offset from the end of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.indexOf([1, 2, 1, 2], 2);
|
|
* // => 1
|
|
*
|
|
* // Search from the `fromIndex`.
|
|
* _.indexOf([1, 2, 1, 2], 2, 2);
|
|
* // => 3
|
|
*/
|
|
function indexOf(array, value, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
|
if (index < 0) {
|
|
index = nativeMax(length + index, 0);
|
|
}
|
|
return baseIndexOf(array, value, index);
|
|
}
|
|
|
|
/**
|
|
* Gets all but the last element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.initial([1, 2, 3]);
|
|
* // => [1, 2]
|
|
*/
|
|
function initial(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseSlice(array, 0, -1) : [];
|
|
}
|
|
|
|
/**
|
|
* Creates an array of unique values that are included in all given arrays
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. The order and references of result values are
|
|
* determined by the first array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* _.intersection([2, 1], [2, 3]);
|
|
* // => [2]
|
|
*/
|
|
var intersection = baseRest(function(arrays) {
|
|
var mapped = arrayMap(arrays, castArrayLikeObject);
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.intersection` except that it accepts `iteratee`
|
|
* which is invoked for each element of each `arrays` to generate the criterion
|
|
* by which they're compared. The order and references of result values are
|
|
* determined by the first array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [2.1]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }]
|
|
*/
|
|
var intersectionBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays),
|
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
|
|
|
if (iteratee === last(mapped)) {
|
|
iteratee = undefined;
|
|
} else {
|
|
mapped.pop();
|
|
}
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped, getIteratee(iteratee, 2))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.intersection` except that it accepts `comparator`
|
|
* which is invoked to compare elements of `arrays`. The order and references
|
|
* of result values are determined by the first array. The comparator is
|
|
* invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.intersectionWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }]
|
|
*/
|
|
var intersectionWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays),
|
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
|
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
if (comparator) {
|
|
mapped.pop();
|
|
}
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped, undefined, comparator)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Converts all elements in `array` into a string separated by `separator`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to convert.
|
|
* @param {string} [separator=','] The element separator.
|
|
* @returns {string} Returns the joined string.
|
|
* @example
|
|
*
|
|
* _.join(['a', 'b', 'c'], '~');
|
|
* // => 'a~b~c'
|
|
*/
|
|
function join(array, separator) {
|
|
return array == null ? '' : nativeJoin.call(array, separator);
|
|
}
|
|
|
|
/**
|
|
* Gets the last element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {*} Returns the last element of `array`.
|
|
* @example
|
|
*
|
|
* _.last([1, 2, 3]);
|
|
* // => 3
|
|
*/
|
|
function last(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? array[length - 1] : undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.indexOf` except that it iterates over elements of
|
|
* `array` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.lastIndexOf([1, 2, 1, 2], 2);
|
|
* // => 3
|
|
*
|
|
* // Search from the `fromIndex`.
|
|
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
|
|
* // => 1
|
|
*/
|
|
function lastIndexOf(array, value, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = length;
|
|
if (fromIndex !== undefined) {
|
|
index = toInteger(fromIndex);
|
|
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
|
|
}
|
|
return value === value
|
|
? strictLastIndexOf(array, value, index)
|
|
: baseFindIndex(array, baseIsNaN, index, true);
|
|
}
|
|
|
|
/**
|
|
* Gets the element at index `n` of `array`. If `n` is negative, the nth
|
|
* element from the end is returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.11.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=0] The index of the element to return.
|
|
* @returns {*} Returns the nth element of `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'd'];
|
|
*
|
|
* _.nth(array, 1);
|
|
* // => 'b'
|
|
*
|
|
* _.nth(array, -2);
|
|
* // => 'c';
|
|
*/
|
|
function nth(array, n) {
|
|
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
|
}
|
|
|
|
/**
|
|
* Removes all given values from `array` using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
|
|
* to remove elements from an array by predicate.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {...*} [values] The values to remove.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
|
*
|
|
* _.pull(array, 'a', 'c');
|
|
* console.log(array);
|
|
* // => ['b', 'b']
|
|
*/
|
|
var pull = baseRest(pullAll);
|
|
|
|
/**
|
|
* This method is like `_.pull` except that it accepts an array of values to remove.
|
|
*
|
|
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
|
*
|
|
* _.pullAll(array, ['a', 'c']);
|
|
* console.log(array);
|
|
* // => ['b', 'b']
|
|
*/
|
|
function pullAll(array, values) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values)
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.pullAll` except that it accepts `iteratee` which is
|
|
* invoked for each element of `array` and `values` to generate the criterion
|
|
* by which they're compared. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
|
*
|
|
* _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
|
* console.log(array);
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
function pullAllBy(array, values, iteratee) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values, getIteratee(iteratee, 2))
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.pullAll` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `array` to `values`. The comparator is
|
|
* invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
|
*
|
|
* _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
|
* console.log(array);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
|
*/
|
|
function pullAllWith(array, values, comparator) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values, undefined, comparator)
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* Removes elements from `array` corresponding to `indexes` and returns an
|
|
* array of removed elements.
|
|
*
|
|
* **Note:** Unlike `_.at`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {...(number|number[])} [indexes] The indexes of elements to remove.
|
|
* @returns {Array} Returns the new array of removed elements.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'd'];
|
|
* var pulled = _.pullAt(array, [1, 3]);
|
|
*
|
|
* console.log(array);
|
|
* // => ['a', 'c']
|
|
*
|
|
* console.log(pulled);
|
|
* // => ['b', 'd']
|
|
*/
|
|
var pullAt = flatRest(function(array, indexes) {
|
|
var length = array == null ? 0 : array.length,
|
|
result = baseAt(array, indexes);
|
|
|
|
basePullAt(array, arrayMap(indexes, function(index) {
|
|
return isIndex(index, length) ? +index : index;
|
|
}).sort(compareAscending));
|
|
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Removes all elements from `array` that `predicate` returns truthy for
|
|
* and returns an array of the removed elements. The predicate is invoked
|
|
* with three arguments: (value, index, array).
|
|
*
|
|
* **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
|
|
* to pull elements from an array by value.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new array of removed elements.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3, 4];
|
|
* var evens = _.remove(array, function(n) {
|
|
* return n % 2 == 0;
|
|
* });
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 3]
|
|
*
|
|
* console.log(evens);
|
|
* // => [2, 4]
|
|
*/
|
|
function remove(array, predicate) {
|
|
var result = [];
|
|
if (!(array && array.length)) {
|
|
return result;
|
|
}
|
|
var index = -1,
|
|
indexes = [],
|
|
length = array.length;
|
|
|
|
predicate = getIteratee(predicate, 3);
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (predicate(value, index, array)) {
|
|
result.push(value);
|
|
indexes.push(index);
|
|
}
|
|
}
|
|
basePullAt(array, indexes);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Reverses `array` so that the first element becomes the last, the second
|
|
* element becomes the second to last, and so on.
|
|
*
|
|
* **Note:** This method mutates `array` and is based on
|
|
* [`Array#reverse`](https://mdn.io/Array/reverse).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _.reverse(array);
|
|
* // => [3, 2, 1]
|
|
*
|
|
* console.log(array);
|
|
* // => [3, 2, 1]
|
|
*/
|
|
function reverse(array) {
|
|
return array == null ? array : nativeReverse.call(array);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
*
|
|
* **Note:** This method is used instead of
|
|
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
* returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to slice.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function slice(array, start, end) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
|
start = 0;
|
|
end = length;
|
|
}
|
|
else {
|
|
start = start == null ? 0 : toInteger(start);
|
|
end = end === undefined ? length : toInteger(end);
|
|
}
|
|
return baseSlice(array, start, end);
|
|
}
|
|
|
|
/**
|
|
* Uses a binary search to determine the lowest index at which `value`
|
|
* should be inserted into `array` in order to maintain its sort order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* _.sortedIndex([30, 50], 40);
|
|
* // => 1
|
|
*/
|
|
function sortedIndex(array, value) {
|
|
return baseSortedIndex(array, value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedIndex` except that it accepts `iteratee`
|
|
* which is invoked for `value` and each element of `array` to compute their
|
|
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
|
*
|
|
* _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
|
* // => 0
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sortedIndexBy(objects, { 'x': 4 }, 'x');
|
|
* // => 0
|
|
*/
|
|
function sortedIndexBy(array, value, iteratee) {
|
|
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.indexOf` except that it performs a binary
|
|
* search on a sorted `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.sortedIndexOf([4, 5, 5, 5, 6], 5);
|
|
* // => 1
|
|
*/
|
|
function sortedIndexOf(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (length) {
|
|
var index = baseSortedIndex(array, value);
|
|
if (index < length && eq(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedIndex` except that it returns the highest
|
|
* index at which `value` should be inserted into `array` in order to
|
|
* maintain its sort order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
|
* // => 4
|
|
*/
|
|
function sortedLastIndex(array, value) {
|
|
return baseSortedIndex(array, value, true);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedLastIndex` except that it accepts `iteratee`
|
|
* which is invoked for `value` and each element of `array` to compute their
|
|
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
|
*
|
|
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
|
* // => 1
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
|
|
* // => 1
|
|
*/
|
|
function sortedLastIndexBy(array, value, iteratee) {
|
|
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.lastIndexOf` except that it performs a binary
|
|
* search on a sorted `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
|
|
* // => 3
|
|
*/
|
|
function sortedLastIndexOf(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (length) {
|
|
var index = baseSortedIndex(array, value, true) - 1;
|
|
if (eq(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it's designed and optimized
|
|
* for sorted arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.sortedUniq([1, 1, 2]);
|
|
* // => [1, 2]
|
|
*/
|
|
function sortedUniq(array) {
|
|
return (array && array.length)
|
|
? baseSortedUniq(array)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniqBy` except that it's designed and optimized
|
|
* for sorted arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
|
* // => [1.1, 2.3]
|
|
*/
|
|
function sortedUniqBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseSortedUniq(array, getIteratee(iteratee, 2))
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Gets all but the first element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.tail([1, 2, 3]);
|
|
* // => [2, 3]
|
|
*/
|
|
function tail(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseSlice(array, 1, length) : [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements taken from the beginning.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to take.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.take([1, 2, 3]);
|
|
* // => [1]
|
|
*
|
|
* _.take([1, 2, 3], 2);
|
|
* // => [1, 2]
|
|
*
|
|
* _.take([1, 2, 3], 5);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* _.take([1, 2, 3], 0);
|
|
* // => []
|
|
*/
|
|
function take(array, n, guard) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
return baseSlice(array, 0, n < 0 ? 0 : n);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements taken from the end.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to take.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.takeRight([1, 2, 3]);
|
|
* // => [3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 2);
|
|
* // => [2, 3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 5);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 0);
|
|
* // => []
|
|
*/
|
|
function takeRight(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
n = length - n;
|
|
return baseSlice(array, n < 0 ? 0 : n, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with elements taken from the end. Elements are
|
|
* taken until `predicate` returns falsey. The predicate is invoked with
|
|
* three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.takeRightWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.takeRightWhile(users, ['active', false]);
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.takeRightWhile(users, 'active');
|
|
* // => []
|
|
*/
|
|
function takeRightWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), false, true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with elements taken from the beginning. Elements
|
|
* are taken until `predicate` returns falsey. The predicate is invoked with
|
|
* three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.takeWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.takeWhile(users, { 'user': 'barney', 'active': false });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.takeWhile(users, ['active', false]);
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.takeWhile(users, 'active');
|
|
* // => []
|
|
*/
|
|
function takeWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3))
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates an array of unique values, in order, from all given arrays using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* _.union([2], [1, 2]);
|
|
* // => [2, 1]
|
|
*/
|
|
var union = baseRest(function(arrays) {
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.union` except that it accepts `iteratee` which is
|
|
* invoked for each element of each `arrays` to generate the criterion by
|
|
* which uniqueness is computed. Result values are chosen from the first
|
|
* array in which the value occurs. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
|
|
* // => [2.1, 1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
|
*/
|
|
var unionBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.union` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `arrays`. Result values are chosen from
|
|
* the first array in which the value occurs. The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.unionWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
|
*/
|
|
var unionWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays);
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
|
|
});
|
|
|
|
/**
|
|
* Creates a duplicate-free version of an array, using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons, in which only the first occurrence of each element
|
|
* is kept. The order of result values is determined by the order they occur
|
|
* in the array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.uniq([2, 1, 2]);
|
|
* // => [2, 1]
|
|
*/
|
|
function uniq(array) {
|
|
return (array && array.length) ? baseUniq(array) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* uniqueness is computed. The order of result values is determined by the
|
|
* order they occur in the array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.uniqBy([2.1, 1.2, 2.3], Math.floor);
|
|
* // => [2.1, 1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
|
*/
|
|
function uniqBy(array, iteratee) {
|
|
return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `array`. The order of result values is
|
|
* determined by the order they occur in the array.The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.uniqWith(objects, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
|
*/
|
|
function uniqWith(array, comparator) {
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zip` except that it accepts an array of grouped
|
|
* elements and creates an array regrouping the elements to their pre-zip
|
|
* configuration.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.2.0
|
|
* @category Array
|
|
* @param {Array} array The array of grouped elements to process.
|
|
* @returns {Array} Returns the new array of regrouped elements.
|
|
* @example
|
|
*
|
|
* var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
|
|
* // => [['a', 1, true], ['b', 2, false]]
|
|
*
|
|
* _.unzip(zipped);
|
|
* // => [['a', 'b'], [1, 2], [true, false]]
|
|
*/
|
|
function unzip(array) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
var length = 0;
|
|
array = arrayFilter(array, function(group) {
|
|
if (isArrayLikeObject(group)) {
|
|
length = nativeMax(group.length, length);
|
|
return true;
|
|
}
|
|
});
|
|
return baseTimes(length, function(index) {
|
|
return arrayMap(array, baseProperty(index));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.unzip` except that it accepts `iteratee` to specify
|
|
* how regrouped values should be combined. The iteratee is invoked with the
|
|
* elements of each group: (...group).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Array
|
|
* @param {Array} array The array of grouped elements to process.
|
|
* @param {Function} [iteratee=_.identity] The function to combine
|
|
* regrouped values.
|
|
* @returns {Array} Returns the new array of regrouped elements.
|
|
* @example
|
|
*
|
|
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
|
|
* // => [[1, 10, 100], [2, 20, 200]]
|
|
*
|
|
* _.unzipWith(zipped, _.add);
|
|
* // => [3, 30, 300]
|
|
*/
|
|
function unzipWith(array, iteratee) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
var result = unzip(array);
|
|
if (iteratee == null) {
|
|
return result;
|
|
}
|
|
return arrayMap(result, function(group) {
|
|
return apply(iteratee, undefined, group);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates an array excluding all given values using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* **Note:** Unlike `_.pull`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...*} [values] The values to exclude.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.difference, _.xor
|
|
* @example
|
|
*
|
|
* _.without([2, 1, 2, 3], 1, 2);
|
|
* // => [3]
|
|
*/
|
|
var without = baseRest(function(array, values) {
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, values)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Creates an array of unique values that is the
|
|
* [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
|
* of the given arrays. The order of result values is determined by the order
|
|
* they occur in the arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.difference, _.without
|
|
* @example
|
|
*
|
|
* _.xor([2, 1], [2, 3]);
|
|
* // => [1, 3]
|
|
*/
|
|
var xor = baseRest(function(arrays) {
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.xor` except that it accepts `iteratee` which is
|
|
* invoked for each element of each `arrays` to generate the criterion by
|
|
* which by which they're compared. The order of result values is determined
|
|
* by the order they occur in the arrays. The iteratee is invoked with one
|
|
* argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [1.2, 3.4]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
var xorBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.xor` except that it accepts `comparator` which is
|
|
* invoked to compare elements of `arrays`. The order of result values is
|
|
* determined by the order they occur in the arrays. The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.xorWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
|
*/
|
|
var xorWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays);
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of grouped elements, the first of which contains the
|
|
* first elements of the given arrays, the second of which contains the
|
|
* second elements of the given arrays, and so on.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to process.
|
|
* @returns {Array} Returns the new array of grouped elements.
|
|
* @example
|
|
*
|
|
* _.zip(['a', 'b'], [1, 2], [true, false]);
|
|
* // => [['a', 1, true], ['b', 2, false]]
|
|
*/
|
|
var zip = baseRest(unzip);
|
|
|
|
/**
|
|
* This method is like `_.fromPairs` except that it accepts two arrays,
|
|
* one of property identifiers and one of corresponding values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.4.0
|
|
* @category Array
|
|
* @param {Array} [props=[]] The property identifiers.
|
|
* @param {Array} [values=[]] The property values.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.zipObject(['a', 'b'], [1, 2]);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
function zipObject(props, values) {
|
|
return baseZipObject(props || [], values || [], assignValue);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zipObject` except that it supports property paths.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.1.0
|
|
* @category Array
|
|
* @param {Array} [props=[]] The property identifiers.
|
|
* @param {Array} [values=[]] The property values.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
|
|
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
|
*/
|
|
function zipObjectDeep(props, values) {
|
|
return baseZipObject(props || [], values || [], baseSet);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zip` except that it accepts `iteratee` to specify
|
|
* how grouped values should be combined. The iteratee is invoked with the
|
|
* elements of each group: (...group).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to process.
|
|
* @param {Function} [iteratee=_.identity] The function to combine
|
|
* grouped values.
|
|
* @returns {Array} Returns the new array of grouped elements.
|
|
* @example
|
|
*
|
|
* _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
|
|
* return a + b + c;
|
|
* });
|
|
* // => [111, 222]
|
|
*/
|
|
var zipWith = baseRest(function(arrays) {
|
|
var length = arrays.length,
|
|
iteratee = length > 1 ? arrays[length - 1] : undefined;
|
|
|
|
iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
|
|
return unzipWith(arrays, iteratee);
|
|
});
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a `lodash` wrapper instance that wraps `value` with explicit method
|
|
* chain sequences enabled. The result of such sequences must be unwrapped
|
|
* with `_#value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.3.0
|
|
* @category Seq
|
|
* @param {*} value The value to wrap.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 40 },
|
|
* { 'user': 'pebbles', 'age': 1 }
|
|
* ];
|
|
*
|
|
* var youngest = _
|
|
* .chain(users)
|
|
* .sortBy('age')
|
|
* .map(function(o) {
|
|
* return o.user + ' is ' + o.age;
|
|
* })
|
|
* .head()
|
|
* .value();
|
|
* // => 'pebbles is 1'
|
|
*/
|
|
function chain(value) {
|
|
var result = lodash(value);
|
|
result.__chain__ = true;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method invokes `interceptor` and returns `value`. The interceptor
|
|
* is invoked with one argument; (value). The purpose of this method is to
|
|
* "tap into" a method chain sequence in order to modify intermediate results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @param {*} value The value to provide to `interceptor`.
|
|
* @param {Function} interceptor The function to invoke.
|
|
* @returns {*} Returns `value`.
|
|
* @example
|
|
*
|
|
* _([1, 2, 3])
|
|
* .tap(function(array) {
|
|
* // Mutate input array.
|
|
* array.pop();
|
|
* })
|
|
* .reverse()
|
|
* .value();
|
|
* // => [2, 1]
|
|
*/
|
|
function tap(value, interceptor) {
|
|
interceptor(value);
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.tap` except that it returns the result of `interceptor`.
|
|
* The purpose of this method is to "pass thru" values replacing intermediate
|
|
* results in a method chain sequence.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Seq
|
|
* @param {*} value The value to provide to `interceptor`.
|
|
* @param {Function} interceptor The function to invoke.
|
|
* @returns {*} Returns the result of `interceptor`.
|
|
* @example
|
|
*
|
|
* _(' abc ')
|
|
* .chain()
|
|
* .trim()
|
|
* .thru(function(value) {
|
|
* return [value];
|
|
* })
|
|
* .value();
|
|
* // => ['abc']
|
|
*/
|
|
function thru(value, interceptor) {
|
|
return interceptor(value);
|
|
}
|
|
|
|
/**
|
|
* This method is the wrapper version of `_.at`.
|
|
*
|
|
* @name at
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Seq
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
*
|
|
* _(object).at(['a[0].b.c', 'a[1]']).value();
|
|
* // => [3, 4]
|
|
*/
|
|
var wrapperAt = flatRest(function(paths) {
|
|
var length = paths.length,
|
|
start = length ? paths[0] : 0,
|
|
value = this.__wrapped__,
|
|
interceptor = function(object) { return baseAt(object, paths); };
|
|
|
|
if (length > 1 || this.__actions__.length ||
|
|
!(value instanceof LazyWrapper) || !isIndex(start)) {
|
|
return this.thru(interceptor);
|
|
}
|
|
value = value.slice(start, +start + (length ? 1 : 0));
|
|
value.__actions__.push({
|
|
'func': thru,
|
|
'args': [interceptor],
|
|
'thisArg': undefined
|
|
});
|
|
return new LodashWrapper(value, this.__chain__).thru(function(array) {
|
|
if (length && !array.length) {
|
|
array.push(undefined);
|
|
}
|
|
return array;
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
|
|
*
|
|
* @name chain
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 40 }
|
|
* ];
|
|
*
|
|
* // A sequence without explicit chaining.
|
|
* _(users).head();
|
|
* // => { 'user': 'barney', 'age': 36 }
|
|
*
|
|
* // A sequence with explicit chaining.
|
|
* _(users)
|
|
* .chain()
|
|
* .head()
|
|
* .pick('user')
|
|
* .value();
|
|
* // => { 'user': 'barney' }
|
|
*/
|
|
function wrapperChain() {
|
|
return chain(this);
|
|
}
|
|
|
|
/**
|
|
* Executes the chain sequence and returns the wrapped result.
|
|
*
|
|
* @name commit
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var array = [1, 2];
|
|
* var wrapped = _(array).push(3);
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 2]
|
|
*
|
|
* wrapped = wrapped.commit();
|
|
* console.log(array);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* wrapped.last();
|
|
* // => 3
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function wrapperCommit() {
|
|
return new LodashWrapper(this.value(), this.__chain__);
|
|
}
|
|
|
|
/**
|
|
* Gets the next value on a wrapped object following the
|
|
* [iterator protocol](https://mdn.io/iteration_protocols#iterator).
|
|
*
|
|
* @name next
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the next iterator value.
|
|
* @example
|
|
*
|
|
* var wrapped = _([1, 2]);
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': false, 'value': 1 }
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': false, 'value': 2 }
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': true, 'value': undefined }
|
|
*/
|
|
function wrapperNext() {
|
|
if (this.__values__ === undefined) {
|
|
this.__values__ = toArray(this.value());
|
|
}
|
|
var done = this.__index__ >= this.__values__.length,
|
|
value = done ? undefined : this.__values__[this.__index__++];
|
|
|
|
return { 'done': done, 'value': value };
|
|
}
|
|
|
|
/**
|
|
* Enables the wrapper to be iterable.
|
|
*
|
|
* @name Symbol.iterator
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the wrapper object.
|
|
* @example
|
|
*
|
|
* var wrapped = _([1, 2]);
|
|
*
|
|
* wrapped[Symbol.iterator]() === wrapped;
|
|
* // => true
|
|
*
|
|
* Array.from(wrapped);
|
|
* // => [1, 2]
|
|
*/
|
|
function wrapperToIterator() {
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the chain sequence planting `value` as the wrapped value.
|
|
*
|
|
* @name plant
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Seq
|
|
* @param {*} value The value to plant.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var wrapped = _([1, 2]).map(square);
|
|
* var other = wrapped.plant([3, 4]);
|
|
*
|
|
* other.value();
|
|
* // => [9, 16]
|
|
*
|
|
* wrapped.value();
|
|
* // => [1, 4]
|
|
*/
|
|
function wrapperPlant(value) {
|
|
var result,
|
|
parent = this;
|
|
|
|
while (parent instanceof baseLodash) {
|
|
var clone = wrapperClone(parent);
|
|
clone.__index__ = 0;
|
|
clone.__values__ = undefined;
|
|
if (result) {
|
|
previous.__wrapped__ = clone;
|
|
} else {
|
|
result = clone;
|
|
}
|
|
var previous = clone;
|
|
parent = parent.__wrapped__;
|
|
}
|
|
previous.__wrapped__ = value;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is the wrapper version of `_.reverse`.
|
|
*
|
|
* **Note:** This method mutates the wrapped array.
|
|
*
|
|
* @name reverse
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _(array).reverse().value()
|
|
* // => [3, 2, 1]
|
|
*
|
|
* console.log(array);
|
|
* // => [3, 2, 1]
|
|
*/
|
|
function wrapperReverse() {
|
|
var value = this.__wrapped__;
|
|
if (value instanceof LazyWrapper) {
|
|
var wrapped = value;
|
|
if (this.__actions__.length) {
|
|
wrapped = new LazyWrapper(this);
|
|
}
|
|
wrapped = wrapped.reverse();
|
|
wrapped.__actions__.push({
|
|
'func': thru,
|
|
'args': [reverse],
|
|
'thisArg': undefined
|
|
});
|
|
return new LodashWrapper(wrapped, this.__chain__);
|
|
}
|
|
return this.thru(reverse);
|
|
}
|
|
|
|
/**
|
|
* Executes the chain sequence to resolve the unwrapped value.
|
|
*
|
|
* @name value
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias toJSON, valueOf
|
|
* @category Seq
|
|
* @returns {*} Returns the resolved unwrapped value.
|
|
* @example
|
|
*
|
|
* _([1, 2, 3]).value();
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function wrapperValue() {
|
|
return baseWrapperValue(this.__wrapped__, this.__actions__);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The corresponding value of
|
|
* each key is the number of times the key was returned by `iteratee`. The
|
|
* iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* _.countBy([6.1, 4.2, 6.3], Math.floor);
|
|
* // => { '4': 1, '6': 2 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.countBy(['one', 'two', 'three'], 'length');
|
|
* // => { '3': 2, '5': 1 }
|
|
*/
|
|
var countBy = createAggregator(function(result, value, key) {
|
|
if (hasOwnProperty.call(result, key)) {
|
|
++result[key];
|
|
} else {
|
|
baseAssignValue(result, key, 1);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Checks if `predicate` returns truthy for **all** elements of `collection`.
|
|
* Iteration is stopped once `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index|key, collection).
|
|
*
|
|
* **Note:** This method returns `true` for
|
|
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
|
|
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
|
|
* elements of empty collections.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.every([true, 1, null, 'yes'], Boolean);
|
|
* // => false
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.every(users, { 'user': 'barney', 'active': false });
|
|
* // => false
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.every(users, ['active', false]);
|
|
* // => true
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.every(users, 'active');
|
|
* // => false
|
|
*/
|
|
function every(collection, predicate, guard) {
|
|
var func = isArray(collection) ? arrayEvery : baseEvery;
|
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
predicate = undefined;
|
|
}
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection`, returning an array of all elements
|
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
* arguments: (value, index|key, collection).
|
|
*
|
|
* **Note:** Unlike `_.remove`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
* @see _.reject
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* _.filter(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.filter(users, { 'age': 36, 'active': true });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.filter(users, ['active', false]);
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.filter(users, 'active');
|
|
* // => objects for ['barney']
|
|
*
|
|
* // Combining several predicates using `_.overEvery` or `_.overSome`.
|
|
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
|
|
* // => objects for ['fred', 'barney']
|
|
*/
|
|
function filter(collection, predicate) {
|
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection`, returning the first element
|
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
* arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false },
|
|
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
|
* ];
|
|
*
|
|
* _.find(users, function(o) { return o.age < 40; });
|
|
* // => object for 'barney'
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.find(users, { 'age': 1, 'active': true });
|
|
* // => object for 'pebbles'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.find(users, ['active', false]);
|
|
* // => object for 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.find(users, 'active');
|
|
* // => object for 'barney'
|
|
*/
|
|
var find = createFind(findIndex);
|
|
|
|
/**
|
|
* This method is like `_.find` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
* @example
|
|
*
|
|
* _.findLast([1, 2, 3, 4], function(n) {
|
|
* return n % 2 == 1;
|
|
* });
|
|
* // => 3
|
|
*/
|
|
var findLast = createFind(findLastIndex);
|
|
|
|
/**
|
|
* Creates a flattened array of values by running each element in `collection`
|
|
* thru `iteratee` and flattening the mapped results. The iteratee is invoked
|
|
* with three arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [n, n];
|
|
* }
|
|
*
|
|
* _.flatMap([1, 2], duplicate);
|
|
* // => [1, 1, 2, 2]
|
|
*/
|
|
function flatMap(collection, iteratee) {
|
|
return baseFlatten(map(collection, iteratee), 1);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.flatMap` except that it recursively flattens the
|
|
* mapped results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [[[n, n]]];
|
|
* }
|
|
*
|
|
* _.flatMapDeep([1, 2], duplicate);
|
|
* // => [1, 1, 2, 2]
|
|
*/
|
|
function flatMapDeep(collection, iteratee) {
|
|
return baseFlatten(map(collection, iteratee), INFINITY);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.flatMap` except that it recursively flattens the
|
|
* mapped results up to `depth` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {number} [depth=1] The maximum recursion depth.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [[[n, n]]];
|
|
* }
|
|
*
|
|
* _.flatMapDepth([1, 2], duplicate, 2);
|
|
* // => [[1, 1], [2, 2]]
|
|
*/
|
|
function flatMapDepth(collection, iteratee, depth) {
|
|
depth = depth === undefined ? 1 : toInteger(depth);
|
|
return baseFlatten(map(collection, iteratee), depth);
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
|
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* **Note:** As with other "Collections" methods, objects with a "length"
|
|
* property are iterated like arrays. To avoid this behavior use `_.forIn`
|
|
* or `_.forOwn` for object iteration.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias each
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
* @see _.forEachRight
|
|
* @example
|
|
*
|
|
* _.forEach([1, 2], function(value) {
|
|
* console.log(value);
|
|
* });
|
|
* // => Logs `1` then `2`.
|
|
*
|
|
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
*/
|
|
function forEach(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayEach : baseEach;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forEach` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @alias eachRight
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
* @see _.forEach
|
|
* @example
|
|
*
|
|
* _.forEachRight([1, 2], function(value) {
|
|
* console.log(value);
|
|
* });
|
|
* // => Logs `2` then `1`.
|
|
*/
|
|
function forEachRight(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The order of grouped values
|
|
* is determined by the order they occur in `collection`. The corresponding
|
|
* value of each key is an array of elements responsible for generating the
|
|
* key. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
|
|
* // => { '4': [4.2], '6': [6.1, 6.3] }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.groupBy(['one', 'two', 'three'], 'length');
|
|
* // => { '3': ['one', 'two'], '5': ['three'] }
|
|
*/
|
|
var groupBy = createAggregator(function(result, value, key) {
|
|
if (hasOwnProperty.call(result, key)) {
|
|
result[key].push(value);
|
|
} else {
|
|
baseAssignValue(result, key, [value]);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
|
* checked for a substring of `value`, otherwise
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
|
* the offset from the end of `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object|string} collection The collection to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
|
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
* @example
|
|
*
|
|
* _.includes([1, 2, 3], 1);
|
|
* // => true
|
|
*
|
|
* _.includes([1, 2, 3], 1, 2);
|
|
* // => false
|
|
*
|
|
* _.includes({ 'a': 1, 'b': 2 }, 1);
|
|
* // => true
|
|
*
|
|
* _.includes('abcd', 'bc');
|
|
* // => true
|
|
*/
|
|
function includes(collection, value, fromIndex, guard) {
|
|
collection = isArrayLike(collection) ? collection : values(collection);
|
|
fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
|
|
|
|
var length = collection.length;
|
|
if (fromIndex < 0) {
|
|
fromIndex = nativeMax(length + fromIndex, 0);
|
|
}
|
|
return isString(collection)
|
|
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
|
|
: (!!length && baseIndexOf(collection, value, fromIndex) > -1);
|
|
}
|
|
|
|
/**
|
|
* Invokes the method at `path` of each element in `collection`, returning
|
|
* an array of the results of each invoked method. Any additional arguments
|
|
* are provided to each invoked method. If `path` is a function, it's invoked
|
|
* for, and `this` bound to, each element in `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Array|Function|string} path The path of the method to invoke or
|
|
* the function invoked per iteration.
|
|
* @param {...*} [args] The arguments to invoke each method with.
|
|
* @returns {Array} Returns the array of results.
|
|
* @example
|
|
*
|
|
* _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
|
|
* // => [[1, 5, 7], [1, 2, 3]]
|
|
*
|
|
* _.invokeMap([123, 456], String.prototype.split, '');
|
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
|
*/
|
|
var invokeMap = baseRest(function(collection, path, args) {
|
|
var index = -1,
|
|
isFunc = typeof path == 'function',
|
|
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
|
|
baseEach(collection, function(value) {
|
|
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
|
});
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The corresponding value of
|
|
* each key is the last element responsible for generating the key. The
|
|
* iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* var array = [
|
|
* { 'dir': 'left', 'code': 97 },
|
|
* { 'dir': 'right', 'code': 100 }
|
|
* ];
|
|
*
|
|
* _.keyBy(array, function(o) {
|
|
* return String.fromCharCode(o.code);
|
|
* });
|
|
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
|
|
*
|
|
* _.keyBy(array, 'dir');
|
|
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
|
*/
|
|
var keyBy = createAggregator(function(result, value, key) {
|
|
baseAssignValue(result, key, value);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of values by running each element in `collection` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, index|key, collection).
|
|
*
|
|
* Many lodash methods are guarded to work as iteratees for methods like
|
|
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
*
|
|
* The guarded methods are:
|
|
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* _.map([4, 8], square);
|
|
* // => [16, 64]
|
|
*
|
|
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
* // => [16, 64] (iteration order is not guaranteed)
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney' },
|
|
* { 'user': 'fred' }
|
|
* ];
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.map(users, 'user');
|
|
* // => ['barney', 'fred']
|
|
*/
|
|
function map(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayMap : baseMap;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortBy` except that it allows specifying the sort
|
|
* orders of the iteratees to sort by. If `orders` is unspecified, all values
|
|
* are sorted in ascending order. Otherwise, specify an order of "desc" for
|
|
* descending or "asc" for ascending sort order of corresponding values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
|
|
* The iteratees to sort by.
|
|
* @param {string[]} [orders] The sort orders of `iteratees`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
|
* @returns {Array} Returns the new sorted array.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'fred', 'age': 48 },
|
|
* { 'user': 'barney', 'age': 34 },
|
|
* { 'user': 'fred', 'age': 40 },
|
|
* { 'user': 'barney', 'age': 36 }
|
|
* ];
|
|
*
|
|
* // Sort by `user` in ascending order and by `age` in descending order.
|
|
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
|
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
|
*/
|
|
function orderBy(collection, iteratees, orders, guard) {
|
|
if (collection == null) {
|
|
return [];
|
|
}
|
|
if (!isArray(iteratees)) {
|
|
iteratees = iteratees == null ? [] : [iteratees];
|
|
}
|
|
orders = guard ? undefined : orders;
|
|
if (!isArray(orders)) {
|
|
orders = orders == null ? [] : [orders];
|
|
}
|
|
return baseOrderBy(collection, iteratees, orders);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of elements split into two groups, the first of which
|
|
* contains elements `predicate` returns truthy for, the second of which
|
|
* contains elements `predicate` returns falsey for. The predicate is
|
|
* invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the array of grouped elements.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': true },
|
|
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
|
* ];
|
|
*
|
|
* _.partition(users, function(o) { return o.active; });
|
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.partition(users, { 'age': 1, 'active': false });
|
|
* // => objects for [['pebbles'], ['barney', 'fred']]
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.partition(users, ['active', false]);
|
|
* // => objects for [['barney', 'pebbles'], ['fred']]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.partition(users, 'active');
|
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
*/
|
|
var partition = createAggregator(function(result, value, key) {
|
|
result[key ? 0 : 1].push(value);
|
|
}, function() { return [[], []]; });
|
|
|
|
/**
|
|
* Reduces `collection` to a value which is the accumulated result of running
|
|
* each element in `collection` thru `iteratee`, where each successive
|
|
* invocation is supplied the return value of the previous. If `accumulator`
|
|
* is not given, the first element of `collection` is used as the initial
|
|
* value. The iteratee is invoked with four arguments:
|
|
* (accumulator, value, index|key, collection).
|
|
*
|
|
* Many lodash methods are guarded to work as iteratees for methods like
|
|
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
|
*
|
|
* The guarded methods are:
|
|
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
|
|
* and `sortBy`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @see _.reduceRight
|
|
* @example
|
|
*
|
|
* _.reduce([1, 2], function(sum, n) {
|
|
* return sum + n;
|
|
* }, 0);
|
|
* // => 3
|
|
*
|
|
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
* (result[value] || (result[value] = [])).push(key);
|
|
* return result;
|
|
* }, {});
|
|
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
|
*/
|
|
function reduce(collection, iteratee, accumulator) {
|
|
var func = isArray(collection) ? arrayReduce : baseReduce,
|
|
initAccum = arguments.length < 3;
|
|
|
|
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.reduce` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @see _.reduce
|
|
* @example
|
|
*
|
|
* var array = [[0, 1], [2, 3], [4, 5]];
|
|
*
|
|
* _.reduceRight(array, function(flattened, other) {
|
|
* return flattened.concat(other);
|
|
* }, []);
|
|
* // => [4, 5, 2, 3, 0, 1]
|
|
*/
|
|
function reduceRight(collection, iteratee, accumulator) {
|
|
var func = isArray(collection) ? arrayReduceRight : baseReduce,
|
|
initAccum = arguments.length < 3;
|
|
|
|
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.filter`; this method returns the elements of `collection`
|
|
* that `predicate` does **not** return truthy for.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
* @see _.filter
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': true }
|
|
* ];
|
|
*
|
|
* _.reject(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.reject(users, { 'age': 40, 'active': true });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.reject(users, ['active', false]);
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.reject(users, 'active');
|
|
* // => objects for ['barney']
|
|
*/
|
|
function reject(collection, predicate) {
|
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
return func(collection, negate(getIteratee(predicate, 3)));
|
|
}
|
|
|
|
/**
|
|
* Gets a random element from `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @returns {*} Returns the random element.
|
|
* @example
|
|
*
|
|
* _.sample([1, 2, 3, 4]);
|
|
* // => 2
|
|
*/
|
|
function sample(collection) {
|
|
var func = isArray(collection) ? arraySample : baseSample;
|
|
return func(collection);
|
|
}
|
|
|
|
/**
|
|
* Gets `n` random elements at unique keys from `collection` up to the
|
|
* size of `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @param {number} [n=1] The number of elements to sample.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the random elements.
|
|
* @example
|
|
*
|
|
* _.sampleSize([1, 2, 3], 2);
|
|
* // => [3, 1]
|
|
*
|
|
* _.sampleSize([1, 2, 3], 4);
|
|
* // => [2, 3, 1]
|
|
*/
|
|
function sampleSize(collection, n, guard) {
|
|
if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
|
|
n = 1;
|
|
} else {
|
|
n = toInteger(n);
|
|
}
|
|
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
|
|
return func(collection, n);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of shuffled values, using a version of the
|
|
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
* @example
|
|
*
|
|
* _.shuffle([1, 2, 3, 4]);
|
|
* // => [4, 1, 3, 2]
|
|
*/
|
|
function shuffle(collection) {
|
|
var func = isArray(collection) ? arrayShuffle : baseShuffle;
|
|
return func(collection);
|
|
}
|
|
|
|
/**
|
|
* Gets the size of `collection` by returning its length for array-like
|
|
* values or the number of own enumerable string keyed properties for objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object|string} collection The collection to inspect.
|
|
* @returns {number} Returns the collection size.
|
|
* @example
|
|
*
|
|
* _.size([1, 2, 3]);
|
|
* // => 3
|
|
*
|
|
* _.size({ 'a': 1, 'b': 2 });
|
|
* // => 2
|
|
*
|
|
* _.size('pebbles');
|
|
* // => 7
|
|
*/
|
|
function size(collection) {
|
|
if (collection == null) {
|
|
return 0;
|
|
}
|
|
if (isArrayLike(collection)) {
|
|
return isString(collection) ? stringSize(collection) : collection.length;
|
|
}
|
|
var tag = getTag(collection);
|
|
if (tag == mapTag || tag == setTag) {
|
|
return collection.size;
|
|
}
|
|
return baseKeys(collection).length;
|
|
}
|
|
|
|
/**
|
|
* Checks if `predicate` returns truthy for **any** element of `collection`.
|
|
* Iteration is stopped once `predicate` returns truthy. The predicate is
|
|
* invoked with three arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.some([null, 0, 'yes', false], Boolean);
|
|
* // => true
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.some(users, { 'user': 'barney', 'active': false });
|
|
* // => false
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.some(users, ['active', false]);
|
|
* // => true
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.some(users, 'active');
|
|
* // => true
|
|
*/
|
|
function some(collection, predicate, guard) {
|
|
var func = isArray(collection) ? arraySome : baseSome;
|
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
predicate = undefined;
|
|
}
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of elements, sorted in ascending order by the results of
|
|
* running each element in a collection thru each iteratee. This method
|
|
* performs a stable sort, that is, it preserves the original sort order of
|
|
* equal elements. The iteratees are invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
* The iteratees to sort by.
|
|
* @returns {Array} Returns the new sorted array.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'fred', 'age': 48 },
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 30 },
|
|
* { 'user': 'barney', 'age': 34 }
|
|
* ];
|
|
*
|
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
*
|
|
* _.sortBy(users, ['user', 'age']);
|
|
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
*/
|
|
var sortBy = baseRest(function(collection, iteratees) {
|
|
if (collection == null) {
|
|
return [];
|
|
}
|
|
var length = iteratees.length;
|
|
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
iteratees = [];
|
|
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
iteratees = [iteratees[0]];
|
|
}
|
|
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
|
});
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Date
|
|
* @returns {number} Returns the timestamp.
|
|
* @example
|
|
*
|
|
* _.defer(function(stamp) {
|
|
* console.log(_.now() - stamp);
|
|
* }, _.now());
|
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
*/
|
|
var now = ctxNow || function() {
|
|
return root.Date.now();
|
|
};
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* The opposite of `_.before`; this method creates a function that invokes
|
|
* `func` once it's called `n` or more times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {number} n The number of calls before `func` is invoked.
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* var saves = ['profile', 'settings'];
|
|
*
|
|
* var done = _.after(saves.length, function() {
|
|
* console.log('done saving!');
|
|
* });
|
|
*
|
|
* _.forEach(saves, function(type) {
|
|
* asyncSave({ 'type': type, 'complete': done });
|
|
* });
|
|
* // => Logs 'done saving!' after the two async saves have completed.
|
|
*/
|
|
function after(n, func) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
n = toInteger(n);
|
|
return function() {
|
|
if (--n < 1) {
|
|
return func.apply(this, arguments);
|
|
}
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func`, with up to `n` arguments,
|
|
* ignoring any additional arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @param {number} [n=func.length] The arity cap.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new capped function.
|
|
* @example
|
|
*
|
|
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function ary(func, n, guard) {
|
|
n = guard ? undefined : n;
|
|
n = (func && n == null) ? func.length : n;
|
|
return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func`, with the `this` binding and arguments
|
|
* of the created function, while it's called less than `n` times. Subsequent
|
|
* calls to the created function return the result of the last `func` invocation.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {number} n The number of calls at which `func` is no longer invoked.
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* jQuery(element).on('click', _.before(5, addContactToList));
|
|
* // => Allows adding up to 4 contacts to the list.
|
|
*/
|
|
function before(n, func) {
|
|
var result;
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
n = toInteger(n);
|
|
return function() {
|
|
if (--n > 0) {
|
|
result = func.apply(this, arguments);
|
|
}
|
|
if (n <= 1) {
|
|
func = undefined;
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of `thisArg`
|
|
* and `partials` prepended to the arguments it receives.
|
|
*
|
|
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
|
* may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
|
|
* property of bound functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to bind.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new bound function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, punctuation) {
|
|
* return greeting + ' ' + this.user + punctuation;
|
|
* }
|
|
*
|
|
* var object = { 'user': 'fred' };
|
|
*
|
|
* var bound = _.bind(greet, object, 'hi');
|
|
* bound('!');
|
|
* // => 'hi fred!'
|
|
*
|
|
* // Bound with placeholders.
|
|
* var bound = _.bind(greet, object, _, '!');
|
|
* bound('hi');
|
|
* // => 'hi fred!'
|
|
*/
|
|
var bind = baseRest(function(func, thisArg, partials) {
|
|
var bitmask = WRAP_BIND_FLAG;
|
|
if (partials.length) {
|
|
var holders = replaceHolders(partials, getHolder(bind));
|
|
bitmask |= WRAP_PARTIAL_FLAG;
|
|
}
|
|
return createWrap(func, bitmask, thisArg, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes the method at `object[key]` with `partials`
|
|
* prepended to the arguments it receives.
|
|
*
|
|
* This method differs from `_.bind` by allowing bound functions to reference
|
|
* methods that may be redefined or don't yet exist. See
|
|
* [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
|
|
* for more details.
|
|
*
|
|
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.10.0
|
|
* @category Function
|
|
* @param {Object} object The object to invoke the method on.
|
|
* @param {string} key The key of the method.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new bound function.
|
|
* @example
|
|
*
|
|
* var object = {
|
|
* 'user': 'fred',
|
|
* 'greet': function(greeting, punctuation) {
|
|
* return greeting + ' ' + this.user + punctuation;
|
|
* }
|
|
* };
|
|
*
|
|
* var bound = _.bindKey(object, 'greet', 'hi');
|
|
* bound('!');
|
|
* // => 'hi fred!'
|
|
*
|
|
* object.greet = function(greeting, punctuation) {
|
|
* return greeting + 'ya ' + this.user + punctuation;
|
|
* };
|
|
*
|
|
* bound('!');
|
|
* // => 'hiya fred!'
|
|
*
|
|
* // Bound with placeholders.
|
|
* var bound = _.bindKey(object, 'greet', _, '!');
|
|
* bound('hi');
|
|
* // => 'hiya fred!'
|
|
*/
|
|
var bindKey = baseRest(function(object, key, partials) {
|
|
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
|
|
if (partials.length) {
|
|
var holders = replaceHolders(partials, getHolder(bindKey));
|
|
bitmask |= WRAP_PARTIAL_FLAG;
|
|
}
|
|
return createWrap(key, bitmask, object, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that accepts arguments of `func` and either invokes
|
|
* `func` returning its result, if at least `arity` number of arguments have
|
|
* been provided, or returns a function that accepts the remaining `func`
|
|
* arguments, and so on. The arity of `func` may be specified if `func.length`
|
|
* is not sufficient.
|
|
*
|
|
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
|
|
* may be used as a placeholder for provided arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of curried functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to curry.
|
|
* @param {number} [arity=func.length] The arity of `func`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new curried function.
|
|
* @example
|
|
*
|
|
* var abc = function(a, b, c) {
|
|
* return [a, b, c];
|
|
* };
|
|
*
|
|
* var curried = _.curry(abc);
|
|
*
|
|
* curried(1)(2)(3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2)(3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2, 3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* // Curried with placeholders.
|
|
* curried(1)(_, 3)(2);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function curry(func, arity, guard) {
|
|
arity = guard ? undefined : arity;
|
|
var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
|
result.placeholder = curry.placeholder;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.curry` except that arguments are applied to `func`
|
|
* in the manner of `_.partialRight` instead of `_.partial`.
|
|
*
|
|
* The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for provided arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of curried functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to curry.
|
|
* @param {number} [arity=func.length] The arity of `func`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new curried function.
|
|
* @example
|
|
*
|
|
* var abc = function(a, b, c) {
|
|
* return [a, b, c];
|
|
* };
|
|
*
|
|
* var curried = _.curryRight(abc);
|
|
*
|
|
* curried(3)(2)(1);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(2, 3)(1);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2, 3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* // Curried with placeholders.
|
|
* curried(3)(1, _)(2);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function curryRight(func, arity, guard) {
|
|
arity = guard ? undefined : arity;
|
|
var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
|
result.placeholder = curryRight.placeholder;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
* milliseconds have elapsed since the last time the debounced function was
|
|
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
* Provide `options` to indicate whether `func` should be invoked on the
|
|
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
* with the last arguments provided to the debounced function. Subsequent
|
|
* calls to the debounced function return the result of the last `func`
|
|
* invocation.
|
|
*
|
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
* invoked on the trailing edge of the timeout only if the debounced function
|
|
* is invoked more than once during the `wait` timeout.
|
|
*
|
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
*
|
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to debounce.
|
|
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.leading=false]
|
|
* Specify invoking on the leading edge of the timeout.
|
|
* @param {number} [options.maxWait]
|
|
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
* @param {boolean} [options.trailing=true]
|
|
* Specify invoking on the trailing edge of the timeout.
|
|
* @returns {Function} Returns the new debounced function.
|
|
* @example
|
|
*
|
|
* // Avoid costly calculations while the window size is in flux.
|
|
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
*
|
|
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
* 'leading': true,
|
|
* 'trailing': false
|
|
* }));
|
|
*
|
|
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
* var source = new EventSource('/stream');
|
|
* jQuery(source).on('message', debounced);
|
|
*
|
|
* // Cancel the trailing debounced invocation.
|
|
* jQuery(window).on('popstate', debounced.cancel);
|
|
*/
|
|
function debounce(func, wait, options) {
|
|
var lastArgs,
|
|
lastThis,
|
|
maxWait,
|
|
result,
|
|
timerId,
|
|
lastCallTime,
|
|
lastInvokeTime = 0,
|
|
leading = false,
|
|
maxing = false,
|
|
trailing = true;
|
|
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
wait = toNumber(wait) || 0;
|
|
if (isObject(options)) {
|
|
leading = !!options.leading;
|
|
maxing = 'maxWait' in options;
|
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
}
|
|
|
|
function invokeFunc(time) {
|
|
var args = lastArgs,
|
|
thisArg = lastThis;
|
|
|
|
lastArgs = lastThis = undefined;
|
|
lastInvokeTime = time;
|
|
result = func.apply(thisArg, args);
|
|
return result;
|
|
}
|
|
|
|
function leadingEdge(time) {
|
|
// Reset any `maxWait` timer.
|
|
lastInvokeTime = time;
|
|
// Start the timer for the trailing edge.
|
|
timerId = setTimeout(timerExpired, wait);
|
|
// Invoke the leading edge.
|
|
return leading ? invokeFunc(time) : result;
|
|
}
|
|
|
|
function remainingWait(time) {
|
|
var timeSinceLastCall = time - lastCallTime,
|
|
timeSinceLastInvoke = time - lastInvokeTime,
|
|
timeWaiting = wait - timeSinceLastCall;
|
|
|
|
return maxing
|
|
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
: timeWaiting;
|
|
}
|
|
|
|
function shouldInvoke(time) {
|
|
var timeSinceLastCall = time - lastCallTime,
|
|
timeSinceLastInvoke = time - lastInvokeTime;
|
|
|
|
// Either this is the first call, activity has stopped and we're at the
|
|
// trailing edge, the system time has gone backwards and we're treating
|
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
}
|
|
|
|
function timerExpired() {
|
|
var time = now();
|
|
if (shouldInvoke(time)) {
|
|
return trailingEdge(time);
|
|
}
|
|
// Restart the timer.
|
|
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
}
|
|
|
|
function trailingEdge(time) {
|
|
timerId = undefined;
|
|
|
|
// Only invoke if we have `lastArgs` which means `func` has been
|
|
// debounced at least once.
|
|
if (trailing && lastArgs) {
|
|
return invokeFunc(time);
|
|
}
|
|
lastArgs = lastThis = undefined;
|
|
return result;
|
|
}
|
|
|
|
function cancel() {
|
|
if (timerId !== undefined) {
|
|
clearTimeout(timerId);
|
|
}
|
|
lastInvokeTime = 0;
|
|
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
}
|
|
|
|
function flush() {
|
|
return timerId === undefined ? result : trailingEdge(now());
|
|
}
|
|
|
|
function debounced() {
|
|
var time = now(),
|
|
isInvoking = shouldInvoke(time);
|
|
|
|
lastArgs = arguments;
|
|
lastThis = this;
|
|
lastCallTime = time;
|
|
|
|
if (isInvoking) {
|
|
if (timerId === undefined) {
|
|
return leadingEdge(lastCallTime);
|
|
}
|
|
if (maxing) {
|
|
// Handle invocations in a tight loop.
|
|
clearTimeout(timerId);
|
|
timerId = setTimeout(timerExpired, wait);
|
|
return invokeFunc(lastCallTime);
|
|
}
|
|
}
|
|
if (timerId === undefined) {
|
|
timerId = setTimeout(timerExpired, wait);
|
|
}
|
|
return result;
|
|
}
|
|
debounced.cancel = cancel;
|
|
debounced.flush = flush;
|
|
return debounced;
|
|
}
|
|
|
|
/**
|
|
* Defers invoking the `func` until the current call stack has cleared. Any
|
|
* additional arguments are provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to defer.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {number} Returns the timer id.
|
|
* @example
|
|
*
|
|
* _.defer(function(text) {
|
|
* console.log(text);
|
|
* }, 'deferred');
|
|
* // => Logs 'deferred' after one millisecond.
|
|
*/
|
|
var defer = baseRest(function(func, args) {
|
|
return baseDelay(func, 1, args);
|
|
});
|
|
|
|
/**
|
|
* Invokes `func` after `wait` milliseconds. Any additional arguments are
|
|
* provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {number} Returns the timer id.
|
|
* @example
|
|
*
|
|
* _.delay(function(text) {
|
|
* console.log(text);
|
|
* }, 1000, 'later');
|
|
* // => Logs 'later' after one second.
|
|
*/
|
|
var delay = baseRest(function(func, wait, args) {
|
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with arguments reversed.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to flip arguments for.
|
|
* @returns {Function} Returns the new flipped function.
|
|
* @example
|
|
*
|
|
* var flipped = _.flip(function() {
|
|
* return _.toArray(arguments);
|
|
* });
|
|
*
|
|
* flipped('a', 'b', 'c', 'd');
|
|
* // => ['d', 'c', 'b', 'a']
|
|
*/
|
|
function flip(func) {
|
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
* provided, it determines the cache key for storing the result based on the
|
|
* arguments provided to the memoized function. By default, the first argument
|
|
* provided to the memoized function is used as the map cache key. The `func`
|
|
* is invoked with the `this` binding of the memoized function.
|
|
*
|
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
* constructor with one whose instances implement the
|
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to have its output memoized.
|
|
* @param {Function} [resolver] The function to resolve the cache key.
|
|
* @returns {Function} Returns the new memoized function.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
* var other = { 'c': 3, 'd': 4 };
|
|
*
|
|
* var values = _.memoize(_.values);
|
|
* values(object);
|
|
* // => [1, 2]
|
|
*
|
|
* values(other);
|
|
* // => [3, 4]
|
|
*
|
|
* object.a = 2;
|
|
* values(object);
|
|
* // => [1, 2]
|
|
*
|
|
* // Modify the result cache.
|
|
* values.cache.set(object, ['a', 'b']);
|
|
* values(object);
|
|
* // => ['a', 'b']
|
|
*
|
|
* // Replace `_.memoize.Cache`.
|
|
* _.memoize.Cache = WeakMap;
|
|
*/
|
|
function memoize(func, resolver) {
|
|
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
var memoized = function() {
|
|
var args = arguments,
|
|
key = resolver ? resolver.apply(this, args) : args[0],
|
|
cache = memoized.cache;
|
|
|
|
if (cache.has(key)) {
|
|
return cache.get(key);
|
|
}
|
|
var result = func.apply(this, args);
|
|
memoized.cache = cache.set(key, result) || cache;
|
|
return result;
|
|
};
|
|
memoized.cache = new (memoize.Cache || MapCache);
|
|
return memoized;
|
|
}
|
|
|
|
// Expose `MapCache`.
|
|
memoize.Cache = MapCache;
|
|
|
|
/**
|
|
* Creates a function that negates the result of the predicate `func`. The
|
|
* `func` predicate is invoked with the `this` binding and arguments of the
|
|
* created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} predicate The predicate to negate.
|
|
* @returns {Function} Returns the new negated function.
|
|
* @example
|
|
*
|
|
* function isEven(n) {
|
|
* return n % 2 == 0;
|
|
* }
|
|
*
|
|
* _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
|
|
* // => [1, 3, 5]
|
|
*/
|
|
function negate(predicate) {
|
|
if (typeof predicate != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return function() {
|
|
var args = arguments;
|
|
switch (args.length) {
|
|
case 0: return !predicate.call(this);
|
|
case 1: return !predicate.call(this, args[0]);
|
|
case 2: return !predicate.call(this, args[0], args[1]);
|
|
case 3: return !predicate.call(this, args[0], args[1], args[2]);
|
|
}
|
|
return !predicate.apply(this, args);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that is restricted to invoking `func` once. Repeat calls
|
|
* to the function return the value of the first invocation. The `func` is
|
|
* invoked with the `this` binding and arguments of the created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* var initialize = _.once(createApplication);
|
|
* initialize();
|
|
* initialize();
|
|
* // => `createApplication` is invoked once
|
|
*/
|
|
function once(func) {
|
|
return before(2, func);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with its arguments transformed.
|
|
*
|
|
* @static
|
|
* @since 4.0.0
|
|
* @memberOf _
|
|
* @category Function
|
|
* @param {Function} func The function to wrap.
|
|
* @param {...(Function|Function[])} [transforms=[_.identity]]
|
|
* The argument transforms.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* function doubled(n) {
|
|
* return n * 2;
|
|
* }
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var func = _.overArgs(function(x, y) {
|
|
* return [x, y];
|
|
* }, [square, doubled]);
|
|
*
|
|
* func(9, 3);
|
|
* // => [81, 6]
|
|
*
|
|
* func(10, 5);
|
|
* // => [100, 10]
|
|
*/
|
|
var overArgs = castRest(function(func, transforms) {
|
|
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
|
? arrayMap(transforms[0], baseUnary(getIteratee()))
|
|
: arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
|
|
|
|
var funcsLength = transforms.length;
|
|
return baseRest(function(args) {
|
|
var index = -1,
|
|
length = nativeMin(args.length, funcsLength);
|
|
|
|
while (++index < length) {
|
|
args[index] = transforms[index].call(this, args[index]);
|
|
}
|
|
return apply(func, this, args);
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with `partials` prepended to the
|
|
* arguments it receives. This method is like `_.bind` except it does **not**
|
|
* alter the `this` binding.
|
|
*
|
|
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of partially
|
|
* applied functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.2.0
|
|
* @category Function
|
|
* @param {Function} func The function to partially apply arguments to.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new partially applied function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, name) {
|
|
* return greeting + ' ' + name;
|
|
* }
|
|
*
|
|
* var sayHelloTo = _.partial(greet, 'hello');
|
|
* sayHelloTo('fred');
|
|
* // => 'hello fred'
|
|
*
|
|
* // Partially applied with placeholders.
|
|
* var greetFred = _.partial(greet, _, 'fred');
|
|
* greetFred('hi');
|
|
* // => 'hi fred'
|
|
*/
|
|
var partial = baseRest(function(func, partials) {
|
|
var holders = replaceHolders(partials, getHolder(partial));
|
|
return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.partial` except that partially applied arguments
|
|
* are appended to the arguments it receives.
|
|
*
|
|
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of partially
|
|
* applied functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to partially apply arguments to.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new partially applied function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, name) {
|
|
* return greeting + ' ' + name;
|
|
* }
|
|
*
|
|
* var greetFred = _.partialRight(greet, 'fred');
|
|
* greetFred('hi');
|
|
* // => 'hi fred'
|
|
*
|
|
* // Partially applied with placeholders.
|
|
* var sayHelloTo = _.partialRight(greet, 'hello', _);
|
|
* sayHelloTo('fred');
|
|
* // => 'hello fred'
|
|
*/
|
|
var partialRight = baseRest(function(func, partials) {
|
|
var holders = replaceHolders(partials, getHolder(partialRight));
|
|
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with arguments arranged according
|
|
* to the specified `indexes` where the argument value at the first index is
|
|
* provided as the first argument, the argument value at the second index is
|
|
* provided as the second argument, and so on.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to rearrange arguments for.
|
|
* @param {...(number|number[])} indexes The arranged argument indexes.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var rearged = _.rearg(function(a, b, c) {
|
|
* return [a, b, c];
|
|
* }, [2, 0, 1]);
|
|
*
|
|
* rearged('b', 'c', 'a')
|
|
* // => ['a', 'b', 'c']
|
|
*/
|
|
var rearg = flatRest(function(func, indexes) {
|
|
return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of the
|
|
* created function and arguments from `start` and beyond provided as
|
|
* an array.
|
|
*
|
|
* **Note:** This method is based on the
|
|
* [rest parameter](https://mdn.io/rest_parameters).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var say = _.rest(function(what, names) {
|
|
* return what + ' ' + _.initial(names).join(', ') +
|
|
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
|
* });
|
|
*
|
|
* say('hello', 'fred', 'barney', 'pebbles');
|
|
* // => 'hello fred, barney, & pebbles'
|
|
*/
|
|
function rest(func, start) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
start = start === undefined ? start : toInteger(start);
|
|
return baseRest(func, start);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of the
|
|
* create function and an array of arguments much like
|
|
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
|
|
*
|
|
* **Note:** This method is based on the
|
|
* [spread operator](https://mdn.io/spread_operator).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Function
|
|
* @param {Function} func The function to spread arguments over.
|
|
* @param {number} [start=0] The start position of the spread.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var say = _.spread(function(who, what) {
|
|
* return who + ' says ' + what;
|
|
* });
|
|
*
|
|
* say(['fred', 'hello']);
|
|
* // => 'fred says hello'
|
|
*
|
|
* var numbers = Promise.all([
|
|
* Promise.resolve(40),
|
|
* Promise.resolve(36)
|
|
* ]);
|
|
*
|
|
* numbers.then(_.spread(function(x, y) {
|
|
* return x + y;
|
|
* }));
|
|
* // => a Promise of 76
|
|
*/
|
|
function spread(func, start) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
|
return baseRest(function(args) {
|
|
var array = args[start],
|
|
otherArgs = castSlice(args, 0, start);
|
|
|
|
if (array) {
|
|
arrayPush(otherArgs, array);
|
|
}
|
|
return apply(func, this, otherArgs);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a throttled function that only invokes `func` at most once per
|
|
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
* method to cancel delayed `func` invocations and a `flush` method to
|
|
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
* timeout. The `func` is invoked with the last arguments provided to the
|
|
* throttled function. Subsequent calls to the throttled function return the
|
|
* result of the last `func` invocation.
|
|
*
|
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
* invoked on the trailing edge of the timeout only if the throttled function
|
|
* is invoked more than once during the `wait` timeout.
|
|
*
|
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
*
|
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to throttle.
|
|
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.leading=true]
|
|
* Specify invoking on the leading edge of the timeout.
|
|
* @param {boolean} [options.trailing=true]
|
|
* Specify invoking on the trailing edge of the timeout.
|
|
* @returns {Function} Returns the new throttled function.
|
|
* @example
|
|
*
|
|
* // Avoid excessively updating the position while scrolling.
|
|
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
*
|
|
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
* jQuery(element).on('click', throttled);
|
|
*
|
|
* // Cancel the trailing throttled invocation.
|
|
* jQuery(window).on('popstate', throttled.cancel);
|
|
*/
|
|
function throttle(func, wait, options) {
|
|
var leading = true,
|
|
trailing = true;
|
|
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
if (isObject(options)) {
|
|
leading = 'leading' in options ? !!options.leading : leading;
|
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
}
|
|
return debounce(func, wait, {
|
|
'leading': leading,
|
|
'maxWait': wait,
|
|
'trailing': trailing
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that accepts up to one argument, ignoring any
|
|
* additional arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @returns {Function} Returns the new capped function.
|
|
* @example
|
|
*
|
|
* _.map(['6', '8', '10'], _.unary(parseInt));
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function unary(func) {
|
|
return ary(func, 1);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that provides `value` to `wrapper` as its first
|
|
* argument. Any additional arguments provided to the function are appended
|
|
* to those provided to the `wrapper`. The wrapper is invoked with the `this`
|
|
* binding of the created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {*} value The value to wrap.
|
|
* @param {Function} [wrapper=identity] The wrapper function.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var p = _.wrap(_.escape, function(func, text) {
|
|
* return '<p>' + func(text) + '</p>';
|
|
* });
|
|
*
|
|
* p('fred, barney, & pebbles');
|
|
* // => '<p>fred, barney, & pebbles</p>'
|
|
*/
|
|
function wrap(value, wrapper) {
|
|
return partial(castFunction(wrapper), value);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Casts `value` as an array if it's not one.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.4.0
|
|
* @category Lang
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Array} Returns the cast array.
|
|
* @example
|
|
*
|
|
* _.castArray(1);
|
|
* // => [1]
|
|
*
|
|
* _.castArray({ 'a': 1 });
|
|
* // => [{ 'a': 1 }]
|
|
*
|
|
* _.castArray('abc');
|
|
* // => ['abc']
|
|
*
|
|
* _.castArray(null);
|
|
* // => [null]
|
|
*
|
|
* _.castArray(undefined);
|
|
* // => [undefined]
|
|
*
|
|
* _.castArray();
|
|
* // => []
|
|
*
|
|
* var array = [1, 2, 3];
|
|
* console.log(_.castArray(array) === array);
|
|
* // => true
|
|
*/
|
|
function castArray() {
|
|
if (!arguments.length) {
|
|
return [];
|
|
}
|
|
var value = arguments[0];
|
|
return isArray(value) ? value : [value];
|
|
}
|
|
|
|
/**
|
|
* Creates a shallow clone of `value`.
|
|
*
|
|
* **Note:** This method is loosely based on the
|
|
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
|
|
* and supports cloning arrays, array buffers, booleans, date objects, maps,
|
|
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
|
|
* arrays. The own enumerable properties of `arguments` objects are cloned
|
|
* as plain objects. An empty object is returned for uncloneable values such
|
|
* as error objects, functions, DOM nodes, and WeakMaps.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to clone.
|
|
* @returns {*} Returns the cloned value.
|
|
* @see _.cloneDeep
|
|
* @example
|
|
*
|
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
*
|
|
* var shallow = _.clone(objects);
|
|
* console.log(shallow[0] === objects[0]);
|
|
* // => true
|
|
*/
|
|
function clone(value) {
|
|
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.clone` except that it accepts `customizer` which
|
|
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
|
|
* cloning is handled by the method instead. The `customizer` is invoked with
|
|
* up to four arguments; (value [, index|key, object, stack]).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to clone.
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @returns {*} Returns the cloned value.
|
|
* @see _.cloneDeepWith
|
|
* @example
|
|
*
|
|
* function customizer(value) {
|
|
* if (_.isElement(value)) {
|
|
* return value.cloneNode(false);
|
|
* }
|
|
* }
|
|
*
|
|
* var el = _.cloneWith(document.body, customizer);
|
|
*
|
|
* console.log(el === document.body);
|
|
* // => false
|
|
* console.log(el.nodeName);
|
|
* // => 'BODY'
|
|
* console.log(el.childNodes.length);
|
|
* // => 0
|
|
*/
|
|
function cloneWith(value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.clone` except that it recursively clones `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to recursively clone.
|
|
* @returns {*} Returns the deep cloned value.
|
|
* @see _.clone
|
|
* @example
|
|
*
|
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
*
|
|
* var deep = _.cloneDeep(objects);
|
|
* console.log(deep[0] === objects[0]);
|
|
* // => false
|
|
*/
|
|
function cloneDeep(value) {
|
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to recursively clone.
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @returns {*} Returns the deep cloned value.
|
|
* @see _.cloneWith
|
|
* @example
|
|
*
|
|
* function customizer(value) {
|
|
* if (_.isElement(value)) {
|
|
* return value.cloneNode(true);
|
|
* }
|
|
* }
|
|
*
|
|
* var el = _.cloneDeepWith(document.body, customizer);
|
|
*
|
|
* console.log(el === document.body);
|
|
* // => false
|
|
* console.log(el.nodeName);
|
|
* // => 'BODY'
|
|
* console.log(el.childNodes.length);
|
|
* // => 20
|
|
*/
|
|
function cloneDeepWith(value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
|
|
}
|
|
|
|
/**
|
|
* Checks if `object` conforms to `source` by invoking the predicate
|
|
* properties of `source` with the corresponding property values of `object`.
|
|
*
|
|
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
|
* partially applied.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.14.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
*
|
|
* _.conformsTo(object, { 'b': function(n) { return n > 1; } });
|
|
* // => true
|
|
*
|
|
* _.conformsTo(object, { 'b': function(n) { return n > 2; } });
|
|
* // => false
|
|
*/
|
|
function conformsTo(object, source) {
|
|
return source == null || baseConformsTo(object, source, keys(source));
|
|
}
|
|
|
|
/**
|
|
* Performs a
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* comparison between two values to determine if they are equivalent.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
* var other = { 'a': 1 };
|
|
*
|
|
* _.eq(object, object);
|
|
* // => true
|
|
*
|
|
* _.eq(object, other);
|
|
* // => false
|
|
*
|
|
* _.eq('a', 'a');
|
|
* // => true
|
|
*
|
|
* _.eq('a', Object('a'));
|
|
* // => false
|
|
*
|
|
* _.eq(NaN, NaN);
|
|
* // => true
|
|
*/
|
|
function eq(value, other) {
|
|
return value === other || (value !== value && other !== other);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is greater than `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
* else `false`.
|
|
* @see _.lt
|
|
* @example
|
|
*
|
|
* _.gt(3, 1);
|
|
* // => true
|
|
*
|
|
* _.gt(3, 3);
|
|
* // => false
|
|
*
|
|
* _.gt(1, 3);
|
|
* // => false
|
|
*/
|
|
var gt = createRelationalOperation(baseGt);
|
|
|
|
/**
|
|
* Checks if `value` is greater than or equal to `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than or equal to
|
|
* `other`, else `false`.
|
|
* @see _.lte
|
|
* @example
|
|
*
|
|
* _.gte(3, 1);
|
|
* // => true
|
|
*
|
|
* _.gte(3, 3);
|
|
* // => true
|
|
*
|
|
* _.gte(1, 3);
|
|
* // => false
|
|
*/
|
|
var gte = createRelationalOperation(function(value, other) {
|
|
return value >= other;
|
|
});
|
|
|
|
/**
|
|
* Checks if `value` is likely an `arguments` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isArguments(function() { return arguments; }());
|
|
* // => true
|
|
*
|
|
* _.isArguments([1, 2, 3]);
|
|
* // => false
|
|
*/
|
|
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
|
!propertyIsEnumerable.call(value, 'callee');
|
|
};
|
|
|
|
/**
|
|
* Checks if `value` is classified as an `Array` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArray([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArray(document.body.children);
|
|
* // => false
|
|
*
|
|
* _.isArray('abc');
|
|
* // => false
|
|
*
|
|
* _.isArray(_.noop);
|
|
* // => false
|
|
*/
|
|
var isArray = Array.isArray;
|
|
|
|
/**
|
|
* Checks if `value` is classified as an `ArrayBuffer` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayBuffer(new ArrayBuffer(2));
|
|
* // => true
|
|
*
|
|
* _.isArrayBuffer(new Array(2));
|
|
* // => false
|
|
*/
|
|
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
|
|
|
|
/**
|
|
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
* not a function and has a `value.length` that's an integer greater than or
|
|
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArrayLike(document.body.children);
|
|
* // => true
|
|
*
|
|
* _.isArrayLike('abc');
|
|
* // => true
|
|
*
|
|
* _.isArrayLike(_.noop);
|
|
* // => false
|
|
*/
|
|
function isArrayLike(value) {
|
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
* is an object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayLikeObject([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArrayLikeObject(document.body.children);
|
|
* // => true
|
|
*
|
|
* _.isArrayLikeObject('abc');
|
|
* // => false
|
|
*
|
|
* _.isArrayLikeObject(_.noop);
|
|
* // => false
|
|
*/
|
|
function isArrayLikeObject(value) {
|
|
return isObjectLike(value) && isArrayLike(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a boolean primitive or object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
|
|
* @example
|
|
*
|
|
* _.isBoolean(false);
|
|
* // => true
|
|
*
|
|
* _.isBoolean(null);
|
|
* // => false
|
|
*/
|
|
function isBoolean(value) {
|
|
return value === true || value === false ||
|
|
(isObjectLike(value) && baseGetTag(value) == boolTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a buffer.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isBuffer(new Buffer(2));
|
|
* // => true
|
|
*
|
|
* _.isBuffer(new Uint8Array(2));
|
|
* // => false
|
|
*/
|
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Date` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isDate(new Date);
|
|
* // => true
|
|
*
|
|
* _.isDate('Mon April 23 2012');
|
|
* // => false
|
|
*/
|
|
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
|
|
|
|
/**
|
|
* Checks if `value` is likely a DOM element.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
|
* @example
|
|
*
|
|
* _.isElement(document.body);
|
|
* // => true
|
|
*
|
|
* _.isElement('<body>');
|
|
* // => false
|
|
*/
|
|
function isElement(value) {
|
|
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an empty object, collection, map, or set.
|
|
*
|
|
* Objects are considered empty if they have no own enumerable string keyed
|
|
* properties.
|
|
*
|
|
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
|
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
|
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
|
* @example
|
|
*
|
|
* _.isEmpty(null);
|
|
* // => true
|
|
*
|
|
* _.isEmpty(true);
|
|
* // => true
|
|
*
|
|
* _.isEmpty(1);
|
|
* // => true
|
|
*
|
|
* _.isEmpty([1, 2, 3]);
|
|
* // => false
|
|
*
|
|
* _.isEmpty({ 'a': 1 });
|
|
* // => false
|
|
*/
|
|
function isEmpty(value) {
|
|
if (value == null) {
|
|
return true;
|
|
}
|
|
if (isArrayLike(value) &&
|
|
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
|
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
|
return !value.length;
|
|
}
|
|
var tag = getTag(value);
|
|
if (tag == mapTag || tag == setTag) {
|
|
return !value.size;
|
|
}
|
|
if (isPrototype(value)) {
|
|
return !baseKeys(value).length;
|
|
}
|
|
for (var key in value) {
|
|
if (hasOwnProperty.call(value, key)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Performs a deep comparison between two values to determine if they are
|
|
* equivalent.
|
|
*
|
|
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
* nodes are compared by strict equality, i.e. `===`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
* var other = { 'a': 1 };
|
|
*
|
|
* _.isEqual(object, other);
|
|
* // => true
|
|
*
|
|
* object === other;
|
|
* // => false
|
|
*/
|
|
function isEqual(value, other) {
|
|
return baseIsEqual(value, other);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isEqual` except that it accepts `customizer` which
|
|
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
|
|
* are handled by the method instead. The `customizer` is invoked with up to
|
|
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* function isGreeting(value) {
|
|
* return /^h(?:i|ello)$/.test(value);
|
|
* }
|
|
*
|
|
* function customizer(objValue, othValue) {
|
|
* if (isGreeting(objValue) && isGreeting(othValue)) {
|
|
* return true;
|
|
* }
|
|
* }
|
|
*
|
|
* var array = ['hello', 'goodbye'];
|
|
* var other = ['hi', 'goodbye'];
|
|
*
|
|
* _.isEqualWith(array, other, customizer);
|
|
* // => true
|
|
*/
|
|
function isEqualWith(value, other, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
var result = customizer ? customizer(value, other) : undefined;
|
|
return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
|
* `SyntaxError`, `TypeError`, or `URIError` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isError(new Error);
|
|
* // => true
|
|
*
|
|
* _.isError(Error);
|
|
* // => false
|
|
*/
|
|
function isError(value) {
|
|
if (!isObjectLike(value)) {
|
|
return false;
|
|
}
|
|
var tag = baseGetTag(value);
|
|
return tag == errorTag || tag == domExcTag ||
|
|
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a finite primitive number.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
|
|
* @example
|
|
*
|
|
* _.isFinite(3);
|
|
* // => true
|
|
*
|
|
* _.isFinite(Number.MIN_VALUE);
|
|
* // => true
|
|
*
|
|
* _.isFinite(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isFinite('3');
|
|
* // => false
|
|
*/
|
|
function isFinite(value) {
|
|
return typeof value == 'number' && nativeIsFinite(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Function` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
* @example
|
|
*
|
|
* _.isFunction(_);
|
|
* // => true
|
|
*
|
|
* _.isFunction(/abc/);
|
|
* // => false
|
|
*/
|
|
function isFunction(value) {
|
|
if (!isObject(value)) {
|
|
return false;
|
|
}
|
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
var tag = baseGetTag(value);
|
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an integer.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isInteger`](https://mdn.io/Number/isInteger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isInteger(3);
|
|
* // => true
|
|
*
|
|
* _.isInteger(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isInteger(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isInteger('3');
|
|
* // => false
|
|
*/
|
|
function isInteger(value) {
|
|
return typeof value == 'number' && value == toInteger(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a valid array-like length.
|
|
*
|
|
* **Note:** This method is loosely based on
|
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
* @example
|
|
*
|
|
* _.isLength(3);
|
|
* // => true
|
|
*
|
|
* _.isLength(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isLength(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isLength('3');
|
|
* // => false
|
|
*/
|
|
function isLength(value) {
|
|
return typeof value == 'number' &&
|
|
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is the
|
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isObject({});
|
|
* // => true
|
|
*
|
|
* _.isObject([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isObject(_.noop);
|
|
* // => true
|
|
*
|
|
* _.isObject(null);
|
|
* // => false
|
|
*/
|
|
function isObject(value) {
|
|
var type = typeof value;
|
|
return value != null && (type == 'object' || type == 'function');
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
* and has a `typeof` result of "object".
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
* @example
|
|
*
|
|
* _.isObjectLike({});
|
|
* // => true
|
|
*
|
|
* _.isObjectLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isObjectLike(_.noop);
|
|
* // => false
|
|
*
|
|
* _.isObjectLike(null);
|
|
* // => false
|
|
*/
|
|
function isObjectLike(value) {
|
|
return value != null && typeof value == 'object';
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Map` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
* @example
|
|
*
|
|
* _.isMap(new Map);
|
|
* // => true
|
|
*
|
|
* _.isMap(new WeakMap);
|
|
* // => false
|
|
*/
|
|
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
|
|
/**
|
|
* Performs a partial deep comparison between `object` and `source` to
|
|
* determine if `object` contains equivalent property values.
|
|
*
|
|
* **Note:** This method is equivalent to `_.matches` when `source` is
|
|
* partially applied.
|
|
*
|
|
* Partial comparisons will match empty array and empty object `source`
|
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
* for a list of supported value comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
*
|
|
* _.isMatch(object, { 'b': 2 });
|
|
* // => true
|
|
*
|
|
* _.isMatch(object, { 'b': 1 });
|
|
* // => false
|
|
*/
|
|
function isMatch(object, source) {
|
|
return object === source || baseIsMatch(object, source, getMatchData(source));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isMatch` except that it accepts `customizer` which
|
|
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
|
|
* are handled by the method instead. The `customizer` is invoked with five
|
|
* arguments: (objValue, srcValue, index|key, object, source).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
* @example
|
|
*
|
|
* function isGreeting(value) {
|
|
* return /^h(?:i|ello)$/.test(value);
|
|
* }
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* if (isGreeting(objValue) && isGreeting(srcValue)) {
|
|
* return true;
|
|
* }
|
|
* }
|
|
*
|
|
* var object = { 'greeting': 'hello' };
|
|
* var source = { 'greeting': 'hi' };
|
|
*
|
|
* _.isMatchWith(object, source, customizer);
|
|
* // => true
|
|
*/
|
|
function isMatchWith(object, source, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `NaN`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
|
|
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
|
|
* `undefined` and other non-number values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNaN(NaN);
|
|
* // => true
|
|
*
|
|
* _.isNaN(new Number(NaN));
|
|
* // => true
|
|
*
|
|
* isNaN(undefined);
|
|
* // => true
|
|
*
|
|
* _.isNaN(undefined);
|
|
* // => false
|
|
*/
|
|
function isNaN(value) {
|
|
// An `NaN` primitive is the only value that is not equal to itself.
|
|
// Perform the `toStringTag` check first to avoid errors with some
|
|
// ActiveX objects in IE.
|
|
return isNumber(value) && value != +value;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a pristine native function.
|
|
*
|
|
* **Note:** This method can't reliably detect native functions in the presence
|
|
* of the core-js package because core-js circumvents this kind of detection.
|
|
* Despite multiple requests, the core-js maintainer has made it clear: any
|
|
* attempt to fix the detection will be obstructed. As a result, we're left
|
|
* with little choice but to throw an error. Unfortunately, this also affects
|
|
* packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
|
|
* which rely on core-js.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isNative(Array.prototype.push);
|
|
* // => true
|
|
*
|
|
* _.isNative(_);
|
|
* // => false
|
|
*/
|
|
function isNative(value) {
|
|
if (isMaskable(value)) {
|
|
throw new Error(CORE_ERROR_TEXT);
|
|
}
|
|
return baseIsNative(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `null`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNull(null);
|
|
* // => true
|
|
*
|
|
* _.isNull(void 0);
|
|
* // => false
|
|
*/
|
|
function isNull(value) {
|
|
return value === null;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `null` or `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNil(null);
|
|
* // => true
|
|
*
|
|
* _.isNil(void 0);
|
|
* // => true
|
|
*
|
|
* _.isNil(NaN);
|
|
* // => false
|
|
*/
|
|
function isNil(value) {
|
|
return value == null;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Number` primitive or object.
|
|
*
|
|
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
|
* classified as numbers, use the `_.isFinite` method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNumber(3);
|
|
* // => true
|
|
*
|
|
* _.isNumber(Number.MIN_VALUE);
|
|
* // => true
|
|
*
|
|
* _.isNumber(Infinity);
|
|
* // => true
|
|
*
|
|
* _.isNumber('3');
|
|
* // => false
|
|
*/
|
|
function isNumber(value) {
|
|
return typeof value == 'number' ||
|
|
(isObjectLike(value) && baseGetTag(value) == numberTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a plain object, that is, an object created by the
|
|
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.8.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* _.isPlainObject(new Foo);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject([1, 2, 3]);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
* // => true
|
|
*
|
|
* _.isPlainObject(Object.create(null));
|
|
* // => true
|
|
*/
|
|
function isPlainObject(value) {
|
|
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
return false;
|
|
}
|
|
var proto = getPrototype(value);
|
|
if (proto === null) {
|
|
return true;
|
|
}
|
|
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
funcToString.call(Ctor) == objectCtorString;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `RegExp` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
|
* @example
|
|
*
|
|
* _.isRegExp(/abc/);
|
|
* // => true
|
|
*
|
|
* _.isRegExp('/abc/');
|
|
* // => false
|
|
*/
|
|
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
|
|
|
|
/**
|
|
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
|
|
* double precision number which isn't the result of a rounded unsafe integer.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSafeInteger(3);
|
|
* // => true
|
|
*
|
|
* _.isSafeInteger(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isSafeInteger(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isSafeInteger('3');
|
|
* // => false
|
|
*/
|
|
function isSafeInteger(value) {
|
|
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Set` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSet(new Set);
|
|
* // => true
|
|
*
|
|
* _.isSet(new WeakSet);
|
|
* // => false
|
|
*/
|
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `String` primitive or object.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
* @example
|
|
*
|
|
* _.isString('abc');
|
|
* // => true
|
|
*
|
|
* _.isString(1);
|
|
* // => false
|
|
*/
|
|
function isString(value) {
|
|
return typeof value == 'string' ||
|
|
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSymbol(Symbol.iterator);
|
|
* // => true
|
|
*
|
|
* _.isSymbol('abc');
|
|
* // => false
|
|
*/
|
|
function isSymbol(value) {
|
|
return typeof value == 'symbol' ||
|
|
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a typed array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
* @example
|
|
*
|
|
* _.isTypedArray(new Uint8Array);
|
|
* // => true
|
|
*
|
|
* _.isTypedArray([]);
|
|
* // => false
|
|
*/
|
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
|
|
/**
|
|
* Checks if `value` is `undefined`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isUndefined(void 0);
|
|
* // => true
|
|
*
|
|
* _.isUndefined(null);
|
|
* // => false
|
|
*/
|
|
function isUndefined(value) {
|
|
return value === undefined;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `WeakMap` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
|
|
* @example
|
|
*
|
|
* _.isWeakMap(new WeakMap);
|
|
* // => true
|
|
*
|
|
* _.isWeakMap(new Map);
|
|
* // => false
|
|
*/
|
|
function isWeakMap(value) {
|
|
return isObjectLike(value) && getTag(value) == weakMapTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `WeakSet` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
|
|
* @example
|
|
*
|
|
* _.isWeakSet(new WeakSet);
|
|
* // => true
|
|
*
|
|
* _.isWeakSet(new Set);
|
|
* // => false
|
|
*/
|
|
function isWeakSet(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is less than `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
* else `false`.
|
|
* @see _.gt
|
|
* @example
|
|
*
|
|
* _.lt(1, 3);
|
|
* // => true
|
|
*
|
|
* _.lt(3, 3);
|
|
* // => false
|
|
*
|
|
* _.lt(3, 1);
|
|
* // => false
|
|
*/
|
|
var lt = createRelationalOperation(baseLt);
|
|
|
|
/**
|
|
* Checks if `value` is less than or equal to `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than or equal to
|
|
* `other`, else `false`.
|
|
* @see _.gte
|
|
* @example
|
|
*
|
|
* _.lte(1, 3);
|
|
* // => true
|
|
*
|
|
* _.lte(3, 3);
|
|
* // => true
|
|
*
|
|
* _.lte(3, 1);
|
|
* // => false
|
|
*/
|
|
var lte = createRelationalOperation(function(value, other) {
|
|
return value <= other;
|
|
});
|
|
|
|
/**
|
|
* Converts `value` to an array.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
* @example
|
|
*
|
|
* _.toArray({ 'a': 1, 'b': 2 });
|
|
* // => [1, 2]
|
|
*
|
|
* _.toArray('abc');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* _.toArray(1);
|
|
* // => []
|
|
*
|
|
* _.toArray(null);
|
|
* // => []
|
|
*/
|
|
function toArray(value) {
|
|
if (!value) {
|
|
return [];
|
|
}
|
|
if (isArrayLike(value)) {
|
|
return isString(value) ? stringToArray(value) : copyArray(value);
|
|
}
|
|
if (symIterator && value[symIterator]) {
|
|
return iteratorToArray(value[symIterator]());
|
|
}
|
|
var tag = getTag(value),
|
|
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
|
|
|
|
return func(value);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a finite number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.12.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted number.
|
|
* @example
|
|
*
|
|
* _.toFinite(3.2);
|
|
* // => 3.2
|
|
*
|
|
* _.toFinite(Number.MIN_VALUE);
|
|
* // => 5e-324
|
|
*
|
|
* _.toFinite(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toFinite('3.2');
|
|
* // => 3.2
|
|
*/
|
|
function toFinite(value) {
|
|
if (!value) {
|
|
return value === 0 ? value : 0;
|
|
}
|
|
value = toNumber(value);
|
|
if (value === INFINITY || value === -INFINITY) {
|
|
var sign = (value < 0 ? -1 : 1);
|
|
return sign * MAX_INTEGER;
|
|
}
|
|
return value === value ? value : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to an integer.
|
|
*
|
|
* **Note:** This method is loosely based on
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toInteger(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toInteger(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toInteger(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toInteger('3.2');
|
|
* // => 3
|
|
*/
|
|
function toInteger(value) {
|
|
var result = toFinite(value),
|
|
remainder = result % 1;
|
|
|
|
return result === result ? (remainder ? result - remainder : result) : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to an integer suitable for use as the length of an
|
|
* array-like object.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toLength(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toLength(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toLength(Infinity);
|
|
* // => 4294967295
|
|
*
|
|
* _.toLength('3.2');
|
|
* // => 3
|
|
*/
|
|
function toLength(value) {
|
|
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to process.
|
|
* @returns {number} Returns the number.
|
|
* @example
|
|
*
|
|
* _.toNumber(3.2);
|
|
* // => 3.2
|
|
*
|
|
* _.toNumber(Number.MIN_VALUE);
|
|
* // => 5e-324
|
|
*
|
|
* _.toNumber(Infinity);
|
|
* // => Infinity
|
|
*
|
|
* _.toNumber('3.2');
|
|
* // => 3.2
|
|
*/
|
|
function toNumber(value) {
|
|
if (typeof value == 'number') {
|
|
return value;
|
|
}
|
|
if (isSymbol(value)) {
|
|
return NAN;
|
|
}
|
|
if (isObject(value)) {
|
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
value = isObject(other) ? (other + '') : other;
|
|
}
|
|
if (typeof value != 'string') {
|
|
return value === 0 ? value : +value;
|
|
}
|
|
value = baseTrim(value);
|
|
var isBinary = reIsBinary.test(value);
|
|
return (isBinary || reIsOctal.test(value))
|
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
: (reIsBadHex.test(value) ? NAN : +value);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a plain object flattening inherited enumerable string
|
|
* keyed properties of `value` to own properties of the plain object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {Object} Returns the converted plain object.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.assign({ 'a': 1 }, new Foo);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*
|
|
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
*/
|
|
function toPlainObject(value) {
|
|
return copyObject(value, keysIn(value));
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a safe integer. A safe integer can be compared and
|
|
* represented correctly.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toSafeInteger(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toSafeInteger(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toSafeInteger(Infinity);
|
|
* // => 9007199254740991
|
|
*
|
|
* _.toSafeInteger('3.2');
|
|
* // => 3
|
|
*/
|
|
function toSafeInteger(value) {
|
|
return value
|
|
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
|
|
: (value === 0 ? value : 0);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a string. An empty string is returned for `null`
|
|
* and `undefined` values. The sign of `-0` is preserved.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.toString(null);
|
|
* // => ''
|
|
*
|
|
* _.toString(-0);
|
|
* // => '-0'
|
|
*
|
|
* _.toString([1, 2, 3]);
|
|
* // => '1,2,3'
|
|
*/
|
|
function toString(value) {
|
|
return value == null ? '' : baseToString(value);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Assigns own enumerable string keyed properties of source objects to the
|
|
* destination object. Source objects are applied from left to right.
|
|
* Subsequent sources overwrite property assignments of previous sources.
|
|
*
|
|
* **Note:** This method mutates `object` and is loosely based on
|
|
* [`Object.assign`](https://mdn.io/Object/assign).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.10.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* function Bar() {
|
|
* this.c = 3;
|
|
* }
|
|
*
|
|
* Foo.prototype.b = 2;
|
|
* Bar.prototype.d = 4;
|
|
*
|
|
* _.assign({ 'a': 0 }, new Foo, new Bar);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
var assign = createAssigner(function(object, source) {
|
|
if (isPrototype(source) || isArrayLike(source)) {
|
|
copyObject(source, keys(source), object);
|
|
return;
|
|
}
|
|
for (var key in source) {
|
|
if (hasOwnProperty.call(source, key)) {
|
|
assignValue(object, key, source[key]);
|
|
}
|
|
}
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it iterates over own and
|
|
* inherited source properties.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias extend
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assign
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* function Bar() {
|
|
* this.c = 3;
|
|
* }
|
|
*
|
|
* Foo.prototype.b = 2;
|
|
* Bar.prototype.d = 4;
|
|
*
|
|
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
|
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
|
*/
|
|
var assignIn = createAssigner(function(object, source) {
|
|
copyObject(source, keysIn(source), object);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assignIn` except that it accepts `customizer`
|
|
* which is invoked to produce the assigned values. If `customizer` returns
|
|
* `undefined`, assignment is handled by the method instead. The `customizer`
|
|
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias extendWith
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignWith
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* return _.isUndefined(objValue) ? srcValue : objValue;
|
|
* }
|
|
*
|
|
* var defaults = _.partialRight(_.assignInWith, customizer);
|
|
*
|
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
copyObject(source, keysIn(source), object, customizer);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it accepts `customizer`
|
|
* which is invoked to produce the assigned values. If `customizer` returns
|
|
* `undefined`, assignment is handled by the method instead. The `customizer`
|
|
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignInWith
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* return _.isUndefined(objValue) ? srcValue : objValue;
|
|
* }
|
|
*
|
|
* var defaults = _.partialRight(_.assignWith, customizer);
|
|
*
|
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
copyObject(source, keys(source), object, customizer);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of values corresponding to `paths` of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Array} Returns the picked values.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
*
|
|
* _.at(object, ['a[0].b.c', 'a[1]']);
|
|
* // => [3, 4]
|
|
*/
|
|
var at = flatRest(baseAt);
|
|
|
|
/**
|
|
* Creates an object that inherits from the `prototype` object. If a
|
|
* `properties` object is given, its own enumerable string keyed properties
|
|
* are assigned to the created object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.3.0
|
|
* @category Object
|
|
* @param {Object} prototype The object to inherit from.
|
|
* @param {Object} [properties] The properties to assign to the object.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* function Shape() {
|
|
* this.x = 0;
|
|
* this.y = 0;
|
|
* }
|
|
*
|
|
* function Circle() {
|
|
* Shape.call(this);
|
|
* }
|
|
*
|
|
* Circle.prototype = _.create(Shape.prototype, {
|
|
* 'constructor': Circle
|
|
* });
|
|
*
|
|
* var circle = new Circle;
|
|
* circle instanceof Circle;
|
|
* // => true
|
|
*
|
|
* circle instanceof Shape;
|
|
* // => true
|
|
*/
|
|
function create(prototype, properties) {
|
|
var result = baseCreate(prototype);
|
|
return properties == null ? result : baseAssign(result, properties);
|
|
}
|
|
|
|
/**
|
|
* Assigns own and inherited enumerable string keyed properties of source
|
|
* objects to the destination object for all destination properties that
|
|
* resolve to `undefined`. Source objects are applied from left to right.
|
|
* Once a property is set, additional values of the same property are ignored.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.defaultsDeep
|
|
* @example
|
|
*
|
|
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var defaults = baseRest(function(object, sources) {
|
|
object = Object(object);
|
|
|
|
var index = -1;
|
|
var length = sources.length;
|
|
var guard = length > 2 ? sources[2] : undefined;
|
|
|
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
length = 1;
|
|
}
|
|
|
|
while (++index < length) {
|
|
var source = sources[index];
|
|
var props = keysIn(source);
|
|
var propsIndex = -1;
|
|
var propsLength = props.length;
|
|
|
|
while (++propsIndex < propsLength) {
|
|
var key = props[propsIndex];
|
|
var value = object[key];
|
|
|
|
if (value === undefined ||
|
|
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
object[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
return object;
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.defaults` except that it recursively assigns
|
|
* default properties.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.defaults
|
|
* @example
|
|
*
|
|
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
|
* // => { 'a': { 'b': 2, 'c': 3 } }
|
|
*/
|
|
var defaultsDeep = baseRest(function(args) {
|
|
args.push(undefined, customDefaultsMerge);
|
|
return apply(mergeWith, undefined, args);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.find` except that it returns the key of the first
|
|
* element `predicate` returns truthy for instead of the element itself.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {string|undefined} Returns the key of the matched element,
|
|
* else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'barney': { 'age': 36, 'active': true },
|
|
* 'fred': { 'age': 40, 'active': false },
|
|
* 'pebbles': { 'age': 1, 'active': true }
|
|
* };
|
|
*
|
|
* _.findKey(users, function(o) { return o.age < 40; });
|
|
* // => 'barney' (iteration order is not guaranteed)
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findKey(users, { 'age': 1, 'active': true });
|
|
* // => 'pebbles'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findKey(users, ['active', false]);
|
|
* // => 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findKey(users, 'active');
|
|
* // => 'barney'
|
|
*/
|
|
function findKey(object, predicate) {
|
|
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.findKey` except that it iterates over elements of
|
|
* a collection in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {string|undefined} Returns the key of the matched element,
|
|
* else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'barney': { 'age': 36, 'active': true },
|
|
* 'fred': { 'age': 40, 'active': false },
|
|
* 'pebbles': { 'age': 1, 'active': true }
|
|
* };
|
|
*
|
|
* _.findLastKey(users, function(o) { return o.age < 40; });
|
|
* // => returns 'pebbles' assuming `_.findKey` returns 'barney'
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findLastKey(users, { 'age': 36, 'active': true });
|
|
* // => 'barney'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findLastKey(users, ['active', false]);
|
|
* // => 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findLastKey(users, 'active');
|
|
* // => 'pebbles'
|
|
*/
|
|
function findLastKey(object, predicate) {
|
|
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
|
|
}
|
|
|
|
/**
|
|
* Iterates over own and inherited enumerable string keyed properties of an
|
|
* object and invokes `iteratee` for each property. The iteratee is invoked
|
|
* with three arguments: (value, key, object). Iteratee functions may exit
|
|
* iteration early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forInRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forIn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
|
|
*/
|
|
function forIn(object, iteratee) {
|
|
return object == null
|
|
? object
|
|
: baseFor(object, getIteratee(iteratee, 3), keysIn);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forIn` except that it iterates over properties of
|
|
* `object` in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forInRight(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
|
|
*/
|
|
function forInRight(object, iteratee) {
|
|
return object == null
|
|
? object
|
|
: baseForRight(object, getIteratee(iteratee, 3), keysIn);
|
|
}
|
|
|
|
/**
|
|
* Iterates over own enumerable string keyed properties of an object and
|
|
* invokes `iteratee` for each property. The iteratee is invoked with three
|
|
* arguments: (value, key, object). Iteratee functions may exit iteration
|
|
* early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forOwnRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forOwn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
*/
|
|
function forOwn(object, iteratee) {
|
|
return object && baseForOwn(object, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forOwn` except that it iterates over properties of
|
|
* `object` in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forOwn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forOwnRight(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
|
|
*/
|
|
function forOwnRight(object, iteratee) {
|
|
return object && baseForOwnRight(object, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of function property names from own enumerable properties
|
|
* of `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @returns {Array} Returns the function names.
|
|
* @see _.functionsIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = _.constant('a');
|
|
* this.b = _.constant('b');
|
|
* }
|
|
*
|
|
* Foo.prototype.c = _.constant('c');
|
|
*
|
|
* _.functions(new Foo);
|
|
* // => ['a', 'b']
|
|
*/
|
|
function functions(object) {
|
|
return object == null ? [] : baseFunctions(object, keys(object));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of function property names from own and inherited
|
|
* enumerable properties of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @returns {Array} Returns the function names.
|
|
* @see _.functions
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = _.constant('a');
|
|
* this.b = _.constant('b');
|
|
* }
|
|
*
|
|
* Foo.prototype.c = _.constant('c');
|
|
*
|
|
* _.functionsIn(new Foo);
|
|
* // => ['a', 'b', 'c']
|
|
*/
|
|
function functionsIn(object) {
|
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
}
|
|
|
|
/**
|
|
* Gets the value at `path` of `object`. If the resolved value is
|
|
* `undefined`, the `defaultValue` is returned in its place.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.get(object, 'a[0].b.c');
|
|
* // => 3
|
|
*
|
|
* _.get(object, ['a', '0', 'b', 'c']);
|
|
* // => 3
|
|
*
|
|
* _.get(object, 'a.b.c', 'default');
|
|
* // => 'default'
|
|
*/
|
|
function get(object, path, defaultValue) {
|
|
var result = object == null ? undefined : baseGet(object, path);
|
|
return result === undefined ? defaultValue : result;
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` is a direct property of `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': { 'b': 2 } };
|
|
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
*
|
|
* _.has(object, 'a');
|
|
* // => true
|
|
*
|
|
* _.has(object, 'a.b');
|
|
* // => true
|
|
*
|
|
* _.has(object, ['a', 'b']);
|
|
* // => true
|
|
*
|
|
* _.has(other, 'a');
|
|
* // => false
|
|
*/
|
|
function has(object, path) {
|
|
return object != null && hasPath(object, path, baseHas);
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` is a direct or inherited property of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
* @example
|
|
*
|
|
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
*
|
|
* _.hasIn(object, 'a');
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, 'a.b');
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, ['a', 'b']);
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, 'b');
|
|
* // => false
|
|
*/
|
|
function hasIn(object, path) {
|
|
return object != null && hasPath(object, path, baseHasIn);
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of the inverted keys and values of `object`.
|
|
* If `object` contains duplicate values, subsequent values overwrite
|
|
* property assignments of previous values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to invert.
|
|
* @returns {Object} Returns the new inverted object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
|
*
|
|
* _.invert(object);
|
|
* // => { '1': 'c', '2': 'b' }
|
|
*/
|
|
var invert = createInverter(function(result, value, key) {
|
|
if (value != null &&
|
|
typeof value.toString != 'function') {
|
|
value = nativeObjectToString.call(value);
|
|
}
|
|
|
|
result[value] = key;
|
|
}, constant(identity));
|
|
|
|
/**
|
|
* This method is like `_.invert` except that the inverted object is generated
|
|
* from the results of running each element of `object` thru `iteratee`. The
|
|
* corresponding inverted value of each inverted key is an array of keys
|
|
* responsible for generating the inverted value. The iteratee is invoked
|
|
* with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.1.0
|
|
* @category Object
|
|
* @param {Object} object The object to invert.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Object} Returns the new inverted object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
|
*
|
|
* _.invertBy(object);
|
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
|
*
|
|
* _.invertBy(object, function(value) {
|
|
* return 'group' + value;
|
|
* });
|
|
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
|
*/
|
|
var invertBy = createInverter(function(result, value, key) {
|
|
if (value != null &&
|
|
typeof value.toString != 'function') {
|
|
value = nativeObjectToString.call(value);
|
|
}
|
|
|
|
if (hasOwnProperty.call(result, value)) {
|
|
result[value].push(key);
|
|
} else {
|
|
result[value] = [key];
|
|
}
|
|
}, getIteratee);
|
|
|
|
/**
|
|
* Invokes the method at `path` of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {*} Returns the result of the invoked method.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
|
|
*
|
|
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
|
|
* // => [2, 3]
|
|
*/
|
|
var invoke = baseRest(baseInvoke);
|
|
|
|
/**
|
|
* Creates an array of the own enumerable property names of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects. See the
|
|
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
* for more details.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.keys(new Foo);
|
|
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
*
|
|
* _.keys('hi');
|
|
* // => ['0', '1']
|
|
*/
|
|
function keys(object) {
|
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.keysIn(new Foo);
|
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
*/
|
|
function keysIn(object) {
|
|
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.mapValues`; this method creates an object with the
|
|
* same values as `object` and keys generated by running each own enumerable
|
|
* string keyed property of `object` thru `iteratee`. The iteratee is invoked
|
|
* with three arguments: (value, key, object).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns the new mapped object.
|
|
* @see _.mapValues
|
|
* @example
|
|
*
|
|
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
|
|
* return key + value;
|
|
* });
|
|
* // => { 'a1': 1, 'b2': 2 }
|
|
*/
|
|
function mapKeys(object, iteratee) {
|
|
var result = {};
|
|
iteratee = getIteratee(iteratee, 3);
|
|
|
|
baseForOwn(object, function(value, key, object) {
|
|
baseAssignValue(result, iteratee(value, key, object), value);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an object with the same keys as `object` and values generated
|
|
* by running each own enumerable string keyed property of `object` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, key, object).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns the new mapped object.
|
|
* @see _.mapKeys
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'fred': { 'user': 'fred', 'age': 40 },
|
|
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
|
* };
|
|
*
|
|
* _.mapValues(users, function(o) { return o.age; });
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.mapValues(users, 'age');
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*/
|
|
function mapValues(object, iteratee) {
|
|
var result = {};
|
|
iteratee = getIteratee(iteratee, 3);
|
|
|
|
baseForOwn(object, function(value, key, object) {
|
|
baseAssignValue(result, key, iteratee(value, key, object));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it recursively merges own and
|
|
* inherited enumerable string keyed properties of source objects into the
|
|
* destination object. Source properties that resolve to `undefined` are
|
|
* skipped if a destination value exists. Array and plain object properties
|
|
* are merged recursively. Other objects and value types are overridden by
|
|
* assignment. Source objects are applied from left to right. Subsequent
|
|
* sources overwrite property assignments of previous sources.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {
|
|
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
|
* };
|
|
*
|
|
* var other = {
|
|
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
|
* };
|
|
*
|
|
* _.merge(object, other);
|
|
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
|
*/
|
|
var merge = createAssigner(function(object, source, srcIndex) {
|
|
baseMerge(object, source, srcIndex);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.merge` except that it accepts `customizer` which
|
|
* is invoked to produce the merged values of the destination and source
|
|
* properties. If `customizer` returns `undefined`, merging is handled by the
|
|
* method instead. The `customizer` is invoked with six arguments:
|
|
* (objValue, srcValue, key, object, source, stack).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} customizer The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* if (_.isArray(objValue)) {
|
|
* return objValue.concat(srcValue);
|
|
* }
|
|
* }
|
|
*
|
|
* var object = { 'a': [1], 'b': [2] };
|
|
* var other = { 'a': [3], 'b': [4] };
|
|
*
|
|
* _.mergeWith(object, other, customizer);
|
|
* // => { 'a': [1, 3], 'b': [2, 4] }
|
|
*/
|
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
baseMerge(object, source, srcIndex, customizer);
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.pick`; this method creates an object composed of the
|
|
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
*
|
|
* **Note:** This method is considerably slower than `_.pick`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.omit(object, ['a', 'c']);
|
|
* // => { 'b': '2' }
|
|
*/
|
|
var omit = flatRest(function(object, paths) {
|
|
var result = {};
|
|
if (object == null) {
|
|
return result;
|
|
}
|
|
var isDeep = false;
|
|
paths = arrayMap(paths, function(path) {
|
|
path = castPath(path, object);
|
|
isDeep || (isDeep = path.length > 1);
|
|
return path;
|
|
});
|
|
copyObject(object, getAllKeysIn(object), result);
|
|
if (isDeep) {
|
|
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
|
}
|
|
var length = paths.length;
|
|
while (length--) {
|
|
baseUnset(result, paths[length]);
|
|
}
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.pickBy`; this method creates an object composed of
|
|
* the own and inherited enumerable string keyed properties of `object` that
|
|
* `predicate` doesn't return truthy for. The predicate is invoked with two
|
|
* arguments: (value, key).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.omitBy(object, _.isNumber);
|
|
* // => { 'b': '2' }
|
|
*/
|
|
function omitBy(object, predicate) {
|
|
return pickBy(object, negate(getIteratee(predicate)));
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of the picked `object` properties.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.pick(object, ['a', 'c']);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
var pick = flatRest(function(object, paths) {
|
|
return object == null ? {} : basePick(object, paths);
|
|
});
|
|
|
|
/**
|
|
* Creates an object composed of the `object` properties `predicate` returns
|
|
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.pickBy(object, _.isNumber);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
function pickBy(object, predicate) {
|
|
if (object == null) {
|
|
return {};
|
|
}
|
|
var props = arrayMap(getAllKeysIn(object), function(prop) {
|
|
return [prop];
|
|
});
|
|
predicate = getIteratee(predicate);
|
|
return basePickBy(object, props, function(value, path) {
|
|
return predicate(value, path[0]);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.get` except that if the resolved value is a
|
|
* function it's invoked with the `this` binding of its parent object and
|
|
* its result is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to resolve.
|
|
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
|
|
*
|
|
* _.result(object, 'a[0].b.c1');
|
|
* // => 3
|
|
*
|
|
* _.result(object, 'a[0].b.c2');
|
|
* // => 4
|
|
*
|
|
* _.result(object, 'a[0].b.c3', 'default');
|
|
* // => 'default'
|
|
*
|
|
* _.result(object, 'a[0].b.c3', _.constant('default'));
|
|
* // => 'default'
|
|
*/
|
|
function result(object, path, defaultValue) {
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length;
|
|
|
|
// Ensure the loop is entered when path is empty.
|
|
if (!length) {
|
|
length = 1;
|
|
object = undefined;
|
|
}
|
|
while (++index < length) {
|
|
var value = object == null ? undefined : object[toKey(path[index])];
|
|
if (value === undefined) {
|
|
index = length;
|
|
value = defaultValue;
|
|
}
|
|
object = isFunction(value) ? value.call(object) : value;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
* it's created. Arrays are created for missing index properties while objects
|
|
* are created for all other missing properties. Use `_.setWith` to customize
|
|
* `path` creation.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.set(object, 'a[0].b.c', 4);
|
|
* console.log(object.a[0].b.c);
|
|
* // => 4
|
|
*
|
|
* _.set(object, ['x', '0', 'y', 'z'], 5);
|
|
* console.log(object.x[0].y.z);
|
|
* // => 5
|
|
*/
|
|
function set(object, path, value) {
|
|
return object == null ? object : baseSet(object, path, value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.set` except that it accepts `customizer` which is
|
|
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
|
|
* path creation is handled by the method instead. The `customizer` is invoked
|
|
* with three arguments: (nsValue, key, nsObject).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {};
|
|
*
|
|
* _.setWith(object, '[0][1]', 'a', Object);
|
|
* // => { '0': { '1': 'a' } }
|
|
*/
|
|
function setWith(object, path, value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return object == null ? object : baseSet(object, path, value, customizer);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own enumerable string keyed-value pairs for `object`
|
|
* which can be consumed by `_.fromPairs`. If `object` is a map or set, its
|
|
* entries are returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias entries
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.toPairs(new Foo);
|
|
* // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
|
|
*/
|
|
var toPairs = createToPairs(keys);
|
|
|
|
/**
|
|
* Creates an array of own and inherited enumerable string keyed-value pairs
|
|
* for `object` which can be consumed by `_.fromPairs`. If `object` is a map
|
|
* or set, its entries are returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias entriesIn
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.toPairsIn(new Foo);
|
|
* // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
|
|
*/
|
|
var toPairsIn = createToPairs(keysIn);
|
|
|
|
/**
|
|
* An alternative to `_.reduce`; this method transforms `object` to a new
|
|
* `accumulator` object which is the result of running each of its own
|
|
* enumerable string keyed properties thru `iteratee`, with each invocation
|
|
* potentially mutating the `accumulator` object. If `accumulator` is not
|
|
* provided, a new object with the same `[[Prototype]]` will be used. The
|
|
* iteratee is invoked with four arguments: (accumulator, value, key, object).
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The custom accumulator value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @example
|
|
*
|
|
* _.transform([2, 3, 4], function(result, n) {
|
|
* result.push(n *= n);
|
|
* return n % 2 == 0;
|
|
* }, []);
|
|
* // => [4, 9]
|
|
*
|
|
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
* (result[value] || (result[value] = [])).push(key);
|
|
* }, {});
|
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
|
*/
|
|
function transform(object, iteratee, accumulator) {
|
|
var isArr = isArray(object),
|
|
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
|
|
|
|
iteratee = getIteratee(iteratee, 4);
|
|
if (accumulator == null) {
|
|
var Ctor = object && object.constructor;
|
|
if (isArrLike) {
|
|
accumulator = isArr ? new Ctor : [];
|
|
}
|
|
else if (isObject(object)) {
|
|
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
|
|
}
|
|
else {
|
|
accumulator = {};
|
|
}
|
|
}
|
|
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
|
|
return iteratee(accumulator, value, index, object);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* Removes the property at `path` of `object`.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to unset.
|
|
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 7 } }] };
|
|
* _.unset(object, 'a[0].b.c');
|
|
* // => true
|
|
*
|
|
* console.log(object);
|
|
* // => { 'a': [{ 'b': {} }] };
|
|
*
|
|
* _.unset(object, ['a', '0', 'b', 'c']);
|
|
* // => true
|
|
*
|
|
* console.log(object);
|
|
* // => { 'a': [{ 'b': {} }] };
|
|
*/
|
|
function unset(object, path) {
|
|
return object == null ? true : baseUnset(object, path);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.set` except that accepts `updater` to produce the
|
|
* value to set. Use `_.updateWith` to customize `path` creation. The `updater`
|
|
* is invoked with one argument: (value).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.update(object, 'a[0].b.c', function(n) { return n * n; });
|
|
* console.log(object.a[0].b.c);
|
|
* // => 9
|
|
*
|
|
* _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
|
|
* console.log(object.x[0].y.z);
|
|
* // => 0
|
|
*/
|
|
function update(object, path, updater) {
|
|
return object == null ? object : baseUpdate(object, path, castFunction(updater));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.update` except that it accepts `customizer` which is
|
|
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
|
|
* path creation is handled by the method instead. The `customizer` is invoked
|
|
* with three arguments: (nsValue, key, nsObject).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {};
|
|
*
|
|
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
|
|
* // => { '0': { '1': 'a' } }
|
|
*/
|
|
function updateWith(object, path, updater, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own enumerable string keyed property values of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property values.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.values(new Foo);
|
|
* // => [1, 2] (iteration order is not guaranteed)
|
|
*
|
|
* _.values('hi');
|
|
* // => ['h', 'i']
|
|
*/
|
|
function values(object) {
|
|
return object == null ? [] : baseValues(object, keys(object));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable string keyed property
|
|
* values of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property values.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.valuesIn(new Foo);
|
|
* // => [1, 2, 3] (iteration order is not guaranteed)
|
|
*/
|
|
function valuesIn(object) {
|
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Clamps `number` within the inclusive `lower` and `upper` bounds.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Number
|
|
* @param {number} number The number to clamp.
|
|
* @param {number} [lower] The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the clamped number.
|
|
* @example
|
|
*
|
|
* _.clamp(-10, -5, 5);
|
|
* // => -5
|
|
*
|
|
* _.clamp(10, -5, 5);
|
|
* // => 5
|
|
*/
|
|
function clamp(number, lower, upper) {
|
|
if (upper === undefined) {
|
|
upper = lower;
|
|
lower = undefined;
|
|
}
|
|
if (upper !== undefined) {
|
|
upper = toNumber(upper);
|
|
upper = upper === upper ? upper : 0;
|
|
}
|
|
if (lower !== undefined) {
|
|
lower = toNumber(lower);
|
|
lower = lower === lower ? lower : 0;
|
|
}
|
|
return baseClamp(toNumber(number), lower, upper);
|
|
}
|
|
|
|
/**
|
|
* Checks if `n` is between `start` and up to, but not including, `end`. If
|
|
* `end` is not specified, it's set to `start` with `start` then set to `0`.
|
|
* If `start` is greater than `end` the params are swapped to support
|
|
* negative ranges.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.3.0
|
|
* @category Number
|
|
* @param {number} number The number to check.
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
|
|
* @see _.range, _.rangeRight
|
|
* @example
|
|
*
|
|
* _.inRange(3, 2, 4);
|
|
* // => true
|
|
*
|
|
* _.inRange(4, 8);
|
|
* // => true
|
|
*
|
|
* _.inRange(4, 2);
|
|
* // => false
|
|
*
|
|
* _.inRange(2, 2);
|
|
* // => false
|
|
*
|
|
* _.inRange(1.2, 2);
|
|
* // => true
|
|
*
|
|
* _.inRange(5.2, 4);
|
|
* // => false
|
|
*
|
|
* _.inRange(-3, -2, -6);
|
|
* // => true
|
|
*/
|
|
function inRange(number, start, end) {
|
|
start = toFinite(start);
|
|
if (end === undefined) {
|
|
end = start;
|
|
start = 0;
|
|
} else {
|
|
end = toFinite(end);
|
|
}
|
|
number = toNumber(number);
|
|
return baseInRange(number, start, end);
|
|
}
|
|
|
|
/**
|
|
* Produces a random number between the inclusive `lower` and `upper` bounds.
|
|
* If only one argument is provided a number between `0` and the given number
|
|
* is returned. If `floating` is `true`, or either `lower` or `upper` are
|
|
* floats, a floating-point number is returned instead of an integer.
|
|
*
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
* floating-point values which can produce unexpected results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.7.0
|
|
* @category Number
|
|
* @param {number} [lower=0] The lower bound.
|
|
* @param {number} [upper=1] The upper bound.
|
|
* @param {boolean} [floating] Specify returning a floating-point number.
|
|
* @returns {number} Returns the random number.
|
|
* @example
|
|
*
|
|
* _.random(0, 5);
|
|
* // => an integer between 0 and 5
|
|
*
|
|
* _.random(5);
|
|
* // => also an integer between 0 and 5
|
|
*
|
|
* _.random(5, true);
|
|
* // => a floating-point number between 0 and 5
|
|
*
|
|
* _.random(1.2, 5.2);
|
|
* // => a floating-point number between 1.2 and 5.2
|
|
*/
|
|
function random(lower, upper, floating) {
|
|
if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
|
|
upper = floating = undefined;
|
|
}
|
|
if (floating === undefined) {
|
|
if (typeof upper == 'boolean') {
|
|
floating = upper;
|
|
upper = undefined;
|
|
}
|
|
else if (typeof lower == 'boolean') {
|
|
floating = lower;
|
|
lower = undefined;
|
|
}
|
|
}
|
|
if (lower === undefined && upper === undefined) {
|
|
lower = 0;
|
|
upper = 1;
|
|
}
|
|
else {
|
|
lower = toFinite(lower);
|
|
if (upper === undefined) {
|
|
upper = lower;
|
|
lower = 0;
|
|
} else {
|
|
upper = toFinite(upper);
|
|
}
|
|
}
|
|
if (lower > upper) {
|
|
var temp = lower;
|
|
lower = upper;
|
|
upper = temp;
|
|
}
|
|
if (floating || lower % 1 || upper % 1) {
|
|
var rand = nativeRandom();
|
|
return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
|
|
}
|
|
return baseRandom(lower, upper);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the camel cased string.
|
|
* @example
|
|
*
|
|
* _.camelCase('Foo Bar');
|
|
* // => 'fooBar'
|
|
*
|
|
* _.camelCase('--foo-bar--');
|
|
* // => 'fooBar'
|
|
*
|
|
* _.camelCase('__FOO_BAR__');
|
|
* // => 'fooBar'
|
|
*/
|
|
var camelCase = createCompounder(function(result, word, index) {
|
|
word = word.toLowerCase();
|
|
return result + (index ? capitalize(word) : word);
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to upper case and the remaining
|
|
* to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to capitalize.
|
|
* @returns {string} Returns the capitalized string.
|
|
* @example
|
|
*
|
|
* _.capitalize('FRED');
|
|
* // => 'Fred'
|
|
*/
|
|
function capitalize(string) {
|
|
return upperFirst(toString(string).toLowerCase());
|
|
}
|
|
|
|
/**
|
|
* Deburrs `string` by converting
|
|
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
* letters to basic Latin letters and removing
|
|
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to deburr.
|
|
* @returns {string} Returns the deburred string.
|
|
* @example
|
|
*
|
|
* _.deburr('déjà vu');
|
|
* // => 'deja vu'
|
|
*/
|
|
function deburr(string) {
|
|
string = toString(string);
|
|
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` ends with the given target string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {string} [target] The string to search for.
|
|
* @param {number} [position=string.length] The position to search up to.
|
|
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.endsWith('abc', 'c');
|
|
* // => true
|
|
*
|
|
* _.endsWith('abc', 'b');
|
|
* // => false
|
|
*
|
|
* _.endsWith('abc', 'b', 2);
|
|
* // => true
|
|
*/
|
|
function endsWith(string, target, position) {
|
|
string = toString(string);
|
|
target = baseToString(target);
|
|
|
|
var length = string.length;
|
|
position = position === undefined
|
|
? length
|
|
: baseClamp(toInteger(position), 0, length);
|
|
|
|
var end = position;
|
|
position -= target.length;
|
|
return position >= 0 && string.slice(position, end) == target;
|
|
}
|
|
|
|
/**
|
|
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
* corresponding HTML entities.
|
|
*
|
|
* **Note:** No other characters are escaped. To escape additional
|
|
* characters use a third-party library like [_he_](https://mths.be/he).
|
|
*
|
|
* Though the ">" character is escaped for symmetry, characters like
|
|
* ">" and "/" don't need escaping in HTML and have no special meaning
|
|
* unless they're part of a tag or unquoted attribute value. See
|
|
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
|
* (under "semi-related fun fact") for more details.
|
|
*
|
|
* When working with HTML you should always
|
|
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
|
|
* XSS vectors.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category String
|
|
* @param {string} [string=''] The string to escape.
|
|
* @returns {string} Returns the escaped string.
|
|
* @example
|
|
*
|
|
* _.escape('fred, barney, & pebbles');
|
|
* // => 'fred, barney, & pebbles'
|
|
*/
|
|
function escape(string) {
|
|
string = toString(string);
|
|
return (string && reHasUnescapedHtml.test(string))
|
|
? string.replace(reUnescapedHtml, escapeHtmlChar)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
|
|
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to escape.
|
|
* @returns {string} Returns the escaped string.
|
|
* @example
|
|
*
|
|
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
|
* // => '\[lodash\]\(https://lodash\.com/\)'
|
|
*/
|
|
function escapeRegExp(string) {
|
|
string = toString(string);
|
|
return (string && reHasRegExpChar.test(string))
|
|
? string.replace(reRegExpChar, '\\$&')
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the kebab cased string.
|
|
* @example
|
|
*
|
|
* _.kebabCase('Foo Bar');
|
|
* // => 'foo-bar'
|
|
*
|
|
* _.kebabCase('fooBar');
|
|
* // => 'foo-bar'
|
|
*
|
|
* _.kebabCase('__FOO_BAR__');
|
|
* // => 'foo-bar'
|
|
*/
|
|
var kebabCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? '-' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the lower cased string.
|
|
* @example
|
|
*
|
|
* _.lowerCase('--Foo-Bar--');
|
|
* // => 'foo bar'
|
|
*
|
|
* _.lowerCase('fooBar');
|
|
* // => 'foo bar'
|
|
*
|
|
* _.lowerCase('__FOO_BAR__');
|
|
* // => 'foo bar'
|
|
*/
|
|
var lowerCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.lowerFirst('Fred');
|
|
* // => 'fred'
|
|
*
|
|
* _.lowerFirst('FRED');
|
|
* // => 'fRED'
|
|
*/
|
|
var lowerFirst = createCaseFirst('toLowerCase');
|
|
|
|
/**
|
|
* Pads `string` on the left and right sides if it's shorter than `length`.
|
|
* Padding characters are truncated if they can't be evenly divided by `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.pad('abc', 8);
|
|
* // => ' abc '
|
|
*
|
|
* _.pad('abc', 8, '_-');
|
|
* // => '_-abc_-_'
|
|
*
|
|
* _.pad('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function pad(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
if (!length || strLength >= length) {
|
|
return string;
|
|
}
|
|
var mid = (length - strLength) / 2;
|
|
return (
|
|
createPadding(nativeFloor(mid), chars) +
|
|
string +
|
|
createPadding(nativeCeil(mid), chars)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Pads `string` on the right side if it's shorter than `length`. Padding
|
|
* characters are truncated if they exceed `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.padEnd('abc', 6);
|
|
* // => 'abc '
|
|
*
|
|
* _.padEnd('abc', 6, '_-');
|
|
* // => 'abc_-_'
|
|
*
|
|
* _.padEnd('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function padEnd(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
return (length && strLength < length)
|
|
? (string + createPadding(length - strLength, chars))
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Pads `string` on the left side if it's shorter than `length`. Padding
|
|
* characters are truncated if they exceed `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.padStart('abc', 6);
|
|
* // => ' abc'
|
|
*
|
|
* _.padStart('abc', 6, '_-');
|
|
* // => '_-_abc'
|
|
*
|
|
* _.padStart('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function padStart(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
return (length && strLength < length)
|
|
? (createPadding(length - strLength, chars) + string)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to an integer of the specified radix. If `radix` is
|
|
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a
|
|
* hexadecimal, in which case a `radix` of `16` is used.
|
|
*
|
|
* **Note:** This method aligns with the
|
|
* [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category String
|
|
* @param {string} string The string to convert.
|
|
* @param {number} [radix=10] The radix to interpret `value` by.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.parseInt('08');
|
|
* // => 8
|
|
*
|
|
* _.map(['6', '08', '10'], _.parseInt);
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function parseInt(string, radix, guard) {
|
|
if (guard || radix == null) {
|
|
radix = 0;
|
|
} else if (radix) {
|
|
radix = +radix;
|
|
}
|
|
return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
|
|
}
|
|
|
|
/**
|
|
* Repeats the given string `n` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to repeat.
|
|
* @param {number} [n=1] The number of times to repeat the string.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the repeated string.
|
|
* @example
|
|
*
|
|
* _.repeat('*', 3);
|
|
* // => '***'
|
|
*
|
|
* _.repeat('abc', 2);
|
|
* // => 'abcabc'
|
|
*
|
|
* _.repeat('abc', 0);
|
|
* // => ''
|
|
*/
|
|
function repeat(string, n, guard) {
|
|
if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
|
|
n = 1;
|
|
} else {
|
|
n = toInteger(n);
|
|
}
|
|
return baseRepeat(toString(string), n);
|
|
}
|
|
|
|
/**
|
|
* Replaces matches for `pattern` in `string` with `replacement`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`String#replace`](https://mdn.io/String/replace).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to modify.
|
|
* @param {RegExp|string} pattern The pattern to replace.
|
|
* @param {Function|string} replacement The match replacement.
|
|
* @returns {string} Returns the modified string.
|
|
* @example
|
|
*
|
|
* _.replace('Hi Fred', 'Fred', 'Barney');
|
|
* // => 'Hi Barney'
|
|
*/
|
|
function replace() {
|
|
var args = arguments,
|
|
string = toString(args[0]);
|
|
|
|
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the snake cased string.
|
|
* @example
|
|
*
|
|
* _.snakeCase('Foo Bar');
|
|
* // => 'foo_bar'
|
|
*
|
|
* _.snakeCase('fooBar');
|
|
* // => 'foo_bar'
|
|
*
|
|
* _.snakeCase('--FOO-BAR--');
|
|
* // => 'foo_bar'
|
|
*/
|
|
var snakeCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? '_' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Splits `string` by `separator`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`String#split`](https://mdn.io/String/split).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to split.
|
|
* @param {RegExp|string} separator The separator pattern to split by.
|
|
* @param {number} [limit] The length to truncate results to.
|
|
* @returns {Array} Returns the string segments.
|
|
* @example
|
|
*
|
|
* _.split('a-b-c', '-', 2);
|
|
* // => ['a', 'b']
|
|
*/
|
|
function split(string, separator, limit) {
|
|
if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
|
|
separator = limit = undefined;
|
|
}
|
|
limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
|
|
if (!limit) {
|
|
return [];
|
|
}
|
|
string = toString(string);
|
|
if (string && (
|
|
typeof separator == 'string' ||
|
|
(separator != null && !isRegExp(separator))
|
|
)) {
|
|
separator = baseToString(separator);
|
|
if (!separator && hasUnicode(string)) {
|
|
return castSlice(stringToArray(string), 0, limit);
|
|
}
|
|
}
|
|
return string.split(separator, limit);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.1.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the start cased string.
|
|
* @example
|
|
*
|
|
* _.startCase('--foo-bar--');
|
|
* // => 'Foo Bar'
|
|
*
|
|
* _.startCase('fooBar');
|
|
* // => 'Foo Bar'
|
|
*
|
|
* _.startCase('__FOO_BAR__');
|
|
* // => 'FOO BAR'
|
|
*/
|
|
var startCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + upperFirst(word);
|
|
});
|
|
|
|
/**
|
|
* Checks if `string` starts with the given target string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {string} [target] The string to search for.
|
|
* @param {number} [position=0] The position to search from.
|
|
* @returns {boolean} Returns `true` if `string` starts with `target`,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.startsWith('abc', 'a');
|
|
* // => true
|
|
*
|
|
* _.startsWith('abc', 'b');
|
|
* // => false
|
|
*
|
|
* _.startsWith('abc', 'b', 1);
|
|
* // => true
|
|
*/
|
|
function startsWith(string, target, position) {
|
|
string = toString(string);
|
|
position = position == null
|
|
? 0
|
|
: baseClamp(toInteger(position), 0, string.length);
|
|
|
|
target = baseToString(target);
|
|
return string.slice(position, position + target.length) == target;
|
|
}
|
|
|
|
/**
|
|
* Creates a compiled template function that can interpolate data properties
|
|
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
|
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
|
* properties may be accessed as free variables in the template. If a setting
|
|
* object is given, it takes precedence over `_.templateSettings` values.
|
|
*
|
|
* **Note:** In the development build `_.template` utilizes
|
|
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
|
* for easier debugging.
|
|
*
|
|
* For more information on precompiling templates see
|
|
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
|
|
*
|
|
* For more information on Chrome extension sandboxes see
|
|
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category String
|
|
* @param {string} [string=''] The template string.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {RegExp} [options.escape=_.templateSettings.escape]
|
|
* The HTML "escape" delimiter.
|
|
* @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
|
|
* The "evaluate" delimiter.
|
|
* @param {Object} [options.imports=_.templateSettings.imports]
|
|
* An object to import into the template as free variables.
|
|
* @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
|
|
* The "interpolate" delimiter.
|
|
* @param {string} [options.sourceURL='lodash.templateSources[n]']
|
|
* The sourceURL of the compiled template.
|
|
* @param {string} [options.variable='obj']
|
|
* The data object variable name.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the compiled template function.
|
|
* @example
|
|
*
|
|
* // Use the "interpolate" delimiter to create a compiled template.
|
|
* var compiled = _.template('hello <%= user %>!');
|
|
* compiled({ 'user': 'fred' });
|
|
* // => 'hello fred!'
|
|
*
|
|
* // Use the HTML "escape" delimiter to escape data property values.
|
|
* var compiled = _.template('<b><%- value %></b>');
|
|
* compiled({ 'value': '<script>' });
|
|
* // => '<b><script></b>'
|
|
*
|
|
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
|
|
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
|
|
* compiled({ 'users': ['fred', 'barney'] });
|
|
* // => '<li>fred</li><li>barney</li>'
|
|
*
|
|
* // Use the internal `print` function in "evaluate" delimiters.
|
|
* var compiled = _.template('<% print("hello " + user); %>!');
|
|
* compiled({ 'user': 'barney' });
|
|
* // => 'hello barney!'
|
|
*
|
|
* // Use the ES template literal delimiter as an "interpolate" delimiter.
|
|
* // Disable support by replacing the "interpolate" delimiter.
|
|
* var compiled = _.template('hello ${ user }!');
|
|
* compiled({ 'user': 'pebbles' });
|
|
* // => 'hello pebbles!'
|
|
*
|
|
* // Use backslashes to treat delimiters as plain text.
|
|
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
|
|
* compiled({ 'value': 'ignored' });
|
|
* // => '<%- value %>'
|
|
*
|
|
* // Use the `imports` option to import `jQuery` as `jq`.
|
|
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
|
|
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
|
|
* compiled({ 'users': ['fred', 'barney'] });
|
|
* // => '<li>fred</li><li>barney</li>'
|
|
*
|
|
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
|
|
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
|
|
* compiled(data);
|
|
* // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
|
|
*
|
|
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
|
|
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
|
* compiled.source;
|
|
* // => function(data) {
|
|
* // var __t, __p = '';
|
|
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
|
|
* // return __p;
|
|
* // }
|
|
*
|
|
* // Use custom template delimiters.
|
|
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
* var compiled = _.template('hello {{ user }}!');
|
|
* compiled({ 'user': 'mustache' });
|
|
* // => 'hello mustache!'
|
|
*
|
|
* // Use the `source` property to inline compiled templates for meaningful
|
|
* // line numbers in error messages and stack traces.
|
|
* fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
|
|
* var JST = {\
|
|
* "main": ' + _.template(mainText).source + '\
|
|
* };\
|
|
* ');
|
|
*/
|
|
function template(string, options, guard) {
|
|
// Based on John Resig's `tmpl` implementation
|
|
// (http://ejohn.org/blog/javascript-micro-templating/)
|
|
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
|
var settings = lodash.templateSettings;
|
|
|
|
if (guard && isIterateeCall(string, options, guard)) {
|
|
options = undefined;
|
|
}
|
|
string = toString(string);
|
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
|
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
|
importsKeys = keys(imports),
|
|
importsValues = baseValues(imports, importsKeys);
|
|
|
|
var isEscaping,
|
|
isEvaluating,
|
|
index = 0,
|
|
interpolate = options.interpolate || reNoMatch,
|
|
source = "__p += '";
|
|
|
|
// Compile the regexp to match each delimiter.
|
|
var reDelimiters = RegExp(
|
|
(options.escape || reNoMatch).source + '|' +
|
|
interpolate.source + '|' +
|
|
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
|
|
(options.evaluate || reNoMatch).source + '|$'
|
|
, 'g');
|
|
|
|
// Use a sourceURL for easier debugging.
|
|
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
|
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
|
|
// and escape the comment, thus injecting code that gets evaled.
|
|
var sourceURL = '//# sourceURL=' +
|
|
(hasOwnProperty.call(options, 'sourceURL')
|
|
? (options.sourceURL + '').replace(/\s/g, ' ')
|
|
: ('lodash.templateSources[' + (++templateCounter) + ']')
|
|
) + '\n';
|
|
|
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
|
|
// Escape characters that can't be included in string literals.
|
|
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
|
|
|
// Replace delimiters with snippets.
|
|
if (escapeValue) {
|
|
isEscaping = true;
|
|
source += "' +\n__e(" + escapeValue + ") +\n'";
|
|
}
|
|
if (evaluateValue) {
|
|
isEvaluating = true;
|
|
source += "';\n" + evaluateValue + ";\n__p += '";
|
|
}
|
|
if (interpolateValue) {
|
|
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
|
}
|
|
index = offset + match.length;
|
|
|
|
// The JS engine embedded in Adobe products needs `match` returned in
|
|
// order to produce the correct `offset` value.
|
|
return match;
|
|
});
|
|
|
|
source += "';\n";
|
|
|
|
// If `variable` is not specified wrap a with-statement around the generated
|
|
// code to add the data object to the top of the scope chain.
|
|
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
|
if (!variable) {
|
|
source = 'with (obj) {\n' + source + '\n}\n';
|
|
}
|
|
// Throw an error if a forbidden character was found in `variable`, to prevent
|
|
// potential command injection attacks.
|
|
else if (reForbiddenIdentifierChars.test(variable)) {
|
|
throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
|
|
}
|
|
|
|
// Cleanup code by stripping empty strings.
|
|
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
|
|
.replace(reEmptyStringMiddle, '$1')
|
|
.replace(reEmptyStringTrailing, '$1;');
|
|
|
|
// Frame code as the function body.
|
|
source = 'function(' + (variable || 'obj') + ') {\n' +
|
|
(variable
|
|
? ''
|
|
: 'obj || (obj = {});\n'
|
|
) +
|
|
"var __t, __p = ''" +
|
|
(isEscaping
|
|
? ', __e = _.escape'
|
|
: ''
|
|
) +
|
|
(isEvaluating
|
|
? ', __j = Array.prototype.join;\n' +
|
|
"function print() { __p += __j.call(arguments, '') }\n"
|
|
: ';\n'
|
|
) +
|
|
source +
|
|
'return __p\n}';
|
|
|
|
var result = attempt(function() {
|
|
return Function(importsKeys, sourceURL + 'return ' + source)
|
|
.apply(undefined, importsValues);
|
|
});
|
|
|
|
// Provide the compiled function's source by its `toString` method or
|
|
// the `source` property as a convenience for inlining compiled templates.
|
|
result.source = source;
|
|
if (isError(result)) {
|
|
throw result;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as a whole, to lower case just like
|
|
* [String#toLowerCase](https://mdn.io/toLowerCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the lower cased string.
|
|
* @example
|
|
*
|
|
* _.toLower('--Foo-Bar--');
|
|
* // => '--foo-bar--'
|
|
*
|
|
* _.toLower('fooBar');
|
|
* // => 'foobar'
|
|
*
|
|
* _.toLower('__FOO_BAR__');
|
|
* // => '__foo_bar__'
|
|
*/
|
|
function toLower(value) {
|
|
return toString(value).toLowerCase();
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as a whole, to upper case just like
|
|
* [String#toUpperCase](https://mdn.io/toUpperCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the upper cased string.
|
|
* @example
|
|
*
|
|
* _.toUpper('--foo-bar--');
|
|
* // => '--FOO-BAR--'
|
|
*
|
|
* _.toUpper('fooBar');
|
|
* // => 'FOOBAR'
|
|
*
|
|
* _.toUpper('__foo_bar__');
|
|
* // => '__FOO_BAR__'
|
|
*/
|
|
function toUpper(value) {
|
|
return toString(value).toUpperCase();
|
|
}
|
|
|
|
/**
|
|
* Removes leading and trailing whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trim(' abc ');
|
|
* // => 'abc'
|
|
*
|
|
* _.trim('-_-abc-_-', '_-');
|
|
* // => 'abc'
|
|
*
|
|
* _.map([' foo ', ' bar '], _.trim);
|
|
* // => ['foo', 'bar']
|
|
*/
|
|
function trim(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return baseTrim(string);
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
chrSymbols = stringToArray(chars),
|
|
start = charsStartIndex(strSymbols, chrSymbols),
|
|
end = charsEndIndex(strSymbols, chrSymbols) + 1;
|
|
|
|
return castSlice(strSymbols, start, end).join('');
|
|
}
|
|
|
|
/**
|
|
* Removes trailing whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trimEnd(' abc ');
|
|
* // => ' abc'
|
|
*
|
|
* _.trimEnd('-_-abc-_-', '_-');
|
|
* // => '-_-abc'
|
|
*/
|
|
function trimEnd(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return string.slice(0, trimmedEndIndex(string) + 1);
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
|
|
|
|
return castSlice(strSymbols, 0, end).join('');
|
|
}
|
|
|
|
/**
|
|
* Removes leading whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trimStart(' abc ');
|
|
* // => 'abc '
|
|
*
|
|
* _.trimStart('-_-abc-_-', '_-');
|
|
* // => 'abc-_-'
|
|
*/
|
|
function trimStart(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return string.replace(reTrimStart, '');
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
start = charsStartIndex(strSymbols, stringToArray(chars));
|
|
|
|
return castSlice(strSymbols, start).join('');
|
|
}
|
|
|
|
/**
|
|
* Truncates `string` if it's longer than the given maximum string length.
|
|
* The last characters of the truncated string are replaced with the omission
|
|
* string which defaults to "...".
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to truncate.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {number} [options.length=30] The maximum string length.
|
|
* @param {string} [options.omission='...'] The string to indicate text is omitted.
|
|
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
|
|
* @returns {string} Returns the truncated string.
|
|
* @example
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino');
|
|
* // => 'hi-diddly-ho there, neighbo...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'length': 24,
|
|
* 'separator': ' '
|
|
* });
|
|
* // => 'hi-diddly-ho there,...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'length': 24,
|
|
* 'separator': /,? +/
|
|
* });
|
|
* // => 'hi-diddly-ho there...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'omission': ' [...]'
|
|
* });
|
|
* // => 'hi-diddly-ho there, neig [...]'
|
|
*/
|
|
function truncate(string, options) {
|
|
var length = DEFAULT_TRUNC_LENGTH,
|
|
omission = DEFAULT_TRUNC_OMISSION;
|
|
|
|
if (isObject(options)) {
|
|
var separator = 'separator' in options ? options.separator : separator;
|
|
length = 'length' in options ? toInteger(options.length) : length;
|
|
omission = 'omission' in options ? baseToString(options.omission) : omission;
|
|
}
|
|
string = toString(string);
|
|
|
|
var strLength = string.length;
|
|
if (hasUnicode(string)) {
|
|
var strSymbols = stringToArray(string);
|
|
strLength = strSymbols.length;
|
|
}
|
|
if (length >= strLength) {
|
|
return string;
|
|
}
|
|
var end = length - stringSize(omission);
|
|
if (end < 1) {
|
|
return omission;
|
|
}
|
|
var result = strSymbols
|
|
? castSlice(strSymbols, 0, end).join('')
|
|
: string.slice(0, end);
|
|
|
|
if (separator === undefined) {
|
|
return result + omission;
|
|
}
|
|
if (strSymbols) {
|
|
end += (result.length - end);
|
|
}
|
|
if (isRegExp(separator)) {
|
|
if (string.slice(end).search(separator)) {
|
|
var match,
|
|
substring = result;
|
|
|
|
if (!separator.global) {
|
|
separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
|
|
}
|
|
separator.lastIndex = 0;
|
|
while ((match = separator.exec(substring))) {
|
|
var newEnd = match.index;
|
|
}
|
|
result = result.slice(0, newEnd === undefined ? end : newEnd);
|
|
}
|
|
} else if (string.indexOf(baseToString(separator), end) != end) {
|
|
var index = result.lastIndexOf(separator);
|
|
if (index > -1) {
|
|
result = result.slice(0, index);
|
|
}
|
|
}
|
|
return result + omission;
|
|
}
|
|
|
|
/**
|
|
* The inverse of `_.escape`; this method converts the HTML entities
|
|
* `&`, `<`, `>`, `"`, and `'` in `string` to
|
|
* their corresponding characters.
|
|
*
|
|
* **Note:** No other HTML entities are unescaped. To unescape additional
|
|
* HTML entities use a third-party library like [_he_](https://mths.be/he).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.6.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to unescape.
|
|
* @returns {string} Returns the unescaped string.
|
|
* @example
|
|
*
|
|
* _.unescape('fred, barney, & pebbles');
|
|
* // => 'fred, barney, & pebbles'
|
|
*/
|
|
function unescape(string) {
|
|
string = toString(string);
|
|
return (string && reHasEscapedHtml.test(string))
|
|
? string.replace(reEscapedHtml, unescapeHtmlChar)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to upper case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the upper cased string.
|
|
* @example
|
|
*
|
|
* _.upperCase('--foo-bar');
|
|
* // => 'FOO BAR'
|
|
*
|
|
* _.upperCase('fooBar');
|
|
* // => 'FOO BAR'
|
|
*
|
|
* _.upperCase('__foo_bar__');
|
|
* // => 'FOO BAR'
|
|
*/
|
|
var upperCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + word.toUpperCase();
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to upper case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.upperFirst('fred');
|
|
* // => 'Fred'
|
|
*
|
|
* _.upperFirst('FRED');
|
|
* // => 'FRED'
|
|
*/
|
|
var upperFirst = createCaseFirst('toUpperCase');
|
|
|
|
/**
|
|
* Splits `string` into an array of its words.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the words of `string`.
|
|
* @example
|
|
*
|
|
* _.words('fred, barney, & pebbles');
|
|
* // => ['fred', 'barney', 'pebbles']
|
|
*
|
|
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
* // => ['fred', 'barney', '&', 'pebbles']
|
|
*/
|
|
function words(string, pattern, guard) {
|
|
string = toString(string);
|
|
pattern = guard ? undefined : pattern;
|
|
|
|
if (pattern === undefined) {
|
|
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
}
|
|
return string.match(pattern) || [];
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Attempts to invoke `func`, returning either the result or the caught error
|
|
* object. Any additional arguments are provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Function} func The function to attempt.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {*} Returns the `func` result or error object.
|
|
* @example
|
|
*
|
|
* // Avoid throwing errors for invalid selectors.
|
|
* var elements = _.attempt(function(selector) {
|
|
* return document.querySelectorAll(selector);
|
|
* }, '>_>');
|
|
*
|
|
* if (_.isError(elements)) {
|
|
* elements = [];
|
|
* }
|
|
*/
|
|
var attempt = baseRest(function(func, args) {
|
|
try {
|
|
return apply(func, undefined, args);
|
|
} catch (e) {
|
|
return isError(e) ? e : new Error(e);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Binds methods of an object to the object itself, overwriting the existing
|
|
* method.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of bound functions.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {Object} object The object to bind and assign the bound methods to.
|
|
* @param {...(string|string[])} methodNames The object method names to bind.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var view = {
|
|
* 'label': 'docs',
|
|
* 'click': function() {
|
|
* console.log('clicked ' + this.label);
|
|
* }
|
|
* };
|
|
*
|
|
* _.bindAll(view, ['click']);
|
|
* jQuery(element).on('click', view.click);
|
|
* // => Logs 'clicked docs' when clicked.
|
|
*/
|
|
var bindAll = flatRest(function(object, methodNames) {
|
|
arrayEach(methodNames, function(key) {
|
|
key = toKey(key);
|
|
baseAssignValue(object, key, bind(object[key], object));
|
|
});
|
|
return object;
|
|
});
|
|
|
|
/**
|
|
* Creates a function that iterates over `pairs` and invokes the corresponding
|
|
* function of the first predicate to return truthy. The predicate-function
|
|
* pairs are invoked with the `this` binding and arguments of the created
|
|
* function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {Array} pairs The predicate-function pairs.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @example
|
|
*
|
|
* var func = _.cond([
|
|
* [_.matches({ 'a': 1 }), _.constant('matches A')],
|
|
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
|
|
* [_.stubTrue, _.constant('no match')]
|
|
* ]);
|
|
*
|
|
* func({ 'a': 1, 'b': 2 });
|
|
* // => 'matches A'
|
|
*
|
|
* func({ 'a': 0, 'b': 1 });
|
|
* // => 'matches B'
|
|
*
|
|
* func({ 'a': '1', 'b': '2' });
|
|
* // => 'no match'
|
|
*/
|
|
function cond(pairs) {
|
|
var length = pairs == null ? 0 : pairs.length,
|
|
toIteratee = getIteratee();
|
|
|
|
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
|
if (typeof pair[1] != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return [toIteratee(pair[0]), pair[1]];
|
|
});
|
|
|
|
return baseRest(function(args) {
|
|
var index = -1;
|
|
while (++index < length) {
|
|
var pair = pairs[index];
|
|
if (apply(pair[0], this, args)) {
|
|
return apply(pair[1], this, args);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes the predicate properties of `source` with
|
|
* the corresponding property values of a given object, returning `true` if
|
|
* all predicates return truthy, else `false`.
|
|
*
|
|
* **Note:** The created function is equivalent to `_.conformsTo` with
|
|
* `source` partially applied.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 2, 'b': 1 },
|
|
* { 'a': 1, 'b': 2 }
|
|
* ];
|
|
*
|
|
* _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
|
|
* // => [{ 'a': 1, 'b': 2 }]
|
|
*/
|
|
function conforms(source) {
|
|
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that returns `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Util
|
|
* @param {*} value The value to return from the new function.
|
|
* @returns {Function} Returns the new constant function.
|
|
* @example
|
|
*
|
|
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
*
|
|
* console.log(objects);
|
|
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
*
|
|
* console.log(objects[0] === objects[1]);
|
|
* // => true
|
|
*/
|
|
function constant(value) {
|
|
return function() {
|
|
return value;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Checks `value` to determine whether a default value should be returned in
|
|
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
|
|
* or `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.14.0
|
|
* @category Util
|
|
* @param {*} value The value to check.
|
|
* @param {*} defaultValue The default value.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* _.defaultTo(1, 10);
|
|
* // => 1
|
|
*
|
|
* _.defaultTo(undefined, 10);
|
|
* // => 10
|
|
*/
|
|
function defaultTo(value, defaultValue) {
|
|
return (value == null || value !== value) ? defaultValue : value;
|
|
}
|
|
|
|
/**
|
|
* Creates a function that returns the result of invoking the given functions
|
|
* with the `this` binding of the created function, where each successive
|
|
* invocation is supplied the return value of the previous.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @see _.flowRight
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var addSquare = _.flow([_.add, square]);
|
|
* addSquare(1, 2);
|
|
* // => 9
|
|
*/
|
|
var flow = createFlow();
|
|
|
|
/**
|
|
* This method is like `_.flow` except that it creates a function that
|
|
* invokes the given functions from right to left.
|
|
*
|
|
* @static
|
|
* @since 3.0.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @see _.flow
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var addSquare = _.flowRight([square, _.add]);
|
|
* addSquare(1, 2);
|
|
* // => 9
|
|
*/
|
|
var flowRight = createFlow(true);
|
|
|
|
/**
|
|
* This method returns the first argument it receives.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {*} value Any value.
|
|
* @returns {*} Returns `value`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
*
|
|
* console.log(_.identity(object) === object);
|
|
* // => true
|
|
*/
|
|
function identity(value) {
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the arguments of the created
|
|
* function. If `func` is a property name, the created function returns the
|
|
* property value for a given element. If `func` is an array or object, the
|
|
* created function returns `true` for elements that contain the equivalent
|
|
* source properties, otherwise it returns `false`.
|
|
*
|
|
* @static
|
|
* @since 4.0.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {*} [func=_.identity] The value to convert to a callback.
|
|
* @returns {Function} Returns the callback.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
|
|
* // => [{ 'user': 'barney', 'age': 36, 'active': true }]
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.filter(users, _.iteratee(['user', 'fred']));
|
|
* // => [{ 'user': 'fred', 'age': 40 }]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.map(users, _.iteratee('user'));
|
|
* // => ['barney', 'fred']
|
|
*
|
|
* // Create custom iteratee shorthands.
|
|
* _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
|
|
* return !_.isRegExp(func) ? iteratee(func) : function(string) {
|
|
* return func.test(string);
|
|
* };
|
|
* });
|
|
*
|
|
* _.filter(['abc', 'def'], /ef/);
|
|
* // => ['def']
|
|
*/
|
|
function iteratee(func) {
|
|
return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a partial deep comparison between a given
|
|
* object and `source`, returning `true` if the given object has equivalent
|
|
* property values, else `false`.
|
|
*
|
|
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
|
* partially applied.
|
|
*
|
|
* Partial comparisons will match empty array and empty object `source`
|
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
* for a list of supported value comparisons.
|
|
*
|
|
* **Note:** Multiple values can be checked by combining several matchers
|
|
* using `_.overSome`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
|
* ];
|
|
*
|
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
|
*
|
|
* // Checking for several possible values
|
|
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
*/
|
|
function matches(source) {
|
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a partial deep comparison between the
|
|
* value at `path` of a given object to `srcValue`, returning `true` if the
|
|
* object value is equivalent, else `false`.
|
|
*
|
|
* **Note:** Partial comparisons will match empty array and empty object
|
|
* `srcValue` values against any array or object value, respectively. See
|
|
* `_.isEqual` for a list of supported value comparisons.
|
|
*
|
|
* **Note:** Multiple values can be checked by combining several matchers
|
|
* using `_.overSome`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
|
* ];
|
|
*
|
|
* _.find(objects, _.matchesProperty('a', 4));
|
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
|
*
|
|
* // Checking for several possible values
|
|
* _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
|
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
*/
|
|
function matchesProperty(path, srcValue) {
|
|
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes the method at `path` of a given object.
|
|
* Any additional arguments are provided to the invoked method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {Function} Returns the new invoker function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': { 'b': _.constant(2) } },
|
|
* { 'a': { 'b': _.constant(1) } }
|
|
* ];
|
|
*
|
|
* _.map(objects, _.method('a.b'));
|
|
* // => [2, 1]
|
|
*
|
|
* _.map(objects, _.method(['a', 'b']));
|
|
* // => [2, 1]
|
|
*/
|
|
var method = baseRest(function(path, args) {
|
|
return function(object) {
|
|
return baseInvoke(object, path, args);
|
|
};
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.method`; this method creates a function that invokes
|
|
* the method at a given path of `object`. Any additional arguments are
|
|
* provided to the invoked method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Util
|
|
* @param {Object} object The object to query.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {Function} Returns the new invoker function.
|
|
* @example
|
|
*
|
|
* var array = _.times(3, _.constant),
|
|
* object = { 'a': array, 'b': array, 'c': array };
|
|
*
|
|
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
|
|
* // => [2, 0]
|
|
*
|
|
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
|
* // => [2, 0]
|
|
*/
|
|
var methodOf = baseRest(function(object, args) {
|
|
return function(path) {
|
|
return baseInvoke(object, path, args);
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Adds all own enumerable string keyed function properties of a source
|
|
* object to the destination object. If `object` is a function, then methods
|
|
* are added to its prototype as well.
|
|
*
|
|
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
|
|
* avoid conflicts caused by modifying the original.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {Function|Object} [object=lodash] The destination object.
|
|
* @param {Object} source The object of functions to add.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.chain=true] Specify whether mixins are chainable.
|
|
* @returns {Function|Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* function vowels(string) {
|
|
* return _.filter(string, function(v) {
|
|
* return /[aeiou]/i.test(v);
|
|
* });
|
|
* }
|
|
*
|
|
* _.mixin({ 'vowels': vowels });
|
|
* _.vowels('fred');
|
|
* // => ['e']
|
|
*
|
|
* _('fred').vowels().value();
|
|
* // => ['e']
|
|
*
|
|
* _.mixin({ 'vowels': vowels }, { 'chain': false });
|
|
* _('fred').vowels();
|
|
* // => ['e']
|
|
*/
|
|
function mixin(object, source, options) {
|
|
var props = keys(source),
|
|
methodNames = baseFunctions(source, props);
|
|
|
|
if (options == null &&
|
|
!(isObject(source) && (methodNames.length || !props.length))) {
|
|
options = source;
|
|
source = object;
|
|
object = this;
|
|
methodNames = baseFunctions(source, keys(source));
|
|
}
|
|
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
|
|
isFunc = isFunction(object);
|
|
|
|
arrayEach(methodNames, function(methodName) {
|
|
var func = source[methodName];
|
|
object[methodName] = func;
|
|
if (isFunc) {
|
|
object.prototype[methodName] = function() {
|
|
var chainAll = this.__chain__;
|
|
if (chain || chainAll) {
|
|
var result = object(this.__wrapped__),
|
|
actions = result.__actions__ = copyArray(this.__actions__);
|
|
|
|
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
|
|
result.__chain__ = chainAll;
|
|
return result;
|
|
}
|
|
return func.apply(object, arrayPush([this.value()], arguments));
|
|
};
|
|
}
|
|
});
|
|
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Reverts the `_` variable to its previous value and returns a reference to
|
|
* the `lodash` function.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @returns {Function} Returns the `lodash` function.
|
|
* @example
|
|
*
|
|
* var lodash = _.noConflict();
|
|
*/
|
|
function noConflict() {
|
|
if (root._ === this) {
|
|
root._ = oldDash;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* This method returns `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.3.0
|
|
* @category Util
|
|
* @example
|
|
*
|
|
* _.times(2, _.noop);
|
|
* // => [undefined, undefined]
|
|
*/
|
|
function noop() {
|
|
// No operation performed.
|
|
}
|
|
|
|
/**
|
|
* Creates a function that gets the argument at index `n`. If `n` is negative,
|
|
* the nth argument from the end is returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {number} [n=0] The index of the argument to return.
|
|
* @returns {Function} Returns the new pass-thru function.
|
|
* @example
|
|
*
|
|
* var func = _.nthArg(1);
|
|
* func('a', 'b', 'c', 'd');
|
|
* // => 'b'
|
|
*
|
|
* var func = _.nthArg(-2);
|
|
* func('a', 'b', 'c', 'd');
|
|
* // => 'c'
|
|
*/
|
|
function nthArg(n) {
|
|
n = toInteger(n);
|
|
return baseRest(function(args) {
|
|
return baseNth(args, n);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `iteratees` with the arguments it receives
|
|
* and returns their results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
* The iteratees to invoke.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.over([Math.max, Math.min]);
|
|
*
|
|
* func(1, 2, 3, 4);
|
|
* // => [4, 1]
|
|
*/
|
|
var over = createOver(arrayMap);
|
|
|
|
/**
|
|
* Creates a function that checks if **all** of the `predicates` return
|
|
* truthy when invoked with the arguments it receives.
|
|
*
|
|
* Following shorthands are possible for providing predicates.
|
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [predicates=[_.identity]]
|
|
* The predicates to check.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.overEvery([Boolean, isFinite]);
|
|
*
|
|
* func('1');
|
|
* // => true
|
|
*
|
|
* func(null);
|
|
* // => false
|
|
*
|
|
* func(NaN);
|
|
* // => false
|
|
*/
|
|
var overEvery = createOver(arrayEvery);
|
|
|
|
/**
|
|
* Creates a function that checks if **any** of the `predicates` return
|
|
* truthy when invoked with the arguments it receives.
|
|
*
|
|
* Following shorthands are possible for providing predicates.
|
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [predicates=[_.identity]]
|
|
* The predicates to check.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.overSome([Boolean, isFinite]);
|
|
*
|
|
* func('1');
|
|
* // => true
|
|
*
|
|
* func(null);
|
|
* // => true
|
|
*
|
|
* func(NaN);
|
|
* // => false
|
|
*
|
|
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
|
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
|
*/
|
|
var overSome = createOver(arraySome);
|
|
|
|
/**
|
|
* Creates a function that returns the value at `path` of a given object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': { 'b': 2 } },
|
|
* { 'a': { 'b': 1 } }
|
|
* ];
|
|
*
|
|
* _.map(objects, _.property('a.b'));
|
|
* // => [2, 1]
|
|
*
|
|
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
* // => [1, 2]
|
|
*/
|
|
function property(path) {
|
|
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.property`; this method creates a function that returns
|
|
* the value at a given path of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Object} object The object to query.
|
|
* @returns {Function} Returns the new accessor function.
|
|
* @example
|
|
*
|
|
* var array = [0, 1, 2],
|
|
* object = { 'a': array, 'b': array, 'c': array };
|
|
*
|
|
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
|
|
* // => [2, 0]
|
|
*
|
|
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
|
|
* // => [2, 0]
|
|
*/
|
|
function propertyOf(object) {
|
|
return function(path) {
|
|
return object == null ? undefined : baseGet(object, path);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates an array of numbers (positive and/or negative) progressing from
|
|
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
|
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
|
* it's set to `start` with `start` then set to `0`.
|
|
*
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
* floating-point values which can produce unexpected results.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
|
* @returns {Array} Returns the range of numbers.
|
|
* @see _.inRange, _.rangeRight
|
|
* @example
|
|
*
|
|
* _.range(4);
|
|
* // => [0, 1, 2, 3]
|
|
*
|
|
* _.range(-4);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 5);
|
|
* // => [1, 2, 3, 4]
|
|
*
|
|
* _.range(0, 20, 5);
|
|
* // => [0, 5, 10, 15]
|
|
*
|
|
* _.range(0, -4, -1);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 4, 0);
|
|
* // => [1, 1, 1]
|
|
*
|
|
* _.range(0);
|
|
* // => []
|
|
*/
|
|
var range = createRange();
|
|
|
|
/**
|
|
* This method is like `_.range` except that it populates values in
|
|
* descending order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
|
* @returns {Array} Returns the range of numbers.
|
|
* @see _.inRange, _.range
|
|
* @example
|
|
*
|
|
* _.rangeRight(4);
|
|
* // => [3, 2, 1, 0]
|
|
*
|
|
* _.rangeRight(-4);
|
|
* // => [-3, -2, -1, 0]
|
|
*
|
|
* _.rangeRight(1, 5);
|
|
* // => [4, 3, 2, 1]
|
|
*
|
|
* _.rangeRight(0, 20, 5);
|
|
* // => [15, 10, 5, 0]
|
|
*
|
|
* _.rangeRight(0, -4, -1);
|
|
* // => [-3, -2, -1, 0]
|
|
*
|
|
* _.rangeRight(1, 4, 0);
|
|
* // => [1, 1, 1]
|
|
*
|
|
* _.rangeRight(0);
|
|
* // => []
|
|
*/
|
|
var rangeRight = createRange(true);
|
|
|
|
/**
|
|
* This method returns a new empty array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {Array} Returns the new empty array.
|
|
* @example
|
|
*
|
|
* var arrays = _.times(2, _.stubArray);
|
|
*
|
|
* console.log(arrays);
|
|
* // => [[], []]
|
|
*
|
|
* console.log(arrays[0] === arrays[1]);
|
|
* // => false
|
|
*/
|
|
function stubArray() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* This method returns `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {boolean} Returns `false`.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubFalse);
|
|
* // => [false, false]
|
|
*/
|
|
function stubFalse() {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* This method returns a new empty object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {Object} Returns the new empty object.
|
|
* @example
|
|
*
|
|
* var objects = _.times(2, _.stubObject);
|
|
*
|
|
* console.log(objects);
|
|
* // => [{}, {}]
|
|
*
|
|
* console.log(objects[0] === objects[1]);
|
|
* // => false
|
|
*/
|
|
function stubObject() {
|
|
return {};
|
|
}
|
|
|
|
/**
|
|
* This method returns an empty string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {string} Returns the empty string.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubString);
|
|
* // => ['', '']
|
|
*/
|
|
function stubString() {
|
|
return '';
|
|
}
|
|
|
|
/**
|
|
* This method returns `true`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {boolean} Returns `true`.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubTrue);
|
|
* // => [true, true]
|
|
*/
|
|
function stubTrue() {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Invokes the iteratee `n` times, returning an array of the results of
|
|
* each invocation. The iteratee is invoked with one argument; (index).
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {number} n The number of times to invoke `iteratee`.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the array of results.
|
|
* @example
|
|
*
|
|
* _.times(3, String);
|
|
* // => ['0', '1', '2']
|
|
*
|
|
* _.times(4, _.constant(0));
|
|
* // => [0, 0, 0, 0]
|
|
*/
|
|
function times(n, iteratee) {
|
|
n = toInteger(n);
|
|
if (n < 1 || n > MAX_SAFE_INTEGER) {
|
|
return [];
|
|
}
|
|
var index = MAX_ARRAY_LENGTH,
|
|
length = nativeMin(n, MAX_ARRAY_LENGTH);
|
|
|
|
iteratee = getIteratee(iteratee);
|
|
n -= MAX_ARRAY_LENGTH;
|
|
|
|
var result = baseTimes(length, iteratee);
|
|
while (++index < n) {
|
|
iteratee(index);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a property path array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {*} value The value to convert.
|
|
* @returns {Array} Returns the new property path array.
|
|
* @example
|
|
*
|
|
* _.toPath('a.b.c');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* _.toPath('a[0].b.c');
|
|
* // => ['a', '0', 'b', 'c']
|
|
*/
|
|
function toPath(value) {
|
|
if (isArray(value)) {
|
|
return arrayMap(value, toKey);
|
|
}
|
|
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
|
|
}
|
|
|
|
/**
|
|
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
* @returns {string} Returns the unique ID.
|
|
* @example
|
|
*
|
|
* _.uniqueId('contact_');
|
|
* // => 'contact_104'
|
|
*
|
|
* _.uniqueId();
|
|
* // => '105'
|
|
*/
|
|
function uniqueId(prefix) {
|
|
var id = ++idCounter;
|
|
return toString(prefix) + id;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Adds two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.4.0
|
|
* @category Math
|
|
* @param {number} augend The first number in an addition.
|
|
* @param {number} addend The second number in an addition.
|
|
* @returns {number} Returns the total.
|
|
* @example
|
|
*
|
|
* _.add(6, 4);
|
|
* // => 10
|
|
*/
|
|
var add = createMathOperation(function(augend, addend) {
|
|
return augend + addend;
|
|
}, 0);
|
|
|
|
/**
|
|
* Computes `number` rounded up to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round up.
|
|
* @param {number} [precision=0] The precision to round up to.
|
|
* @returns {number} Returns the rounded up number.
|
|
* @example
|
|
*
|
|
* _.ceil(4.006);
|
|
* // => 5
|
|
*
|
|
* _.ceil(6.004, 2);
|
|
* // => 6.01
|
|
*
|
|
* _.ceil(6040, -2);
|
|
* // => 6100
|
|
*/
|
|
var ceil = createRound('ceil');
|
|
|
|
/**
|
|
* Divide two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {number} dividend The first number in a division.
|
|
* @param {number} divisor The second number in a division.
|
|
* @returns {number} Returns the quotient.
|
|
* @example
|
|
*
|
|
* _.divide(6, 4);
|
|
* // => 1.5
|
|
*/
|
|
var divide = createMathOperation(function(dividend, divisor) {
|
|
return dividend / divisor;
|
|
}, 1);
|
|
|
|
/**
|
|
* Computes `number` rounded down to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round down.
|
|
* @param {number} [precision=0] The precision to round down to.
|
|
* @returns {number} Returns the rounded down number.
|
|
* @example
|
|
*
|
|
* _.floor(4.006);
|
|
* // => 4
|
|
*
|
|
* _.floor(0.046, 2);
|
|
* // => 0.04
|
|
*
|
|
* _.floor(4060, -2);
|
|
* // => 4000
|
|
*/
|
|
var floor = createRound('floor');
|
|
|
|
/**
|
|
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the maximum value.
|
|
* @example
|
|
*
|
|
* _.max([4, 2, 8, 6]);
|
|
* // => 8
|
|
*
|
|
* _.max([]);
|
|
* // => undefined
|
|
*/
|
|
function max(array) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, identity, baseGt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.max` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {*} Returns the maximum value.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
*
|
|
* _.maxBy(objects, function(o) { return o.n; });
|
|
* // => { 'n': 2 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.maxBy(objects, 'n');
|
|
* // => { 'n': 2 }
|
|
*/
|
|
function maxBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* Computes the mean of the values in `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {number} Returns the mean.
|
|
* @example
|
|
*
|
|
* _.mean([4, 2, 8, 6]);
|
|
* // => 5
|
|
*/
|
|
function mean(array) {
|
|
return baseMean(array, identity);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.mean` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the value to be averaged.
|
|
* The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the mean.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
|
*
|
|
* _.meanBy(objects, function(o) { return o.n; });
|
|
* // => 5
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.meanBy(objects, 'n');
|
|
* // => 5
|
|
*/
|
|
function meanBy(array, iteratee) {
|
|
return baseMean(array, getIteratee(iteratee, 2));
|
|
}
|
|
|
|
/**
|
|
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* _.min([4, 2, 8, 6]);
|
|
* // => 2
|
|
*
|
|
* _.min([]);
|
|
* // => undefined
|
|
*/
|
|
function min(array) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, identity, baseLt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.min` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
*
|
|
* _.minBy(objects, function(o) { return o.n; });
|
|
* // => { 'n': 1 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.minBy(objects, 'n');
|
|
* // => { 'n': 1 }
|
|
*/
|
|
function minBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* Multiply two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {number} multiplier The first number in a multiplication.
|
|
* @param {number} multiplicand The second number in a multiplication.
|
|
* @returns {number} Returns the product.
|
|
* @example
|
|
*
|
|
* _.multiply(6, 4);
|
|
* // => 24
|
|
*/
|
|
var multiply = createMathOperation(function(multiplier, multiplicand) {
|
|
return multiplier * multiplicand;
|
|
}, 1);
|
|
|
|
/**
|
|
* Computes `number` rounded to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round.
|
|
* @param {number} [precision=0] The precision to round to.
|
|
* @returns {number} Returns the rounded number.
|
|
* @example
|
|
*
|
|
* _.round(4.006);
|
|
* // => 4
|
|
*
|
|
* _.round(4.006, 2);
|
|
* // => 4.01
|
|
*
|
|
* _.round(4060, -2);
|
|
* // => 4100
|
|
*/
|
|
var round = createRound('round');
|
|
|
|
/**
|
|
* Subtract two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {number} minuend The first number in a subtraction.
|
|
* @param {number} subtrahend The second number in a subtraction.
|
|
* @returns {number} Returns the difference.
|
|
* @example
|
|
*
|
|
* _.subtract(6, 4);
|
|
* // => 2
|
|
*/
|
|
var subtract = createMathOperation(function(minuend, subtrahend) {
|
|
return minuend - subtrahend;
|
|
}, 0);
|
|
|
|
/**
|
|
* Computes the sum of the values in `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.4.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {number} Returns the sum.
|
|
* @example
|
|
*
|
|
* _.sum([4, 2, 8, 6]);
|
|
* // => 20
|
|
*/
|
|
function sum(array) {
|
|
return (array && array.length)
|
|
? baseSum(array, identity)
|
|
: 0;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sum` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the value to be summed.
|
|
* The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the sum.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
|
*
|
|
* _.sumBy(objects, function(o) { return o.n; });
|
|
* // => 20
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sumBy(objects, 'n');
|
|
* // => 20
|
|
*/
|
|
function sumBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseSum(array, getIteratee(iteratee, 2))
|
|
: 0;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
// Add methods that return wrapped values in chain sequences.
|
|
lodash.after = after;
|
|
lodash.ary = ary;
|
|
lodash.assign = assign;
|
|
lodash.assignIn = assignIn;
|
|
lodash.assignInWith = assignInWith;
|
|
lodash.assignWith = assignWith;
|
|
lodash.at = at;
|
|
lodash.before = before;
|
|
lodash.bind = bind;
|
|
lodash.bindAll = bindAll;
|
|
lodash.bindKey = bindKey;
|
|
lodash.castArray = castArray;
|
|
lodash.chain = chain;
|
|
lodash.chunk = chunk;
|
|
lodash.compact = compact;
|
|
lodash.concat = concat;
|
|
lodash.cond = cond;
|
|
lodash.conforms = conforms;
|
|
lodash.constant = constant;
|
|
lodash.countBy = countBy;
|
|
lodash.create = create;
|
|
lodash.curry = curry;
|
|
lodash.curryRight = curryRight;
|
|
lodash.debounce = debounce;
|
|
lodash.defaults = defaults;
|
|
lodash.defaultsDeep = defaultsDeep;
|
|
lodash.defer = defer;
|
|
lodash.delay = delay;
|
|
lodash.difference = difference;
|
|
lodash.differenceBy = differenceBy;
|
|
lodash.differenceWith = differenceWith;
|
|
lodash.drop = drop;
|
|
lodash.dropRight = dropRight;
|
|
lodash.dropRightWhile = dropRightWhile;
|
|
lodash.dropWhile = dropWhile;
|
|
lodash.fill = fill;
|
|
lodash.filter = filter;
|
|
lodash.flatMap = flatMap;
|
|
lodash.flatMapDeep = flatMapDeep;
|
|
lodash.flatMapDepth = flatMapDepth;
|
|
lodash.flatten = flatten;
|
|
lodash.flattenDeep = flattenDeep;
|
|
lodash.flattenDepth = flattenDepth;
|
|
lodash.flip = flip;
|
|
lodash.flow = flow;
|
|
lodash.flowRight = flowRight;
|
|
lodash.fromPairs = fromPairs;
|
|
lodash.functions = functions;
|
|
lodash.functionsIn = functionsIn;
|
|
lodash.groupBy = groupBy;
|
|
lodash.initial = initial;
|
|
lodash.intersection = intersection;
|
|
lodash.intersectionBy = intersectionBy;
|
|
lodash.intersectionWith = intersectionWith;
|
|
lodash.invert = invert;
|
|
lodash.invertBy = invertBy;
|
|
lodash.invokeMap = invokeMap;
|
|
lodash.iteratee = iteratee;
|
|
lodash.keyBy = keyBy;
|
|
lodash.keys = keys;
|
|
lodash.keysIn = keysIn;
|
|
lodash.map = map;
|
|
lodash.mapKeys = mapKeys;
|
|
lodash.mapValues = mapValues;
|
|
lodash.matches = matches;
|
|
lodash.matchesProperty = matchesProperty;
|
|
lodash.memoize = memoize;
|
|
lodash.merge = merge;
|
|
lodash.mergeWith = mergeWith;
|
|
lodash.method = method;
|
|
lodash.methodOf = methodOf;
|
|
lodash.mixin = mixin;
|
|
lodash.negate = negate;
|
|
lodash.nthArg = nthArg;
|
|
lodash.omit = omit;
|
|
lodash.omitBy = omitBy;
|
|
lodash.once = once;
|
|
lodash.orderBy = orderBy;
|
|
lodash.over = over;
|
|
lodash.overArgs = overArgs;
|
|
lodash.overEvery = overEvery;
|
|
lodash.overSome = overSome;
|
|
lodash.partial = partial;
|
|
lodash.partialRight = partialRight;
|
|
lodash.partition = partition;
|
|
lodash.pick = pick;
|
|
lodash.pickBy = pickBy;
|
|
lodash.property = property;
|
|
lodash.propertyOf = propertyOf;
|
|
lodash.pull = pull;
|
|
lodash.pullAll = pullAll;
|
|
lodash.pullAllBy = pullAllBy;
|
|
lodash.pullAllWith = pullAllWith;
|
|
lodash.pullAt = pullAt;
|
|
lodash.range = range;
|
|
lodash.rangeRight = rangeRight;
|
|
lodash.rearg = rearg;
|
|
lodash.reject = reject;
|
|
lodash.remove = remove;
|
|
lodash.rest = rest;
|
|
lodash.reverse = reverse;
|
|
lodash.sampleSize = sampleSize;
|
|
lodash.set = set;
|
|
lodash.setWith = setWith;
|
|
lodash.shuffle = shuffle;
|
|
lodash.slice = slice;
|
|
lodash.sortBy = sortBy;
|
|
lodash.sortedUniq = sortedUniq;
|
|
lodash.sortedUniqBy = sortedUniqBy;
|
|
lodash.split = split;
|
|
lodash.spread = spread;
|
|
lodash.tail = tail;
|
|
lodash.take = take;
|
|
lodash.takeRight = takeRight;
|
|
lodash.takeRightWhile = takeRightWhile;
|
|
lodash.takeWhile = takeWhile;
|
|
lodash.tap = tap;
|
|
lodash.throttle = throttle;
|
|
lodash.thru = thru;
|
|
lodash.toArray = toArray;
|
|
lodash.toPairs = toPairs;
|
|
lodash.toPairsIn = toPairsIn;
|
|
lodash.toPath = toPath;
|
|
lodash.toPlainObject = toPlainObject;
|
|
lodash.transform = transform;
|
|
lodash.unary = unary;
|
|
lodash.union = union;
|
|
lodash.unionBy = unionBy;
|
|
lodash.unionWith = unionWith;
|
|
lodash.uniq = uniq;
|
|
lodash.uniqBy = uniqBy;
|
|
lodash.uniqWith = uniqWith;
|
|
lodash.unset = unset;
|
|
lodash.unzip = unzip;
|
|
lodash.unzipWith = unzipWith;
|
|
lodash.update = update;
|
|
lodash.updateWith = updateWith;
|
|
lodash.values = values;
|
|
lodash.valuesIn = valuesIn;
|
|
lodash.without = without;
|
|
lodash.words = words;
|
|
lodash.wrap = wrap;
|
|
lodash.xor = xor;
|
|
lodash.xorBy = xorBy;
|
|
lodash.xorWith = xorWith;
|
|
lodash.zip = zip;
|
|
lodash.zipObject = zipObject;
|
|
lodash.zipObjectDeep = zipObjectDeep;
|
|
lodash.zipWith = zipWith;
|
|
|
|
// Add aliases.
|
|
lodash.entries = toPairs;
|
|
lodash.entriesIn = toPairsIn;
|
|
lodash.extend = assignIn;
|
|
lodash.extendWith = assignInWith;
|
|
|
|
// Add methods to `lodash.prototype`.
|
|
mixin(lodash, lodash);
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
// Add methods that return unwrapped values in chain sequences.
|
|
lodash.add = add;
|
|
lodash.attempt = attempt;
|
|
lodash.camelCase = camelCase;
|
|
lodash.capitalize = capitalize;
|
|
lodash.ceil = ceil;
|
|
lodash.clamp = clamp;
|
|
lodash.clone = clone;
|
|
lodash.cloneDeep = cloneDeep;
|
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
lodash.cloneWith = cloneWith;
|
|
lodash.conformsTo = conformsTo;
|
|
lodash.deburr = deburr;
|
|
lodash.defaultTo = defaultTo;
|
|
lodash.divide = divide;
|
|
lodash.endsWith = endsWith;
|
|
lodash.eq = eq;
|
|
lodash.escape = escape;
|
|
lodash.escapeRegExp = escapeRegExp;
|
|
lodash.every = every;
|
|
lodash.find = find;
|
|
lodash.findIndex = findIndex;
|
|
lodash.findKey = findKey;
|
|
lodash.findLast = findLast;
|
|
lodash.findLastIndex = findLastIndex;
|
|
lodash.findLastKey = findLastKey;
|
|
lodash.floor = floor;
|
|
lodash.forEach = forEach;
|
|
lodash.forEachRight = forEachRight;
|
|
lodash.forIn = forIn;
|
|
lodash.forInRight = forInRight;
|
|
lodash.forOwn = forOwn;
|
|
lodash.forOwnRight = forOwnRight;
|
|
lodash.get = get;
|
|
lodash.gt = gt;
|
|
lodash.gte = gte;
|
|
lodash.has = has;
|
|
lodash.hasIn = hasIn;
|
|
lodash.head = head;
|
|
lodash.identity = identity;
|
|
lodash.includes = includes;
|
|
lodash.indexOf = indexOf;
|
|
lodash.inRange = inRange;
|
|
lodash.invoke = invoke;
|
|
lodash.isArguments = isArguments;
|
|
lodash.isArray = isArray;
|
|
lodash.isArrayBuffer = isArrayBuffer;
|
|
lodash.isArrayLike = isArrayLike;
|
|
lodash.isArrayLikeObject = isArrayLikeObject;
|
|
lodash.isBoolean = isBoolean;
|
|
lodash.isBuffer = isBuffer;
|
|
lodash.isDate = isDate;
|
|
lodash.isElement = isElement;
|
|
lodash.isEmpty = isEmpty;
|
|
lodash.isEqual = isEqual;
|
|
lodash.isEqualWith = isEqualWith;
|
|
lodash.isError = isError;
|
|
lodash.isFinite = isFinite;
|
|
lodash.isFunction = isFunction;
|
|
lodash.isInteger = isInteger;
|
|
lodash.isLength = isLength;
|
|
lodash.isMap = isMap;
|
|
lodash.isMatch = isMatch;
|
|
lodash.isMatchWith = isMatchWith;
|
|
lodash.isNaN = isNaN;
|
|
lodash.isNative = isNative;
|
|
lodash.isNil = isNil;
|
|
lodash.isNull = isNull;
|
|
lodash.isNumber = isNumber;
|
|
lodash.isObject = isObject;
|
|
lodash.isObjectLike = isObjectLike;
|
|
lodash.isPlainObject = isPlainObject;
|
|
lodash.isRegExp = isRegExp;
|
|
lodash.isSafeInteger = isSafeInteger;
|
|
lodash.isSet = isSet;
|
|
lodash.isString = isString;
|
|
lodash.isSymbol = isSymbol;
|
|
lodash.isTypedArray = isTypedArray;
|
|
lodash.isUndefined = isUndefined;
|
|
lodash.isWeakMap = isWeakMap;
|
|
lodash.isWeakSet = isWeakSet;
|
|
lodash.join = join;
|
|
lodash.kebabCase = kebabCase;
|
|
lodash.last = last;
|
|
lodash.lastIndexOf = lastIndexOf;
|
|
lodash.lowerCase = lowerCase;
|
|
lodash.lowerFirst = lowerFirst;
|
|
lodash.lt = lt;
|
|
lodash.lte = lte;
|
|
lodash.max = max;
|
|
lodash.maxBy = maxBy;
|
|
lodash.mean = mean;
|
|
lodash.meanBy = meanBy;
|
|
lodash.min = min;
|
|
lodash.minBy = minBy;
|
|
lodash.stubArray = stubArray;
|
|
lodash.stubFalse = stubFalse;
|
|
lodash.stubObject = stubObject;
|
|
lodash.stubString = stubString;
|
|
lodash.stubTrue = stubTrue;
|
|
lodash.multiply = multiply;
|
|
lodash.nth = nth;
|
|
lodash.noConflict = noConflict;
|
|
lodash.noop = noop;
|
|
lodash.now = now;
|
|
lodash.pad = pad;
|
|
lodash.padEnd = padEnd;
|
|
lodash.padStart = padStart;
|
|
lodash.parseInt = parseInt;
|
|
lodash.random = random;
|
|
lodash.reduce = reduce;
|
|
lodash.reduceRight = reduceRight;
|
|
lodash.repeat = repeat;
|
|
lodash.replace = replace;
|
|
lodash.result = result;
|
|
lodash.round = round;
|
|
lodash.runInContext = runInContext;
|
|
lodash.sample = sample;
|
|
lodash.size = size;
|
|
lodash.snakeCase = snakeCase;
|
|
lodash.some = some;
|
|
lodash.sortedIndex = sortedIndex;
|
|
lodash.sortedIndexBy = sortedIndexBy;
|
|
lodash.sortedIndexOf = sortedIndexOf;
|
|
lodash.sortedLastIndex = sortedLastIndex;
|
|
lodash.sortedLastIndexBy = sortedLastIndexBy;
|
|
lodash.sortedLastIndexOf = sortedLastIndexOf;
|
|
lodash.startCase = startCase;
|
|
lodash.startsWith = startsWith;
|
|
lodash.subtract = subtract;
|
|
lodash.sum = sum;
|
|
lodash.sumBy = sumBy;
|
|
lodash.template = template;
|
|
lodash.times = times;
|
|
lodash.toFinite = toFinite;
|
|
lodash.toInteger = toInteger;
|
|
lodash.toLength = toLength;
|
|
lodash.toLower = toLower;
|
|
lodash.toNumber = toNumber;
|
|
lodash.toSafeInteger = toSafeInteger;
|
|
lodash.toString = toString;
|
|
lodash.toUpper = toUpper;
|
|
lodash.trim = trim;
|
|
lodash.trimEnd = trimEnd;
|
|
lodash.trimStart = trimStart;
|
|
lodash.truncate = truncate;
|
|
lodash.unescape = unescape;
|
|
lodash.uniqueId = uniqueId;
|
|
lodash.upperCase = upperCase;
|
|
lodash.upperFirst = upperFirst;
|
|
|
|
// Add aliases.
|
|
lodash.each = forEach;
|
|
lodash.eachRight = forEachRight;
|
|
lodash.first = head;
|
|
|
|
mixin(lodash, (function() {
|
|
var source = {};
|
|
baseForOwn(lodash, function(func, methodName) {
|
|
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
|
|
source[methodName] = func;
|
|
}
|
|
});
|
|
return source;
|
|
}()), { 'chain': false });
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* The semantic version number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @type {string}
|
|
*/
|
|
lodash.VERSION = VERSION;
|
|
|
|
// Assign default placeholders.
|
|
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
|
|
lodash[methodName].placeholder = lodash;
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
|
arrayEach(['drop', 'take'], function(methodName, index) {
|
|
LazyWrapper.prototype[methodName] = function(n) {
|
|
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
|
|
|
|
var result = (this.__filtered__ && !index)
|
|
? new LazyWrapper(this)
|
|
: this.clone();
|
|
|
|
if (result.__filtered__) {
|
|
result.__takeCount__ = nativeMin(n, result.__takeCount__);
|
|
} else {
|
|
result.__views__.push({
|
|
'size': nativeMin(n, MAX_ARRAY_LENGTH),
|
|
'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
|
|
});
|
|
}
|
|
return result;
|
|
};
|
|
|
|
LazyWrapper.prototype[methodName + 'Right'] = function(n) {
|
|
return this.reverse()[methodName](n).reverse();
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
|
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
|
var type = index + 1,
|
|
isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
|
|
|
|
LazyWrapper.prototype[methodName] = function(iteratee) {
|
|
var result = this.clone();
|
|
result.__iteratees__.push({
|
|
'iteratee': getIteratee(iteratee, 3),
|
|
'type': type
|
|
});
|
|
result.__filtered__ = result.__filtered__ || isFilter;
|
|
return result;
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.head` and `_.last`.
|
|
arrayEach(['head', 'last'], function(methodName, index) {
|
|
var takeName = 'take' + (index ? 'Right' : '');
|
|
|
|
LazyWrapper.prototype[methodName] = function() {
|
|
return this[takeName](1).value()[0];
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
|
|
arrayEach(['initial', 'tail'], function(methodName, index) {
|
|
var dropName = 'drop' + (index ? '' : 'Right');
|
|
|
|
LazyWrapper.prototype[methodName] = function() {
|
|
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
|
|
};
|
|
});
|
|
|
|
LazyWrapper.prototype.compact = function() {
|
|
return this.filter(identity);
|
|
};
|
|
|
|
LazyWrapper.prototype.find = function(predicate) {
|
|
return this.filter(predicate).head();
|
|
};
|
|
|
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
return this.reverse().find(predicate);
|
|
};
|
|
|
|
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
|
|
if (typeof path == 'function') {
|
|
return new LazyWrapper(this);
|
|
}
|
|
return this.map(function(value) {
|
|
return baseInvoke(value, path, args);
|
|
});
|
|
});
|
|
|
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
return this.filter(negate(getIteratee(predicate)));
|
|
};
|
|
|
|
LazyWrapper.prototype.slice = function(start, end) {
|
|
start = toInteger(start);
|
|
|
|
var result = this;
|
|
if (result.__filtered__ && (start > 0 || end < 0)) {
|
|
return new LazyWrapper(result);
|
|
}
|
|
if (start < 0) {
|
|
result = result.takeRight(-start);
|
|
} else if (start) {
|
|
result = result.drop(start);
|
|
}
|
|
if (end !== undefined) {
|
|
end = toInteger(end);
|
|
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
LazyWrapper.prototype.takeRightWhile = function(predicate) {
|
|
return this.reverse().takeWhile(predicate).reverse();
|
|
};
|
|
|
|
LazyWrapper.prototype.toArray = function() {
|
|
return this.take(MAX_ARRAY_LENGTH);
|
|
};
|
|
|
|
// Add `LazyWrapper` methods to `lodash.prototype`.
|
|
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
|
isTaker = /^(?:head|last)$/.test(methodName),
|
|
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
|
|
retUnwrapped = isTaker || /^find/.test(methodName);
|
|
|
|
if (!lodashFunc) {
|
|
return;
|
|
}
|
|
lodash.prototype[methodName] = function() {
|
|
var value = this.__wrapped__,
|
|
args = isTaker ? [1] : arguments,
|
|
isLazy = value instanceof LazyWrapper,
|
|
iteratee = args[0],
|
|
useLazy = isLazy || isArray(value);
|
|
|
|
var interceptor = function(value) {
|
|
var result = lodashFunc.apply(lodash, arrayPush([value], args));
|
|
return (isTaker && chainAll) ? result[0] : result;
|
|
};
|
|
|
|
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
|
|
// Avoid lazy use if the iteratee has a "length" value other than `1`.
|
|
isLazy = useLazy = false;
|
|
}
|
|
var chainAll = this.__chain__,
|
|
isHybrid = !!this.__actions__.length,
|
|
isUnwrapped = retUnwrapped && !chainAll,
|
|
onlyLazy = isLazy && !isHybrid;
|
|
|
|
if (!retUnwrapped && useLazy) {
|
|
value = onlyLazy ? value : new LazyWrapper(this);
|
|
var result = func.apply(value, args);
|
|
result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
|
|
return new LodashWrapper(result, chainAll);
|
|
}
|
|
if (isUnwrapped && onlyLazy) {
|
|
return func.apply(this, args);
|
|
}
|
|
result = this.thru(interceptor);
|
|
return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
|
|
};
|
|
});
|
|
|
|
// Add `Array` methods to `lodash.prototype`.
|
|
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
|
var func = arrayProto[methodName],
|
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
|
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
|
|
|
lodash.prototype[methodName] = function() {
|
|
var args = arguments;
|
|
if (retUnwrapped && !this.__chain__) {
|
|
var value = this.value();
|
|
return func.apply(isArray(value) ? value : [], args);
|
|
}
|
|
return this[chainName](function(value) {
|
|
return func.apply(isArray(value) ? value : [], args);
|
|
});
|
|
};
|
|
});
|
|
|
|
// Map minified method names to their real names.
|
|
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
var lodashFunc = lodash[methodName];
|
|
if (lodashFunc) {
|
|
var key = lodashFunc.name + '';
|
|
if (!hasOwnProperty.call(realNames, key)) {
|
|
realNames[key] = [];
|
|
}
|
|
realNames[key].push({ 'name': methodName, 'func': lodashFunc });
|
|
}
|
|
});
|
|
|
|
realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
|
|
'name': 'wrapper',
|
|
'func': undefined
|
|
}];
|
|
|
|
// Add methods to `LazyWrapper`.
|
|
LazyWrapper.prototype.clone = lazyClone;
|
|
LazyWrapper.prototype.reverse = lazyReverse;
|
|
LazyWrapper.prototype.value = lazyValue;
|
|
|
|
// Add chain sequence methods to the `lodash` wrapper.
|
|
lodash.prototype.at = wrapperAt;
|
|
lodash.prototype.chain = wrapperChain;
|
|
lodash.prototype.commit = wrapperCommit;
|
|
lodash.prototype.next = wrapperNext;
|
|
lodash.prototype.plant = wrapperPlant;
|
|
lodash.prototype.reverse = wrapperReverse;
|
|
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
|
|
|
|
// Add lazy aliases.
|
|
lodash.prototype.first = lodash.prototype.head;
|
|
|
|
if (symIterator) {
|
|
lodash.prototype[symIterator] = wrapperToIterator;
|
|
}
|
|
return lodash;
|
|
});
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
// Export lodash.
|
|
var _ = runInContext();
|
|
|
|
// Some AMD build optimizers, like r.js, check for condition patterns like:
|
|
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
|
// Expose Lodash on the global object to prevent errors when Lodash is
|
|
// loaded by a script tag in the presence of an AMD loader.
|
|
// See http://requirejs.org/docs/errors.html#mismatch for more details.
|
|
// Use `_.noConflict` to remove Lodash from the global object.
|
|
root._ = _;
|
|
|
|
// Define as an anonymous module so, through path mapping, it can be
|
|
// referenced as the "underscore" module.
|
|
define(function() {
|
|
return _;
|
|
});
|
|
}
|
|
// Check for `exports` after `define` in case a build optimizer adds it.
|
|
else if (freeModule) {
|
|
// Export for Node.js.
|
|
(freeModule.exports = _)._ = _;
|
|
// Export for CommonJS support.
|
|
freeExports._ = _;
|
|
}
|
|
else {
|
|
// Export to the global object.
|
|
root._ = _;
|
|
}
|
|
}.call(this));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7426:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
/*!
|
|
* mime-db
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
* MIT Licensed
|
|
*/
|
|
|
|
/**
|
|
* Module exports.
|
|
*/
|
|
|
|
module.exports = __nccwpck_require__(3765)
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3583:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
/*!
|
|
* mime-types
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
* MIT Licensed
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Module dependencies.
|
|
* @private
|
|
*/
|
|
|
|
var db = __nccwpck_require__(7426)
|
|
var extname = (__nccwpck_require__(1017).extname)
|
|
|
|
/**
|
|
* Module variables.
|
|
* @private
|
|
*/
|
|
|
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
|
|
var TEXT_TYPE_REGEXP = /^text\//i
|
|
|
|
/**
|
|
* Module exports.
|
|
* @public
|
|
*/
|
|
|
|
exports.charset = charset
|
|
exports.charsets = { lookup: charset }
|
|
exports.contentType = contentType
|
|
exports.extension = extension
|
|
exports.extensions = Object.create(null)
|
|
exports.lookup = lookup
|
|
exports.types = Object.create(null)
|
|
|
|
// Populate the extensions/types maps
|
|
populateMaps(exports.extensions, exports.types)
|
|
|
|
/**
|
|
* Get the default charset for a MIME type.
|
|
*
|
|
* @param {string} type
|
|
* @return {boolean|string}
|
|
*/
|
|
|
|
function charset (type) {
|
|
if (!type || typeof type !== 'string') {
|
|
return false
|
|
}
|
|
|
|
// TODO: use media-typer
|
|
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
|
var mime = match && db[match[1].toLowerCase()]
|
|
|
|
if (mime && mime.charset) {
|
|
return mime.charset
|
|
}
|
|
|
|
// default text/* to utf-8
|
|
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
return 'UTF-8'
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
/**
|
|
* Create a full Content-Type header given a MIME type or extension.
|
|
*
|
|
* @param {string} str
|
|
* @return {boolean|string}
|
|
*/
|
|
|
|
function contentType (str) {
|
|
// TODO: should this even be in this module?
|
|
if (!str || typeof str !== 'string') {
|
|
return false
|
|
}
|
|
|
|
var mime = str.indexOf('/') === -1
|
|
? exports.lookup(str)
|
|
: str
|
|
|
|
if (!mime) {
|
|
return false
|
|
}
|
|
|
|
// TODO: use content-type or other module
|
|
if (mime.indexOf('charset') === -1) {
|
|
var charset = exports.charset(mime)
|
|
if (charset) mime += '; charset=' + charset.toLowerCase()
|
|
}
|
|
|
|
return mime
|
|
}
|
|
|
|
/**
|
|
* Get the default extension for a MIME type.
|
|
*
|
|
* @param {string} type
|
|
* @return {boolean|string}
|
|
*/
|
|
|
|
function extension (type) {
|
|
if (!type || typeof type !== 'string') {
|
|
return false
|
|
}
|
|
|
|
// TODO: use media-typer
|
|
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
|
|
|
// get extensions
|
|
var exts = match && exports.extensions[match[1].toLowerCase()]
|
|
|
|
if (!exts || !exts.length) {
|
|
return false
|
|
}
|
|
|
|
return exts[0]
|
|
}
|
|
|
|
/**
|
|
* Lookup the MIME type for a file path/extension.
|
|
*
|
|
* @param {string} path
|
|
* @return {boolean|string}
|
|
*/
|
|
|
|
function lookup (path) {
|
|
if (!path || typeof path !== 'string') {
|
|
return false
|
|
}
|
|
|
|
// get the extension ("ext" or ".ext" or full path)
|
|
var extension = extname('x.' + path)
|
|
.toLowerCase()
|
|
.substr(1)
|
|
|
|
if (!extension) {
|
|
return false
|
|
}
|
|
|
|
return exports.types[extension] || false
|
|
}
|
|
|
|
/**
|
|
* Populate the extensions and types maps.
|
|
* @private
|
|
*/
|
|
|
|
function populateMaps (extensions, types) {
|
|
// source preference (least -> most)
|
|
var preference = ['nginx', 'apache', undefined, 'iana']
|
|
|
|
Object.keys(db).forEach(function forEachMimeType (type) {
|
|
var mime = db[type]
|
|
var exts = mime.extensions
|
|
|
|
if (!exts || !exts.length) {
|
|
return
|
|
}
|
|
|
|
// mime -> extensions
|
|
extensions[type] = exts
|
|
|
|
// extension -> mime
|
|
for (var i = 0; i < exts.length; i++) {
|
|
var extension = exts[i]
|
|
|
|
if (types[extension]) {
|
|
var from = preference.indexOf(db[types[extension]].source)
|
|
var to = preference.indexOf(mime.source)
|
|
|
|
if (types[extension] !== 'application/octet-stream' &&
|
|
(from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
|
|
// skip the remapping
|
|
continue
|
|
}
|
|
}
|
|
|
|
// set the extension -> mime
|
|
types[extension] = type
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3973:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
module.exports = minimatch
|
|
minimatch.Minimatch = Minimatch
|
|
|
|
var path = (function () { try { return __nccwpck_require__(1017) } catch (e) {}}()) || {
|
|
sep: '/'
|
|
}
|
|
minimatch.sep = path.sep
|
|
|
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
|
var expand = __nccwpck_require__(3717)
|
|
|
|
var plTypes = {
|
|
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
|
'?': { open: '(?:', close: ')?' },
|
|
'+': { open: '(?:', close: ')+' },
|
|
'*': { open: '(?:', close: ')*' },
|
|
'@': { open: '(?:', close: ')' }
|
|
}
|
|
|
|
// any single thing other than /
|
|
// don't need to escape / when using new RegExp()
|
|
var qmark = '[^/]'
|
|
|
|
// * => any number of characters
|
|
var star = qmark + '*?'
|
|
|
|
// ** when dots are allowed. Anything goes, except .. and .
|
|
// not (^ or / followed by one or two dots followed by $ or /),
|
|
// followed by anything, any number of times.
|
|
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
|
|
|
// not a ^ or / followed by a dot,
|
|
// followed by anything, any number of times.
|
|
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
|
|
|
// characters that need to be escaped in RegExp.
|
|
var reSpecials = charSet('().*{}+?[]^$\\!')
|
|
|
|
// "abc" -> { a:true, b:true, c:true }
|
|
function charSet (s) {
|
|
return s.split('').reduce(function (set, c) {
|
|
set[c] = true
|
|
return set
|
|
}, {})
|
|
}
|
|
|
|
// normalizes slashes.
|
|
var slashSplit = /\/+/
|
|
|
|
minimatch.filter = filter
|
|
function filter (pattern, options) {
|
|
options = options || {}
|
|
return function (p, i, list) {
|
|
return minimatch(p, pattern, options)
|
|
}
|
|
}
|
|
|
|
function ext (a, b) {
|
|
b = b || {}
|
|
var t = {}
|
|
Object.keys(a).forEach(function (k) {
|
|
t[k] = a[k]
|
|
})
|
|
Object.keys(b).forEach(function (k) {
|
|
t[k] = b[k]
|
|
})
|
|
return t
|
|
}
|
|
|
|
minimatch.defaults = function (def) {
|
|
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
|
return minimatch
|
|
}
|
|
|
|
var orig = minimatch
|
|
|
|
var m = function minimatch (p, pattern, options) {
|
|
return orig(p, pattern, ext(def, options))
|
|
}
|
|
|
|
m.Minimatch = function Minimatch (pattern, options) {
|
|
return new orig.Minimatch(pattern, ext(def, options))
|
|
}
|
|
m.Minimatch.defaults = function defaults (options) {
|
|
return orig.defaults(ext(def, options)).Minimatch
|
|
}
|
|
|
|
m.filter = function filter (pattern, options) {
|
|
return orig.filter(pattern, ext(def, options))
|
|
}
|
|
|
|
m.defaults = function defaults (options) {
|
|
return orig.defaults(ext(def, options))
|
|
}
|
|
|
|
m.makeRe = function makeRe (pattern, options) {
|
|
return orig.makeRe(pattern, ext(def, options))
|
|
}
|
|
|
|
m.braceExpand = function braceExpand (pattern, options) {
|
|
return orig.braceExpand(pattern, ext(def, options))
|
|
}
|
|
|
|
m.match = function (list, pattern, options) {
|
|
return orig.match(list, pattern, ext(def, options))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
Minimatch.defaults = function (def) {
|
|
return minimatch.defaults(def).Minimatch
|
|
}
|
|
|
|
function minimatch (p, pattern, options) {
|
|
assertValidPattern(pattern)
|
|
|
|
if (!options) options = {}
|
|
|
|
// shortcut: comments match nothing.
|
|
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
return false
|
|
}
|
|
|
|
return new Minimatch(pattern, options).match(p)
|
|
}
|
|
|
|
function Minimatch (pattern, options) {
|
|
if (!(this instanceof Minimatch)) {
|
|
return new Minimatch(pattern, options)
|
|
}
|
|
|
|
assertValidPattern(pattern)
|
|
|
|
if (!options) options = {}
|
|
|
|
pattern = pattern.trim()
|
|
|
|
// windows support: need to use /, not \
|
|
if (!options.allowWindowsEscape && path.sep !== '/') {
|
|
pattern = pattern.split(path.sep).join('/')
|
|
}
|
|
|
|
this.options = options
|
|
this.set = []
|
|
this.pattern = pattern
|
|
this.regexp = null
|
|
this.negate = false
|
|
this.comment = false
|
|
this.empty = false
|
|
this.partial = !!options.partial
|
|
|
|
// make the set of regexps etc.
|
|
this.make()
|
|
}
|
|
|
|
Minimatch.prototype.debug = function () {}
|
|
|
|
Minimatch.prototype.make = make
|
|
function make () {
|
|
var pattern = this.pattern
|
|
var options = this.options
|
|
|
|
// empty patterns and comments match nothing.
|
|
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
this.comment = true
|
|
return
|
|
}
|
|
if (!pattern) {
|
|
this.empty = true
|
|
return
|
|
}
|
|
|
|
// step 1: figure out negation, etc.
|
|
this.parseNegate()
|
|
|
|
// step 2: expand braces
|
|
var set = this.globSet = this.braceExpand()
|
|
|
|
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
|
|
|
|
this.debug(this.pattern, set)
|
|
|
|
// step 3: now we have a set, so turn each one into a series of path-portion
|
|
// matching patterns.
|
|
// These will be regexps, except in the case of "**", which is
|
|
// set to the GLOBSTAR object for globstar behavior,
|
|
// and will not contain any / characters
|
|
set = this.globParts = set.map(function (s) {
|
|
return s.split(slashSplit)
|
|
})
|
|
|
|
this.debug(this.pattern, set)
|
|
|
|
// glob --> regexps
|
|
set = set.map(function (s, si, set) {
|
|
return s.map(this.parse, this)
|
|
}, this)
|
|
|
|
this.debug(this.pattern, set)
|
|
|
|
// filter out everything that didn't compile properly.
|
|
set = set.filter(function (s) {
|
|
return s.indexOf(false) === -1
|
|
})
|
|
|
|
this.debug(this.pattern, set)
|
|
|
|
this.set = set
|
|
}
|
|
|
|
Minimatch.prototype.parseNegate = parseNegate
|
|
function parseNegate () {
|
|
var pattern = this.pattern
|
|
var negate = false
|
|
var options = this.options
|
|
var negateOffset = 0
|
|
|
|
if (options.nonegate) return
|
|
|
|
for (var i = 0, l = pattern.length
|
|
; i < l && pattern.charAt(i) === '!'
|
|
; i++) {
|
|
negate = !negate
|
|
negateOffset++
|
|
}
|
|
|
|
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
|
this.negate = negate
|
|
}
|
|
|
|
// Brace expansion:
|
|
// a{b,c}d -> abd acd
|
|
// a{b,}c -> abc ac
|
|
// a{0..3}d -> a0d a1d a2d a3d
|
|
// a{b,c{d,e}f}g -> abg acdfg acefg
|
|
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
|
//
|
|
// Invalid sets are not expanded.
|
|
// a{2..}b -> a{2..}b
|
|
// a{b}c -> a{b}c
|
|
minimatch.braceExpand = function (pattern, options) {
|
|
return braceExpand(pattern, options)
|
|
}
|
|
|
|
Minimatch.prototype.braceExpand = braceExpand
|
|
|
|
function braceExpand (pattern, options) {
|
|
if (!options) {
|
|
if (this instanceof Minimatch) {
|
|
options = this.options
|
|
} else {
|
|
options = {}
|
|
}
|
|
}
|
|
|
|
pattern = typeof pattern === 'undefined'
|
|
? this.pattern : pattern
|
|
|
|
assertValidPattern(pattern)
|
|
|
|
// Thanks to Yeting Li <https://github.com/yetingli> for
|
|
// improving this regexp to avoid a ReDOS vulnerability.
|
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
// shortcut. no need to expand.
|
|
return [pattern]
|
|
}
|
|
|
|
return expand(pattern)
|
|
}
|
|
|
|
var MAX_PATTERN_LENGTH = 1024 * 64
|
|
var assertValidPattern = function (pattern) {
|
|
if (typeof pattern !== 'string') {
|
|
throw new TypeError('invalid pattern')
|
|
}
|
|
|
|
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
throw new TypeError('pattern is too long')
|
|
}
|
|
}
|
|
|
|
// parse a component of the expanded set.
|
|
// At this point, no pattern may contain "/" in it
|
|
// so we're going to return a 2d array, where each entry is the full
|
|
// pattern, split on '/', and then turned into a regular expression.
|
|
// A regexp is made at the end which joins each array with an
|
|
// escaped /, and another full one which joins each regexp with |.
|
|
//
|
|
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
|
// when it is the *only* thing in a path portion. Otherwise, any series
|
|
// of * is equivalent to a single *. Globstar behavior is enabled by
|
|
// default, and can be disabled by setting options.noglobstar.
|
|
Minimatch.prototype.parse = parse
|
|
var SUBPARSE = {}
|
|
function parse (pattern, isSub) {
|
|
assertValidPattern(pattern)
|
|
|
|
var options = this.options
|
|
|
|
// shortcuts
|
|
if (pattern === '**') {
|
|
if (!options.noglobstar)
|
|
return GLOBSTAR
|
|
else
|
|
pattern = '*'
|
|
}
|
|
if (pattern === '') return ''
|
|
|
|
var re = ''
|
|
var hasMagic = !!options.nocase
|
|
var escaping = false
|
|
// ? => one single character
|
|
var patternListStack = []
|
|
var negativeLists = []
|
|
var stateChar
|
|
var inClass = false
|
|
var reClassStart = -1
|
|
var classStart = -1
|
|
// . and .. never match anything that doesn't start with .,
|
|
// even when options.dot is set.
|
|
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
|
// not (start or / followed by . or .. followed by / or end)
|
|
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
|
: '(?!\\.)'
|
|
var self = this
|
|
|
|
function clearStateChar () {
|
|
if (stateChar) {
|
|
// we had some state-tracking character
|
|
// that wasn't consumed by this pass.
|
|
switch (stateChar) {
|
|
case '*':
|
|
re += star
|
|
hasMagic = true
|
|
break
|
|
case '?':
|
|
re += qmark
|
|
hasMagic = true
|
|
break
|
|
default:
|
|
re += '\\' + stateChar
|
|
break
|
|
}
|
|
self.debug('clearStateChar %j %j', stateChar, re)
|
|
stateChar = false
|
|
}
|
|
}
|
|
|
|
for (var i = 0, len = pattern.length, c
|
|
; (i < len) && (c = pattern.charAt(i))
|
|
; i++) {
|
|
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
|
|
|
// skip over any that are escaped.
|
|
if (escaping && reSpecials[c]) {
|
|
re += '\\' + c
|
|
escaping = false
|
|
continue
|
|
}
|
|
|
|
switch (c) {
|
|
/* istanbul ignore next */
|
|
case '/': {
|
|
// completely not allowed, even escaped.
|
|
// Should already be path-split by now.
|
|
return false
|
|
}
|
|
|
|
case '\\':
|
|
clearStateChar()
|
|
escaping = true
|
|
continue
|
|
|
|
// the various stateChar values
|
|
// for the "extglob" stuff.
|
|
case '?':
|
|
case '*':
|
|
case '+':
|
|
case '@':
|
|
case '!':
|
|
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
|
|
|
// all of those are literals inside a class, except that
|
|
// the glob [!a] means [^a] in regexp
|
|
if (inClass) {
|
|
this.debug(' in class')
|
|
if (c === '!' && i === classStart + 1) c = '^'
|
|
re += c
|
|
continue
|
|
}
|
|
|
|
// if we already have a stateChar, then it means
|
|
// that there was something like ** or +? in there.
|
|
// Handle the stateChar, then proceed with this one.
|
|
self.debug('call clearStateChar %j', stateChar)
|
|
clearStateChar()
|
|
stateChar = c
|
|
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
// just clear the statechar *now*, rather than even diving into
|
|
// the patternList stuff.
|
|
if (options.noext) clearStateChar()
|
|
continue
|
|
|
|
case '(':
|
|
if (inClass) {
|
|
re += '('
|
|
continue
|
|
}
|
|
|
|
if (!stateChar) {
|
|
re += '\\('
|
|
continue
|
|
}
|
|
|
|
patternListStack.push({
|
|
type: stateChar,
|
|
start: i - 1,
|
|
reStart: re.length,
|
|
open: plTypes[stateChar].open,
|
|
close: plTypes[stateChar].close
|
|
})
|
|
// negation is (?:(?!js)[^/]*)
|
|
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
|
this.debug('plType %j %j', stateChar, re)
|
|
stateChar = false
|
|
continue
|
|
|
|
case ')':
|
|
if (inClass || !patternListStack.length) {
|
|
re += '\\)'
|
|
continue
|
|
}
|
|
|
|
clearStateChar()
|
|
hasMagic = true
|
|
var pl = patternListStack.pop()
|
|
// negation is (?:(?!js)[^/]*)
|
|
// The others are (?:<pattern>)<type>
|
|
re += pl.close
|
|
if (pl.type === '!') {
|
|
negativeLists.push(pl)
|
|
}
|
|
pl.reEnd = re.length
|
|
continue
|
|
|
|
case '|':
|
|
if (inClass || !patternListStack.length || escaping) {
|
|
re += '\\|'
|
|
escaping = false
|
|
continue
|
|
}
|
|
|
|
clearStateChar()
|
|
re += '|'
|
|
continue
|
|
|
|
// these are mostly the same in regexp and glob
|
|
case '[':
|
|
// swallow any state-tracking char before the [
|
|
clearStateChar()
|
|
|
|
if (inClass) {
|
|
re += '\\' + c
|
|
continue
|
|
}
|
|
|
|
inClass = true
|
|
classStart = i
|
|
reClassStart = re.length
|
|
re += c
|
|
continue
|
|
|
|
case ']':
|
|
// a right bracket shall lose its special
|
|
// meaning and represent itself in
|
|
// a bracket expression if it occurs
|
|
// first in the list. -- POSIX.2 2.8.3.2
|
|
if (i === classStart + 1 || !inClass) {
|
|
re += '\\' + c
|
|
escaping = false
|
|
continue
|
|
}
|
|
|
|
// handle the case where we left a class open.
|
|
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
|
// split where the last [ was, make sure we don't have
|
|
// an invalid re. if so, re-walk the contents of the
|
|
// would-be class to re-translate any characters that
|
|
// were passed through as-is
|
|
// TODO: It would probably be faster to determine this
|
|
// without a try/catch and a new RegExp, but it's tricky
|
|
// to do safely. For now, this is safe and works.
|
|
var cs = pattern.substring(classStart + 1, i)
|
|
try {
|
|
RegExp('[' + cs + ']')
|
|
} catch (er) {
|
|
// not a valid class!
|
|
var sp = this.parse(cs, SUBPARSE)
|
|
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
|
hasMagic = hasMagic || sp[1]
|
|
inClass = false
|
|
continue
|
|
}
|
|
|
|
// finish up the class.
|
|
hasMagic = true
|
|
inClass = false
|
|
re += c
|
|
continue
|
|
|
|
default:
|
|
// swallow any state char that wasn't consumed
|
|
clearStateChar()
|
|
|
|
if (escaping) {
|
|
// no need
|
|
escaping = false
|
|
} else if (reSpecials[c]
|
|
&& !(c === '^' && inClass)) {
|
|
re += '\\'
|
|
}
|
|
|
|
re += c
|
|
|
|
} // switch
|
|
} // for
|
|
|
|
// handle the case where we left a class open.
|
|
// "[abc" is valid, equivalent to "\[abc"
|
|
if (inClass) {
|
|
// split where the last [ was, and escape it
|
|
// this is a huge pita. We now have to re-walk
|
|
// the contents of the would-be class to re-translate
|
|
// any characters that were passed through as-is
|
|
cs = pattern.substr(classStart + 1)
|
|
sp = this.parse(cs, SUBPARSE)
|
|
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
|
hasMagic = hasMagic || sp[1]
|
|
}
|
|
|
|
// handle the case where we had a +( thing at the *end*
|
|
// of the pattern.
|
|
// each pattern list stack adds 3 chars, and we need to go through
|
|
// and escape any | chars that were passed through as-is for the regexp.
|
|
// Go through and escape them, taking care not to double-escape any
|
|
// | chars that were already escaped.
|
|
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
var tail = re.slice(pl.reStart + pl.open.length)
|
|
this.debug('setting tail', re, pl)
|
|
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
|
if (!$2) {
|
|
// the | isn't already escaped, so escape it.
|
|
$2 = '\\'
|
|
}
|
|
|
|
// need to escape all those slashes *again*, without escaping the
|
|
// one that we need for escaping the | character. As it works out,
|
|
// escaping an even number of slashes can be done by simply repeating
|
|
// it exactly after itself. That's why this trick works.
|
|
//
|
|
// I am sorry that you have to see this.
|
|
return $1 + $1 + $2 + '|'
|
|
})
|
|
|
|
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
|
var t = pl.type === '*' ? star
|
|
: pl.type === '?' ? qmark
|
|
: '\\' + pl.type
|
|
|
|
hasMagic = true
|
|
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
|
}
|
|
|
|
// handle trailing things that only matter at the very end.
|
|
clearStateChar()
|
|
if (escaping) {
|
|
// trailing \\
|
|
re += '\\\\'
|
|
}
|
|
|
|
// only need to apply the nodot start if the re starts with
|
|
// something that could conceivably capture a dot
|
|
var addPatternStart = false
|
|
switch (re.charAt(0)) {
|
|
case '[': case '.': case '(': addPatternStart = true
|
|
}
|
|
|
|
// Hack to work around lack of negative lookbehind in JS
|
|
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
|
// like 'a.xyz.yz' doesn't match. So, the first negative
|
|
// lookahead, has to look ALL the way ahead, to the end of
|
|
// the pattern.
|
|
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
var nl = negativeLists[n]
|
|
|
|
var nlBefore = re.slice(0, nl.reStart)
|
|
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
|
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
|
|
var nlAfter = re.slice(nl.reEnd)
|
|
|
|
nlLast += nlAfter
|
|
|
|
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
// mean that we should *not* include the ) in the bit that is considered
|
|
// "after" the negated section.
|
|
var openParensBefore = nlBefore.split('(').length - 1
|
|
var cleanAfter = nlAfter
|
|
for (i = 0; i < openParensBefore; i++) {
|
|
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
|
}
|
|
nlAfter = cleanAfter
|
|
|
|
var dollar = ''
|
|
if (nlAfter === '' && isSub !== SUBPARSE) {
|
|
dollar = '$'
|
|
}
|
|
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
|
re = newRe
|
|
}
|
|
|
|
// if the re is not "" at this point, then we need to make sure
|
|
// it doesn't match against an empty path part.
|
|
// Otherwise a/* will match a/, which it should not.
|
|
if (re !== '' && hasMagic) {
|
|
re = '(?=.)' + re
|
|
}
|
|
|
|
if (addPatternStart) {
|
|
re = patternStart + re
|
|
}
|
|
|
|
// parsing just a piece of a larger pattern.
|
|
if (isSub === SUBPARSE) {
|
|
return [re, hasMagic]
|
|
}
|
|
|
|
// skip the regexp for non-magical patterns
|
|
// unescape anything in it, though, so that it'll be
|
|
// an exact match against a file etc.
|
|
if (!hasMagic) {
|
|
return globUnescape(pattern)
|
|
}
|
|
|
|
var flags = options.nocase ? 'i' : ''
|
|
try {
|
|
var regExp = new RegExp('^' + re + '$', flags)
|
|
} catch (er) /* istanbul ignore next - should be impossible */ {
|
|
// If it was an invalid regular expression, then it can't match
|
|
// anything. This trick looks for a character after the end of
|
|
// the string, which is of course impossible, except in multi-line
|
|
// mode, but it's not a /m regex.
|
|
return new RegExp('$.')
|
|
}
|
|
|
|
regExp._glob = pattern
|
|
regExp._src = re
|
|
|
|
return regExp
|
|
}
|
|
|
|
minimatch.makeRe = function (pattern, options) {
|
|
return new Minimatch(pattern, options || {}).makeRe()
|
|
}
|
|
|
|
Minimatch.prototype.makeRe = makeRe
|
|
function makeRe () {
|
|
if (this.regexp || this.regexp === false) return this.regexp
|
|
|
|
// at this point, this.set is a 2d array of partial
|
|
// pattern strings, or "**".
|
|
//
|
|
// It's better to use .match(). This function shouldn't
|
|
// be used, really, but it's pretty convenient sometimes,
|
|
// when you just want to work with a regex.
|
|
var set = this.set
|
|
|
|
if (!set.length) {
|
|
this.regexp = false
|
|
return this.regexp
|
|
}
|
|
var options = this.options
|
|
|
|
var twoStar = options.noglobstar ? star
|
|
: options.dot ? twoStarDot
|
|
: twoStarNoDot
|
|
var flags = options.nocase ? 'i' : ''
|
|
|
|
var re = set.map(function (pattern) {
|
|
return pattern.map(function (p) {
|
|
return (p === GLOBSTAR) ? twoStar
|
|
: (typeof p === 'string') ? regExpEscape(p)
|
|
: p._src
|
|
}).join('\\\/')
|
|
}).join('|')
|
|
|
|
// must match entire pattern
|
|
// ending in a * or ** will make it less strict.
|
|
re = '^(?:' + re + ')$'
|
|
|
|
// can match anything, as long as it's not this.
|
|
if (this.negate) re = '^(?!' + re + ').*$'
|
|
|
|
try {
|
|
this.regexp = new RegExp(re, flags)
|
|
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
|
this.regexp = false
|
|
}
|
|
return this.regexp
|
|
}
|
|
|
|
minimatch.match = function (list, pattern, options) {
|
|
options = options || {}
|
|
var mm = new Minimatch(pattern, options)
|
|
list = list.filter(function (f) {
|
|
return mm.match(f)
|
|
})
|
|
if (mm.options.nonull && !list.length) {
|
|
list.push(pattern)
|
|
}
|
|
return list
|
|
}
|
|
|
|
Minimatch.prototype.match = function match (f, partial) {
|
|
if (typeof partial === 'undefined') partial = this.partial
|
|
this.debug('match', f, this.pattern)
|
|
// short-circuit in the case of busted things.
|
|
// comments, etc.
|
|
if (this.comment) return false
|
|
if (this.empty) return f === ''
|
|
|
|
if (f === '/' && partial) return true
|
|
|
|
var options = this.options
|
|
|
|
// windows: need to use /, not \
|
|
if (path.sep !== '/') {
|
|
f = f.split(path.sep).join('/')
|
|
}
|
|
|
|
// treat the test path as a set of pathparts.
|
|
f = f.split(slashSplit)
|
|
this.debug(this.pattern, 'split', f)
|
|
|
|
// just ONE of the pattern sets in this.set needs to match
|
|
// in order for it to be valid. If negating, then just one
|
|
// match means that we have failed.
|
|
// Either way, return on the first hit.
|
|
|
|
var set = this.set
|
|
this.debug(this.pattern, 'set', set)
|
|
|
|
// Find the basename of the path by looking for the last non-empty segment
|
|
var filename
|
|
var i
|
|
for (i = f.length - 1; i >= 0; i--) {
|
|
filename = f[i]
|
|
if (filename) break
|
|
}
|
|
|
|
for (i = 0; i < set.length; i++) {
|
|
var pattern = set[i]
|
|
var file = f
|
|
if (options.matchBase && pattern.length === 1) {
|
|
file = [filename]
|
|
}
|
|
var hit = this.matchOne(file, pattern, partial)
|
|
if (hit) {
|
|
if (options.flipNegate) return true
|
|
return !this.negate
|
|
}
|
|
}
|
|
|
|
// didn't get any hits. this is success if it's a negative
|
|
// pattern, failure otherwise.
|
|
if (options.flipNegate) return false
|
|
return this.negate
|
|
}
|
|
|
|
// set partial to true to test if, for example,
|
|
// "/a/b" matches the start of "/*/b/*/d"
|
|
// Partial means, if you run out of file before you run
|
|
// out of pattern, then that's fine, as long as all
|
|
// the parts match.
|
|
Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|
var options = this.options
|
|
|
|
this.debug('matchOne',
|
|
{ 'this': this, file: file, pattern: pattern })
|
|
|
|
this.debug('matchOne', file.length, pattern.length)
|
|
|
|
for (var fi = 0,
|
|
pi = 0,
|
|
fl = file.length,
|
|
pl = pattern.length
|
|
; (fi < fl) && (pi < pl)
|
|
; fi++, pi++) {
|
|
this.debug('matchOne loop')
|
|
var p = pattern[pi]
|
|
var f = file[fi]
|
|
|
|
this.debug(pattern, p, f)
|
|
|
|
// should be impossible.
|
|
// some invalid regexp stuff in the set.
|
|
/* istanbul ignore if */
|
|
if (p === false) return false
|
|
|
|
if (p === GLOBSTAR) {
|
|
this.debug('GLOBSTAR', [pattern, p, f])
|
|
|
|
// "**"
|
|
// a/**/b/**/c would match the following:
|
|
// a/b/x/y/z/c
|
|
// a/x/y/z/b/c
|
|
// a/b/x/b/x/c
|
|
// a/b/c
|
|
// To do this, take the rest of the pattern after
|
|
// the **, and see if it would match the file remainder.
|
|
// If so, return success.
|
|
// If not, the ** "swallows" a segment, and try again.
|
|
// This is recursively awful.
|
|
//
|
|
// a/**/b/**/c matching a/b/x/y/z/c
|
|
// - a matches a
|
|
// - doublestar
|
|
// - matchOne(b/x/y/z/c, b/**/c)
|
|
// - b matches b
|
|
// - doublestar
|
|
// - matchOne(x/y/z/c, c) -> no
|
|
// - matchOne(y/z/c, c) -> no
|
|
// - matchOne(z/c, c) -> no
|
|
// - matchOne(c, c) yes, hit
|
|
var fr = fi
|
|
var pr = pi + 1
|
|
if (pr === pl) {
|
|
this.debug('** at the end')
|
|
// a ** at the end will just swallow the rest.
|
|
// We have found a match.
|
|
// however, it will not swallow /.x, unless
|
|
// options.dot is set.
|
|
// . and .. are *never* matched by **, for explosively
|
|
// exponential reasons.
|
|
for (; fi < fl; fi++) {
|
|
if (file[fi] === '.' || file[fi] === '..' ||
|
|
(!options.dot && file[fi].charAt(0) === '.')) return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
// ok, let's see if we can swallow whatever we can.
|
|
while (fr < fl) {
|
|
var swallowee = file[fr]
|
|
|
|
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
|
|
|
// XXX remove this slice. Just pass the start index.
|
|
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
this.debug('globstar found match!', fr, fl, swallowee)
|
|
// found a match.
|
|
return true
|
|
} else {
|
|
// can't swallow "." or ".." ever.
|
|
// can only swallow ".foo" when explicitly asked.
|
|
if (swallowee === '.' || swallowee === '..' ||
|
|
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
this.debug('dot detected!', file, fr, pattern, pr)
|
|
break
|
|
}
|
|
|
|
// ** swallows a segment, and continue.
|
|
this.debug('globstar swallow a segment, and continue')
|
|
fr++
|
|
}
|
|
}
|
|
|
|
// no match was found.
|
|
// However, in partial mode, we can't say this is necessarily over.
|
|
// If there's more *pattern* left, then
|
|
/* istanbul ignore if */
|
|
if (partial) {
|
|
// ran out of file
|
|
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
|
if (fr === fl) return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// something other than **
|
|
// non-magic patterns just have to match exactly
|
|
// patterns with magic have been turned into regexps.
|
|
var hit
|
|
if (typeof p === 'string') {
|
|
hit = f === p
|
|
this.debug('string match', p, f, hit)
|
|
} else {
|
|
hit = f.match(p)
|
|
this.debug('pattern match', p, f, hit)
|
|
}
|
|
|
|
if (!hit) return false
|
|
}
|
|
|
|
// Note: ending in / means that we'll get a final ""
|
|
// at the end of the pattern. This can only match a
|
|
// corresponding "" at the end of the file.
|
|
// If the file ends in /, then it can only match a
|
|
// a pattern that ends in /, unless the pattern just
|
|
// doesn't have any more for it. But, a/b/ should *not*
|
|
// match "a/b/*", even though "" matches against the
|
|
// [^/]*? pattern, except in partial mode, where it might
|
|
// simply not be reached yet.
|
|
// However, a/b/ should still satisfy a/*
|
|
|
|
// now either we fell off the end of the pattern, or we're done.
|
|
if (fi === fl && pi === pl) {
|
|
// ran out of pattern and filename at the same time.
|
|
// an exact hit!
|
|
return true
|
|
} else if (fi === fl) {
|
|
// ran out of file, but still had pattern left.
|
|
// this is ok if we're doing the match as part of
|
|
// a glob fs traversal.
|
|
return partial
|
|
} else /* istanbul ignore else */ if (pi === pl) {
|
|
// ran out of pattern, still have file left.
|
|
// this is only acceptable if we're on the very last
|
|
// empty segment of a file with a trailing slash.
|
|
// a/* should match a/b/
|
|
return (fi === fl - 1) && (file[fi] === '')
|
|
}
|
|
|
|
// should be unreachable.
|
|
/* istanbul ignore next */
|
|
throw new Error('wtf?')
|
|
}
|
|
|
|
// replace stuff like \* with *
|
|
function globUnescape (s) {
|
|
return s.replace(/\\(.)/g, '$1')
|
|
}
|
|
|
|
function regExpEscape (s) {
|
|
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6570:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var _Credentials = __nccwpck_require__(739);
|
|
class CredentialProvider {
|
|
constructor({
|
|
accessKey,
|
|
secretKey,
|
|
sessionToken
|
|
}) {
|
|
this.credentials = new _Credentials.Credentials({
|
|
accessKey,
|
|
secretKey,
|
|
sessionToken
|
|
});
|
|
}
|
|
async getCredentials() {
|
|
return this.credentials.get();
|
|
}
|
|
setCredentials(credentials) {
|
|
if (credentials instanceof _Credentials.Credentials) {
|
|
this.credentials = credentials;
|
|
} else {
|
|
throw new Error('Unable to set Credentials. it should be an instance of Credentials class');
|
|
}
|
|
}
|
|
setAccessKey(accessKey) {
|
|
this.credentials.setAccessKey(accessKey);
|
|
}
|
|
getAccessKey() {
|
|
return this.credentials.getAccessKey();
|
|
}
|
|
setSecretKey(secretKey) {
|
|
this.credentials.setSecretKey(secretKey);
|
|
}
|
|
getSecretKey() {
|
|
return this.credentials.getSecretKey();
|
|
}
|
|
setSessionToken(sessionToken) {
|
|
this.credentials.setSessionToken(sessionToken);
|
|
}
|
|
getSessionToken() {
|
|
return this.credentials.getSessionToken();
|
|
}
|
|
}
|
|
|
|
// deprecated default export, please use named exports.
|
|
// keep for backward compatibility.
|
|
// eslint-disable-next-line import/no-default-export
|
|
exports.CredentialProvider = CredentialProvider;
|
|
var _default = CredentialProvider;
|
|
exports["default"] = _default;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfQ3JlZGVudGlhbHMiLCJyZXF1aXJlIiwiQ3JlZGVudGlhbFByb3ZpZGVyIiwiY29uc3RydWN0b3IiLCJhY2Nlc3NLZXkiLCJzZWNyZXRLZXkiLCJzZXNzaW9uVG9rZW4iLCJjcmVkZW50aWFscyIsIkNyZWRlbnRpYWxzIiwiZ2V0Q3JlZGVudGlhbHMiLCJnZXQiLCJzZXRDcmVkZW50aWFscyIsIkVycm9yIiwic2V0QWNjZXNzS2V5IiwiZ2V0QWNjZXNzS2V5Iiwic2V0U2VjcmV0S2V5IiwiZ2V0U2VjcmV0S2V5Iiwic2V0U2Vzc2lvblRva2VuIiwiZ2V0U2Vzc2lvblRva2VuIiwiZXhwb3J0cyIsIl9kZWZhdWx0IiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIkNyZWRlbnRpYWxQcm92aWRlci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDcmVkZW50aWFscyB9IGZyb20gJy4vQ3JlZGVudGlhbHMudHMnXG5cbmV4cG9ydCBjbGFzcyBDcmVkZW50aWFsUHJvdmlkZXIge1xuICBwcml2YXRlIGNyZWRlbnRpYWxzOiBDcmVkZW50aWFsc1xuXG4gIGNvbnN0cnVjdG9yKHsgYWNjZXNzS2V5LCBzZWNyZXRLZXksIHNlc3Npb25Ub2tlbiB9OiB7IGFjY2Vzc0tleTogc3RyaW5nOyBzZWNyZXRLZXk6IHN0cmluZzsgc2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SyxDQUFDLDBFQUEwRSxDQUFDO0lBQzdGO0VBQ0Y7RUFFQUMsWUFBWUEsQ0FBQ1QsU0FBaUIsRUFBRTtJQUM5QixJQUFJLENBQUNHLFdBQVcsQ0FBQ00sWUFBWSxDQUFDVCxTQUFTLENBQUM7RUFDMUM7RUFFQVUsWUFBWUEsQ0FBQSxFQUFHO0lBQ2IsT0FBTyxJQUFJLENBQUNQLFdBQVcsQ0FBQ08sWUFBWSxDQUFDLENBQUM7RUFDeEM7RUFFQUMsWUFBWUEsQ0FBQ1YsU0FBaUIsRUFBRTtJQUM5QixJQUFJLENBQUNFLFdBQVcsQ0FBQ1EsWUFBWSxDQUFDVixTQUFTLENBQUM7RUFDMUM7RUFFQVcsWUFBWUEsQ0FBQSxFQUFHO0lBQ2IsT0FBTyxJQUFJLENBQUNULFdBQVcsQ0FBQ1MsWUFBWSxDQUFDLENBQUM7RUFDeEM7RUFFQUMsZUFBZUEsQ0FBQ1gsWUFBb0IsRUFBRTtJQUNwQyxJQUFJLENBQUNDLFdBQVcsQ0FBQ1UsZUFBZSxDQUFDWCxZQUFZLENBQUM7RUFDaEQ7RUFFQVksZUFBZUEsQ0FBQSxFQUFHO0lBQ2hCLE9BQU8sSUFBSSxDQUFDWCxXQUFXLENBQUNXLGVBQWUsQ0FBQyxDQUFDO0VBQzNDO0FBQ0Y7O0FBRUE7QUFDQTtBQUNBO0FBQUFDLE9BQUEsQ0FBQWpCLGtCQUFBLEdBQUFBLGtCQUFBO0FBQUEsSUFBQWtCLFFBQUEsR0FDZWxCLGtCQUFrQjtBQUFBaUIsT0FBQSxDQUFBRSxPQUFBLEdBQUFELFFBQUEifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 739:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
class Credentials {
|
|
constructor({
|
|
accessKey,
|
|
secretKey,
|
|
sessionToken
|
|
}) {
|
|
this.accessKey = accessKey;
|
|
this.secretKey = secretKey;
|
|
this.sessionToken = sessionToken;
|
|
}
|
|
setAccessKey(accessKey) {
|
|
this.accessKey = accessKey;
|
|
}
|
|
getAccessKey() {
|
|
return this.accessKey;
|
|
}
|
|
setSecretKey(secretKey) {
|
|
this.secretKey = secretKey;
|
|
}
|
|
getSecretKey() {
|
|
return this.secretKey;
|
|
}
|
|
setSessionToken(sessionToken) {
|
|
this.sessionToken = sessionToken;
|
|
}
|
|
getSessionToken() {
|
|
return this.sessionToken;
|
|
}
|
|
get() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
// deprecated default export, please use named exports.
|
|
// keep for backward compatibility.
|
|
// eslint-disable-next-line import/no-default-export
|
|
exports.Credentials = Credentials;
|
|
var _default = Credentials;
|
|
exports["default"] = _default;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDcmVkZW50aWFscyIsImNvbnN0cnVjdG9yIiwiYWNjZXNzS2V5Iiwic2VjcmV0S2V5Iiwic2Vzc2lvblRva2VuIiwic2V0QWNjZXNzS2V5IiwiZ2V0QWNjZXNzS2V5Iiwic2V0U2VjcmV0S2V5IiwiZ2V0U2VjcmV0S2V5Iiwic2V0U2Vzc2lvblRva2VuIiwiZ2V0U2Vzc2lvblRva2VuIiwiZ2V0IiwiZXhwb3J0cyIsIl9kZWZhdWx0IiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIkNyZWRlbnRpYWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjbGFzcyBDcmVkZW50aWFscyB7XG4gIHB1YmxpYyBhY2Nlc3NLZXk6IHN0cmluZ1xuICBwdWJsaWMgc2VjcmV0S2V5OiBzdHJpbmdcbiAgcHVibGljIHNlc3Npb25Ub2tlbj86IHN0cmluZ1xuXG4gIGNvbnN0cnVjdG9yKHsgYWNjZXNzS2V5LCBzZWNyZXRLZXksIHNlc3Npb25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__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/// <reference lib="ES2022.Error" />
|
|
|
|
class ExtendableError extends Error {
|
|
constructor(message, opt) {
|
|
// error Option {cause?: unknown} is a 'nice to have',
|
|
// don't use it internally
|
|
super(message, opt);
|
|
// set error name, otherwise it's always 'Error'
|
|
this.name = this.constructor.name;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* AnonymousRequestError is generated for anonymous keys on specific
|
|
* APIs. NOTE: PresignedURL generation always requires access keys.
|
|
*/
|
|
class AnonymousRequestError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidArgumentError is generated for all invalid arguments.
|
|
*/
|
|
exports.AnonymousRequestError = AnonymousRequestError;
|
|
class InvalidArgumentError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidPortError is generated when a non integer value is provided
|
|
* for ports.
|
|
*/
|
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
class InvalidPortError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidEndpointError is generated when an invalid end point value is
|
|
* provided which does not follow domain standards.
|
|
*/
|
|
exports.InvalidPortError = InvalidPortError;
|
|
class InvalidEndpointError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidBucketNameError is generated when an invalid bucket name is
|
|
* provided which does not follow AWS S3 specifications.
|
|
* http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
|
|
*/
|
|
exports.InvalidEndpointError = InvalidEndpointError;
|
|
class InvalidBucketNameError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidObjectNameError is generated when an invalid object name is
|
|
* provided which does not follow AWS S3 specifications.
|
|
* http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
|
|
*/
|
|
exports.InvalidBucketNameError = InvalidBucketNameError;
|
|
class InvalidObjectNameError extends ExtendableError {}
|
|
|
|
/**
|
|
* AccessKeyRequiredError generated by signature methods when access
|
|
* key is not found.
|
|
*/
|
|
exports.InvalidObjectNameError = InvalidObjectNameError;
|
|
class AccessKeyRequiredError extends ExtendableError {}
|
|
|
|
/**
|
|
* SecretKeyRequiredError generated by signature methods when secret
|
|
* key is not found.
|
|
*/
|
|
exports.AccessKeyRequiredError = AccessKeyRequiredError;
|
|
class SecretKeyRequiredError extends ExtendableError {}
|
|
|
|
/**
|
|
* ExpiresParamError generated when expires parameter value is not
|
|
* well within stipulated limits.
|
|
*/
|
|
exports.SecretKeyRequiredError = SecretKeyRequiredError;
|
|
class ExpiresParamError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidDateError generated when invalid date is found.
|
|
*/
|
|
exports.ExpiresParamError = ExpiresParamError;
|
|
class InvalidDateError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidPrefixError generated when object prefix provided is invalid
|
|
* or does not conform to AWS S3 object key restrictions.
|
|
*/
|
|
exports.InvalidDateError = InvalidDateError;
|
|
class InvalidPrefixError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidBucketPolicyError generated when the given bucket policy is invalid.
|
|
*/
|
|
exports.InvalidPrefixError = InvalidPrefixError;
|
|
class InvalidBucketPolicyError extends ExtendableError {}
|
|
|
|
/**
|
|
* IncorrectSizeError generated when total data read mismatches with
|
|
* the input size.
|
|
*/
|
|
exports.InvalidBucketPolicyError = InvalidBucketPolicyError;
|
|
class IncorrectSizeError extends ExtendableError {}
|
|
|
|
/**
|
|
* InvalidXMLError generated when an unknown XML is found.
|
|
*/
|
|
exports.IncorrectSizeError = IncorrectSizeError;
|
|
class InvalidXMLError extends ExtendableError {}
|
|
|
|
/**
|
|
* S3Error is generated for errors returned from S3 server.
|
|
* see getErrorTransformer for details
|
|
*/
|
|
exports.InvalidXMLError = InvalidXMLError;
|
|
class S3Error extends ExtendableError {}
|
|
exports.S3Error = S3Error;
|
|
class IsValidBucketNameError extends ExtendableError {}
|
|
exports.IsValidBucketNameError = IsValidBucketNameError;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFeHRlbmRhYmxlRXJyb3IiLCJFcnJvciIsImNvbnN0cnVjdG9yIiwibWVzc2FnZSIsIm9wdCIsIm5hbWUiLCJBbm9ueW1vdXNSZXF1ZXN0RXJyb3IiLCJleHBvcnRzIiwiSW52YWxpZEFyZ3VtZW50RXJyb3IiLCJJbnZhbGlkUG9ydEVycm9yIiwiSW52YWxpZEVuZHBvaW50RXJyb3IiLCJJbnZhbGlkQnVja2V0TmFtZUVycm9yIiwiSW52YWxpZE9iamVjdE5hbWVFcnJvciIsIkFjY2Vzc0tleVJlcXVpcmVkRXJyb3IiLCJTZWNyZXRLZXlSZXF1aXJlZEVycm9yIiwiRXhwaXJlc1BhcmFtRXJyb3IiLCJJbnZhbGlkRGF0ZUVycm9yIiwiSW52YWxpZFByZWZpeEVycm9yIiwiSW52YWxpZEJ1Y2tldFBvbGljeUVycm9yIiwiSW5jb3JyZWN0U2l6ZUVycm9yIiwiSW52YWxpZFhNTEVycm9yIiwiUzNFcnJvciIsIklzVmFsaWRCdWNrZXROYW1lRXJyb3IiXSwic291cmNlcyI6WyJlcnJvcnMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIE1pbklPIEphdmFzY3JpcHQgTGlicmFyeSBmb3IgQW1hem9uIFMzIENvbXBhdGlibGUgQ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9455:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.removeDirAndFiles = removeDirAndFiles;
|
|
var fs = _interopRequireWildcard(__nccwpck_require__(7147), true);
|
|
var path = _interopRequireWildcard(__nccwpck_require__(1017), true);
|
|
var querystring = _interopRequireWildcard(__nccwpck_require__(293), true);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _type = __nccwpck_require__(7293);
|
|
exports.RETENTION_MODES = _type.RETENTION_MODES;
|
|
exports.ENCRYPTION_TYPES = _type.ENCRYPTION_TYPES;
|
|
exports.LEGAL_HOLD_STATUS = _type.LEGAL_HOLD_STATUS;
|
|
exports.RETENTION_VALIDITY_UNITS = _type.RETENTION_VALIDITY_UNITS;
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
const DEFAULT_REGION = 'us-east-1';
|
|
exports.DEFAULT_REGION = DEFAULT_REGION;
|
|
class CopySourceOptions {
|
|
constructor({
|
|
Bucket,
|
|
Object,
|
|
VersionID = '',
|
|
MatchETag = '',
|
|
NoMatchETag = '',
|
|
MatchModifiedSince = null,
|
|
MatchUnmodifiedSince = null,
|
|
MatchRange = false,
|
|
Start = 0,
|
|
End = 0,
|
|
Encryption = undefined
|
|
}) {
|
|
this.Bucket = Bucket;
|
|
this.Object = Object;
|
|
this.VersionID = VersionID;
|
|
this.MatchETag = MatchETag;
|
|
this.NoMatchETag = NoMatchETag;
|
|
this.MatchModifiedSince = MatchModifiedSince;
|
|
this.MatchUnmodifiedSince = MatchUnmodifiedSince;
|
|
this.MatchRange = MatchRange;
|
|
this.Start = Start;
|
|
this.End = End;
|
|
this.Encryption = Encryption;
|
|
}
|
|
validate() {
|
|
if (!(0, _helper.isValidBucketName)(this.Bucket)) {
|
|
throw new errors.InvalidBucketNameError('Invalid Source bucket name: ' + this.Bucket);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(this.Object)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid Source object name: ${this.Object}`);
|
|
}
|
|
if (this.MatchRange && this.Start !== -1 && this.End !== -1 && this.Start > this.End || this.Start < 0) {
|
|
throw new errors.InvalidObjectNameError('Source start must be non-negative, and start must be at most end.');
|
|
} else if (this.MatchRange && !(0, _helper.isNumber)(this.Start) || !(0, _helper.isNumber)(this.End)) {
|
|
throw new errors.InvalidObjectNameError('MatchRange is specified. But Invalid Start and End values are specified.');
|
|
}
|
|
return true;
|
|
}
|
|
getHeaders() {
|
|
const headerOptions = {};
|
|
headerOptions['x-amz-copy-source'] = encodeURI(this.Bucket + '/' + this.Object);
|
|
if (!(0, _helper.isEmpty)(this.VersionID)) {
|
|
headerOptions['x-amz-copy-source'] = `${encodeURI(this.Bucket + '/' + this.Object)}?versionId=${this.VersionID}`;
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.MatchETag)) {
|
|
headerOptions['x-amz-copy-source-if-match'] = this.MatchETag;
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.NoMatchETag)) {
|
|
headerOptions['x-amz-copy-source-if-none-match'] = this.NoMatchETag;
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.MatchModifiedSince)) {
|
|
headerOptions['x-amz-copy-source-if-modified-since'] = this.MatchModifiedSince;
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.MatchUnmodifiedSince)) {
|
|
headerOptions['x-amz-copy-source-if-unmodified-since'] = this.MatchUnmodifiedSince;
|
|
}
|
|
return headerOptions;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @deprecated use nodejs fs module
|
|
*/
|
|
exports.CopySourceOptions = CopySourceOptions;
|
|
function removeDirAndFiles(dirPath, removeSelf = true) {
|
|
if (removeSelf) {
|
|
return fs.rmSync(dirPath, {
|
|
recursive: true,
|
|
force: true
|
|
});
|
|
}
|
|
fs.readdirSync(dirPath).forEach(item => {
|
|
fs.rmSync(path.join(dirPath, item), {
|
|
recursive: true,
|
|
force: true
|
|
});
|
|
});
|
|
}
|
|
class CopyDestinationOptions {
|
|
constructor({
|
|
Bucket,
|
|
Object,
|
|
Encryption,
|
|
UserMetadata,
|
|
UserTags,
|
|
LegalHold,
|
|
RetainUntilDate,
|
|
Mode,
|
|
MetadataDirective
|
|
}) {
|
|
this.Bucket = Bucket;
|
|
this.Object = Object;
|
|
this.Encryption = Encryption ?? undefined; // null input will become undefined, easy for runtime assert
|
|
this.UserMetadata = UserMetadata;
|
|
this.UserTags = UserTags;
|
|
this.LegalHold = LegalHold;
|
|
this.Mode = Mode; // retention mode
|
|
this.RetainUntilDate = RetainUntilDate;
|
|
this.MetadataDirective = MetadataDirective;
|
|
}
|
|
getHeaders() {
|
|
const replaceDirective = 'REPLACE';
|
|
const headerOptions = {};
|
|
const userTags = this.UserTags;
|
|
if (!(0, _helper.isEmpty)(userTags)) {
|
|
headerOptions['X-Amz-Tagging-Directive'] = replaceDirective;
|
|
headerOptions['X-Amz-Tagging'] = (0, _helper.isObject)(userTags) ? querystring.stringify(userTags) : (0, _helper.isString)(userTags) ? userTags : '';
|
|
}
|
|
if (this.Mode) {
|
|
headerOptions['X-Amz-Object-Lock-Mode'] = this.Mode; // GOVERNANCE or COMPLIANCE
|
|
}
|
|
|
|
if (this.RetainUntilDate) {
|
|
headerOptions['X-Amz-Object-Lock-Retain-Until-Date'] = this.RetainUntilDate; // needs to be UTC.
|
|
}
|
|
|
|
if (this.LegalHold) {
|
|
headerOptions['X-Amz-Object-Lock-Legal-Hold'] = this.LegalHold; // ON or OFF
|
|
}
|
|
|
|
if (this.UserMetadata) {
|
|
for (const [key, value] of Object.entries(this.UserMetadata)) {
|
|
headerOptions[`X-Amz-Meta-${key}`] = value.toString();
|
|
}
|
|
}
|
|
if (this.MetadataDirective) {
|
|
headerOptions[`X-Amz-Metadata-Directive`] = this.MetadataDirective;
|
|
}
|
|
if (this.Encryption) {
|
|
const encryptionHeaders = (0, _helper.getEncryptionHeaders)(this.Encryption);
|
|
for (const [key, value] of Object.entries(encryptionHeaders)) {
|
|
headerOptions[key] = value;
|
|
}
|
|
}
|
|
return headerOptions;
|
|
}
|
|
validate() {
|
|
if (!(0, _helper.isValidBucketName)(this.Bucket)) {
|
|
throw new errors.InvalidBucketNameError('Invalid Destination bucket name: ' + this.Bucket);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(this.Object)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid Destination object name: ${this.Object}`);
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.UserMetadata) && !(0, _helper.isObject)(this.UserMetadata)) {
|
|
throw new errors.InvalidObjectNameError(`Destination UserMetadata should be an object with key value pairs`);
|
|
}
|
|
if (!(0, _helper.isEmpty)(this.Mode) && ![_type.RETENTION_MODES.GOVERNANCE, _type.RETENTION_MODES.COMPLIANCE].includes(this.Mode)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid Mode specified for destination object it should be one of [GOVERNANCE,COMPLIANCE]`);
|
|
}
|
|
if (this.Encryption !== undefined && (0, _helper.isEmptyObject)(this.Encryption)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid Encryption configuration for destination object `);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* maybe this should be a generic type for Records, leave it for later refactor
|
|
*/
|
|
exports.CopyDestinationOptions = CopyDestinationOptions;
|
|
class SelectResults {
|
|
constructor({
|
|
records,
|
|
// parsed data as stream
|
|
response,
|
|
// original response stream
|
|
stats,
|
|
// stats as xml
|
|
progress // stats as xml
|
|
}) {
|
|
this.records = records;
|
|
this.response = response;
|
|
this.stats = stats;
|
|
this.progress = progress;
|
|
}
|
|
setStats(stats) {
|
|
this.stats = stats;
|
|
}
|
|
getStats() {
|
|
return this.stats;
|
|
}
|
|
setProgress(progress) {
|
|
this.progress = progress;
|
|
}
|
|
getProgress() {
|
|
return this.progress;
|
|
}
|
|
setResponse(response) {
|
|
this.response = response;
|
|
}
|
|
getResponse() {
|
|
return this.response;
|
|
}
|
|
setRecords(records) {
|
|
this.records = records;
|
|
}
|
|
getRecords() {
|
|
return this.records;
|
|
}
|
|
}
|
|
exports.SelectResults = SelectResults;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJmcyIsIl9pbnRlcm9wUmVxdWlyZVdpbGRjYXJkIiwicmVxdWlyZSIsInBhdGgiLCJxdWVyeXN0cmluZyIsImVycm9ycyIsIl9oZWxwZXIiLCJfdHlwZSIsImV4cG9ydHMiLCJSRVRFTlRJT05fTU9ERVMiLCJFTkNSWVBUSU9OX1RZUEVTIiwiTEVHQUxfSE9MRF9TVEFUVVMiLCJSRVRFTlRJT05fVkFMSURJVFlfVU5JVFMiLCJfZ2V0UmVxdWlyZVdpbGRjYXJkQ2FjaGUiLCJub2RlSW50ZXJvcCIsIldlYWtNYXAiLCJjYWNoZUJhYmVsSW50ZXJvcCIsImNhY2hlTm9kZUludGVyb3AiLCJvYmoiLCJfX2VzTW9kdWxlIiwiZG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.callbackify = callbackify;
|
|
// wrapper an async function that support callback style API.
|
|
// It will preserve 'this'.
|
|
function callbackify(fn) {
|
|
return function () {
|
|
const args = [...arguments];
|
|
const callback = args.pop();
|
|
|
|
// If the last argument is a function, assume it's the callback.
|
|
if (typeof callback === 'function') {
|
|
return fn.apply(this, args).then(result => callback(null, result), err => callback(err));
|
|
}
|
|
return fn.apply(this, arguments);
|
|
};
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjYWxsYmFja2lmeSIsImZuIiwiYXJncyIsImFyZ3VtZW50cyIsImNhbGxiYWNrIiwicG9wIiwiYXBwbHkiLCJ0aGVuIiwicmVzdWx0IiwiZXJyIl0sInNvdXJjZXMiOlsiY2FsbGJhY2tpZnkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gd3JhcHBlciBhbiBhc3luYyBmdW5jdGlvbiB0aGF0IHN1cHBvcnQgY2FsbGJhY2sgc3R5bGUgQVBJLlxuLy8gSXQgd2lsbCBwcmVzZXJ2ZSAndGhpcycuXG5leHBvcnQgZnVuY3Rpb24gY2FsbGJhY2tpZnkoZm4pIHtcbiAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcbiAgICBjb25zdCBhcmdzID0gWy4uLmFyZ3VtZW50c11cbiAgICBjb25zdCBjYWxsYmFjayA9IGFyZ3MucG9wKClcblxuICAgIC8vIElmIHRoZSBsYXN0IGFyZ3VtZW50IGlzIGEgZnVuY3Rpb24sIGFzc3VtZSBpdCdzIHRoZSBjYWxsYmFjay5cbiAgICBpZiAodHlwZW9mIGNhbGxiYWNrID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICByZXR1cm4gZm4uYXBwbHkodGhpcywgYXJncykudGhlbihcbiAgICAgICAgKHJlc3VsdCkgPT4gY2FsbGJhY2sobnVsbCwgcmVzdWx0KSxcbiAgICAgICAgKGVycikgPT4gY2FsbGJhY2soZXJyKSxcbiAgICAgIClcbiAgICB9XG5cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpcywgYXJndW1lbnRzKVxuICB9XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBO0FBQ0E7QUFDTyxTQUFTQSxXQUFXQSxDQUFDQyxFQUFFLEVBQUU7RUFDOUIsT0FBTyxZQUFZO0lBQ2pCLE1BQU1DLElBQUksR0FBRyxDQUFDLEdBQUdDLFNBQVMsQ0FBQztJQUMzQixNQUFNQyxRQUFRLEdBQUdGLElBQUksQ0FBQ0csR0FBRyxDQUFDLENBQUM7O0lBRTNCO0lBQ0EsSUFBSSxPQUFPRCxRQUFRLEtBQUssVUFBVSxFQUFFO01BQ2xDLE9BQU9ILEVBQUUsQ0FBQ0ssS0FBSyxDQUFDLElBQUksRUFBRUosSUFBSSxDQUFDLENBQUNLLElBQUksQ0FDN0JDLE1BQU0sSUFBS0osUUFBUSxDQUFDLElBQUksRUFBRUksTUFBTSxDQUFDLEVBQ2pDQyxHQUFHLElBQUtMLFFBQVEsQ0FBQ0ssR0FBRyxDQUN2QixDQUFDO0lBQ0g7SUFFQSxPQUFPUixFQUFFLENBQUNLLEtBQUssQ0FBQyxJQUFJLEVBQUVILFNBQVMsQ0FBQztFQUNsQyxDQUFDO0FBQ0gifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5586:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var http = _interopRequireWildcard(__nccwpck_require__(3685), true);
|
|
var https = _interopRequireWildcard(__nccwpck_require__(5687), true);
|
|
var _browserOrNode = __nccwpck_require__(9107);
|
|
var _lodash = __nccwpck_require__(250);
|
|
var qs = _interopRequireWildcard(__nccwpck_require__(293), true);
|
|
var _xml2js = __nccwpck_require__(6189);
|
|
var _CredentialProvider = __nccwpck_require__(6570);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helpers = __nccwpck_require__(9455);
|
|
var _signing = __nccwpck_require__(2029);
|
|
var _extensions = __nccwpck_require__(1159);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _request = __nccwpck_require__(9093);
|
|
var _response = __nccwpck_require__(2644);
|
|
var _s3Endpoints = __nccwpck_require__(6314);
|
|
var xmlParsers = _interopRequireWildcard(__nccwpck_require__(4040), true);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
// will be replaced by bundler.
|
|
const Package = {
|
|
version: "7.1.3" || 0
|
|
};
|
|
const requestOptionProperties = ['agent', 'ca', 'cert', 'ciphers', 'clientCertEngine', 'crl', 'dhparam', 'ecdhCurve', 'family', 'honorCipherOrder', 'key', 'passphrase', 'pfx', 'rejectUnauthorized', 'secureOptions', 'secureProtocol', 'servername', 'sessionIdContext'];
|
|
class TypedClient {
|
|
partSize = 64 * 1024 * 1024;
|
|
maximumPartSize = 5 * 1024 * 1024 * 1024;
|
|
maxObjectSize = 5 * 1024 * 1024 * 1024 * 1024;
|
|
constructor(params) {
|
|
// @ts-expect-error deprecated property
|
|
if (params.secure !== undefined) {
|
|
throw new Error('"secure" option deprecated, "useSSL" should be used instead');
|
|
}
|
|
// Default values if not specified.
|
|
if (params.useSSL === undefined) {
|
|
params.useSSL = true;
|
|
}
|
|
if (!params.port) {
|
|
params.port = 0;
|
|
}
|
|
// Validate input params.
|
|
if (!(0, _helper.isValidEndpoint)(params.endPoint)) {
|
|
throw new errors.InvalidEndpointError(`Invalid endPoint : ${params.endPoint}`);
|
|
}
|
|
if (!(0, _helper.isValidPort)(params.port)) {
|
|
throw new errors.InvalidArgumentError(`Invalid port : ${params.port}`);
|
|
}
|
|
if (!(0, _helper.isBoolean)(params.useSSL)) {
|
|
throw new errors.InvalidArgumentError(`Invalid useSSL flag type : ${params.useSSL}, expected to be of type "boolean"`);
|
|
}
|
|
|
|
// Validate region only if its set.
|
|
if (params.region) {
|
|
if (!(0, _helper.isString)(params.region)) {
|
|
throw new errors.InvalidArgumentError(`Invalid region : ${params.region}`);
|
|
}
|
|
}
|
|
const host = params.endPoint.toLowerCase();
|
|
let port = params.port;
|
|
let protocol;
|
|
let transport;
|
|
let transportAgent;
|
|
// Validate if configuration is not using SSL
|
|
// for constructing relevant endpoints.
|
|
if (params.useSSL) {
|
|
// Defaults to secure.
|
|
transport = https;
|
|
protocol = 'https:';
|
|
port = port || 443;
|
|
transportAgent = https.globalAgent;
|
|
} else {
|
|
transport = http;
|
|
protocol = 'http:';
|
|
port = port || 80;
|
|
transportAgent = http.globalAgent;
|
|
}
|
|
|
|
// if custom transport is set, use it.
|
|
if (params.transport) {
|
|
if (!(0, _helper.isObject)(params.transport)) {
|
|
throw new errors.InvalidArgumentError(`Invalid transport type : ${params.transport}, expected to be type "object"`);
|
|
}
|
|
transport = params.transport;
|
|
}
|
|
|
|
// if custom transport agent is set, use it.
|
|
if (params.transportAgent) {
|
|
if (!(0, _helper.isObject)(params.transportAgent)) {
|
|
throw new errors.InvalidArgumentError(`Invalid transportAgent type: ${params.transportAgent}, expected to be type "object"`);
|
|
}
|
|
transportAgent = params.transportAgent;
|
|
}
|
|
|
|
// User Agent should always following the below style.
|
|
// Please open an issue to discuss any new changes here.
|
|
//
|
|
// MinIO (OS; ARCH) LIB/VER APP/VER
|
|
//
|
|
const libraryComments = `(${process.platform}; ${process.arch})`;
|
|
const libraryAgent = `MinIO ${libraryComments} minio-js/${Package.version}`;
|
|
// User agent block ends.
|
|
|
|
this.transport = transport;
|
|
this.transportAgent = transportAgent;
|
|
this.host = host;
|
|
this.port = port;
|
|
this.protocol = protocol;
|
|
this.userAgent = `${libraryAgent}`;
|
|
|
|
// Default path style is true
|
|
if (params.pathStyle === undefined) {
|
|
this.pathStyle = true;
|
|
} else {
|
|
this.pathStyle = params.pathStyle;
|
|
}
|
|
this.accessKey = params.accessKey ?? '';
|
|
this.secretKey = params.secretKey ?? '';
|
|
this.sessionToken = params.sessionToken;
|
|
this.anonymous = !this.accessKey || !this.secretKey;
|
|
if (params.credentialsProvider) {
|
|
this.credentialsProvider = params.credentialsProvider;
|
|
}
|
|
this.regionMap = {};
|
|
if (params.region) {
|
|
this.region = params.region;
|
|
}
|
|
if (params.partSize) {
|
|
this.partSize = params.partSize;
|
|
this.overRidePartSize = true;
|
|
}
|
|
if (this.partSize < 5 * 1024 * 1024) {
|
|
throw new errors.InvalidArgumentError(`Part size should be greater than 5MB`);
|
|
}
|
|
if (this.partSize > 5 * 1024 * 1024 * 1024) {
|
|
throw new errors.InvalidArgumentError(`Part size should be less than 5GB`);
|
|
}
|
|
|
|
// SHA256 is enabled only for authenticated http requests. If the request is authenticated
|
|
// and the connection is https we use x-amz-content-sha256=UNSIGNED-PAYLOAD
|
|
// header for signature calculation.
|
|
this.enableSHA256 = !this.anonymous && !params.useSSL;
|
|
this.s3AccelerateEndpoint = params.s3AccelerateEndpoint || undefined;
|
|
this.reqOptions = {};
|
|
this.clientExtensions = new _extensions.Extensions(this);
|
|
}
|
|
|
|
/**
|
|
* Minio extensions that aren't necessary present for Amazon S3 compatible storage servers
|
|
*/
|
|
get extensions() {
|
|
return this.clientExtensions;
|
|
}
|
|
|
|
/**
|
|
* @param endPoint - valid S3 acceleration end point
|
|
*/
|
|
setS3TransferAccelerate(endPoint) {
|
|
this.s3AccelerateEndpoint = endPoint;
|
|
}
|
|
|
|
/**
|
|
* Sets the supported request options.
|
|
*/
|
|
setRequestOptions(options) {
|
|
if (!(0, _helper.isObject)(options)) {
|
|
throw new TypeError('request options should be of type "object"');
|
|
}
|
|
this.reqOptions = _lodash.pick(options, requestOptionProperties);
|
|
}
|
|
|
|
/**
|
|
* This is s3 Specific and does not hold validity in any other Object storage.
|
|
*/
|
|
getAccelerateEndPointIfSet(bucketName, objectName) {
|
|
if (!(0, _helper.isEmpty)(this.s3AccelerateEndpoint) && !(0, _helper.isEmpty)(bucketName) && !(0, _helper.isEmpty)(objectName)) {
|
|
// http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html
|
|
// Disable transfer acceleration for non-compliant bucket names.
|
|
if (bucketName.includes('.')) {
|
|
throw new Error(`Transfer Acceleration is not supported for non compliant bucket:${bucketName}`);
|
|
}
|
|
// If transfer acceleration is requested set new host.
|
|
// For more details about enabling transfer acceleration read here.
|
|
// http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html
|
|
return this.s3AccelerateEndpoint;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* returns options object that can be used with http.request()
|
|
* Takes care of constructing virtual-host-style or path-style hostname
|
|
*/
|
|
getRequestOptions(opts) {
|
|
const method = opts.method;
|
|
const region = opts.region;
|
|
const bucketName = opts.bucketName;
|
|
let objectName = opts.objectName;
|
|
const headers = opts.headers;
|
|
const query = opts.query;
|
|
let reqOptions = {
|
|
method,
|
|
headers: {},
|
|
protocol: this.protocol,
|
|
// If custom transportAgent was supplied earlier, we'll inject it here
|
|
agent: this.transportAgent
|
|
};
|
|
|
|
// Verify if virtual host supported.
|
|
let virtualHostStyle;
|
|
if (bucketName) {
|
|
virtualHostStyle = (0, _helper.isVirtualHostStyle)(this.host, this.protocol, bucketName, this.pathStyle);
|
|
}
|
|
let path = '/';
|
|
let host = this.host;
|
|
let port;
|
|
if (this.port) {
|
|
port = this.port;
|
|
}
|
|
if (objectName) {
|
|
objectName = (0, _helper.uriResourceEscape)(objectName);
|
|
}
|
|
|
|
// For Amazon S3 endpoint, get endpoint based on region.
|
|
if ((0, _helper.isAmazonEndpoint)(host)) {
|
|
const accelerateEndPoint = this.getAccelerateEndPointIfSet(bucketName, objectName);
|
|
if (accelerateEndPoint) {
|
|
host = `${accelerateEndPoint}`;
|
|
} else {
|
|
host = (0, _s3Endpoints.getS3Endpoint)(region);
|
|
}
|
|
}
|
|
if (virtualHostStyle && !opts.pathStyle) {
|
|
// For all hosts which support virtual host style, `bucketName`
|
|
// is part of the hostname in the following format:
|
|
//
|
|
// var host = 'bucketName.example.com'
|
|
//
|
|
if (bucketName) {
|
|
host = `${bucketName}.${host}`;
|
|
}
|
|
if (objectName) {
|
|
path = `/${objectName}`;
|
|
}
|
|
} else {
|
|
// For all S3 compatible storage services we will fallback to
|
|
// path style requests, where `bucketName` is part of the URI
|
|
// path.
|
|
if (bucketName) {
|
|
path = `/${bucketName}`;
|
|
}
|
|
if (objectName) {
|
|
path = `/${bucketName}/${objectName}`;
|
|
}
|
|
}
|
|
if (query) {
|
|
path += `?${query}`;
|
|
}
|
|
reqOptions.headers.host = host;
|
|
if (reqOptions.protocol === 'http:' && port !== 80 || reqOptions.protocol === 'https:' && port !== 443) {
|
|
reqOptions.headers.host = `${host}:${port}`;
|
|
}
|
|
reqOptions.headers['user-agent'] = this.userAgent;
|
|
if (headers) {
|
|
// have all header keys in lower case - to make signing easy
|
|
for (const [k, v] of Object.entries(headers)) {
|
|
reqOptions.headers[k.toLowerCase()] = v;
|
|
}
|
|
}
|
|
|
|
// Use any request option specified in minioClient.setRequestOptions()
|
|
reqOptions = Object.assign({}, this.reqOptions, reqOptions);
|
|
return {
|
|
...reqOptions,
|
|
headers: _lodash.mapValues(_lodash.pickBy(reqOptions.headers, _helper.isDefined), v => v.toString()),
|
|
host,
|
|
port,
|
|
path
|
|
};
|
|
}
|
|
async setCredentialsProvider(credentialsProvider) {
|
|
if (!(credentialsProvider instanceof _CredentialProvider.CredentialProvider)) {
|
|
throw new Error('Unable to get credentials. Expected instance of CredentialProvider');
|
|
}
|
|
this.credentialsProvider = credentialsProvider;
|
|
await this.checkAndRefreshCreds();
|
|
}
|
|
async checkAndRefreshCreds() {
|
|
if (this.credentialsProvider) {
|
|
try {
|
|
const credentialsConf = await this.credentialsProvider.getCredentials();
|
|
this.accessKey = credentialsConf.getAccessKey();
|
|
this.secretKey = credentialsConf.getSecretKey();
|
|
this.sessionToken = credentialsConf.getSessionToken();
|
|
} catch (e) {
|
|
throw new Error(`Unable to get credentials: ${e}`, {
|
|
cause: e
|
|
});
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* log the request, response, error
|
|
*/
|
|
logHTTP(reqOptions, response, err) {
|
|
// if no logStream available return.
|
|
if (!this.logStream) {
|
|
return;
|
|
}
|
|
if (!(0, _helper.isObject)(reqOptions)) {
|
|
throw new TypeError('reqOptions should be of type "object"');
|
|
}
|
|
if (response && !(0, _helper.isReadableStream)(response)) {
|
|
throw new TypeError('response should be of type "Stream"');
|
|
}
|
|
if (err && !(err instanceof Error)) {
|
|
throw new TypeError('err should be of type "Error"');
|
|
}
|
|
const logStream = this.logStream;
|
|
const logHeaders = headers => {
|
|
Object.entries(headers).forEach(([k, v]) => {
|
|
if (k == 'authorization') {
|
|
if ((0, _helper.isString)(v)) {
|
|
const redactor = new RegExp('Signature=([0-9a-f]+)');
|
|
v = v.replace(redactor, 'Signature=**REDACTED**');
|
|
}
|
|
}
|
|
logStream.write(`${k}: ${v}\n`);
|
|
});
|
|
logStream.write('\n');
|
|
};
|
|
logStream.write(`REQUEST: ${reqOptions.method} ${reqOptions.path}\n`);
|
|
logHeaders(reqOptions.headers);
|
|
if (response) {
|
|
this.logStream.write(`RESPONSE: ${response.statusCode}\n`);
|
|
logHeaders(response.headers);
|
|
}
|
|
if (err) {
|
|
logStream.write('ERROR BODY:\n');
|
|
const errJSON = JSON.stringify(err, null, '\t');
|
|
logStream.write(`${errJSON}\n`);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Enable tracing
|
|
*/
|
|
traceOn(stream) {
|
|
if (!stream) {
|
|
stream = process.stdout;
|
|
}
|
|
this.logStream = stream;
|
|
}
|
|
|
|
/**
|
|
* Disable tracing
|
|
*/
|
|
traceOff() {
|
|
this.logStream = undefined;
|
|
}
|
|
|
|
/**
|
|
* makeRequest is the primitive used by the apis for making S3 requests.
|
|
* payload can be empty string in case of no payload.
|
|
* statusCode is the expected statusCode. If response.statusCode does not match
|
|
* we parse the XML error and call the callback with the error message.
|
|
*
|
|
* A valid region is passed by the calls - listBuckets, makeBucket and getBucketRegion.
|
|
*
|
|
* @internal
|
|
*/
|
|
async makeRequestAsync(options, payload = '', expectedCodes = [200], region = '') {
|
|
if (!(0, _helper.isObject)(options)) {
|
|
throw new TypeError('options should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(payload) && !(0, _helper.isObject)(payload)) {
|
|
// Buffer is of type 'object'
|
|
throw new TypeError('payload should be of type "string" or "Buffer"');
|
|
}
|
|
expectedCodes.forEach(statusCode => {
|
|
if (!(0, _helper.isNumber)(statusCode)) {
|
|
throw new TypeError('statusCode should be of type "number"');
|
|
}
|
|
});
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!options.headers) {
|
|
options.headers = {};
|
|
}
|
|
if (options.method === 'POST' || options.method === 'PUT' || options.method === 'DELETE') {
|
|
options.headers['content-length'] = payload.length.toString();
|
|
}
|
|
const sha256sum = this.enableSHA256 ? (0, _helper.toSha256)(payload) : '';
|
|
return this.makeRequestStreamAsync(options, payload, sha256sum, expectedCodes, region);
|
|
}
|
|
|
|
/**
|
|
* new request with promise
|
|
*
|
|
* No need to drain response, response body is not valid
|
|
*/
|
|
async makeRequestAsyncOmit(options, payload = '', statusCodes = [200], region = '') {
|
|
const res = await this.makeRequestAsync(options, payload, statusCodes, region);
|
|
await (0, _response.drainResponse)(res);
|
|
return res;
|
|
}
|
|
|
|
/**
|
|
* makeRequestStream will be used directly instead of makeRequest in case the payload
|
|
* is available as a stream. for ex. putObject
|
|
*
|
|
* @internal
|
|
*/
|
|
async makeRequestStreamAsync(options, body, sha256sum, statusCodes, region) {
|
|
if (!(0, _helper.isObject)(options)) {
|
|
throw new TypeError('options should be of type "object"');
|
|
}
|
|
if (!(Buffer.isBuffer(body) || typeof body === 'string' || (0, _helper.isReadableStream)(body))) {
|
|
throw new errors.InvalidArgumentError(`stream should be a Buffer, string or readable Stream, got ${typeof body} instead`);
|
|
}
|
|
if (!(0, _helper.isString)(sha256sum)) {
|
|
throw new TypeError('sha256sum should be of type "string"');
|
|
}
|
|
statusCodes.forEach(statusCode => {
|
|
if (!(0, _helper.isNumber)(statusCode)) {
|
|
throw new TypeError('statusCode should be of type "number"');
|
|
}
|
|
});
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
// sha256sum will be empty for anonymous or https requests
|
|
if (!this.enableSHA256 && sha256sum.length !== 0) {
|
|
throw new errors.InvalidArgumentError(`sha256sum expected to be empty for anonymous or https requests`);
|
|
}
|
|
// sha256sum should be valid for non-anonymous http requests.
|
|
if (this.enableSHA256 && sha256sum.length !== 64) {
|
|
throw new errors.InvalidArgumentError(`Invalid sha256sum : ${sha256sum}`);
|
|
}
|
|
await this.checkAndRefreshCreds();
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
region = region || (await this.getBucketRegionAsync(options.bucketName));
|
|
const reqOptions = this.getRequestOptions({
|
|
...options,
|
|
region
|
|
});
|
|
if (!this.anonymous) {
|
|
// For non-anonymous https requests sha256sum is 'UNSIGNED-PAYLOAD' for signature calculation.
|
|
if (!this.enableSHA256) {
|
|
sha256sum = 'UNSIGNED-PAYLOAD';
|
|
}
|
|
const date = new Date();
|
|
reqOptions.headers['x-amz-date'] = (0, _helper.makeDateLong)(date);
|
|
reqOptions.headers['x-amz-content-sha256'] = sha256sum;
|
|
if (this.sessionToken) {
|
|
reqOptions.headers['x-amz-security-token'] = this.sessionToken;
|
|
}
|
|
reqOptions.headers.authorization = (0, _signing.signV4)(reqOptions, this.accessKey, this.secretKey, region, date, sha256sum);
|
|
}
|
|
const response = await (0, _request.request)(this.transport, reqOptions, body);
|
|
if (!response.statusCode) {
|
|
throw new Error("BUG: response doesn't have a statusCode");
|
|
}
|
|
if (!statusCodes.includes(response.statusCode)) {
|
|
// For an incorrect region, S3 server always sends back 400.
|
|
// But we will do cache invalidation for all errors so that,
|
|
// in future, if AWS S3 decides to send a different status code or
|
|
// XML error code we will still work fine.
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
delete this.regionMap[options.bucketName];
|
|
const err = await xmlParsers.parseResponseError(response);
|
|
this.logHTTP(reqOptions, response, err);
|
|
throw err;
|
|
}
|
|
this.logHTTP(reqOptions, response);
|
|
return response;
|
|
}
|
|
|
|
/**
|
|
* gets the region of the bucket
|
|
*
|
|
* @param bucketName
|
|
*
|
|
* @internal
|
|
*/
|
|
async getBucketRegionAsync(bucketName) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name : ${bucketName}`);
|
|
}
|
|
|
|
// Region is set with constructor, return the region right here.
|
|
if (this.region) {
|
|
return this.region;
|
|
}
|
|
const cached = this.regionMap[bucketName];
|
|
if (cached) {
|
|
return cached;
|
|
}
|
|
const extractRegionAsync = async response => {
|
|
const body = await (0, _response.readAsString)(response);
|
|
const region = xmlParsers.parseBucketRegion(body) || _helpers.DEFAULT_REGION;
|
|
this.regionMap[bucketName] = region;
|
|
return region;
|
|
};
|
|
const method = 'GET';
|
|
const query = 'location';
|
|
// `getBucketLocation` behaves differently in following ways for
|
|
// different environments.
|
|
//
|
|
// - For nodejs env we default to path style requests.
|
|
// - For browser env path style requests on buckets yields CORS
|
|
// error. To circumvent this problem we make a virtual host
|
|
// style request signed with 'us-east-1'. This request fails
|
|
// with an error 'AuthorizationHeaderMalformed', additionally
|
|
// the error XML also provides Region of the bucket. To validate
|
|
// this region is proper we retry the same request with the newly
|
|
// obtained region.
|
|
const pathStyle = this.pathStyle && !_browserOrNode.isBrowser;
|
|
let region;
|
|
try {
|
|
const res = await this.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
pathStyle
|
|
}, '', [200], _helpers.DEFAULT_REGION);
|
|
return extractRegionAsync(res);
|
|
} catch (e) {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
if (!(e.name === 'AuthorizationHeaderMalformed')) {
|
|
throw e;
|
|
}
|
|
// @ts-expect-error we set extra properties on error object
|
|
region = e.Region;
|
|
if (!region) {
|
|
throw e;
|
|
}
|
|
}
|
|
const res = await this.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
pathStyle
|
|
}, '', [200], region);
|
|
return await extractRegionAsync(res);
|
|
}
|
|
|
|
/**
|
|
* makeRequest is the primitive used by the apis for making S3 requests.
|
|
* payload can be empty string in case of no payload.
|
|
* statusCode is the expected statusCode. If response.statusCode does not match
|
|
* we parse the XML error and call the callback with the error message.
|
|
* A valid region is passed by the calls - listBuckets, makeBucket and
|
|
* getBucketRegion.
|
|
*
|
|
* @deprecated use `makeRequestAsync` instead
|
|
*/
|
|
makeRequest(options, payload = '', expectedCodes = [200], region = '', returnResponse, cb) {
|
|
let prom;
|
|
if (returnResponse) {
|
|
prom = this.makeRequestAsync(options, payload, expectedCodes, region);
|
|
} else {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-expect-error compatible for old behaviour
|
|
prom = this.makeRequestAsyncOmit(options, payload, expectedCodes, region);
|
|
}
|
|
prom.then(result => cb(null, result), err => {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
cb(err);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* makeRequestStream will be used directly instead of makeRequest in case the payload
|
|
* is available as a stream. for ex. putObject
|
|
*
|
|
* @deprecated use `makeRequestStreamAsync` instead
|
|
*/
|
|
makeRequestStream(options, stream, sha256sum, statusCodes, region, returnResponse, cb) {
|
|
const executor = async () => {
|
|
const res = await this.makeRequestStreamAsync(options, stream, sha256sum, statusCodes, region);
|
|
if (!returnResponse) {
|
|
await (0, _response.drainResponse)(res);
|
|
}
|
|
return res;
|
|
};
|
|
executor().then(result => cb(null, result),
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
err => cb(err));
|
|
}
|
|
|
|
/**
|
|
* @deprecated use `getBucketRegionAsync` instead
|
|
*/
|
|
getBucketRegion(bucketName, cb) {
|
|
return this.getBucketRegionAsync(bucketName).then(result => cb(null, result),
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
err => cb(err));
|
|
}
|
|
|
|
/**
|
|
* @deprecated use promise style API
|
|
*/
|
|
|
|
async removeBucket(bucketName) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
const method = 'DELETE';
|
|
await this.makeRequestAsyncOmit({
|
|
method,
|
|
bucketName
|
|
}, '', [204]);
|
|
delete this.regionMap[bucketName];
|
|
}
|
|
|
|
/**
|
|
* Stat information of the object.
|
|
*/
|
|
async statObject(bucketName, objectName, statOpts = {}) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isObject)(statOpts)) {
|
|
throw new errors.InvalidArgumentError('statOpts should be of type "object"');
|
|
}
|
|
const query = qs.stringify(statOpts);
|
|
const method = 'HEAD';
|
|
const res = await this.makeRequestAsyncOmit({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
});
|
|
return {
|
|
size: parseInt(res.headers['content-length']),
|
|
metaData: (0, _helper.extractMetadata)(res.headers),
|
|
lastModified: new Date(res.headers['last-modified']),
|
|
versionId: (0, _helper.getVersionId)(res.headers),
|
|
etag: (0, _helper.sanitizeETag)(res.headers.etag)
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Remove the specified object.
|
|
* @deprecated use new promise style API
|
|
*/
|
|
|
|
/**
|
|
* @deprecated use new promise style API
|
|
*/ // @ts-ignore
|
|
async removeObject(bucketName, objectName, removeOpts = {}) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isObject)(removeOpts)) {
|
|
throw new errors.InvalidArgumentError('removeOpts should be of type "object"');
|
|
}
|
|
const method = 'DELETE';
|
|
const headers = {};
|
|
if (removeOpts.governanceBypass) {
|
|
headers['X-Amz-Bypass-Governance-Retention'] = true;
|
|
}
|
|
if (removeOpts.forceDelete) {
|
|
headers['x-minio-force-delete'] = true;
|
|
}
|
|
const queryParams = {};
|
|
if (removeOpts.versionId) {
|
|
queryParams.versionId = `${removeOpts.versionId}`;
|
|
}
|
|
const query = qs.stringify(queryParams);
|
|
await this.makeRequestAsyncOmit({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
headers,
|
|
query
|
|
}, '', [200, 204]);
|
|
}
|
|
|
|
// Calls implemented below are related to multipart.
|
|
|
|
/**
|
|
* Initiate a new multipart upload.
|
|
* @internal
|
|
*/
|
|
async initiateNewMultipartUpload(bucketName, objectName, headers) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isObject)(headers)) {
|
|
throw new errors.InvalidObjectNameError('contentType should be of type "object"');
|
|
}
|
|
const method = 'POST';
|
|
const query = 'uploads';
|
|
const res = await this.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query,
|
|
headers
|
|
});
|
|
const body = await (0, _response.readAsBuffer)(res);
|
|
return (0, xmlParsers.parseInitiateMultipart)(body.toString());
|
|
}
|
|
|
|
/**
|
|
* Internal Method to abort a multipart upload request in case of any errors.
|
|
*
|
|
* @param bucketName - Bucket Name
|
|
* @param objectName - Object Name
|
|
* @param uploadId - id of a multipart upload to cancel during compose object sequence.
|
|
*/
|
|
async abortMultipartUpload(bucketName, objectName, uploadId) {
|
|
const method = 'DELETE';
|
|
const query = `uploadId=${uploadId}`;
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
objectName: objectName,
|
|
query
|
|
};
|
|
await this.makeRequestAsyncOmit(requestOptions, '', [204]);
|
|
}
|
|
|
|
/**
|
|
* Get part-info of all parts of an incomplete upload specified by uploadId.
|
|
*/
|
|
async listParts(bucketName, objectName, uploadId) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(uploadId)) {
|
|
throw new TypeError('uploadId should be of type "string"');
|
|
}
|
|
if (!uploadId) {
|
|
throw new errors.InvalidArgumentError('uploadId cannot be empty');
|
|
}
|
|
const parts = [];
|
|
let marker = 0;
|
|
let result;
|
|
do {
|
|
result = await this.listPartsQuery(bucketName, objectName, uploadId, marker);
|
|
marker = result.marker;
|
|
parts.push(...result.parts);
|
|
} while (result.isTruncated);
|
|
return parts;
|
|
}
|
|
|
|
/**
|
|
* Called by listParts to fetch a batch of part-info
|
|
*/
|
|
async listPartsQuery(bucketName, objectName, uploadId, marker) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(uploadId)) {
|
|
throw new TypeError('uploadId should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isNumber)(marker)) {
|
|
throw new TypeError('marker should be of type "number"');
|
|
}
|
|
if (!uploadId) {
|
|
throw new errors.InvalidArgumentError('uploadId cannot be empty');
|
|
}
|
|
let query = `uploadId=${(0, _helper.uriEscape)(uploadId)}`;
|
|
if (marker) {
|
|
query += `&part-number-marker=${marker}`;
|
|
}
|
|
const method = 'GET';
|
|
const res = await this.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
});
|
|
return xmlParsers.parseListParts(await (0, _response.readAsString)(res));
|
|
}
|
|
async listBuckets() {
|
|
const method = 'GET';
|
|
const httpRes = await this.makeRequestAsync({
|
|
method
|
|
}, '', [200], _helpers.DEFAULT_REGION);
|
|
const xmlResult = await (0, _response.readAsString)(httpRes);
|
|
return xmlParsers.parseListBucket(xmlResult);
|
|
}
|
|
async removeBucketReplication(bucketName) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
const method = 'DELETE';
|
|
const query = 'replication';
|
|
await this.makeRequestAsyncOmit({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200, 204], '');
|
|
}
|
|
async setBucketReplication(bucketName, replicationConfig) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isObject)(replicationConfig)) {
|
|
throw new errors.InvalidArgumentError('replicationConfig should be of type "object"');
|
|
} else {
|
|
if (_lodash.isEmpty(replicationConfig.role)) {
|
|
throw new errors.InvalidArgumentError('Role cannot be empty');
|
|
} else if (replicationConfig.role && !(0, _helper.isString)(replicationConfig.role)) {
|
|
throw new errors.InvalidArgumentError('Invalid value for role', replicationConfig.role);
|
|
}
|
|
if (_lodash.isEmpty(replicationConfig.rules)) {
|
|
throw new errors.InvalidArgumentError('Minimum one replication rule must be specified');
|
|
}
|
|
}
|
|
const method = 'PUT';
|
|
const query = 'replication';
|
|
const headers = {};
|
|
const replicationParamsConfig = {
|
|
ReplicationConfiguration: {
|
|
Role: replicationConfig.role,
|
|
Rule: replicationConfig.rules
|
|
}
|
|
};
|
|
const builder = new _xml2js.Builder({
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
const payload = builder.buildObject(replicationParamsConfig);
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
await this.makeRequestAsyncOmit({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
}, payload);
|
|
}
|
|
async getBucketReplication(bucketName) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
const method = 'GET';
|
|
const query = 'replication';
|
|
const httpRes = await this.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200, 204]);
|
|
const xmlResult = await (0, _response.readAsString)(httpRes);
|
|
return xmlParsers.parseReplicationConfig(xmlResult);
|
|
}
|
|
}
|
|
exports.TypedClient = TypedClient;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9u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
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
class CopyConditions {
|
|
modified = '';
|
|
unmodified = '';
|
|
matchETag = '';
|
|
matchETagExcept = '';
|
|
setModified(date) {
|
|
if (!(date instanceof Date)) {
|
|
throw new TypeError('date must be of type Date');
|
|
}
|
|
this.modified = date.toUTCString();
|
|
}
|
|
setUnmodified(date) {
|
|
if (!(date instanceof Date)) {
|
|
throw new TypeError('date must be of type Date');
|
|
}
|
|
this.unmodified = date.toUTCString();
|
|
}
|
|
setMatchETag(etag) {
|
|
this.matchETag = etag;
|
|
}
|
|
setMatchETagExcept(etag) {
|
|
this.matchETagExcept = etag;
|
|
}
|
|
}
|
|
exports.CopyConditions = CopyConditions;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDb3B5Q29uZGl0aW9ucyIsIm1vZGlmaWVkIiwidW5tb2RpZmllZCIsIm1hdGNoRVRhZyIsIm1hdGNoRVRhZ0V4Y2VwdCIsInNldE1vZGlmaWVkIiwiZGF0ZSIsIkRhdGUiLCJUeXBlRXJyb3IiLCJ0b1VUQ1N0cmluZyIsInNldFVubW9kaWZpZWQiLCJzZXRNYXRjaEVUYWciLCJldGFnIiwic2V0TWF0Y2hFVGFnRXhjZXB0IiwiZXhwb3J0cyJdLCJzb3VyY2VzIjpbImNvcHktY29uZGl0aW9ucy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgQ29weUNvbmRpdGlvbnMge1xuICBwdWJsaWMgbW9kaWZpZWQgPSAnJ1xuICBwdWJsaWMgdW5tb2RpZmllZCA9ICcnXG4gIHB1YmxpYyBtYXRjaEVUYWcgPSAnJ1xuICBwdWJsaWMgbWF0Y2hFVGFnRXhjZXB0ID0gJydcblxuICBzZXRNb2RpZmllZChkYXRlOiBEYXRlKTogdm9pZCB7XG4gICAgaWYgKCEoZGF0ZSBpbn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ElBQVUsRUFBUTtJQUM5QixJQUFJLEVBQUVBLElBQUksWUFBWUMsSUFBSSxDQUFDLEVBQUU7TUFDM0IsTUFBTSxJQUFJQyxTQUFTLENBQUMsMkJBQTJCLENBQUM7SUFDbEQ7SUFFQSxJQUFJLENBQUNOLFVBQVUsR0FBR0ksSUFBSSxDQUFDRyxXQUFXLENBQUMsQ0FBQztFQUN0QztFQUVBRSxZQUFZQSxDQUFDQyxJQUFZLEVBQVE7SUFDL0IsSUFBSSxDQUFDVCxTQUFTLEdBQUdTLElBQUk7RUFDdkI7RUFFQUMsa0JBQWtCQSxDQUFDRCxJQUFZLEVBQVE7SUFDckMsSUFBSSxDQUFDUixlQUFlLEdBQUdRLElBQUk7RUFDN0I7QUFDRjtBQUFDRSxPQUFBLENBQUFkLGNBQUEsR0FBQUEsY0FBQSJ9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1159:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var stream = _interopRequireWildcard(__nccwpck_require__(2781), true);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _response = __nccwpck_require__(2644);
|
|
var _xmlParser = __nccwpck_require__(4040);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
class Extensions {
|
|
constructor(client) {
|
|
this.client = client;
|
|
}
|
|
|
|
/**
|
|
* List the objects in the bucket using S3 ListObjects V2 With Metadata
|
|
*
|
|
* @param bucketName - name of the bucket
|
|
* @param prefix - the prefix of the objects that should be listed (optional, default `''`)
|
|
* @param recursive - `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/'. (optional, default `false`)
|
|
* @param startAfter - Specifies the key to start after when listing objects in a bucket. (optional, default `''`)
|
|
* @returns stream emitting the objects in the bucket, the object is of the format:
|
|
*/
|
|
listObjectsV2WithMetadata(bucketName, prefix, recursive, startAfter) {
|
|
if (prefix === undefined) {
|
|
prefix = '';
|
|
}
|
|
if (recursive === undefined) {
|
|
recursive = false;
|
|
}
|
|
if (startAfter === undefined) {
|
|
startAfter = '';
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidPrefix)(prefix)) {
|
|
throw new errors.InvalidPrefixError(`Invalid prefix : ${prefix}`);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isBoolean)(recursive)) {
|
|
throw new TypeError('recursive should be of type "boolean"');
|
|
}
|
|
if (!(0, _helper.isString)(startAfter)) {
|
|
throw new TypeError('startAfter should be of type "string"');
|
|
}
|
|
|
|
// if recursive is false set delimiter to '/'
|
|
const delimiter = recursive ? '' : '/';
|
|
return stream.Readable.from(this.listObjectsV2WithMetadataGen(bucketName, prefix, delimiter, startAfter), {
|
|
objectMode: true
|
|
});
|
|
}
|
|
async *listObjectsV2WithMetadataGen(bucketName, prefix, delimiter, startAfter) {
|
|
let ended = false;
|
|
let continuationToken = '';
|
|
do {
|
|
const result = await this.listObjectsV2WithMetadataQuery(bucketName, prefix, continuationToken, delimiter, startAfter);
|
|
ended = !result.isTruncated;
|
|
continuationToken = result.nextContinuationToken;
|
|
for (const obj of result.objects) {
|
|
yield obj;
|
|
}
|
|
} while (!ended);
|
|
}
|
|
async listObjectsV2WithMetadataQuery(bucketName, prefix, continuationToken, delimiter, startAfter) {
|
|
const queries = [];
|
|
|
|
// Call for listing objects v2 API
|
|
queries.push(`list-type=2`);
|
|
queries.push(`encoding-type=url`);
|
|
// escape every value in query string, except maxKeys
|
|
queries.push(`prefix=${(0, _helper.uriEscape)(prefix)}`);
|
|
queries.push(`delimiter=${(0, _helper.uriEscape)(delimiter)}`);
|
|
queries.push(`metadata=true`);
|
|
if (continuationToken) {
|
|
continuationToken = (0, _helper.uriEscape)(continuationToken);
|
|
queries.push(`continuation-token=${continuationToken}`);
|
|
}
|
|
// Set start-after
|
|
if (startAfter) {
|
|
startAfter = (0, _helper.uriEscape)(startAfter);
|
|
queries.push(`start-after=${startAfter}`);
|
|
}
|
|
queries.push(`max-keys=1000`);
|
|
queries.sort();
|
|
let query = '';
|
|
if (queries.length > 0) {
|
|
query = `${queries.join('&')}`;
|
|
}
|
|
const method = 'GET';
|
|
const res = await this.client.makeRequestAsync({
|
|
method,
|
|
bucketName,
|
|
query
|
|
});
|
|
return (0, _xmlParser.parseListObjectsV2WithMetadata)(await (0, _response.readAsString)(res));
|
|
}
|
|
}
|
|
exports.Extensions = Extensions;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzdHJlYW0iLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJlcnJvcnMiLCJfaGVscGVyIiwiX3Jlc3BvbnNlIiwiX3htbFBhcnNlciIsIl9nZXRSZXF1aXJlV2lsZGNhcmRDYWNoZSIsIm5vZGVJbnRlcm9wIiwiV2Vha01hcCIsImNhY2hlQmFiZWxJbnRlcm9wIiwiY2FjaGVOb2RlSW50ZXJvcCIsIm9iaiIsIl9fZXNNb2R1bGUiLCJkZWZhdWx0IiwiY2FjaGUiLCJoYXMiLCJnZXQiLCJuZXdPYmoiLCJoYXNQcm9wZXJ0eURlc2NyaXB0b3IiLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImdldE93blByb3BlcnR5RGVzY3JpcHRvciIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImRlc2MiLCJzZXQiLCJFeHRlbnNpb25zIiwiY29uc3RydWN0b3IiLCJjbGllbnQiLCJsaXN0T2JqZWN0c1YyV2l0aE1ldGFkYXRhIiwiYnVja2V0TmFtZSIsInByZWZpeCIsInJlY3Vyc2l2ZSIsInN0YXJ0QWZ0ZXIiLCJ1bmRlZmluZWQiLCJpc1ZhbGlkQnVja2V0TmFtZSIsIkludmFsaWRCdWNrZXROYW1lRXJyb3IiLCJpc1ZhbGlkUHJlZml4IiwiSW52YWxpZFByZWZpeEVycm9yIiwiaXNTdHJpbmciLCJUeXBlRXJyb3IiLCJpc0Jvb2xlYW4iLCJkZWxpbWl0ZXIiLCJSZWFkYWJsZSIsImZyb20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CQUFnQixDQUFDO01BQUVGLE1BQU07TUFBRS9CLFVBQVU7TUFBRTRCO0lBQU0sQ0FBQyxDQUFDO0lBQzdFLE9BQU8sSUFBQU0seUNBQThCLEVBQUMsTUFBTSxJQUFBQyxzQkFBWSxFQUFDSCxHQUFHLENBQUMsQ0FBQztFQUNoRTtBQUNGO0FBQUNJLE9BQUEsQ0FBQXhDLFVBQUEsR0FBQUEsVUFBQSJ9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9921:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.calculateEvenSplits = calculateEvenSplits;
|
|
exports.extractMetadata = extractMetadata;
|
|
exports.getEncryptionHeaders = getEncryptionHeaders;
|
|
exports.getScope = getScope;
|
|
exports.getSourceVersionId = getSourceVersionId;
|
|
exports.getVersionId = getVersionId;
|
|
exports.insertContentType = insertContentType;
|
|
exports.isAmazonEndpoint = isAmazonEndpoint;
|
|
exports.isAmzHeader = isAmzHeader;
|
|
exports.isBoolean = isBoolean;
|
|
exports.isDefined = isDefined;
|
|
exports.isEmpty = isEmpty;
|
|
exports.isEmptyObject = isEmptyObject;
|
|
exports.isFunction = isFunction;
|
|
exports.isNumber = isNumber;
|
|
exports.isObject = isObject;
|
|
exports.isReadableStream = isReadableStream;
|
|
exports.isStorageClassHeader = isStorageClassHeader;
|
|
exports.isString = isString;
|
|
exports.isSupportedHeader = isSupportedHeader;
|
|
exports.isValidBucketName = isValidBucketName;
|
|
exports.isValidDate = isValidDate;
|
|
exports.isValidDomain = isValidDomain;
|
|
exports.isValidEndpoint = isValidEndpoint;
|
|
exports.isValidIP = isValidIP;
|
|
exports.isValidObjectName = isValidObjectName;
|
|
exports.isValidPort = isValidPort;
|
|
exports.isValidPrefix = isValidPrefix;
|
|
exports.isVirtualHostStyle = isVirtualHostStyle;
|
|
exports.makeDateLong = makeDateLong;
|
|
exports.makeDateShort = makeDateShort;
|
|
exports.parseXml = parseXml;
|
|
exports.partsRequired = partsRequired;
|
|
exports.pipesetup = pipesetup;
|
|
exports.prependXAMZMeta = prependXAMZMeta;
|
|
exports.probeContentType = probeContentType;
|
|
exports.readableStream = readableStream;
|
|
exports.sanitizeETag = sanitizeETag;
|
|
exports.sanitizeObjectKey = sanitizeObjectKey;
|
|
exports.sanitizeSize = sanitizeSize;
|
|
exports.toArray = toArray;
|
|
exports.toMd5 = toMd5;
|
|
exports.toSha256 = toSha256;
|
|
exports.uriEscape = uriEscape;
|
|
exports.uriResourceEscape = uriResourceEscape;
|
|
var crypto = _interopRequireWildcard(__nccwpck_require__(6113), true);
|
|
var stream = _interopRequireWildcard(__nccwpck_require__(2781), true);
|
|
var _fastXmlParser = __nccwpck_require__(2603);
|
|
var _ipaddr = __nccwpck_require__(7263);
|
|
var _lodash = __nccwpck_require__(250);
|
|
var mime = _interopRequireWildcard(__nccwpck_require__(3583), true);
|
|
var _type = __nccwpck_require__(7293);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const MetaDataHeaderPrefix = 'x-amz-meta-';
|
|
|
|
/**
|
|
* All characters in string which are NOT unreserved should be percent encoded.
|
|
* Unreserved characters are : ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
* Reference https://tools.ietf.org/html/rfc3986#section-2.2
|
|
*/
|
|
function uriEscape(string) {
|
|
return string.split('').reduce((acc, elem) => {
|
|
const buf = Buffer.from(elem);
|
|
if (buf.length === 1) {
|
|
// length 1 indicates that elem is not a unicode character.
|
|
// Check if it is an unreserved characer.
|
|
if ('A' <= elem && elem <= 'Z' || 'a' <= elem && elem <= 'z' || '0' <= elem && elem <= '9' || elem === '_' || elem === '.' || elem === '~' || elem === '-') {
|
|
// Unreserved characer should not be encoded.
|
|
acc = acc + elem;
|
|
return acc;
|
|
}
|
|
}
|
|
// elem needs encoding - i.e elem should be encoded if it's not unreserved
|
|
// character or if it's a unicode character.
|
|
for (const char of buf) {
|
|
acc = acc + '%' + char.toString(16).toUpperCase();
|
|
}
|
|
return acc;
|
|
}, '');
|
|
}
|
|
function uriResourceEscape(string) {
|
|
return uriEscape(string).replace(/%2F/g, '/');
|
|
}
|
|
function getScope(region, date, serviceName = 's3') {
|
|
return `${makeDateShort(date)}/${region}/${serviceName}/aws4_request`;
|
|
}
|
|
|
|
/**
|
|
* isAmazonEndpoint - true if endpoint is 's3.amazonaws.com' or 's3.cn-north-1.amazonaws.com.cn'
|
|
*/
|
|
function isAmazonEndpoint(endpoint) {
|
|
return endpoint === 's3.amazonaws.com' || endpoint === 's3.cn-north-1.amazonaws.com.cn';
|
|
}
|
|
|
|
/**
|
|
* isVirtualHostStyle - verify if bucket name is support with virtual
|
|
* hosts. bucketNames with periods should be always treated as path
|
|
* style if the protocol is 'https:', this is due to SSL wildcard
|
|
* limitation. For all other buckets and Amazon S3 endpoint we will
|
|
* default to virtual host style.
|
|
*/
|
|
function isVirtualHostStyle(endpoint, protocol, bucket, pathStyle) {
|
|
if (protocol === 'https:' && bucket.includes('.')) {
|
|
return false;
|
|
}
|
|
return isAmazonEndpoint(endpoint) || !pathStyle;
|
|
}
|
|
function isValidIP(ip) {
|
|
return _ipaddr.isValid(ip);
|
|
}
|
|
|
|
/**
|
|
* @returns if endpoint is valid domain.
|
|
*/
|
|
function isValidEndpoint(endpoint) {
|
|
return isValidDomain(endpoint) || isValidIP(endpoint);
|
|
}
|
|
|
|
/**
|
|
* @returns if input host is a valid domain.
|
|
*/
|
|
function isValidDomain(host) {
|
|
if (!isString(host)) {
|
|
return false;
|
|
}
|
|
// See RFC 1035, RFC 3696.
|
|
if (host.length === 0 || host.length > 255) {
|
|
return false;
|
|
}
|
|
// Host cannot start or end with a '-'
|
|
if (host[0] === '-' || host.slice(-1) === '-') {
|
|
return false;
|
|
}
|
|
// Host cannot start or end with a '_'
|
|
if (host[0] === '_' || host.slice(-1) === '_') {
|
|
return false;
|
|
}
|
|
// Host cannot start with a '.'
|
|
if (host[0] === '.') {
|
|
return false;
|
|
}
|
|
const alphaNumerics = '`~!@#$%^&*()+={}[]|\\"\';:><?/';
|
|
// All non alphanumeric characters are invalid.
|
|
for (const char of alphaNumerics) {
|
|
if (host.includes(char)) {
|
|
return false;
|
|
}
|
|
}
|
|
// No need to regexp match, since the list is non-exhaustive.
|
|
// We let it be valid and fail later.
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Probes contentType using file extensions.
|
|
*
|
|
* @example
|
|
* ```
|
|
* // return 'image/png'
|
|
* probeContentType('file.png')
|
|
* ```
|
|
*/
|
|
function probeContentType(path) {
|
|
let contentType = mime.lookup(path);
|
|
if (!contentType) {
|
|
contentType = 'application/octet-stream';
|
|
}
|
|
return contentType;
|
|
}
|
|
|
|
/**
|
|
* is input port valid.
|
|
*/
|
|
function isValidPort(port) {
|
|
// verify if port is a number.
|
|
if (!isNumber(port)) {
|
|
return false;
|
|
}
|
|
|
|
// port `0` is valid and special case
|
|
return 0 <= port && port <= 65535;
|
|
}
|
|
function isValidBucketName(bucket) {
|
|
if (!isString(bucket)) {
|
|
return false;
|
|
}
|
|
|
|
// bucket length should be less than and no more than 63
|
|
// characters long.
|
|
if (bucket.length < 3 || bucket.length > 63) {
|
|
return false;
|
|
}
|
|
// bucket with successive periods is invalid.
|
|
if (bucket.includes('..')) {
|
|
return false;
|
|
}
|
|
// bucket cannot have ip address style.
|
|
if (/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/.test(bucket)) {
|
|
return false;
|
|
}
|
|
// bucket should begin with alphabet/number and end with alphabet/number,
|
|
// with alphabet/number/.- in the middle.
|
|
if (/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/.test(bucket)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* check if objectName is a valid object name
|
|
*/
|
|
function isValidObjectName(objectName) {
|
|
if (!isValidPrefix(objectName)) {
|
|
return false;
|
|
}
|
|
return objectName.length !== 0;
|
|
}
|
|
|
|
/**
|
|
* check if prefix is valid
|
|
*/
|
|
function isValidPrefix(prefix) {
|
|
if (!isString(prefix)) {
|
|
return false;
|
|
}
|
|
if (prefix.length > 1024) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* check if typeof arg number
|
|
*/
|
|
function isNumber(arg) {
|
|
return typeof arg === 'number';
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
/**
|
|
* check if typeof arg function
|
|
*/
|
|
function isFunction(arg) {
|
|
return typeof arg === 'function';
|
|
}
|
|
|
|
/**
|
|
* check if typeof arg string
|
|
*/
|
|
function isString(arg) {
|
|
return typeof arg === 'string';
|
|
}
|
|
|
|
/**
|
|
* check if typeof arg object
|
|
*/
|
|
function isObject(arg) {
|
|
return typeof arg === 'object' && arg !== null;
|
|
}
|
|
|
|
/**
|
|
* check if object is readable stream
|
|
*/
|
|
function isReadableStream(arg) {
|
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
return isObject(arg) && isFunction(arg._read);
|
|
}
|
|
|
|
/**
|
|
* check if arg is boolean
|
|
*/
|
|
function isBoolean(arg) {
|
|
return typeof arg === 'boolean';
|
|
}
|
|
function isEmpty(o) {
|
|
return _lodash.isEmpty(o);
|
|
}
|
|
function isEmptyObject(o) {
|
|
return Object.values(o).filter(x => x !== undefined).length !== 0;
|
|
}
|
|
function isDefined(o) {
|
|
return o !== null && o !== undefined;
|
|
}
|
|
|
|
/**
|
|
* check if arg is a valid date
|
|
*/
|
|
function isValidDate(arg) {
|
|
// @ts-expect-error checknew Date(Math.NaN)
|
|
return arg instanceof Date && !isNaN(arg);
|
|
}
|
|
|
|
/**
|
|
* Create a Date string with format: 'YYYYMMDDTHHmmss' + Z
|
|
*/
|
|
function makeDateLong(date) {
|
|
date = date || new Date();
|
|
|
|
// Gives format like: '2017-08-07T16:28:59.889Z'
|
|
const s = date.toISOString();
|
|
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) + s.slice(14, 16) + s.slice(17, 19) + 'Z';
|
|
}
|
|
|
|
/**
|
|
* Create a Date string with format: 'YYYYMMDD'
|
|
*/
|
|
function makeDateShort(date) {
|
|
date = date || new Date();
|
|
|
|
// Gives format like: '2017-08-07T16:28:59.889Z'
|
|
const s = date.toISOString();
|
|
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 10);
|
|
}
|
|
|
|
/**
|
|
* pipesetup sets up pipe() from left to right os streams array
|
|
* pipesetup will also make sure that error emitted at any of the upstream Stream
|
|
* will be emitted at the last stream. This makes error handling simple
|
|
*/
|
|
function pipesetup(...streams) {
|
|
// @ts-expect-error ts can't narrow this
|
|
return streams.reduce((src, dst) => {
|
|
src.on('error', err => dst.emit('error', err));
|
|
return src.pipe(dst);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* return a Readable stream that emits data
|
|
*/
|
|
function readableStream(data) {
|
|
const s = new stream.Readable();
|
|
s._read = () => {};
|
|
s.push(data);
|
|
s.push(null);
|
|
return s;
|
|
}
|
|
|
|
/**
|
|
* Process metadata to insert appropriate value to `content-type` attribute
|
|
*/
|
|
function insertContentType(metaData, filePath) {
|
|
// check if content-type attribute present in metaData
|
|
for (const key in metaData) {
|
|
if (key.toLowerCase() === 'content-type') {
|
|
return metaData;
|
|
}
|
|
}
|
|
|
|
// if `content-type` attribute is not present in metadata, then infer it from the extension in filePath
|
|
return {
|
|
...metaData,
|
|
'content-type': probeContentType(filePath)
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Function prepends metadata with the appropriate prefix if it is not already on
|
|
*/
|
|
function prependXAMZMeta(metaData) {
|
|
if (!metaData) {
|
|
return {};
|
|
}
|
|
return _lodash.mapKeys(metaData, (value, key) => {
|
|
if (isAmzHeader(key) || isSupportedHeader(key) || isStorageClassHeader(key)) {
|
|
return key;
|
|
}
|
|
return MetaDataHeaderPrefix + key;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Checks if it is a valid header according to the AmazonS3 API
|
|
*/
|
|
function isAmzHeader(key) {
|
|
const temp = key.toLowerCase();
|
|
return temp.startsWith(MetaDataHeaderPrefix) || temp === 'x-amz-acl' || temp.startsWith('x-amz-server-side-encryption-') || temp === 'x-amz-server-side-encryption';
|
|
}
|
|
|
|
/**
|
|
* Checks if it is a supported Header
|
|
*/
|
|
function isSupportedHeader(key) {
|
|
const supported_headers = ['content-type', 'cache-control', 'content-encoding', 'content-disposition', 'content-language', 'x-amz-website-redirect-location'];
|
|
return supported_headers.includes(key.toLowerCase());
|
|
}
|
|
|
|
/**
|
|
* Checks if it is a storage header
|
|
*/
|
|
function isStorageClassHeader(key) {
|
|
return key.toLowerCase() === 'x-amz-storage-class';
|
|
}
|
|
function extractMetadata(headers) {
|
|
return _lodash.mapKeys(_lodash.pickBy(headers, (value, key) => isSupportedHeader(key) || isStorageClassHeader(key) || isAmzHeader(key)), (value, key) => {
|
|
const lower = key.toLowerCase();
|
|
if (lower.startsWith(MetaDataHeaderPrefix)) {
|
|
return lower.slice(MetaDataHeaderPrefix.length);
|
|
}
|
|
return key;
|
|
});
|
|
}
|
|
function getVersionId(headers = {}) {
|
|
return headers['x-amz-version-id'] || null;
|
|
}
|
|
function getSourceVersionId(headers = {}) {
|
|
return headers['x-amz-copy-source-version-id'] || null;
|
|
}
|
|
function sanitizeETag(etag = '') {
|
|
const replaceChars = {
|
|
'"': '',
|
|
'"': '',
|
|
'"': '',
|
|
'"': '',
|
|
'"': ''
|
|
};
|
|
return etag.replace(/^("|"|")|("|"|")$/g, m => replaceChars[m]);
|
|
}
|
|
function toMd5(payload) {
|
|
// use string from browser and buffer from nodejs
|
|
// browser support is tested only against minio server
|
|
return crypto.createHash('md5').update(Buffer.from(payload)).digest().toString('base64');
|
|
}
|
|
function toSha256(payload) {
|
|
return crypto.createHash('sha256').update(payload).digest('hex');
|
|
}
|
|
|
|
/**
|
|
* toArray returns a single element array with param being the element,
|
|
* if param is just a string, and returns 'param' back if it is an array
|
|
* So, it makes sure param is always an array
|
|
*/
|
|
function toArray(param) {
|
|
if (!Array.isArray(param)) {
|
|
return [param];
|
|
}
|
|
return param;
|
|
}
|
|
function sanitizeObjectKey(objectName) {
|
|
// + symbol characters are not decoded as spaces in JS. so replace them first and decode to get the correct result.
|
|
const asStrName = (objectName ? objectName.toString() : '').replace(/\+/g, ' ');
|
|
return decodeURIComponent(asStrName);
|
|
}
|
|
function sanitizeSize(size) {
|
|
return size ? Number.parseInt(size) : undefined;
|
|
}
|
|
const PART_CONSTRAINTS = {
|
|
// absMinPartSize - absolute minimum part size (5 MiB)
|
|
ABS_MIN_PART_SIZE: 1024 * 1024 * 5,
|
|
// MIN_PART_SIZE - minimum part size 16MiB per object after which
|
|
MIN_PART_SIZE: 1024 * 1024 * 16,
|
|
// MAX_PARTS_COUNT - maximum number of parts for a single multipart session.
|
|
MAX_PARTS_COUNT: 10000,
|
|
// MAX_PART_SIZE - maximum part size 5GiB for a single multipart upload
|
|
// operation.
|
|
MAX_PART_SIZE: 1024 * 1024 * 1024 * 5,
|
|
// MAX_SINGLE_PUT_OBJECT_SIZE - maximum size 5GiB of object per PUT
|
|
// operation.
|
|
MAX_SINGLE_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 5,
|
|
// MAX_MULTIPART_PUT_OBJECT_SIZE - maximum size 5TiB of object for
|
|
// Multipart operation.
|
|
MAX_MULTIPART_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 1024 * 5
|
|
};
|
|
exports.PART_CONSTRAINTS = PART_CONSTRAINTS;
|
|
const GENERIC_SSE_HEADER = 'X-Amz-Server-Side-Encryption';
|
|
const ENCRYPTION_HEADERS = {
|
|
// sseGenericHeader is the AWS SSE header used for SSE-S3 and SSE-KMS.
|
|
sseGenericHeader: GENERIC_SSE_HEADER,
|
|
// sseKmsKeyID is the AWS SSE-KMS key id.
|
|
sseKmsKeyID: GENERIC_SSE_HEADER + '-Aws-Kms-Key-Id'
|
|
};
|
|
|
|
/**
|
|
* Return Encryption headers
|
|
* @param encConfig
|
|
* @returns an object with key value pairs that can be used in headers.
|
|
*/
|
|
function getEncryptionHeaders(encConfig) {
|
|
const encType = encConfig.type;
|
|
if (!isEmpty(encType)) {
|
|
if (encType === _type.ENCRYPTION_TYPES.SSEC) {
|
|
return {
|
|
[ENCRYPTION_HEADERS.sseGenericHeader]: 'AES256'
|
|
};
|
|
} else if (encType === _type.ENCRYPTION_TYPES.KMS) {
|
|
return {
|
|
[ENCRYPTION_HEADERS.sseGenericHeader]: encConfig.SSEAlgorithm,
|
|
[ENCRYPTION_HEADERS.sseKmsKeyID]: encConfig.KMSMasterKeyID
|
|
};
|
|
}
|
|
}
|
|
return {};
|
|
}
|
|
function partsRequired(size) {
|
|
const maxPartSize = PART_CONSTRAINTS.MAX_MULTIPART_PUT_OBJECT_SIZE / (PART_CONSTRAINTS.MAX_PARTS_COUNT - 1);
|
|
let requiredPartSize = size / maxPartSize;
|
|
if (size % maxPartSize > 0) {
|
|
requiredPartSize++;
|
|
}
|
|
requiredPartSize = Math.trunc(requiredPartSize);
|
|
return requiredPartSize;
|
|
}
|
|
|
|
/**
|
|
* calculateEvenSplits - computes splits for a source and returns
|
|
* start and end index slices. Splits happen evenly to be sure that no
|
|
* part is less than 5MiB, as that could fail the multipart request if
|
|
* it is not the last part.
|
|
*/
|
|
function calculateEvenSplits(size, objInfo) {
|
|
if (size === 0) {
|
|
return null;
|
|
}
|
|
const reqParts = partsRequired(size);
|
|
const startIndexParts = [];
|
|
const endIndexParts = [];
|
|
let start = objInfo.Start;
|
|
if (isEmpty(start) || start === -1) {
|
|
start = 0;
|
|
}
|
|
const divisorValue = Math.trunc(size / reqParts);
|
|
const reminderValue = size % reqParts;
|
|
let nextStart = start;
|
|
for (let i = 0; i < reqParts; i++) {
|
|
let curPartSize = divisorValue;
|
|
if (i < reminderValue) {
|
|
curPartSize++;
|
|
}
|
|
const currentStart = nextStart;
|
|
const currentEnd = currentStart + curPartSize - 1;
|
|
nextStart = currentEnd + 1;
|
|
startIndexParts.push(currentStart);
|
|
endIndexParts.push(currentEnd);
|
|
}
|
|
return {
|
|
startIndex: startIndexParts,
|
|
endIndex: endIndexParts,
|
|
objInfo: objInfo
|
|
};
|
|
}
|
|
const fxp = new _fastXmlParser.XMLParser();
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
function parseXml(xml) {
|
|
const result = fxp.parse(xml);
|
|
if (result.Error) {
|
|
throw result.Error;
|
|
}
|
|
return result;
|
|
}
|
|
//#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08sU0FBU0MsUUFBUUEsQ0FBQ0MsR0FBVyxFQUFPO0VBQ3pDLE1BQU1DLE1BQU0sR0FBR0osR0FBRyxDQUFDSyxLQUFLLENBQUNGLEdBQUcsQ0FBQztFQUM3QixJQUFJQyxNQUFNLENBQUNFLEtBQUssRUFBRTtJQUNoQixNQUFNRixNQUFNLENBQUNFLEtBQUs7RUFDcEI7RUFFQSxPQUFPRixNQUFNO0FBQ2YifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3925:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
// Build PostPolicy object that can be signed by presignedPostPolicy
|
|
|
|
class PostPolicy {
|
|
policy = {
|
|
conditions: []
|
|
};
|
|
formData = {};
|
|
|
|
// set expiration date
|
|
setExpires(date) {
|
|
if (!date) {
|
|
throw new errors.InvalidDateError('Invalid date: cannot be null');
|
|
}
|
|
this.policy.expiration = date.toISOString();
|
|
}
|
|
|
|
// set object name
|
|
setKey(objectName) {
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name : ${objectName}`);
|
|
}
|
|
this.policy.conditions.push(['eq', '$key', objectName]);
|
|
this.formData.key = objectName;
|
|
}
|
|
|
|
// set object name prefix, i.e policy allows any keys with this prefix
|
|
setKeyStartsWith(prefix) {
|
|
if (!(0, _helper.isValidPrefix)(prefix)) {
|
|
throw new errors.InvalidPrefixError(`Invalid prefix : ${prefix}`);
|
|
}
|
|
this.policy.conditions.push(['starts-with', '$key', prefix]);
|
|
this.formData.key = prefix;
|
|
}
|
|
|
|
// set bucket name
|
|
setBucket(bucketName) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name : ${bucketName}`);
|
|
}
|
|
this.policy.conditions.push(['eq', '$bucket', bucketName]);
|
|
this.formData.bucket = bucketName;
|
|
}
|
|
|
|
// set Content-Type
|
|
setContentType(type) {
|
|
if (!type) {
|
|
throw new Error('content-type cannot be null');
|
|
}
|
|
this.policy.conditions.push(['eq', '$Content-Type', type]);
|
|
this.formData['Content-Type'] = type;
|
|
}
|
|
|
|
// set Content-Type prefix, i.e image/ allows any image
|
|
setContentTypeStartsWith(prefix) {
|
|
if (!prefix) {
|
|
throw new Error('content-type cannot be null');
|
|
}
|
|
this.policy.conditions.push(['starts-with', '$Content-Type', prefix]);
|
|
this.formData['Content-Type'] = prefix;
|
|
}
|
|
|
|
// set Content-Disposition
|
|
setContentDisposition(value) {
|
|
if (!value) {
|
|
throw new Error('content-disposition cannot be null');
|
|
}
|
|
this.policy.conditions.push(['eq', '$Content-Disposition', value]);
|
|
this.formData['Content-Disposition'] = value;
|
|
}
|
|
|
|
// set minimum/maximum length of what Content-Length can be.
|
|
setContentLengthRange(min, max) {
|
|
if (min > max) {
|
|
throw new Error('min cannot be more than max');
|
|
}
|
|
if (min < 0) {
|
|
throw new Error('min should be > 0');
|
|
}
|
|
if (max < 0) {
|
|
throw new Error('max should be > 0');
|
|
}
|
|
this.policy.conditions.push(['content-length-range', min, max]);
|
|
}
|
|
|
|
// set user defined metadata
|
|
setUserMetaData(metaData) {
|
|
if (!(0, _helper.isObject)(metaData)) {
|
|
throw new TypeError('metadata should be of type "object"');
|
|
}
|
|
Object.entries(metaData).forEach(([key, value]) => {
|
|
const amzMetaDataKey = `x-amz-meta-${key}`;
|
|
this.policy.conditions.push(['eq', `$${amzMetaDataKey}`, value]);
|
|
this.formData[amzMetaDataKey] = value.toString();
|
|
});
|
|
}
|
|
}
|
|
exports.PostPolicy = PostPolicy;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJlcnJvcnMiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfaGVscGVyIiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwibm9kZUludGVyb3AiLCJXZWFrTWFwIiwiY2FjaGVCYWJlbEludGVyb3AiLCJjYWNoZU5vZGVJbnRlcm9wIiwib2JqIiwiX19lc01vZHVsZSIsImRlZmF1bHQiLCJjYWNoZSIsImhhcyIsImdldCIsIm5ld09iaiIsImhhc1Byb3BlcnR5RGVzY3JpcHRvciIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwia2V5IiwicHJvdG90eXBlIiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZGVzYyIsInNldCIsIlBvc3RQb2xpY3kiLCJwb2xpY3kiLCJjb25kaXRpb25zIiwiZm9ybURhdGEiLCJzZXRFeHBpcmVzIiwiZGF0ZSIsIkludmFsaWREYXRlRXJyb3IiLCJleHBpcmF0aW9uIiwidG9JU09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BQUM7SUFDNUQ7SUFDQTVDLE1BQU0sQ0FBQzZDLE9BQU8sQ0FBQ0gsUUFBUSxDQUFDLENBQUNJLE9BQU8sQ0FBQyxDQUFDLENBQUMzQyxHQUFHLEVBQUVrQyxLQUFLLENBQUMsS0FBSztNQUNqRCxNQUFNVSxjQUFjLEdBQUksY0FBYTVDLEdBQUksRUFBQztNQUMxQyxJQUFJLENBQUNPLE1BQU0sQ0FBQ0MsVUFBVSxDQUFDVyxJQUFJLENBQUMsQ0FBQyxJQUFJLEVBQUcsSUFBR3lCLGNBQWUsRUFBQyxFQUFFVixLQUFLLENBQUMsQ0FBQztNQUNoRSxJQUFJLENBQUN6QixRQUFRLENBQUNtQyxjQUFjLENBQUMsR0FBR1YsS0FBSyxDQUFDVyxRQUFRLENBQUMsQ0FBQztJQUNsRCxDQUFDLENBQUM7RUFDSjtBQUNGO0FBQUNDLE9BQUEsQ0FBQXhDLFVBQUEsR0FBQUEsVUFBQSJ9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9093:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.request = request;
|
|
var _stream = __nccwpck_require__(2781);
|
|
async function request(transport, opt, body = null) {
|
|
return new Promise((resolve, reject) => {
|
|
const requestObj = transport.request(opt, resp => {
|
|
resolve(resp);
|
|
});
|
|
if (!body || Buffer.isBuffer(body) || typeof body === 'string') {
|
|
requestObj.on('error', e => {
|
|
reject(e);
|
|
}).end(body);
|
|
return;
|
|
}
|
|
|
|
// pump readable stream
|
|
(0, _stream.pipeline)(body, requestObj, err => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfc3RyZWFtIiwicmVxdWlyZSIsInJlcXVlc3QiLCJ0cm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FHLElBQUs7TUFDbEMsSUFBSUEsR0FBRyxFQUFFO1FBQ1BULE1BQU0sQ0FBQ1MsR0FBRyxDQUFDO01BQ2I7SUFDRixDQUFDLENBQUM7RUFDSixDQUFDLENBQUM7QUFDSiJ9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2644:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.drainResponse = drainResponse;
|
|
exports.readAsBuffer = readAsBuffer;
|
|
exports.readAsString = readAsString;
|
|
async function readAsBuffer(res) {
|
|
return new Promise((resolve, reject) => {
|
|
const body = [];
|
|
res.on('data', chunk => body.push(chunk)).on('error', e => reject(e)).on('end', () => resolve(Buffer.concat(body)));
|
|
});
|
|
}
|
|
async function readAsString(res) {
|
|
const body = await readAsBuffer(res);
|
|
return body.toString();
|
|
}
|
|
async function drainResponse(res) {
|
|
return new Promise((resolve, reject) => {
|
|
res.on('data', () => {}).on('error', e => reject(e)).on('end', () => resolve());
|
|
});
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZWFkQXNCdWZmZXIiLCJyZXMiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsImJvZHkiLCJvbiIsImNodW5rIiwicHVzaCIsImUiLCJCdWZmZXIiLCJjb25jYXQiLCJyZWFkQXNTdHJpbmciLCJ0b1N0cmluZyIsImRyYWluUmVzcG9uc2UiXSwic291cmNlcyI6WyJyZXNwb25zZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSBodHRwIGZyb20gJ25vZGU6aHR0cCdcbmltcG9ydCB0eXBlIHN0cmVhbSBmcm9tICdub2RlOnN0cmVhbSdcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIHJlYWRBc0J1ZmZlcihyZXM6IHN0cmVhbS5SZWFkYW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yxFQUFFLENBQUMsTUFBTSxFQUFHQyxLQUFhLElBQUtGLElBQUksQ0FBQ0csSUFBSSxDQUFDRCxLQUFLLENBQUMsQ0FBQyxDQUMvQ0QsRUFBRSxDQUFDLE9BQU8sRUFBR0csQ0FBQyxJQUFLTCxNQUFNLENBQUNLLENBQUMsQ0FBQyxDQUFDLENBQzdCSCxFQUFFLENBQUMsS0FBSyxFQUFFLE1BQU1ILE9BQU8sQ0FBQ08sTUFBTSxDQUFDQyxNQUFNLENBQUNOLElBQUksQ0FBQyxDQUFDLENBQUM7RUFDbEQsQ0FBQyxDQUFDO0FBQ0o7QUFFTyxlQUFlTyxZQUFZQSxDQUFDWCxHQUF5QixFQUFtQjtFQUM3RSxNQUFNSSxJQUFJLEdBQUcsTUFBTUwsWUFBWSxDQUFDQyxHQUFHLENBQUM7RUFDcEMsT0FBT0ksSUFBSSxDQUFDUSxRQUFRLENBQUMsQ0FBQztBQUN4QjtBQUVPLGVBQWVDLGFBQWFBLENBQUNiLEdBQW9CLEVBQWlCO0VBQ3ZFLE9BQU8sSUFBSUMsT0FBTyxDQUFDLENBQUNDLE9BQU8sRUFBRUMsTUFBTSxLQUFLO0lBQ3RDSCxHQUFHLENBQ0FLLEVBQUUsQ0FBQyxNQUFNLEVBQUUsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUNwQkEsRUFBRSxDQUFDLE9BQU8sRUFBR0csQ0FBQyxJQUFLTCxNQUFNLENBQUNLLENBQUMsQ0FBQyxDQUFDLENBQzdCSCxFQUFFLENBQUMsS0FBSyxFQUFFLE1BQU1ILE9BQU8sQ0FBQyxDQUFDLENBQUM7RUFDL0IsQ0FBQyxDQUFDO0FBQ0oifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6314:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.getS3Endpoint = getS3Endpoint;
|
|
var _helper = __nccwpck_require__(9921);
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015, 2016 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// List of currently supported endpoints.
|
|
const awsS3Endpoint = {
|
|
'us-east-1': 's3.amazonaws.com',
|
|
'us-east-2': 's3-us-east-2.amazonaws.com',
|
|
'us-west-1': 's3-us-west-1.amazonaws.com',
|
|
'us-west-2': 's3-us-west-2.amazonaws.com',
|
|
'ca-central-1': 's3.ca-central-1.amazonaws.com',
|
|
'eu-west-1': 's3-eu-west-1.amazonaws.com',
|
|
'eu-west-2': 's3-eu-west-2.amazonaws.com',
|
|
'sa-east-1': 's3-sa-east-1.amazonaws.com',
|
|
'eu-central-1': 's3-eu-central-1.amazonaws.com',
|
|
'ap-south-1': 's3-ap-south-1.amazonaws.com',
|
|
'ap-southeast-1': 's3-ap-southeast-1.amazonaws.com',
|
|
'ap-southeast-2': 's3-ap-southeast-2.amazonaws.com',
|
|
'ap-northeast-1': 's3-ap-northeast-1.amazonaws.com',
|
|
'cn-north-1': 's3.cn-north-1.amazonaws.com.cn',
|
|
'ap-east-1': 's3.ap-east-1.amazonaws.com',
|
|
'eu-north-1': 's3.eu-north-1.amazonaws.com'
|
|
// Add new endpoints here.
|
|
};
|
|
|
|
// getS3Endpoint get relevant endpoint for the region.
|
|
function getS3Endpoint(region) {
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError(`Invalid region: ${region}`);
|
|
}
|
|
const endpoint = awsS3Endpoint[region];
|
|
if (endpoint) {
|
|
return endpoint;
|
|
}
|
|
return 's3.amazonaws.com';
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfaGVscGVyIiwicmVxdWlyZSIsImF3c1MzRW5kcG9pbnQiLCJnZXRTM0VuZHBvaW50IiwicmVnaW9uIiwiaXNTdHJpbmciLCJUeXBlRXJyb3IiLCJlbmRwb2ludCJdLCJzb3VyY2VzIjpbInMzLWVuZHBvaW50cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogTWluSU8gSmF2YXNjcmlwdCBMaWJyYXJ5IGZvciBBbWF6b24gUzMgQ29tcGF0aWJsZSBDbG91ZCBTdG9yYWdlLCAoQykgMjAxNSwgMjAxNiBNaW5JTywgSW5jLlxuICpcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSBcIkxpY2Vuc2VcIik7XG4gKiB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuXG4gKiBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXRcbiAqXG4gKiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wXG4gKlxuICogVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZVxuICogZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gXCJBUyBJU1wiIEJBU0lTLFxuICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZ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QyxhQUFhLEdBQUc7RUFDcEIsV0FBVyxFQUFFLGtCQUFrQjtFQUMvQixXQUFXLEVBQUUsNEJBQTRCO0VBQ3pDLFdBQVcsRUFBRSw0QkFBNEI7RUFDekMsV0FBVyxFQUFFLDRCQUE0QjtFQUN6QyxjQUFjLEVBQUUsK0JBQStCO0VBQy9DLFdBQVcsRUFBRSw0QkFBNEI7RUFDekMsV0FBVyxFQUFFLDRCQUE0QjtFQUN6QyxXQUFXLEVBQUUsNEJBQTRCO0VBQ3pDLGNBQWMsRUFBRSwrQkFBK0I7RUFDL0MsWUFBWSxFQUFFLDZCQUE2QjtFQUMzQyxnQkFBZ0IsRUFBRSxpQ0FBaUM7RUFDbkQsZ0JBQWdCLEVBQUUsaUNBQWlDO0VBQ25ELGdCQUFnQixFQUFFLGlDQUFpQztFQUNuRCxZQUFZLEVBQUUsZ0NBQWdDO0VBQzlDLFdBQVcsRUFBRSw0QkFBNEI7RUFDekMsWUFBWSxFQUFFO0VBQ2Q7QUFDRixDQUFDOztBQUlEO0FBQ08sU0FBU0MsYUFBYUEsQ0FBQ0MsTUFBYyxFQUFVO0VBQ3BELElBQUksQ0FBQyxJQUFBQyxnQkFBUSxFQUFDRCxNQUFNLENBQUMsRUFBRTtJQUNyQixNQUFNLElBQUlFLFNBQVMsQ0FBRSxtQkFBa0JGLE1BQU8sRUFBQyxDQUFDO0VBQ2xEO0VBRUEsTUFBTUcsUUFBUSxHQUFJTCxhQUFhLENBQTRCRSxNQUFNLENBQUM7RUFDbEUsSUFBSUcsUUFBUSxFQUFFO0lBQ1osT0FBT0EsUUFBUTtFQUNqQjtFQUNBLE9BQU8sa0JBQWtCO0FBQzNCIn0=
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7293:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
// nodejs IncomingHttpHeaders is Record<string, string | string[]>, but it's actually this:
|
|
let ENCRYPTION_TYPES = /*#__PURE__*/function (ENCRYPTION_TYPES) {
|
|
ENCRYPTION_TYPES["SSEC"] = "SSE-C";
|
|
ENCRYPTION_TYPES["KMS"] = "KMS";
|
|
return ENCRYPTION_TYPES;
|
|
}({});
|
|
exports.ENCRYPTION_TYPES = ENCRYPTION_TYPES;
|
|
let RETENTION_MODES = /*#__PURE__*/function (RETENTION_MODES) {
|
|
RETENTION_MODES["GOVERNANCE"] = "GOVERNANCE";
|
|
RETENTION_MODES["COMPLIANCE"] = "COMPLIANCE";
|
|
return RETENTION_MODES;
|
|
}({});
|
|
exports.RETENTION_MODES = RETENTION_MODES;
|
|
let RETENTION_VALIDITY_UNITS = /*#__PURE__*/function (RETENTION_VALIDITY_UNITS) {
|
|
RETENTION_VALIDITY_UNITS["DAYS"] = "Days";
|
|
RETENTION_VALIDITY_UNITS["YEARS"] = "Years";
|
|
return RETENTION_VALIDITY_UNITS;
|
|
}({});
|
|
exports.RETENTION_VALIDITY_UNITS = RETENTION_VALIDITY_UNITS;
|
|
let LEGAL_HOLD_STATUS = /*#__PURE__*/function (LEGAL_HOLD_STATUS) {
|
|
LEGAL_HOLD_STATUS["ENABLED"] = "ON";
|
|
LEGAL_HOLD_STATUS["DISABLED"] = "OFF";
|
|
return LEGAL_HOLD_STATUS;
|
|
}({});
|
|
/* Replication Config types */
|
|
/* Replication Config types */
|
|
exports.LEGAL_HOLD_STATUS = LEGAL_HOLD_STATUS;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFTkNSWVBUSU9OX1RZUEVTIiwiZXhwb3J0cyIsIlJFVEVOVElPTl9NT0RFUyIsIlJFVEVOVElPTl9WQUxJRElUWV9VTklUUyIsIkxFR0FMX0hPTERfU1RBVFVTIl0sInNvdXJjZXMiOlsidHlwZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSAqIGFzIGh0dHAgZnJvbS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9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4040:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.parseBucketRegion = parseBucketRegion;
|
|
exports.parseError = parseError;
|
|
exports.parseInitiateMultipart = parseInitiateMultipart;
|
|
exports.parseListBucket = parseListBucket;
|
|
exports.parseListObjectsV2WithMetadata = parseListObjectsV2WithMetadata;
|
|
exports.parseListParts = parseListParts;
|
|
exports.parseReplicationConfig = parseReplicationConfig;
|
|
exports.parseResponseError = parseResponseError;
|
|
var _fastXmlParser = __nccwpck_require__(2603);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _response = __nccwpck_require__(2644);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
// parse XML response for bucket region
|
|
function parseBucketRegion(xml) {
|
|
// return region information
|
|
return (0, _helper.parseXml)(xml).LocationConstraint;
|
|
}
|
|
const fxp = new _fastXmlParser.XMLParser();
|
|
|
|
// Parse XML and return information as Javascript types
|
|
// parse error XML response
|
|
function parseError(xml, headerInfo) {
|
|
let xmlErr = {};
|
|
const xmlObj = fxp.parse(xml);
|
|
if (xmlObj.Error) {
|
|
xmlErr = xmlObj.Error;
|
|
}
|
|
const e = new errors.S3Error();
|
|
Object.entries(xmlErr).forEach(([key, value]) => {
|
|
e[key.toLowerCase()] = value;
|
|
});
|
|
Object.entries(headerInfo).forEach(([key, value]) => {
|
|
e[key] = value;
|
|
});
|
|
return e;
|
|
}
|
|
|
|
// Generates an Error object depending on http statusCode and XML body
|
|
async function parseResponseError(response) {
|
|
const statusCode = response.statusCode;
|
|
let code, message;
|
|
if (statusCode === 301) {
|
|
code = 'MovedPermanently';
|
|
message = 'Moved Permanently';
|
|
} else if (statusCode === 307) {
|
|
code = 'TemporaryRedirect';
|
|
message = 'Are you using the correct endpoint URL?';
|
|
} else if (statusCode === 403) {
|
|
code = 'AccessDenied';
|
|
message = 'Valid and authorized credentials required';
|
|
} else if (statusCode === 404) {
|
|
code = 'NotFound';
|
|
message = 'Not Found';
|
|
} else if (statusCode === 405) {
|
|
code = 'MethodNotAllowed';
|
|
message = 'Method Not Allowed';
|
|
} else if (statusCode === 501) {
|
|
code = 'MethodNotAllowed';
|
|
message = 'Method Not Allowed';
|
|
} else {
|
|
code = 'UnknownError';
|
|
message = `${statusCode}`;
|
|
}
|
|
const headerInfo = {};
|
|
// A value created by S3 compatible server that uniquely identifies the request.
|
|
headerInfo.amzRequestid = response.headers['x-amz-request-id'];
|
|
// A special token that helps troubleshoot API replies and issues.
|
|
headerInfo.amzId2 = response.headers['x-amz-id-2'];
|
|
|
|
// Region where the bucket is located. This header is returned only
|
|
// in HEAD bucket and ListObjects response.
|
|
headerInfo.amzBucketRegion = response.headers['x-amz-bucket-region'];
|
|
const xmlString = await (0, _response.readAsString)(response);
|
|
if (xmlString) {
|
|
throw parseError(xmlString, headerInfo);
|
|
}
|
|
|
|
// Message should be instantiated for each S3Errors.
|
|
const e = new errors.S3Error(message, {
|
|
cause: headerInfo
|
|
});
|
|
// S3 Error code.
|
|
e.code = code;
|
|
Object.entries(headerInfo).forEach(([key, value]) => {
|
|
// @ts-expect-error force set error properties
|
|
e[key] = value;
|
|
});
|
|
throw e;
|
|
}
|
|
|
|
/**
|
|
* parse XML response for list objects v2 with metadata in a bucket
|
|
*/
|
|
function parseListObjectsV2WithMetadata(xml) {
|
|
const result = {
|
|
objects: [],
|
|
isTruncated: false,
|
|
nextContinuationToken: ''
|
|
};
|
|
let xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.ListBucketResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListBucketResult"');
|
|
}
|
|
xmlobj = xmlobj.ListBucketResult;
|
|
if (xmlobj.IsTruncated) {
|
|
result.isTruncated = xmlobj.IsTruncated;
|
|
}
|
|
if (xmlobj.NextContinuationToken) {
|
|
result.nextContinuationToken = xmlobj.NextContinuationToken;
|
|
}
|
|
if (xmlobj.Contents) {
|
|
(0, _helper.toArray)(xmlobj.Contents).forEach(content => {
|
|
const name = (0, _helper.sanitizeObjectKey)(content.Key);
|
|
const lastModified = new Date(content.LastModified);
|
|
const etag = (0, _helper.sanitizeETag)(content.ETag);
|
|
const size = content.Size;
|
|
let metadata;
|
|
if (content.UserMetadata != null) {
|
|
metadata = (0, _helper.toArray)(content.UserMetadata)[0];
|
|
} else {
|
|
metadata = null;
|
|
}
|
|
result.objects.push({
|
|
name,
|
|
lastModified,
|
|
etag,
|
|
size,
|
|
metadata
|
|
});
|
|
});
|
|
}
|
|
if (xmlobj.CommonPrefixes) {
|
|
(0, _helper.toArray)(xmlobj.CommonPrefixes).forEach(commonPrefix => {
|
|
result.objects.push({
|
|
prefix: (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(commonPrefix.Prefix)[0]),
|
|
size: 0
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
// parse XML response for list parts of an in progress multipart upload
|
|
function parseListParts(xml) {
|
|
let xmlobj = (0, _helper.parseXml)(xml);
|
|
const result = {
|
|
isTruncated: false,
|
|
parts: [],
|
|
marker: 0
|
|
};
|
|
if (!xmlobj.ListPartsResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListPartsResult"');
|
|
}
|
|
xmlobj = xmlobj.ListPartsResult;
|
|
if (xmlobj.IsTruncated) {
|
|
result.isTruncated = xmlobj.IsTruncated;
|
|
}
|
|
if (xmlobj.NextPartNumberMarker) {
|
|
result.marker = (0, _helper.toArray)(xmlobj.NextPartNumberMarker)[0] || '';
|
|
}
|
|
if (xmlobj.Part) {
|
|
(0, _helper.toArray)(xmlobj.Part).forEach(p => {
|
|
const part = parseInt((0, _helper.toArray)(p.PartNumber)[0], 10);
|
|
const lastModified = new Date(p.LastModified);
|
|
const etag = p.ETag.replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
|
|
result.parts.push({
|
|
part,
|
|
lastModified,
|
|
etag,
|
|
size: parseInt(p.Size, 10)
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
function parseListBucket(xml) {
|
|
let result = [];
|
|
const parsedXmlRes = (0, _helper.parseXml)(xml);
|
|
if (!parsedXmlRes.ListAllMyBucketsResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListAllMyBucketsResult"');
|
|
}
|
|
const {
|
|
ListAllMyBucketsResult: {
|
|
Buckets = {}
|
|
} = {}
|
|
} = parsedXmlRes;
|
|
if (Buckets.Bucket) {
|
|
result = (0, _helper.toArray)(Buckets.Bucket).map((bucket = {}) => {
|
|
const {
|
|
Name: bucketName,
|
|
CreationDate
|
|
} = bucket;
|
|
const creationDate = new Date(CreationDate);
|
|
return {
|
|
name: bucketName,
|
|
creationDate: creationDate
|
|
};
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
function parseInitiateMultipart(xml) {
|
|
let xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.InitiateMultipartUploadResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "InitiateMultipartUploadResult"');
|
|
}
|
|
xmlobj = xmlobj.InitiateMultipartUploadResult;
|
|
if (xmlobj.UploadId) {
|
|
return xmlobj.UploadId;
|
|
}
|
|
throw new errors.InvalidXMLError('Missing tag: "UploadId"');
|
|
}
|
|
function parseReplicationConfig(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
const {
|
|
Role,
|
|
Rule
|
|
} = xmlObj.ReplicationConfiguration;
|
|
return {
|
|
ReplicationConfiguration: {
|
|
role: Role,
|
|
rules: (0, _helper.toArray)(Rule)
|
|
}
|
|
};
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfZmFzdFhtbFBhcnNlciIsInJlcXVpcmUiLCJlcnJvcnMiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsIl9oZWxwZXIiLCJfcmVzcG9uc2UiLCJfZ2V0UmVxdWlyZVdpbGRjYXJkQ2FjaGUiLCJub2RlSW50ZXJvcCIsIldlYWtNYXAiLCJjYWNoZUJhYmVsSW50ZXJvcCIsImNhY2hlTm9kZUludGVyb3AiLCJvYmoiLCJfX2VzTW9kdWxlIiwiZGVmYXVsdCIsImNhY2hlIiwiaGFzIiwiZ2V0IiwibmV3T2JqIiwiaGFzUHJvcGVydHlEZXNjcmlwdG9yIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCJrZXkiLCJwcm90b3R5cGUiLCJoYXNPd25Qcm9wZXJ0eSIsImNhbGwiLCJkZXNjIiwic2V0IiwicGFyc2VCdWNrZXRSZWdpb24iLCJ4bWwiLCJwYXJzZVhtbCIsIkxvY2F0aW9uQ29uc3RyYWludCIsImZ4cCIsIlhNTFBhcnNlciIsInBhcnNlRXJyb3IiLC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Module", ({
|
|
value: true
|
|
}));
|
|
var _exportNames = {
|
|
Client: true,
|
|
CopyConditions: true,
|
|
PostPolicy: true
|
|
};
|
|
var fs = _interopRequireWildcard(__nccwpck_require__(7147), true);
|
|
var path = _interopRequireWildcard(__nccwpck_require__(1017), true);
|
|
var Stream = _interopRequireWildcard(__nccwpck_require__(2781), true);
|
|
var _async = __nccwpck_require__(7888);
|
|
var _blockStream = __nccwpck_require__(7124);
|
|
var _lodash = __nccwpck_require__(250);
|
|
var querystring = _interopRequireWildcard(__nccwpck_require__(293), true);
|
|
var _webEncoding = __nccwpck_require__(1430);
|
|
var _xml = __nccwpck_require__(7578);
|
|
var _xml2js = __nccwpck_require__(6189);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helpers = __nccwpck_require__(9455);
|
|
Object.keys(_helpers).forEach(function (key) {
|
|
if (key === "default" || key === "__esModule") return;
|
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
if (key in exports && exports[key] === _helpers[key]) return;
|
|
exports[key] = _helpers[key];
|
|
});
|
|
var _callbackify = __nccwpck_require__(3826);
|
|
var _client = __nccwpck_require__(5586);
|
|
var _copyConditions = __nccwpck_require__(3250);
|
|
exports.CopyConditions = _copyConditions.CopyConditions;
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _postPolicy = __nccwpck_require__(3925);
|
|
exports.PostPolicy = _postPolicy.PostPolicy;
|
|
var _type = __nccwpck_require__(7293);
|
|
var _notification = __nccwpck_require__(3791);
|
|
Object.keys(_notification).forEach(function (key) {
|
|
if (key === "default" || key === "__esModule") return;
|
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
if (key in exports && exports[key] === _notification[key]) return;
|
|
exports[key] = _notification[key];
|
|
});
|
|
var _objectUploader = __nccwpck_require__(8373);
|
|
var _promisify = __nccwpck_require__(5081);
|
|
var _signing = __nccwpck_require__(2029);
|
|
var transformers = _interopRequireWildcard(__nccwpck_require__(9237), true);
|
|
var _xmlParsers = __nccwpck_require__(714);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
class Client extends _client.TypedClient {
|
|
// Set application specific information.
|
|
//
|
|
// Generates User-Agent in the following style.
|
|
//
|
|
// MinIO (OS; ARCH) LIB/VER APP/VER
|
|
//
|
|
// __Arguments__
|
|
// * `appName` _string_ - Application name.
|
|
// * `appVersion` _string_ - Application version.
|
|
setAppInfo(appName, appVersion) {
|
|
if (!(0, _helper.isString)(appName)) {
|
|
throw new TypeError(`Invalid appName: ${appName}`);
|
|
}
|
|
if (appName.trim() === '') {
|
|
throw new errors.InvalidArgumentError('Input appName cannot be empty.');
|
|
}
|
|
if (!(0, _helper.isString)(appVersion)) {
|
|
throw new TypeError(`Invalid appVersion: ${appVersion}`);
|
|
}
|
|
if (appVersion.trim() === '') {
|
|
throw new errors.InvalidArgumentError('Input appVersion cannot be empty.');
|
|
}
|
|
this.userAgent = `${this.userAgent} ${appName}/${appVersion}`;
|
|
}
|
|
|
|
// Calculate part size given the object size. Part size will be atleast this.partSize
|
|
calculatePartSize(size) {
|
|
if (!(0, _helper.isNumber)(size)) {
|
|
throw new TypeError('size should be of type "number"');
|
|
}
|
|
if (size > this.maxObjectSize) {
|
|
throw new TypeError(`size should not be more than ${this.maxObjectSize}`);
|
|
}
|
|
if (this.overRidePartSize) {
|
|
return this.partSize;
|
|
}
|
|
var partSize = this.partSize;
|
|
for (;;) {
|
|
// while(true) {...} throws linting error.
|
|
// If partSize is big enough to accomodate the object size, then use it.
|
|
if (partSize * 10000 > size) {
|
|
return partSize;
|
|
}
|
|
// Try part sizes as 64MB, 80MB, 96MB etc.
|
|
partSize += 16 * 1024 * 1024;
|
|
}
|
|
}
|
|
|
|
// Creates the bucket `bucketName`.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_ - Name of the bucket
|
|
// * `region` _string_ - region valid values are _us-west-1_, _us-west-2_, _eu-west-1_, _eu-central-1_, _ap-southeast-1_, _ap-northeast-1_, _ap-southeast-2_, _sa-east-1_.
|
|
// * `makeOpts` _object_ - Options to create a bucket. e.g {ObjectLocking:true} (Optional)
|
|
// * `callback(err)` _function_ - callback function with `err` as the error argument. `err` is null if the bucket is successfully created.
|
|
makeBucket(bucketName, region, makeOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
// Backward Compatibility
|
|
if ((0, _helper.isObject)(region)) {
|
|
cb = makeOpts;
|
|
makeOpts = region;
|
|
region = '';
|
|
}
|
|
if ((0, _helper.isFunction)(region)) {
|
|
cb = region;
|
|
region = '';
|
|
makeOpts = {};
|
|
}
|
|
if ((0, _helper.isFunction)(makeOpts)) {
|
|
cb = makeOpts;
|
|
makeOpts = {};
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(makeOpts)) {
|
|
throw new TypeError('makeOpts should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var payload = '';
|
|
|
|
// Region already set in constructor, validate if
|
|
// caller requested bucket location is same.
|
|
if (region && this.region) {
|
|
if (region !== this.region) {
|
|
throw new errors.InvalidArgumentError(`Configured region ${this.region}, requested ${region}`);
|
|
}
|
|
}
|
|
// sending makeBucket request with XML containing 'us-east-1' fails. For
|
|
// default region server expects the request without body
|
|
if (region && region !== _helpers.DEFAULT_REGION) {
|
|
var createBucketConfiguration = [];
|
|
createBucketConfiguration.push({
|
|
_attr: {
|
|
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/'
|
|
}
|
|
});
|
|
createBucketConfiguration.push({
|
|
LocationConstraint: region
|
|
});
|
|
var payloadObject = {
|
|
CreateBucketConfiguration: createBucketConfiguration
|
|
};
|
|
payload = _xml(payloadObject);
|
|
}
|
|
var method = 'PUT';
|
|
var headers = {};
|
|
if (makeOpts.ObjectLocking) {
|
|
headers['x-amz-bucket-object-lock-enabled'] = true;
|
|
}
|
|
if (!region) {
|
|
region = _helpers.DEFAULT_REGION;
|
|
}
|
|
const processWithRetry = err => {
|
|
if (err && (region === '' || region === _helpers.DEFAULT_REGION)) {
|
|
if (err.code === 'AuthorizationHeaderMalformed' && err.region !== '') {
|
|
// Retry with region returned as part of error
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
headers
|
|
}, payload, [200], err.region, false, cb);
|
|
} else {
|
|
return cb && cb(err);
|
|
}
|
|
}
|
|
return cb && cb(err);
|
|
};
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
headers
|
|
}, payload, [200], region, false, processWithRetry);
|
|
}
|
|
|
|
// Returns a stream that emits objects that are partially uploaded.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `prefix` _string_: prefix of the object names that are partially uploaded (optional, default `''`)
|
|
// * `recursive` _bool_: directory style listing when false, recursive listing when true (optional, default `false`)
|
|
//
|
|
// __Return Value__
|
|
// * `stream` _Stream_ : emits objects of the format:
|
|
// * `object.key` _string_: name of the object
|
|
// * `object.uploadId` _string_: upload ID of the object
|
|
// * `object.size` _Integer_: size of the partially uploaded object
|
|
listIncompleteUploads(bucket, prefix, recursive) {
|
|
if (prefix === undefined) {
|
|
prefix = '';
|
|
}
|
|
if (recursive === undefined) {
|
|
recursive = false;
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucket)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucket);
|
|
}
|
|
if (!(0, _helper.isValidPrefix)(prefix)) {
|
|
throw new errors.InvalidPrefixError(`Invalid prefix : ${prefix}`);
|
|
}
|
|
if (!(0, _helper.isBoolean)(recursive)) {
|
|
throw new TypeError('recursive should be of type "boolean"');
|
|
}
|
|
var delimiter = recursive ? '' : '/';
|
|
var keyMarker = '';
|
|
var uploadIdMarker = '';
|
|
var uploads = [];
|
|
var ended = false;
|
|
var readStream = Stream.Readable({
|
|
objectMode: true
|
|
});
|
|
readStream._read = () => {
|
|
// push one upload info per _read()
|
|
if (uploads.length) {
|
|
return readStream.push(uploads.shift());
|
|
}
|
|
if (ended) {
|
|
return readStream.push(null);
|
|
}
|
|
this.listIncompleteUploadsQuery(bucket, prefix, keyMarker, uploadIdMarker, delimiter).on('error', e => readStream.emit('error', e)).on('data', result => {
|
|
result.prefixes.forEach(prefix => uploads.push(prefix));
|
|
_async.eachSeries(result.uploads, (upload, cb) => {
|
|
// for each incomplete upload add the sizes of its uploaded parts
|
|
this.listParts(bucket, upload.key, upload.uploadId).then(parts => {
|
|
upload.size = parts.reduce((acc, item) => acc + item.size, 0);
|
|
uploads.push(upload);
|
|
cb();
|
|
}, cb);
|
|
}, err => {
|
|
if (err) {
|
|
readStream.emit('error', err);
|
|
return;
|
|
}
|
|
if (result.isTruncated) {
|
|
keyMarker = result.nextKeyMarker;
|
|
uploadIdMarker = result.nextUploadIdMarker;
|
|
} else {
|
|
ended = true;
|
|
}
|
|
readStream._read();
|
|
});
|
|
});
|
|
};
|
|
return readStream;
|
|
}
|
|
|
|
// To check if a bucket already exists.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_ : name of the bucket
|
|
// * `callback(err)` _function_ : `err` is `null` if the bucket exists
|
|
bucketExists(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var method = 'HEAD';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName
|
|
}, '', [200], '', false, err => {
|
|
if (err) {
|
|
if (err.code == 'NoSuchBucket' || err.code == 'NotFound') {
|
|
return cb(null, false);
|
|
}
|
|
return cb(err);
|
|
}
|
|
cb(null, true);
|
|
});
|
|
}
|
|
|
|
// Remove the partially uploaded object.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `callback(err)` _function_: callback function is called with non `null` value in case of error
|
|
removeIncompleteUpload(bucketName, objectName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.IsValidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var removeUploadId;
|
|
_async.during(cb => {
|
|
this.findUploadId(bucketName, objectName, (e, uploadId) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
removeUploadId = uploadId;
|
|
cb(null, uploadId);
|
|
});
|
|
}, cb => {
|
|
var method = 'DELETE';
|
|
var query = `uploadId=${removeUploadId}`;
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
}, '', [204], '', false, e => cb(e));
|
|
}, cb);
|
|
}
|
|
|
|
// Callback is called with `error` in case of error or `null` in case of success
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `filePath` _string_: path to which the object data will be written to
|
|
// * `getOpts` _object_: Version of the object in the form `{versionId:'my-uuid'}`. Default is `{}`. (optional)
|
|
// * `callback(err)` _function_: callback is called with `err` in case of error.
|
|
fGetObject(bucketName, objectName, filePath, getOpts = {}, cb) {
|
|
// Input validation.
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(filePath)) {
|
|
throw new TypeError('filePath should be of type "string"');
|
|
}
|
|
// Backward Compatibility
|
|
if ((0, _helper.isFunction)(getOpts)) {
|
|
cb = getOpts;
|
|
getOpts = {};
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
|
|
// Internal data.
|
|
var partFile;
|
|
var partFileStream;
|
|
var objStat;
|
|
|
|
// Rename wrapper.
|
|
var rename = err => {
|
|
if (err) {
|
|
return cb(err);
|
|
}
|
|
fs.rename(partFile, filePath, cb);
|
|
};
|
|
_async.waterfall([cb => this.statObject(bucketName, objectName, getOpts, cb), (result, cb) => {
|
|
objStat = result;
|
|
// Create any missing top level directories.
|
|
fs.mkdir(path.dirname(filePath), {
|
|
recursive: true
|
|
}, err => cb(err));
|
|
}, cb => {
|
|
partFile = `${filePath}.${objStat.etag}.part.minio`;
|
|
fs.stat(partFile, (e, stats) => {
|
|
var offset = 0;
|
|
if (e) {
|
|
partFileStream = fs.createWriteStream(partFile, {
|
|
flags: 'w'
|
|
});
|
|
} else {
|
|
if (objStat.size === stats.size) {
|
|
return rename();
|
|
}
|
|
offset = stats.size;
|
|
partFileStream = fs.createWriteStream(partFile, {
|
|
flags: 'a'
|
|
});
|
|
}
|
|
this.getPartialObject(bucketName, objectName, offset, 0, getOpts, cb);
|
|
});
|
|
}, (downloadStream, cb) => {
|
|
(0, _helper.pipesetup)(downloadStream, partFileStream).on('error', e => cb(e)).on('finish', cb);
|
|
}, cb => fs.stat(partFile, cb), (stats, cb) => {
|
|
if (stats.size === objStat.size) {
|
|
return cb();
|
|
}
|
|
cb(new Error('Size mismatch between downloaded file and the object'));
|
|
}], rename);
|
|
}
|
|
|
|
// Callback is called with readable stream of the object content.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `getOpts` _object_: Version of the object in the form `{versionId:'my-uuid'}`. Default is `{}`. (optional)
|
|
// * `callback(err, stream)` _function_: callback is called with `err` in case of error. `stream` is the object content stream
|
|
getObject(bucketName, objectName, getOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
// Backward Compatibility
|
|
if ((0, _helper.isFunction)(getOpts)) {
|
|
cb = getOpts;
|
|
getOpts = {};
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
this.getPartialObject(bucketName, objectName, 0, 0, getOpts, cb);
|
|
}
|
|
|
|
// Callback is called with readable stream of the partial object content.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `offset` _number_: offset of the object from where the stream will start
|
|
// * `length` _number_: length of the object that will be read in the stream (optional, if not specified we read the rest of the file from the offset)
|
|
// * `getOpts` _object_: Version of the object in the form `{versionId:'my-uuid'}`. Default is `{}`. (optional)
|
|
// * `callback(err, stream)` _function_: callback is called with `err` in case of error. `stream` is the object content stream
|
|
getPartialObject(bucketName, objectName, offset, length, getOpts = {}, cb) {
|
|
if ((0, _helper.isFunction)(length)) {
|
|
cb = length;
|
|
length = 0;
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isNumber)(offset)) {
|
|
throw new TypeError('offset should be of type "number"');
|
|
}
|
|
if (!(0, _helper.isNumber)(length)) {
|
|
throw new TypeError('length should be of type "number"');
|
|
}
|
|
// Backward Compatibility
|
|
if ((0, _helper.isFunction)(getOpts)) {
|
|
cb = getOpts;
|
|
getOpts = {};
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var range = '';
|
|
if (offset || length) {
|
|
if (offset) {
|
|
range = `bytes=${+offset}-`;
|
|
} else {
|
|
range = 'bytes=0-';
|
|
offset = 0;
|
|
}
|
|
if (length) {
|
|
range += `${+length + offset - 1}`;
|
|
}
|
|
}
|
|
var headers = {};
|
|
if (range !== '') {
|
|
headers.range = range;
|
|
}
|
|
var expectedStatusCodes = [200];
|
|
if (range) {
|
|
expectedStatusCodes.push(206);
|
|
}
|
|
var method = 'GET';
|
|
var query = querystring.stringify(getOpts);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
headers,
|
|
query
|
|
}, '', expectedStatusCodes, '', true, cb);
|
|
}
|
|
|
|
// Uploads the object using contents from a file
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `filePath` _string_: file path of the file to be uploaded
|
|
// * `metaData` _Javascript Object_: metaData assosciated with the object
|
|
// * `callback(err, objInfo)` _function_: non null `err` indicates error, `objInfo` _object_ which contains versionId and etag.
|
|
fPutObject(bucketName, objectName, filePath, metaData, callback) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(filePath)) {
|
|
throw new TypeError('filePath should be of type "string"');
|
|
}
|
|
if ((0, _helper.isFunction)(metaData)) {
|
|
callback = metaData;
|
|
metaData = {}; // Set metaData empty if no metaData provided.
|
|
}
|
|
|
|
if (!(0, _helper.isObject)(metaData)) {
|
|
throw new TypeError('metaData should be of type "object"');
|
|
}
|
|
|
|
// Inserts correct `content-type` attribute based on metaData and filePath
|
|
metaData = (0, _helper.insertContentType)(metaData, filePath);
|
|
fs.lstat(filePath, (err, stat) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
return this.putObject(bucketName, objectName, fs.createReadStream(filePath), stat.size, metaData, callback);
|
|
});
|
|
}
|
|
|
|
// Uploads the object.
|
|
//
|
|
// Uploading a stream
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `stream` _Stream_: Readable stream
|
|
// * `size` _number_: size of the object (optional)
|
|
// * `callback(err, etag)` _function_: non null `err` indicates error, `etag` _string_ is the etag of the object uploaded.
|
|
//
|
|
// Uploading "Buffer" or "string"
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `string or Buffer` _string_ or _Buffer_: string or buffer
|
|
// * `callback(err, objInfo)` _function_: `err` is `null` in case of success and `info` will have the following object details:
|
|
// * `etag` _string_: etag of the object
|
|
// * `versionId` _string_: versionId of the object
|
|
putObject(bucketName, objectName, stream, size, metaData, callback) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
|
|
// We'll need to shift arguments to the left because of size and metaData.
|
|
if ((0, _helper.isFunction)(size)) {
|
|
callback = size;
|
|
metaData = {};
|
|
} else if ((0, _helper.isFunction)(metaData)) {
|
|
callback = metaData;
|
|
metaData = {};
|
|
}
|
|
|
|
// We'll need to shift arguments to the left because of metaData
|
|
// and size being optional.
|
|
if ((0, _helper.isObject)(size)) {
|
|
metaData = size;
|
|
}
|
|
|
|
// Ensures Metadata has appropriate prefix for A3 API
|
|
metaData = (0, _helper.prependXAMZMeta)(metaData);
|
|
if (typeof stream === 'string' || stream instanceof Buffer) {
|
|
// Adapts the non-stream interface into a stream.
|
|
size = stream.length;
|
|
stream = (0, _helper.readableStream)(stream);
|
|
} else if (!(0, _helper.isReadableStream)(stream)) {
|
|
throw new TypeError('third argument should be of type "stream.Readable" or "Buffer" or "string"');
|
|
}
|
|
if (!(0, _helper.isFunction)(callback)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
if ((0, _helper.isNumber)(size) && size < 0) {
|
|
throw new errors.InvalidArgumentError(`size cannot be negative, given size: ${size}`);
|
|
}
|
|
|
|
// Get the part size and forward that to the BlockStream. Default to the
|
|
// largest block size possible if necessary.
|
|
if (!(0, _helper.isNumber)(size)) {
|
|
size = this.maxObjectSize;
|
|
}
|
|
size = this.calculatePartSize(size);
|
|
|
|
// s3 requires that all non-end chunks be at least `this.partSize`,
|
|
// so we chunk the stream until we hit either that size or the end before
|
|
// we flush it to s3.
|
|
let chunker = new _blockStream({
|
|
size,
|
|
zeroPadding: false
|
|
});
|
|
|
|
// This is a Writable stream that can be written to in order to upload
|
|
// to the specified bucket and object automatically.
|
|
let uploader = new _objectUploader.ObjectUploader(this, bucketName, objectName, size, metaData, callback);
|
|
// stream => chunker => uploader
|
|
(0, _helper.pipesetup)(stream, chunker, uploader);
|
|
}
|
|
|
|
// Copy the object.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `srcObject` _string_: path of the source object to be copied
|
|
// * `conditions` _CopyConditions_: copy conditions that needs to be satisfied (optional, default `null`)
|
|
// * `callback(err, {etag, lastModified})` _function_: non null `err` indicates error, `etag` _string_ and `listModifed` _Date_ are respectively the etag and the last modified date of the newly copied object
|
|
copyObjectV1(arg1, arg2, arg3, arg4, arg5) {
|
|
var bucketName = arg1;
|
|
var objectName = arg2;
|
|
var srcObject = arg3;
|
|
var conditions, cb;
|
|
if (typeof arg4 == 'function' && arg5 === undefined) {
|
|
conditions = null;
|
|
cb = arg4;
|
|
} else {
|
|
conditions = arg4;
|
|
cb = arg5;
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(srcObject)) {
|
|
throw new TypeError('srcObject should be of type "string"');
|
|
}
|
|
if (srcObject === '') {
|
|
throw new errors.InvalidPrefixError(`Empty source prefix`);
|
|
}
|
|
if (conditions !== null && !(conditions instanceof _copyConditions.CopyConditions)) {
|
|
throw new TypeError('conditions should be of type "CopyConditions"');
|
|
}
|
|
var headers = {};
|
|
headers['x-amz-copy-source'] = (0, _helper.uriResourceEscape)(srcObject);
|
|
if (conditions !== null) {
|
|
if (conditions.modified !== '') {
|
|
headers['x-amz-copy-source-if-modified-since'] = conditions.modified;
|
|
}
|
|
if (conditions.unmodified !== '') {
|
|
headers['x-amz-copy-source-if-unmodified-since'] = conditions.unmodified;
|
|
}
|
|
if (conditions.matchETag !== '') {
|
|
headers['x-amz-copy-source-if-match'] = conditions.matchETag;
|
|
}
|
|
if (conditions.matchEtagExcept !== '') {
|
|
headers['x-amz-copy-source-if-none-match'] = conditions.matchETagExcept;
|
|
}
|
|
}
|
|
var method = 'PUT';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
headers
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
var transformer = transformers.getCopyObjectTransformer();
|
|
(0, _helper.pipesetup)(response, transformer).on('error', e => cb(e)).on('data', data => cb(null, data));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Internal Method to perform copy of an object.
|
|
* @param sourceConfig __object__ instance of CopySourceOptions @link ./helpers/CopySourceOptions
|
|
* @param destConfig __object__ instance of CopyDestinationOptions @link ./helpers/CopyDestinationOptions
|
|
* @param cb __function__ called with null if there is an error
|
|
* @returns Promise if no callack is passed.
|
|
*/
|
|
copyObjectV2(sourceConfig, destConfig, cb) {
|
|
if (!(sourceConfig instanceof _helpers.CopySourceOptions)) {
|
|
throw new errors.InvalidArgumentError('sourceConfig should of type CopySourceOptions ');
|
|
}
|
|
if (!(destConfig instanceof _helpers.CopyDestinationOptions)) {
|
|
throw new errors.InvalidArgumentError('destConfig should of type CopyDestinationOptions ');
|
|
}
|
|
if (!destConfig.validate()) {
|
|
return false;
|
|
}
|
|
if (!destConfig.validate()) {
|
|
return false;
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
const headers = Object.assign({}, sourceConfig.getHeaders(), destConfig.getHeaders());
|
|
const bucketName = destConfig.Bucket;
|
|
const objectName = destConfig.Object;
|
|
const method = 'PUT';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
headers
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
const transformer = transformers.getCopyObjectTransformer();
|
|
(0, _helper.pipesetup)(response, transformer).on('error', e => cb(e)).on('data', data => {
|
|
const resHeaders = response.headers;
|
|
const copyObjResponse = {
|
|
Bucket: destConfig.Bucket,
|
|
Key: destConfig.Object,
|
|
LastModified: data.LastModified,
|
|
MetaData: (0, _helper.extractMetadata)(resHeaders),
|
|
VersionId: (0, _helper.getVersionId)(resHeaders),
|
|
SourceVersionId: (0, _helper.getSourceVersionId)(resHeaders),
|
|
Etag: (0, _helper.sanitizeETag)(resHeaders.etag),
|
|
Size: +resHeaders['content-length']
|
|
};
|
|
return cb(null, copyObjResponse);
|
|
});
|
|
});
|
|
}
|
|
|
|
// Backward compatibility for Copy Object API.
|
|
copyObject(...allArgs) {
|
|
if (allArgs[0] instanceof _helpers.CopySourceOptions && allArgs[1] instanceof _helpers.CopyDestinationOptions) {
|
|
return this.copyObjectV2(...arguments);
|
|
}
|
|
return this.copyObjectV1(...arguments);
|
|
}
|
|
|
|
// list a batch of objects
|
|
listObjectsQuery(bucketName, prefix, marker, listQueryOpts = {}) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(marker)) {
|
|
throw new TypeError('marker should be of type "string"');
|
|
}
|
|
let {
|
|
Delimiter,
|
|
MaxKeys,
|
|
IncludeVersion
|
|
} = listQueryOpts;
|
|
if (!(0, _helper.isObject)(listQueryOpts)) {
|
|
throw new TypeError('listQueryOpts should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(Delimiter)) {
|
|
throw new TypeError('Delimiter should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isNumber)(MaxKeys)) {
|
|
throw new TypeError('MaxKeys should be of type "number"');
|
|
}
|
|
const queries = [];
|
|
// escape every value in query string, except maxKeys
|
|
queries.push(`prefix=${(0, _helper.uriEscape)(prefix)}`);
|
|
queries.push(`delimiter=${(0, _helper.uriEscape)(Delimiter)}`);
|
|
queries.push(`encoding-type=url`);
|
|
if (IncludeVersion) {
|
|
queries.push(`versions`);
|
|
}
|
|
if (marker) {
|
|
marker = (0, _helper.uriEscape)(marker);
|
|
if (IncludeVersion) {
|
|
queries.push(`key-marker=${marker}`);
|
|
} else {
|
|
queries.push(`marker=${marker}`);
|
|
}
|
|
}
|
|
|
|
// no need to escape maxKeys
|
|
if (MaxKeys) {
|
|
if (MaxKeys >= 1000) {
|
|
MaxKeys = 1000;
|
|
}
|
|
queries.push(`max-keys=${MaxKeys}`);
|
|
}
|
|
queries.sort();
|
|
var query = '';
|
|
if (queries.length > 0) {
|
|
query = `${queries.join('&')}`;
|
|
}
|
|
var method = 'GET';
|
|
var transformer = transformers.getListObjectsTransformer();
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return transformer.emit('error', e);
|
|
}
|
|
(0, _helper.pipesetup)(response, transformer);
|
|
});
|
|
return transformer;
|
|
}
|
|
|
|
// List the objects in the bucket.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `prefix` _string_: the prefix of the objects that should be listed (optional, default `''`)
|
|
// * `recursive` _bool_: `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/'. (optional, default `false`)
|
|
// * `listOpts _object_: query params to list object with below keys
|
|
// * listOpts.MaxKeys _int_ maximum number of keys to return
|
|
// * listOpts.IncludeVersion _bool_ true|false to include versions.
|
|
// __Return Value__
|
|
// * `stream` _Stream_: stream emitting the objects in the bucket, the object is of the format:
|
|
// * `obj.name` _string_: name of the object
|
|
// * `obj.prefix` _string_: name of the object prefix
|
|
// * `obj.size` _number_: size of the object
|
|
// * `obj.etag` _string_: etag of the object
|
|
// * `obj.lastModified` _Date_: modified time stamp
|
|
// * `obj.isDeleteMarker` _boolean_: true if it is a delete marker
|
|
// * `obj.versionId` _string_: versionId of the object
|
|
listObjects(bucketName, prefix, recursive, listOpts = {}) {
|
|
if (prefix === undefined) {
|
|
prefix = '';
|
|
}
|
|
if (recursive === undefined) {
|
|
recursive = false;
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidPrefix)(prefix)) {
|
|
throw new errors.InvalidPrefixError(`Invalid prefix : ${prefix}`);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isBoolean)(recursive)) {
|
|
throw new TypeError('recursive should be of type "boolean"');
|
|
}
|
|
if (!(0, _helper.isObject)(listOpts)) {
|
|
throw new TypeError('listOpts should be of type "object"');
|
|
}
|
|
var marker = '';
|
|
const listQueryOpts = {
|
|
Delimiter: recursive ? '' : '/',
|
|
// if recursive is false set delimiter to '/'
|
|
MaxKeys: 1000,
|
|
IncludeVersion: listOpts.IncludeVersion
|
|
};
|
|
var objects = [];
|
|
var ended = false;
|
|
var readStream = Stream.Readable({
|
|
objectMode: true
|
|
});
|
|
readStream._read = () => {
|
|
// push one object per _read()
|
|
if (objects.length) {
|
|
readStream.push(objects.shift());
|
|
return;
|
|
}
|
|
if (ended) {
|
|
return readStream.push(null);
|
|
}
|
|
// if there are no objects to push do query for the next batch of objects
|
|
this.listObjectsQuery(bucketName, prefix, marker, listQueryOpts).on('error', e => readStream.emit('error', e)).on('data', result => {
|
|
if (result.isTruncated) {
|
|
marker = result.nextMarker || result.versionIdMarker;
|
|
} else {
|
|
ended = true;
|
|
}
|
|
objects = result.objects;
|
|
readStream._read();
|
|
});
|
|
};
|
|
return readStream;
|
|
}
|
|
|
|
// listObjectsV2Query - (List Objects V2) - List some or all (up to 1000) of the objects in a bucket.
|
|
//
|
|
// You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
|
|
// request parameters :-
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `prefix` _string_: Limits the response to keys that begin with the specified prefix.
|
|
// * `continuation-token` _string_: Used to continue iterating over a set of objects.
|
|
// * `delimiter` _string_: A delimiter is a character you use to group keys.
|
|
// * `max-keys` _number_: Sets the maximum number of keys returned in the response body.
|
|
// * `start-after` _string_: Specifies the key to start after when listing objects in a bucket.
|
|
listObjectsV2Query(bucketName, prefix, continuationToken, delimiter, maxKeys, startAfter) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(continuationToken)) {
|
|
throw new TypeError('continuationToken should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(delimiter)) {
|
|
throw new TypeError('delimiter should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isNumber)(maxKeys)) {
|
|
throw new TypeError('maxKeys should be of type "number"');
|
|
}
|
|
if (!(0, _helper.isString)(startAfter)) {
|
|
throw new TypeError('startAfter should be of type "string"');
|
|
}
|
|
var queries = [];
|
|
|
|
// Call for listing objects v2 API
|
|
queries.push(`list-type=2`);
|
|
queries.push(`encoding-type=url`);
|
|
|
|
// escape every value in query string, except maxKeys
|
|
queries.push(`prefix=${(0, _helper.uriEscape)(prefix)}`);
|
|
queries.push(`delimiter=${(0, _helper.uriEscape)(delimiter)}`);
|
|
if (continuationToken) {
|
|
continuationToken = (0, _helper.uriEscape)(continuationToken);
|
|
queries.push(`continuation-token=${continuationToken}`);
|
|
}
|
|
// Set start-after
|
|
if (startAfter) {
|
|
startAfter = (0, _helper.uriEscape)(startAfter);
|
|
queries.push(`start-after=${startAfter}`);
|
|
}
|
|
// no need to escape maxKeys
|
|
if (maxKeys) {
|
|
if (maxKeys >= 1000) {
|
|
maxKeys = 1000;
|
|
}
|
|
queries.push(`max-keys=${maxKeys}`);
|
|
}
|
|
queries.sort();
|
|
var query = '';
|
|
if (queries.length > 0) {
|
|
query = `${queries.join('&')}`;
|
|
}
|
|
var method = 'GET';
|
|
var transformer = transformers.getListObjectsV2Transformer();
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return transformer.emit('error', e);
|
|
}
|
|
(0, _helper.pipesetup)(response, transformer);
|
|
});
|
|
return transformer;
|
|
}
|
|
|
|
// List the objects in the bucket using S3 ListObjects V2
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `prefix` _string_: the prefix of the objects that should be listed (optional, default `''`)
|
|
// * `recursive` _bool_: `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/'. (optional, default `false`)
|
|
// * `startAfter` _string_: Specifies the key to start after when listing objects in a bucket. (optional, default `''`)
|
|
//
|
|
// __Return Value__
|
|
// * `stream` _Stream_: stream emitting the objects in the bucket, the object is of the format:
|
|
// * `obj.name` _string_: name of the object
|
|
// * `obj.prefix` _string_: name of the object prefix
|
|
// * `obj.size` _number_: size of the object
|
|
// * `obj.etag` _string_: etag of the object
|
|
// * `obj.lastModified` _Date_: modified time stamp
|
|
listObjectsV2(bucketName, prefix, recursive, startAfter) {
|
|
if (prefix === undefined) {
|
|
prefix = '';
|
|
}
|
|
if (recursive === undefined) {
|
|
recursive = false;
|
|
}
|
|
if (startAfter === undefined) {
|
|
startAfter = '';
|
|
}
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidPrefix)(prefix)) {
|
|
throw new errors.InvalidPrefixError(`Invalid prefix : ${prefix}`);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isBoolean)(recursive)) {
|
|
throw new TypeError('recursive should be of type "boolean"');
|
|
}
|
|
if (!(0, _helper.isString)(startAfter)) {
|
|
throw new TypeError('startAfter should be of type "string"');
|
|
}
|
|
// if recursive is false set delimiter to '/'
|
|
var delimiter = recursive ? '' : '/';
|
|
var continuationToken = '';
|
|
var objects = [];
|
|
var ended = false;
|
|
var readStream = Stream.Readable({
|
|
objectMode: true
|
|
});
|
|
readStream._read = () => {
|
|
// push one object per _read()
|
|
if (objects.length) {
|
|
readStream.push(objects.shift());
|
|
return;
|
|
}
|
|
if (ended) {
|
|
return readStream.push(null);
|
|
}
|
|
// if there are no objects to push do query for the next batch of objects
|
|
this.listObjectsV2Query(bucketName, prefix, continuationToken, delimiter, 1000, startAfter).on('error', e => readStream.emit('error', e)).on('data', result => {
|
|
if (result.isTruncated) {
|
|
continuationToken = result.nextContinuationToken;
|
|
} else {
|
|
ended = true;
|
|
}
|
|
objects = result.objects;
|
|
readStream._read();
|
|
});
|
|
};
|
|
return readStream;
|
|
}
|
|
|
|
// Remove all the objects residing in the objectsList.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectsList` _array_: array of objects of one of the following:
|
|
// * List of Object names as array of strings which are object keys: ['objectname1','objectname2']
|
|
// * List of Object name and versionId as an object: [{name:"objectname",versionId:"my-version-id"}]
|
|
|
|
removeObjects(bucketName, objectsList, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!Array.isArray(objectsList)) {
|
|
throw new errors.InvalidArgumentError('objectsList should be a list');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
const maxEntries = 1000;
|
|
const query = 'delete';
|
|
const method = 'POST';
|
|
let result = objectsList.reduce((result, entry) => {
|
|
result.list.push(entry);
|
|
if (result.list.length === maxEntries) {
|
|
result.listOfList.push(result.list);
|
|
result.list = [];
|
|
}
|
|
return result;
|
|
}, {
|
|
listOfList: [],
|
|
list: []
|
|
});
|
|
if (result.list.length > 0) {
|
|
result.listOfList.push(result.list);
|
|
}
|
|
const encoder = new _webEncoding.TextEncoder();
|
|
const batchResults = [];
|
|
_async.eachSeries(result.listOfList, (list, batchCb) => {
|
|
var objects = [];
|
|
list.forEach(function (value) {
|
|
if ((0, _helper.isObject)(value)) {
|
|
objects.push({
|
|
Key: value.name,
|
|
VersionId: value.versionId
|
|
});
|
|
} else {
|
|
objects.push({
|
|
Key: value
|
|
});
|
|
}
|
|
});
|
|
let deleteObjects = {
|
|
Delete: {
|
|
Quiet: true,
|
|
Object: objects
|
|
}
|
|
};
|
|
const builder = new _xml2js.Builder({
|
|
headless: true
|
|
});
|
|
let payload = builder.buildObject(deleteObjects);
|
|
payload = Buffer.from(encoder.encode(payload));
|
|
const headers = {};
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
let removeObjectsResult;
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
}, payload, [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return batchCb(e);
|
|
}
|
|
(0, _helper.pipesetup)(response, transformers.removeObjectsTransformer()).on('data', data => {
|
|
removeObjectsResult = data;
|
|
}).on('error', e => {
|
|
return batchCb(e, null);
|
|
}).on('end', () => {
|
|
batchResults.push(removeObjectsResult);
|
|
return batchCb(null, removeObjectsResult);
|
|
});
|
|
});
|
|
}, () => {
|
|
cb(null, _lodash.flatten(batchResults));
|
|
});
|
|
}
|
|
|
|
// Get the policy on a bucket or an object prefix.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `callback(err, policy)` _function_: callback function
|
|
getBucketPolicy(bucketName, cb) {
|
|
// Validate arguments.
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
let method = 'GET';
|
|
let query = 'policy';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let policy = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.getConcater()).on('data', data => policy = data).on('error', cb).on('end', () => {
|
|
cb(null, policy.toString());
|
|
});
|
|
});
|
|
}
|
|
|
|
// Set the policy on a bucket or an object prefix.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `bucketPolicy` _string_: bucket policy (JSON stringify'ed)
|
|
// * `callback(err)` _function_: callback function
|
|
setBucketPolicy(bucketName, policy, cb) {
|
|
// Validate arguments.
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isString)(policy)) {
|
|
throw new errors.InvalidBucketPolicyError(`Invalid bucket policy: ${policy} - must be "string"`);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
let method = 'DELETE';
|
|
let query = 'policy';
|
|
if (policy) {
|
|
method = 'PUT';
|
|
}
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, policy, [204], '', false, cb);
|
|
}
|
|
|
|
// Generate a generic presigned URL which can be
|
|
// used for HTTP methods GET, PUT, HEAD and DELETE
|
|
//
|
|
// __Arguments__
|
|
// * `method` _string_: name of the HTTP method
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `expiry` _number_: expiry in seconds (optional, default 7 days)
|
|
// * `reqParams` _object_: request parameters (optional) e.g {versionId:"10fa9946-3f64-4137-a58f-888065c0732e"}
|
|
// * `requestDate` _Date_: A date object, the url will be issued at (optional)
|
|
presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate, cb) {
|
|
if (this.anonymous) {
|
|
throw new errors.AnonymousRequestError('Presigned ' + method + ' url cannot be generated for anonymous requests');
|
|
}
|
|
if ((0, _helper.isFunction)(requestDate)) {
|
|
cb = requestDate;
|
|
requestDate = new Date();
|
|
}
|
|
if ((0, _helper.isFunction)(reqParams)) {
|
|
cb = reqParams;
|
|
reqParams = {};
|
|
requestDate = new Date();
|
|
}
|
|
if ((0, _helper.isFunction)(expires)) {
|
|
cb = expires;
|
|
reqParams = {};
|
|
expires = 24 * 60 * 60 * 7; // 7 days in seconds
|
|
requestDate = new Date();
|
|
}
|
|
if (!(0, _helper.isNumber)(expires)) {
|
|
throw new TypeError('expires should be of type "number"');
|
|
}
|
|
if (!(0, _helper.isObject)(reqParams)) {
|
|
throw new TypeError('reqParams should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isValidDate)(requestDate)) {
|
|
throw new TypeError('requestDate should be of type "Date" and valid');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var query = querystring.stringify(reqParams);
|
|
this.getBucketRegion(bucketName, (e, region) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
// This statement is added to ensure that we send error through
|
|
// callback on presign failure.
|
|
var url;
|
|
var reqOptions = this.getRequestOptions({
|
|
method,
|
|
region,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
});
|
|
this.checkAndRefreshCreds();
|
|
try {
|
|
url = (0, _signing.presignSignatureV4)(reqOptions, this.accessKey, this.secretKey, this.sessionToken, region, requestDate, expires);
|
|
} catch (pe) {
|
|
return cb(pe);
|
|
}
|
|
cb(null, url);
|
|
});
|
|
}
|
|
|
|
// Generate a presigned URL for GET
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `expiry` _number_: expiry in seconds (optional, default 7 days)
|
|
// * `respHeaders` _object_: response headers to override or request params for query (optional) e.g {versionId:"10fa9946-3f64-4137-a58f-888065c0732e"}
|
|
// * `requestDate` _Date_: A date object, the url will be issued at (optional)
|
|
presignedGetObject(bucketName, objectName, expires, respHeaders, requestDate, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if ((0, _helper.isFunction)(respHeaders)) {
|
|
cb = respHeaders;
|
|
respHeaders = {};
|
|
requestDate = new Date();
|
|
}
|
|
var validRespHeaders = ['response-content-type', 'response-content-language', 'response-expires', 'response-cache-control', 'response-content-disposition', 'response-content-encoding'];
|
|
validRespHeaders.forEach(header => {
|
|
if (respHeaders !== undefined && respHeaders[header] !== undefined && !(0, _helper.isString)(respHeaders[header])) {
|
|
throw new TypeError(`response header ${header} should be of type "string"`);
|
|
}
|
|
});
|
|
return this.presignedUrl('GET', bucketName, objectName, expires, respHeaders, requestDate, cb);
|
|
}
|
|
|
|
// Generate a presigned URL for PUT. Using this URL, the browser can upload to S3 only with the specified object name.
|
|
//
|
|
// __Arguments__
|
|
// * `bucketName` _string_: name of the bucket
|
|
// * `objectName` _string_: name of the object
|
|
// * `expiry` _number_: expiry in seconds (optional, default 7 days)
|
|
presignedPutObject(bucketName, objectName, expires, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
return this.presignedUrl('PUT', bucketName, objectName, expires, cb);
|
|
}
|
|
|
|
// return PostPolicy object
|
|
newPostPolicy() {
|
|
return new _postPolicy.PostPolicy();
|
|
}
|
|
|
|
// presignedPostPolicy can be used in situations where we want more control on the upload than what
|
|
// presignedPutObject() provides. i.e Using presignedPostPolicy we will be able to put policy restrictions
|
|
// on the object's `name` `bucket` `expiry` `Content-Type` `Content-Disposition` `metaData`
|
|
presignedPostPolicy(postPolicy, cb) {
|
|
if (this.anonymous) {
|
|
throw new errors.AnonymousRequestError('Presigned POST policy cannot be generated for anonymous requests');
|
|
}
|
|
if (!(0, _helper.isObject)(postPolicy)) {
|
|
throw new TypeError('postPolicy should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('cb should be of type "function"');
|
|
}
|
|
this.getBucketRegion(postPolicy.formData.bucket, (e, region) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
var date = new Date();
|
|
var dateStr = (0, _helper.makeDateLong)(date);
|
|
this.checkAndRefreshCreds();
|
|
if (!postPolicy.policy.expiration) {
|
|
// 'expiration' is mandatory field for S3.
|
|
// Set default expiration date of 7 days.
|
|
var expires = new Date();
|
|
expires.setSeconds(24 * 60 * 60 * 7);
|
|
postPolicy.setExpires(expires);
|
|
}
|
|
postPolicy.policy.conditions.push(['eq', '$x-amz-date', dateStr]);
|
|
postPolicy.formData['x-amz-date'] = dateStr;
|
|
postPolicy.policy.conditions.push(['eq', '$x-amz-algorithm', 'AWS4-HMAC-SHA256']);
|
|
postPolicy.formData['x-amz-algorithm'] = 'AWS4-HMAC-SHA256';
|
|
postPolicy.policy.conditions.push(['eq', '$x-amz-credential', this.accessKey + '/' + (0, _helper.getScope)(region, date)]);
|
|
postPolicy.formData['x-amz-credential'] = this.accessKey + '/' + (0, _helper.getScope)(region, date);
|
|
if (this.sessionToken) {
|
|
postPolicy.policy.conditions.push(['eq', '$x-amz-security-token', this.sessionToken]);
|
|
postPolicy.formData['x-amz-security-token'] = this.sessionToken;
|
|
}
|
|
var policyBase64 = Buffer.from(JSON.stringify(postPolicy.policy)).toString('base64');
|
|
postPolicy.formData.policy = policyBase64;
|
|
var signature = (0, _signing.postPresignSignatureV4)(region, date, this.secretKey, policyBase64);
|
|
postPolicy.formData['x-amz-signature'] = signature;
|
|
var opts = {};
|
|
opts.region = region;
|
|
opts.bucketName = postPolicy.formData.bucket;
|
|
var reqOptions = this.getRequestOptions(opts);
|
|
var portStr = this.port == 80 || this.port === 443 ? '' : `:${this.port.toString()}`;
|
|
var urlStr = `${reqOptions.protocol}//${reqOptions.host}${portStr}${reqOptions.path}`;
|
|
cb(null, {
|
|
postURL: urlStr,
|
|
formData: postPolicy.formData
|
|
});
|
|
});
|
|
}
|
|
|
|
// Complete the multipart upload. After all the parts are uploaded issuing
|
|
// this call will aggregate the parts on the server into a single object.
|
|
completeMultipartUpload(bucketName, objectName, uploadId, etags, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isString)(uploadId)) {
|
|
throw new TypeError('uploadId should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(etags)) {
|
|
throw new TypeError('etags should be of type "Array"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('cb should be of type "function"');
|
|
}
|
|
if (!uploadId) {
|
|
throw new errors.InvalidArgumentError('uploadId cannot be empty');
|
|
}
|
|
var method = 'POST';
|
|
var query = `uploadId=${(0, _helper.uriEscape)(uploadId)}`;
|
|
var parts = [];
|
|
etags.forEach(element => {
|
|
parts.push({
|
|
Part: [{
|
|
PartNumber: element.part
|
|
}, {
|
|
ETag: element.etag
|
|
}]
|
|
});
|
|
});
|
|
var payloadObject = {
|
|
CompleteMultipartUpload: parts
|
|
};
|
|
var payload = _xml(payloadObject);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
}, payload, [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
var transformer = transformers.getCompleteMultipartTransformer();
|
|
(0, _helper.pipesetup)(response, transformer).on('error', e => cb(e)).on('data', result => {
|
|
if (result.errCode) {
|
|
// Multipart Complete API returns an error XML after a 200 http status
|
|
cb(new errors.S3Error(result.errMessage));
|
|
} else {
|
|
const completeMultipartResult = {
|
|
etag: result.etag,
|
|
versionId: (0, _helper.getVersionId)(response.headers)
|
|
};
|
|
cb(null, completeMultipartResult);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// Called by listIncompleteUploads to fetch a batch of incomplete uploads.
|
|
listIncompleteUploadsQuery(bucketName, prefix, keyMarker, uploadIdMarker, delimiter) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(keyMarker)) {
|
|
throw new TypeError('keyMarker should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(uploadIdMarker)) {
|
|
throw new TypeError('uploadIdMarker should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(delimiter)) {
|
|
throw new TypeError('delimiter should be of type "string"');
|
|
}
|
|
var queries = [];
|
|
queries.push(`prefix=${(0, _helper.uriEscape)(prefix)}`);
|
|
queries.push(`delimiter=${(0, _helper.uriEscape)(delimiter)}`);
|
|
if (keyMarker) {
|
|
keyMarker = (0, _helper.uriEscape)(keyMarker);
|
|
queries.push(`key-marker=${keyMarker}`);
|
|
}
|
|
if (uploadIdMarker) {
|
|
queries.push(`upload-id-marker=${uploadIdMarker}`);
|
|
}
|
|
var maxUploads = 1000;
|
|
queries.push(`max-uploads=${maxUploads}`);
|
|
queries.sort();
|
|
queries.unshift('uploads');
|
|
var query = '';
|
|
if (queries.length > 0) {
|
|
query = `${queries.join('&')}`;
|
|
}
|
|
var method = 'GET';
|
|
var transformer = transformers.getListMultipartTransformer();
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return transformer.emit('error', e);
|
|
}
|
|
(0, _helper.pipesetup)(response, transformer);
|
|
});
|
|
return transformer;
|
|
}
|
|
|
|
// Find uploadId of an incomplete upload.
|
|
findUploadId(bucketName, objectName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('cb should be of type "function"');
|
|
}
|
|
var latestUpload;
|
|
var listNext = (keyMarker, uploadIdMarker) => {
|
|
this.listIncompleteUploadsQuery(bucketName, objectName, keyMarker, uploadIdMarker, '').on('error', e => cb(e)).on('data', result => {
|
|
result.uploads.forEach(upload => {
|
|
if (upload.key === objectName) {
|
|
if (!latestUpload || upload.initiated.getTime() > latestUpload.initiated.getTime()) {
|
|
latestUpload = upload;
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
if (result.isTruncated) {
|
|
listNext(result.nextKeyMarker, result.nextUploadIdMarker);
|
|
return;
|
|
}
|
|
if (latestUpload) {
|
|
return cb(null, latestUpload.uploadId);
|
|
}
|
|
cb(null, undefined);
|
|
});
|
|
};
|
|
listNext('', '');
|
|
}
|
|
|
|
// Remove all the notification configurations in the S3 provider
|
|
setBucketNotification(bucketName, config, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isObject)(config)) {
|
|
throw new TypeError('notification config should be of type "Object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var method = 'PUT';
|
|
var query = 'notification';
|
|
var builder = new _xml2js.Builder({
|
|
rootName: 'NotificationConfiguration',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
var payload = builder.buildObject(config);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, payload, [200], '', false, cb);
|
|
}
|
|
removeAllBucketNotification(bucketName, cb) {
|
|
this.setBucketNotification(bucketName, new _notification.NotificationConfig(), cb);
|
|
}
|
|
|
|
// Return the list of notification configurations stored
|
|
// in the S3 provider
|
|
getBucketNotification(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var method = 'GET';
|
|
var query = 'notification';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
var transformer = transformers.getBucketNotificationTransformer();
|
|
var bucketNotification;
|
|
(0, _helper.pipesetup)(response, transformer).on('data', result => bucketNotification = result).on('error', e => cb(e)).on('end', () => cb(null, bucketNotification));
|
|
});
|
|
}
|
|
|
|
// Listens for bucket notifications. Returns an EventEmitter.
|
|
listenBucketNotification(bucketName, prefix, suffix, events) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isString)(prefix)) {
|
|
throw new TypeError('prefix must be of type string');
|
|
}
|
|
if (!(0, _helper.isString)(suffix)) {
|
|
throw new TypeError('suffix must be of type string');
|
|
}
|
|
if (!Array.isArray(events)) {
|
|
throw new TypeError('events must be of type Array');
|
|
}
|
|
let listener = new _notification.NotificationPoller(this, bucketName, prefix, suffix, events);
|
|
listener.start();
|
|
return listener;
|
|
}
|
|
getBucketVersioning(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
var method = 'GET';
|
|
var query = 'versioning';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let versionConfig = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.bucketVersioningTransformer()).on('data', data => {
|
|
versionConfig = data;
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, versionConfig);
|
|
});
|
|
});
|
|
}
|
|
setBucketVersioning(bucketName, versionConfig, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!Object.keys(versionConfig).length) {
|
|
throw new errors.InvalidArgumentError('versionConfig should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
var method = 'PUT';
|
|
var query = 'versioning';
|
|
var builder = new _xml2js.Builder({
|
|
rootName: 'VersioningConfiguration',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
var payload = builder.buildObject(versionConfig);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, payload, [200], '', false, cb);
|
|
}
|
|
|
|
/** To set Tags on a bucket or object based on the params
|
|
* __Arguments__
|
|
* taggingParams _object_ Which contains the following properties
|
|
* bucketName _string_,
|
|
* objectName _string_ (Optional),
|
|
* tags _object_ of the form {'<tag-key-1>':'<tag-value-1>','<tag-key-2>':'<tag-value-2>'}
|
|
* putOpts _object_ (Optional) e.g {versionId:"my-object-version-id"},
|
|
* cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
setTagging(taggingParams) {
|
|
const {
|
|
bucketName,
|
|
objectName,
|
|
tags,
|
|
putOpts = {},
|
|
cb
|
|
} = taggingParams;
|
|
const method = 'PUT';
|
|
let query = 'tagging';
|
|
if (putOpts && putOpts.versionId) {
|
|
query = `${query}&versionId=${putOpts.versionId}`;
|
|
}
|
|
const tagsList = [];
|
|
for (const [key, value] of Object.entries(tags)) {
|
|
tagsList.push({
|
|
Key: key,
|
|
Value: value
|
|
});
|
|
}
|
|
const taggingConfig = {
|
|
Tagging: {
|
|
TagSet: {
|
|
Tag: tagsList
|
|
}
|
|
}
|
|
};
|
|
const encoder = new _webEncoding.TextEncoder();
|
|
const headers = {};
|
|
const builder = new _xml2js.Builder({
|
|
headless: true,
|
|
renderOpts: {
|
|
pretty: false
|
|
}
|
|
});
|
|
let payload = builder.buildObject(taggingConfig);
|
|
payload = Buffer.from(encoder.encode(payload));
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
};
|
|
if (objectName) {
|
|
requestOptions['objectName'] = objectName;
|
|
}
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest(requestOptions, payload, [200], '', false, cb);
|
|
}
|
|
|
|
/** Set Tags on a Bucket
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* tags _object_ of the form {'<tag-key-1>':'<tag-value-1>','<tag-key-2>':'<tag-value-2>'}
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
setBucketTagging(bucketName, tags, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isObject)(tags)) {
|
|
throw new errors.InvalidArgumentError('tags should be of type "object"');
|
|
}
|
|
if (Object.keys(tags).length > 10) {
|
|
throw new errors.InvalidArgumentError('maximum tags allowed is 10"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
return this.setTagging({
|
|
bucketName,
|
|
tags,
|
|
cb
|
|
});
|
|
}
|
|
|
|
/** Set Tags on an Object
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* objectName _string_
|
|
* * tags _object_ of the form {'<tag-key-1>':'<tag-value-1>','<tag-key-2>':'<tag-value-2>'}
|
|
* putOpts _object_ (Optional) e.g {versionId:"my-object-version-id"},
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
setObjectTagging(bucketName, objectName, tags, putOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid object name: ' + objectName);
|
|
}
|
|
if ((0, _helper.isFunction)(putOpts)) {
|
|
cb = putOpts;
|
|
putOpts = {};
|
|
}
|
|
if (!(0, _helper.isObject)(tags)) {
|
|
throw new errors.InvalidArgumentError('tags should be of type "object"');
|
|
}
|
|
if (Object.keys(tags).length > 10) {
|
|
throw new errors.InvalidArgumentError('Maximum tags allowed is 10"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
return this.setTagging({
|
|
bucketName,
|
|
objectName,
|
|
tags,
|
|
putOpts,
|
|
cb
|
|
});
|
|
}
|
|
|
|
/** Remove Tags on an Bucket/Object based on params
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* objectName _string_ (optional)
|
|
* removeOpts _object_ (Optional) e.g {versionId:"my-object-version-id"},
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
removeTagging({
|
|
bucketName,
|
|
objectName,
|
|
removeOpts,
|
|
cb
|
|
}) {
|
|
const method = 'DELETE';
|
|
let query = 'tagging';
|
|
if (removeOpts && Object.keys(removeOpts).length && removeOpts.versionId) {
|
|
query = `${query}&versionId=${removeOpts.versionId}`;
|
|
}
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
};
|
|
if (objectName) {
|
|
requestOptions['objectName'] = objectName;
|
|
}
|
|
this.makeRequest(requestOptions, '', [200, 204], '', true, cb);
|
|
}
|
|
|
|
/** Remove Tags associated with a bucket
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
removeBucketTagging(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
return this.removeTagging({
|
|
bucketName,
|
|
cb
|
|
});
|
|
}
|
|
|
|
/** Remove tags associated with an object
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* objectName _string_
|
|
* removeOpts _object_ (Optional) e.g. {VersionID:"my-object-version-id"}
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
removeObjectTagging(bucketName, objectName, removeOpts, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid object name: ' + objectName);
|
|
}
|
|
if ((0, _helper.isFunction)(removeOpts)) {
|
|
cb = removeOpts;
|
|
removeOpts = {};
|
|
}
|
|
if (removeOpts && Object.keys(removeOpts).length && !(0, _helper.isObject)(removeOpts)) {
|
|
throw new errors.InvalidArgumentError('removeOpts should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
return this.removeTagging({
|
|
bucketName,
|
|
objectName,
|
|
removeOpts,
|
|
cb
|
|
});
|
|
}
|
|
|
|
/** Get Tags associated with a Bucket
|
|
* __Arguments__
|
|
* bucketName _string_
|
|
* `cb(error, tags)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
getBucketTagging(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
const method = 'GET';
|
|
const query = 'tagging';
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
query
|
|
};
|
|
this.makeRequest(requestOptions, '', [200], '', true, (e, response) => {
|
|
var transformer = transformers.getTagsTransformer();
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let tagsList;
|
|
(0, _helper.pipesetup)(response, transformer).on('data', result => tagsList = result).on('error', e => cb(e)).on('end', () => cb(null, tagsList));
|
|
});
|
|
}
|
|
|
|
/** Get the tags associated with a bucket OR an object
|
|
* bucketName _string_
|
|
* objectName _string_ (Optional)
|
|
* getOpts _object_ (Optional) e.g {versionId:"my-object-version-id"}
|
|
* `cb(error, tags)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
getObjectTagging(bucketName, objectName, getOpts = {}, cb = () => false) {
|
|
const method = 'GET';
|
|
let query = 'tagging';
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid object name: ' + objectName);
|
|
}
|
|
if ((0, _helper.isFunction)(getOpts)) {
|
|
cb = getOpts;
|
|
getOpts = {};
|
|
}
|
|
if (!(0, _helper.isObject)(getOpts)) {
|
|
throw new errors.InvalidArgumentError('getOpts should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
if (getOpts && getOpts.versionId) {
|
|
query = `${query}&versionId=${getOpts.versionId}`;
|
|
}
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
query
|
|
};
|
|
if (objectName) {
|
|
requestOptions['objectName'] = objectName;
|
|
}
|
|
this.makeRequest(requestOptions, '', [200], '', true, (e, response) => {
|
|
const transformer = transformers.getTagsTransformer();
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let tagsList;
|
|
(0, _helper.pipesetup)(response, transformer).on('data', result => tagsList = result).on('error', e => cb(e)).on('end', () => cb(null, tagsList));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Apply lifecycle configuration on a bucket.
|
|
* bucketName _string_
|
|
* policyConfig _object_ a valid policy configuration object.
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
applyBucketLifecycle(bucketName, policyConfig, cb) {
|
|
const method = 'PUT';
|
|
const query = 'lifecycle';
|
|
const encoder = new _webEncoding.TextEncoder();
|
|
const headers = {};
|
|
const builder = new _xml2js.Builder({
|
|
rootName: 'LifecycleConfiguration',
|
|
headless: true,
|
|
renderOpts: {
|
|
pretty: false
|
|
}
|
|
});
|
|
let payload = builder.buildObject(policyConfig);
|
|
payload = Buffer.from(encoder.encode(payload));
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
};
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest(requestOptions, payload, [200], '', false, cb);
|
|
}
|
|
|
|
/** Remove lifecycle configuration of a bucket.
|
|
* bucketName _string_
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
removeBucketLifecycle(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
const method = 'DELETE';
|
|
const query = 'lifecycle';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [204], '', false, cb);
|
|
}
|
|
|
|
/** Set/Override lifecycle configuration on a bucket. if the configuration is empty, it removes the configuration.
|
|
* bucketName _string_
|
|
* lifeCycleConfig _object_ one of the following values: (null or '') to remove the lifecycle configuration. or a valid lifecycle configuration
|
|
* `cb(error)` _function_ - callback function with `err` as the error argument. `err` is null if the operation is successful.
|
|
*/
|
|
setBucketLifecycle(bucketName, lifeCycleConfig = null, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (_lodash.isEmpty(lifeCycleConfig)) {
|
|
this.removeBucketLifecycle(bucketName, cb);
|
|
} else {
|
|
this.applyBucketLifecycle(bucketName, lifeCycleConfig, cb);
|
|
}
|
|
}
|
|
|
|
/** Get lifecycle configuration on a bucket.
|
|
* bucketName _string_
|
|
* `cb(config)` _function_ - callback function with lifecycle configuration as the error argument.
|
|
*/
|
|
getBucketLifecycle(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
const method = 'GET';
|
|
const query = 'lifecycle';
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
query
|
|
};
|
|
this.makeRequest(requestOptions, '', [200], '', true, (e, response) => {
|
|
const transformer = transformers.lifecycleTransformer();
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let lifecycleConfig;
|
|
(0, _helper.pipesetup)(response, transformer).on('data', result => lifecycleConfig = result).on('error', e => cb(e)).on('end', () => cb(null, lifecycleConfig));
|
|
});
|
|
}
|
|
setObjectLockConfig(bucketName, lockConfigOpts = {}, cb) {
|
|
const retentionModes = [_type.RETENTION_MODES.COMPLIANCE, _type.RETENTION_MODES.GOVERNANCE];
|
|
const validUnits = [_type.RETENTION_VALIDITY_UNITS.DAYS, _type.RETENTION_VALIDITY_UNITS.YEARS];
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (lockConfigOpts.mode && !retentionModes.includes(lockConfigOpts.mode)) {
|
|
throw new TypeError(`lockConfigOpts.mode should be one of ${retentionModes}`);
|
|
}
|
|
if (lockConfigOpts.unit && !validUnits.includes(lockConfigOpts.unit)) {
|
|
throw new TypeError(`lockConfigOpts.unit should be one of ${validUnits}`);
|
|
}
|
|
if (lockConfigOpts.validity && !(0, _helper.isNumber)(lockConfigOpts.validity)) {
|
|
throw new TypeError(`lockConfigOpts.validity should be a number`);
|
|
}
|
|
const method = 'PUT';
|
|
const query = 'object-lock';
|
|
let config = {
|
|
ObjectLockEnabled: 'Enabled'
|
|
};
|
|
const configKeys = Object.keys(lockConfigOpts);
|
|
// Check if keys are present and all keys are present.
|
|
if (configKeys.length > 0) {
|
|
if (_lodash.difference(configKeys, ['unit', 'mode', 'validity']).length !== 0) {
|
|
throw new TypeError(`lockConfigOpts.mode,lockConfigOpts.unit,lockConfigOpts.validity all the properties should be specified.`);
|
|
} else {
|
|
config.Rule = {
|
|
DefaultRetention: {}
|
|
};
|
|
if (lockConfigOpts.mode) {
|
|
config.Rule.DefaultRetention.Mode = lockConfigOpts.mode;
|
|
}
|
|
if (lockConfigOpts.unit === _type.RETENTION_VALIDITY_UNITS.DAYS) {
|
|
config.Rule.DefaultRetention.Days = lockConfigOpts.validity;
|
|
} else if (lockConfigOpts.unit === _type.RETENTION_VALIDITY_UNITS.YEARS) {
|
|
config.Rule.DefaultRetention.Years = lockConfigOpts.validity;
|
|
}
|
|
}
|
|
}
|
|
const builder = new _xml2js.Builder({
|
|
rootName: 'ObjectLockConfiguration',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
const payload = builder.buildObject(config);
|
|
const headers = {};
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
}, payload, [200], '', false, cb);
|
|
}
|
|
getObjectLockConfig(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
const method = 'GET';
|
|
const query = 'object-lock';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let objectLockConfig = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.objectLockTransformer()).on('data', data => {
|
|
objectLockConfig = data;
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, objectLockConfig);
|
|
});
|
|
});
|
|
}
|
|
putObjectRetention(bucketName, objectName, retentionOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isObject)(retentionOpts)) {
|
|
throw new errors.InvalidArgumentError('retentionOpts should be of type "object"');
|
|
} else {
|
|
if (retentionOpts.governanceBypass && !(0, _helper.isBoolean)(retentionOpts.governanceBypass)) {
|
|
throw new errors.InvalidArgumentError('Invalid value for governanceBypass', retentionOpts.governanceBypass);
|
|
}
|
|
if (retentionOpts.mode && ![_type.RETENTION_MODES.COMPLIANCE, _type.RETENTION_MODES.GOVERNANCE].includes(retentionOpts.mode)) {
|
|
throw new errors.InvalidArgumentError('Invalid object retention mode ', retentionOpts.mode);
|
|
}
|
|
if (retentionOpts.retainUntilDate && !(0, _helper.isString)(retentionOpts.retainUntilDate)) {
|
|
throw new errors.InvalidArgumentError('Invalid value for retainUntilDate', retentionOpts.retainUntilDate);
|
|
}
|
|
if (retentionOpts.versionId && !(0, _helper.isString)(retentionOpts.versionId)) {
|
|
throw new errors.InvalidArgumentError('Invalid value for versionId', retentionOpts.versionId);
|
|
}
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
const method = 'PUT';
|
|
let query = 'retention';
|
|
const headers = {};
|
|
if (retentionOpts.governanceBypass) {
|
|
headers['X-Amz-Bypass-Governance-Retention'] = true;
|
|
}
|
|
const builder = new _xml2js.Builder({
|
|
rootName: 'Retention',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
const params = {};
|
|
if (retentionOpts.mode) {
|
|
params.Mode = retentionOpts.mode;
|
|
}
|
|
if (retentionOpts.retainUntilDate) {
|
|
params.RetainUntilDate = retentionOpts.retainUntilDate;
|
|
}
|
|
if (retentionOpts.versionId) {
|
|
query += `&versionId=${retentionOpts.versionId}`;
|
|
}
|
|
let payload = builder.buildObject(params);
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query,
|
|
headers
|
|
}, payload, [200, 204], '', false, cb);
|
|
}
|
|
getObjectRetention(bucketName, objectName, getOpts, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!(0, _helper.isObject)(getOpts)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "object"');
|
|
} else if (getOpts.versionId && !(0, _helper.isString)(getOpts.versionId)) {
|
|
throw new errors.InvalidArgumentError('VersionID should be of type "string"');
|
|
}
|
|
if (cb && !(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
const method = 'GET';
|
|
let query = 'retention';
|
|
if (getOpts.versionId) {
|
|
query += `&versionId=${getOpts.versionId}`;
|
|
}
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let retentionConfig = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.objectRetentionTransformer()).on('data', data => {
|
|
retentionConfig = data;
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, retentionConfig);
|
|
});
|
|
});
|
|
}
|
|
setBucketEncryption(bucketName, encryptionConfig, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if ((0, _helper.isFunction)(encryptionConfig)) {
|
|
cb = encryptionConfig;
|
|
encryptionConfig = null;
|
|
}
|
|
if (!_lodash.isEmpty(encryptionConfig) && encryptionConfig.Rule.length > 1) {
|
|
throw new errors.InvalidArgumentError('Invalid Rule length. Only one rule is allowed.: ' + encryptionConfig.Rule);
|
|
}
|
|
if (cb && !(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
let encryptionObj = encryptionConfig;
|
|
if (_lodash.isEmpty(encryptionConfig)) {
|
|
encryptionObj = {
|
|
// Default MinIO Server Supported Rule
|
|
Rule: [{
|
|
ApplyServerSideEncryptionByDefault: {
|
|
SSEAlgorithm: 'AES256'
|
|
}
|
|
}]
|
|
};
|
|
}
|
|
let method = 'PUT';
|
|
let query = 'encryption';
|
|
let builder = new _xml2js.Builder({
|
|
rootName: 'ServerSideEncryptionConfiguration',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
let payload = builder.buildObject(encryptionObj);
|
|
const headers = {};
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query,
|
|
headers
|
|
}, payload, [200], '', false, cb);
|
|
}
|
|
getBucketEncryption(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
const method = 'GET';
|
|
const query = 'encryption';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let bucketEncConfig = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.bucketEncryptionTransformer()).on('data', data => {
|
|
bucketEncConfig = data;
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, bucketEncConfig);
|
|
});
|
|
});
|
|
}
|
|
removeBucketEncryption(bucketName, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
const method = 'DELETE';
|
|
const query = 'encryption';
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
query
|
|
}, '', [204], '', false, cb);
|
|
}
|
|
getObjectLegalHold(bucketName, objectName, getOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if ((0, _helper.isFunction)(getOpts)) {
|
|
cb = getOpts;
|
|
getOpts = {};
|
|
}
|
|
if (!(0, _helper.isObject)(getOpts)) {
|
|
throw new TypeError('getOpts should be of type "Object"');
|
|
} else if (Object.keys(getOpts).length > 0 && getOpts.versionId && !(0, _helper.isString)(getOpts.versionId)) {
|
|
throw new TypeError('versionId should be of type string.:', getOpts.versionId);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
const method = 'GET';
|
|
let query = 'legal-hold';
|
|
if (getOpts.versionId) {
|
|
query += `&versionId=${getOpts.versionId}`;
|
|
}
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
}, '', [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let legalHoldConfig = Buffer.from('');
|
|
(0, _helper.pipesetup)(response, transformers.objectLegalHoldTransformer()).on('data', data => {
|
|
legalHoldConfig = data;
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, legalHoldConfig);
|
|
});
|
|
});
|
|
}
|
|
setObjectLegalHold(bucketName, objectName, setOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
const defaultOpts = {
|
|
status: _type.LEGAL_HOLD_STATUS.ENABLED
|
|
};
|
|
if ((0, _helper.isFunction)(setOpts)) {
|
|
cb = setOpts;
|
|
setOpts = defaultOpts;
|
|
}
|
|
if (!(0, _helper.isObject)(setOpts)) {
|
|
throw new TypeError('setOpts should be of type "Object"');
|
|
} else {
|
|
if (![_type.LEGAL_HOLD_STATUS.ENABLED, _type.LEGAL_HOLD_STATUS.DISABLED].includes(setOpts.status)) {
|
|
throw new TypeError('Invalid status: ' + setOpts.status);
|
|
}
|
|
if (setOpts.versionId && !setOpts.versionId.length) {
|
|
throw new TypeError('versionId should be of type string.:' + setOpts.versionId);
|
|
}
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new errors.InvalidArgumentError('callback should be of type "function"');
|
|
}
|
|
if (_lodash.isEmpty(setOpts)) {
|
|
setOpts = {
|
|
defaultOpts
|
|
};
|
|
}
|
|
const method = 'PUT';
|
|
let query = 'legal-hold';
|
|
if (setOpts.versionId) {
|
|
query += `&versionId=${setOpts.versionId}`;
|
|
}
|
|
let config = {
|
|
Status: setOpts.status
|
|
};
|
|
const builder = new _xml2js.Builder({
|
|
rootName: 'LegalHold',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
const payload = builder.buildObject(config);
|
|
const headers = {};
|
|
headers['Content-MD5'] = (0, _helper.toMd5)(payload);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query,
|
|
headers
|
|
}, payload, [200], '', false, cb);
|
|
}
|
|
|
|
/**
|
|
* Internal method to upload a part during compose object.
|
|
* @param partConfig __object__ contains the following.
|
|
* bucketName __string__
|
|
* objectName __string__
|
|
* uploadID __string__
|
|
* partNumber __number__
|
|
* headers __object__
|
|
* @param cb called with null incase of error.
|
|
*/
|
|
uploadPartCopy(partConfig, cb) {
|
|
const {
|
|
bucketName,
|
|
objectName,
|
|
uploadID,
|
|
partNumber,
|
|
headers
|
|
} = partConfig;
|
|
const method = 'PUT';
|
|
let query = `uploadId=${uploadID}&partNumber=${partNumber}`;
|
|
const requestOptions = {
|
|
method,
|
|
bucketName,
|
|
objectName: objectName,
|
|
query,
|
|
headers
|
|
};
|
|
return this.makeRequest(requestOptions, '', [200], '', true, (e, response) => {
|
|
let partCopyResult = Buffer.from('');
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
(0, _helper.pipesetup)(response, transformers.uploadPartTransformer()).on('data', data => {
|
|
partCopyResult = data;
|
|
}).on('error', cb).on('end', () => {
|
|
let uploadPartCopyRes = {
|
|
etag: (0, _helper.sanitizeETag)(partCopyResult.ETag),
|
|
key: objectName,
|
|
part: partNumber
|
|
};
|
|
cb(null, uploadPartCopyRes);
|
|
});
|
|
});
|
|
}
|
|
composeObject(destObjConfig = {}, sourceObjList = [], cb) {
|
|
const me = this; // many async flows. so store the ref.
|
|
const sourceFilesLength = sourceObjList.length;
|
|
if (!Array.isArray(sourceObjList)) {
|
|
throw new errors.InvalidArgumentError('sourceConfig should an array of CopySourceOptions ');
|
|
}
|
|
if (!(destObjConfig instanceof _helpers.CopyDestinationOptions)) {
|
|
throw new errors.InvalidArgumentError('destConfig should of type CopyDestinationOptions ');
|
|
}
|
|
if (sourceFilesLength < 1 || sourceFilesLength > _helper.PART_CONSTRAINTS.MAX_PARTS_COUNT) {
|
|
throw new errors.InvalidArgumentError(`"There must be as least one and up to ${_helper.PART_CONSTRAINTS.MAX_PARTS_COUNT} source objects.`);
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
for (let i = 0; i < sourceFilesLength; i++) {
|
|
if (!sourceObjList[i].validate()) {
|
|
return false;
|
|
}
|
|
}
|
|
if (!destObjConfig.validate()) {
|
|
return false;
|
|
}
|
|
const getStatOptions = srcConfig => {
|
|
let statOpts = {};
|
|
if (!_lodash.isEmpty(srcConfig.VersionID)) {
|
|
statOpts = {
|
|
versionId: srcConfig.VersionID
|
|
};
|
|
}
|
|
return statOpts;
|
|
};
|
|
const srcObjectSizes = [];
|
|
let totalSize = 0;
|
|
let totalParts = 0;
|
|
const sourceObjStats = sourceObjList.map(srcItem => me.statObject(srcItem.Bucket, srcItem.Object, getStatOptions(srcItem)));
|
|
return Promise.all(sourceObjStats).then(srcObjectInfos => {
|
|
const validatedStats = srcObjectInfos.map((resItemStat, index) => {
|
|
const srcConfig = sourceObjList[index];
|
|
let srcCopySize = resItemStat.size;
|
|
// Check if a segment is specified, and if so, is the
|
|
// segment within object bounds?
|
|
if (srcConfig.MatchRange) {
|
|
// Since range is specified,
|
|
// 0 <= src.srcStart <= src.srcEnd
|
|
// so only invalid case to check is:
|
|
const srcStart = srcConfig.Start;
|
|
const srcEnd = srcConfig.End;
|
|
if (srcEnd >= srcCopySize || srcStart < 0) {
|
|
throw new errors.InvalidArgumentError(`CopySrcOptions ${index} has invalid segment-to-copy [${srcStart}, ${srcEnd}] (size is ${srcCopySize})`);
|
|
}
|
|
srcCopySize = srcEnd - srcStart + 1;
|
|
}
|
|
|
|
// Only the last source may be less than `absMinPartSize`
|
|
if (srcCopySize < _helper.PART_CONSTRAINTS.ABS_MIN_PART_SIZE && index < sourceFilesLength - 1) {
|
|
throw new errors.InvalidArgumentError(`CopySrcOptions ${index} is too small (${srcCopySize}) and it is not the last part.`);
|
|
}
|
|
|
|
// Is data to copy too large?
|
|
totalSize += srcCopySize;
|
|
if (totalSize > _helper.PART_CONSTRAINTS.MAX_MULTIPART_PUT_OBJECT_SIZE) {
|
|
throw new errors.InvalidArgumentError(`Cannot compose an object of size ${totalSize} (> 5TiB)`);
|
|
}
|
|
|
|
// record source size
|
|
srcObjectSizes[index] = srcCopySize;
|
|
|
|
// calculate parts needed for current source
|
|
totalParts += (0, _helper.partsRequired)(srcCopySize);
|
|
// Do we need more parts than we are allowed?
|
|
if (totalParts > _helper.PART_CONSTRAINTS.MAX_PARTS_COUNT) {
|
|
throw new errors.InvalidArgumentError(`Your proposed compose object requires more than ${_helper.PART_CONSTRAINTS.MAX_PARTS_COUNT} parts`);
|
|
}
|
|
return resItemStat;
|
|
});
|
|
if (totalParts === 1 && totalSize <= _helper.PART_CONSTRAINTS.MAX_PART_SIZE || totalSize === 0) {
|
|
return this.copyObject(sourceObjList[0], destObjConfig, cb); // use copyObjectV2
|
|
}
|
|
|
|
// preserve etag to avoid modification of object while copying.
|
|
for (let i = 0; i < sourceFilesLength; i++) {
|
|
sourceObjList[i].MatchETag = validatedStats[i].etag;
|
|
}
|
|
const splitPartSizeList = validatedStats.map((resItemStat, idx) => {
|
|
const calSize = (0, _helper.calculateEvenSplits)(srcObjectSizes[idx], sourceObjList[idx]);
|
|
return calSize;
|
|
});
|
|
function getUploadPartConfigList(uploadId) {
|
|
const uploadPartConfigList = [];
|
|
splitPartSizeList.forEach((splitSize, splitIndex) => {
|
|
const {
|
|
startIndex: startIdx,
|
|
endIndex: endIdx,
|
|
objInfo: objConfig
|
|
} = splitSize;
|
|
let partIndex = splitIndex + 1; // part index starts from 1.
|
|
const totalUploads = Array.from(startIdx);
|
|
const headers = sourceObjList[splitIndex].getHeaders();
|
|
totalUploads.forEach((splitStart, upldCtrIdx) => {
|
|
let splitEnd = endIdx[upldCtrIdx];
|
|
const sourceObj = `${objConfig.Bucket}/${objConfig.Object}`;
|
|
headers['x-amz-copy-source'] = `${sourceObj}`;
|
|
headers['x-amz-copy-source-range'] = `bytes=${splitStart}-${splitEnd}`;
|
|
const uploadPartConfig = {
|
|
bucketName: destObjConfig.Bucket,
|
|
objectName: destObjConfig.Object,
|
|
uploadID: uploadId,
|
|
partNumber: partIndex,
|
|
headers: headers,
|
|
sourceObj: sourceObj
|
|
};
|
|
uploadPartConfigList.push(uploadPartConfig);
|
|
});
|
|
});
|
|
return uploadPartConfigList;
|
|
}
|
|
const performUploadParts = uploadId => {
|
|
const uploadList = getUploadPartConfigList(uploadId);
|
|
_async.map(uploadList, me.uploadPartCopy.bind(me), (err, res) => {
|
|
if (err) {
|
|
this.abortMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, uploadId).then(() => cb(), err => cb(err));
|
|
return;
|
|
}
|
|
const partsDone = res.map(partCopy => ({
|
|
etag: partCopy.etag,
|
|
part: partCopy.part
|
|
}));
|
|
return me.completeMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, uploadId, partsDone, cb);
|
|
});
|
|
};
|
|
const newUploadHeaders = destObjConfig.getHeaders();
|
|
me.initiateNewMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, newUploadHeaders).then(uploadId => {
|
|
performUploadParts(uploadId);
|
|
}, err => {
|
|
cb(err, null);
|
|
});
|
|
}).catch(error => {
|
|
cb(error, null);
|
|
});
|
|
}
|
|
selectObjectContent(bucketName, objectName, selectOpts = {}, cb) {
|
|
if (!(0, _helper.isValidBucketName)(bucketName)) {
|
|
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
|
|
}
|
|
if (!(0, _helper.isValidObjectName)(objectName)) {
|
|
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`);
|
|
}
|
|
if (!_lodash.isEmpty(selectOpts)) {
|
|
if (!(0, _helper.isString)(selectOpts.expression)) {
|
|
throw new TypeError('sqlExpression should be of type "string"');
|
|
}
|
|
if (!_lodash.isEmpty(selectOpts.inputSerialization)) {
|
|
if (!(0, _helper.isObject)(selectOpts.inputSerialization)) {
|
|
throw new TypeError('inputSerialization should be of type "object"');
|
|
}
|
|
} else {
|
|
throw new TypeError('inputSerialization is required');
|
|
}
|
|
if (!_lodash.isEmpty(selectOpts.outputSerialization)) {
|
|
if (!(0, _helper.isObject)(selectOpts.outputSerialization)) {
|
|
throw new TypeError('outputSerialization should be of type "object"');
|
|
}
|
|
} else {
|
|
throw new TypeError('outputSerialization is required');
|
|
}
|
|
} else {
|
|
throw new TypeError('valid select configuration is required');
|
|
}
|
|
if (!(0, _helper.isFunction)(cb)) {
|
|
throw new TypeError('callback should be of type "function"');
|
|
}
|
|
const method = 'POST';
|
|
let query = `select`;
|
|
query += '&select-type=2';
|
|
const config = [{
|
|
Expression: selectOpts.expression
|
|
}, {
|
|
ExpressionType: selectOpts.expressionType || 'SQL'
|
|
}, {
|
|
InputSerialization: [selectOpts.inputSerialization]
|
|
}, {
|
|
OutputSerialization: [selectOpts.outputSerialization]
|
|
}];
|
|
|
|
// Optional
|
|
if (selectOpts.requestProgress) {
|
|
config.push({
|
|
RequestProgress: selectOpts.requestProgress
|
|
});
|
|
}
|
|
// Optional
|
|
if (selectOpts.scanRange) {
|
|
config.push({
|
|
ScanRange: selectOpts.scanRange
|
|
});
|
|
}
|
|
const builder = new _xml2js.Builder({
|
|
rootName: 'SelectObjectContentRequest',
|
|
renderOpts: {
|
|
pretty: false
|
|
},
|
|
headless: true
|
|
});
|
|
const payload = builder.buildObject(config);
|
|
this.makeRequest({
|
|
method,
|
|
bucketName,
|
|
objectName,
|
|
query
|
|
}, payload, [200], '', true, (e, response) => {
|
|
if (e) {
|
|
return cb(e);
|
|
}
|
|
let selectResult;
|
|
(0, _helper.pipesetup)(response, transformers.selectObjectContentTransformer()).on('data', data => {
|
|
selectResult = (0, _xmlParsers.parseSelectObjectContentResponse)(data);
|
|
}).on('error', cb).on('end', () => {
|
|
cb(null, selectResult);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
// Promisify various public-facing APIs on the Client module.
|
|
exports.Client = Client;
|
|
Client.prototype.makeBucket = (0, _promisify.promisify)(Client.prototype.makeBucket);
|
|
Client.prototype.bucketExists = (0, _promisify.promisify)(Client.prototype.bucketExists);
|
|
Client.prototype.getObject = (0, _promisify.promisify)(Client.prototype.getObject);
|
|
Client.prototype.getPartialObject = (0, _promisify.promisify)(Client.prototype.getPartialObject);
|
|
Client.prototype.fGetObject = (0, _promisify.promisify)(Client.prototype.fGetObject);
|
|
Client.prototype.putObject = (0, _promisify.promisify)(Client.prototype.putObject);
|
|
Client.prototype.fPutObject = (0, _promisify.promisify)(Client.prototype.fPutObject);
|
|
Client.prototype.copyObject = (0, _promisify.promisify)(Client.prototype.copyObject);
|
|
Client.prototype.removeObjects = (0, _promisify.promisify)(Client.prototype.removeObjects);
|
|
Client.prototype.presignedUrl = (0, _promisify.promisify)(Client.prototype.presignedUrl);
|
|
Client.prototype.presignedGetObject = (0, _promisify.promisify)(Client.prototype.presignedGetObject);
|
|
Client.prototype.presignedPutObject = (0, _promisify.promisify)(Client.prototype.presignedPutObject);
|
|
Client.prototype.presignedPostPolicy = (0, _promisify.promisify)(Client.prototype.presignedPostPolicy);
|
|
Client.prototype.getBucketNotification = (0, _promisify.promisify)(Client.prototype.getBucketNotification);
|
|
Client.prototype.setBucketNotification = (0, _promisify.promisify)(Client.prototype.setBucketNotification);
|
|
Client.prototype.removeAllBucketNotification = (0, _promisify.promisify)(Client.prototype.removeAllBucketNotification);
|
|
Client.prototype.getBucketPolicy = (0, _promisify.promisify)(Client.prototype.getBucketPolicy);
|
|
Client.prototype.setBucketPolicy = (0, _promisify.promisify)(Client.prototype.setBucketPolicy);
|
|
Client.prototype.removeIncompleteUpload = (0, _promisify.promisify)(Client.prototype.removeIncompleteUpload);
|
|
Client.prototype.getBucketVersioning = (0, _promisify.promisify)(Client.prototype.getBucketVersioning);
|
|
Client.prototype.setBucketVersioning = (0, _promisify.promisify)(Client.prototype.setBucketVersioning);
|
|
Client.prototype.setBucketTagging = (0, _promisify.promisify)(Client.prototype.setBucketTagging);
|
|
Client.prototype.removeBucketTagging = (0, _promisify.promisify)(Client.prototype.removeBucketTagging);
|
|
Client.prototype.getBucketTagging = (0, _promisify.promisify)(Client.prototype.getBucketTagging);
|
|
Client.prototype.setObjectTagging = (0, _promisify.promisify)(Client.prototype.setObjectTagging);
|
|
Client.prototype.removeObjectTagging = (0, _promisify.promisify)(Client.prototype.removeObjectTagging);
|
|
Client.prototype.getObjectTagging = (0, _promisify.promisify)(Client.prototype.getObjectTagging);
|
|
Client.prototype.setBucketLifecycle = (0, _promisify.promisify)(Client.prototype.setBucketLifecycle);
|
|
Client.prototype.getBucketLifecycle = (0, _promisify.promisify)(Client.prototype.getBucketLifecycle);
|
|
Client.prototype.removeBucketLifecycle = (0, _promisify.promisify)(Client.prototype.removeBucketLifecycle);
|
|
Client.prototype.setObjectLockConfig = (0, _promisify.promisify)(Client.prototype.setObjectLockConfig);
|
|
Client.prototype.getObjectLockConfig = (0, _promisify.promisify)(Client.prototype.getObjectLockConfig);
|
|
Client.prototype.putObjectRetention = (0, _promisify.promisify)(Client.prototype.putObjectRetention);
|
|
Client.prototype.getObjectRetention = (0, _promisify.promisify)(Client.prototype.getObjectRetention);
|
|
Client.prototype.setBucketEncryption = (0, _promisify.promisify)(Client.prototype.setBucketEncryption);
|
|
Client.prototype.getBucketEncryption = (0, _promisify.promisify)(Client.prototype.getBucketEncryption);
|
|
Client.prototype.removeBucketEncryption = (0, _promisify.promisify)(Client.prototype.removeBucketEncryption);
|
|
Client.prototype.setObjectLegalHold = (0, _promisify.promisify)(Client.prototype.setObjectLegalHold);
|
|
Client.prototype.getObjectLegalHold = (0, _promisify.promisify)(Client.prototype.getObjectLegalHold);
|
|
Client.prototype.composeObject = (0, _promisify.promisify)(Client.prototype.composeObject);
|
|
Client.prototype.selectObjectContent = (0, _promisify.promisify)(Client.prototype.selectObjectContent);
|
|
|
|
// refactored API use promise internally
|
|
Client.prototype.removeObject = (0, _callbackify.callbackify)(Client.prototype.removeObject);
|
|
Client.prototype.statObject = (0, _callbackify.callbackify)(Client.prototype.statObject);
|
|
Client.prototype.removeBucket = (0, _callbackify.callbackify)(Client.prototype.removeBucket);
|
|
Client.prototype.listBuckets = (0, _callbackify.callbackify)(Client.prototype.listBuckets);
|
|
Client.prototype.removeBucketReplication = (0, _callbackify.callbackify)(Client.prototype.removeBucketReplication);
|
|
Client.prototype.setBucketReplication = (0, _callbackify.callbackify)(Client.prototype.setBucketReplication);
|
|
Client.prototype.getBucketReplication = (0, _callbackify.callbackify)(Client.prototype.getBucketRe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XN1bHQudXBsb2FkcyxcbiAgICAgICAgICAgICh1cGxvYWQsIGNiKSA9PiB7XG4gICAgICAgICAgICAgIC8vIGZvciBlYWNoIGluY29tcGxldGUgdXBsb2FkIGFkZCB0aGUgc2l6ZXMgb2YgaXRzIHVwbG9hZGVkIHBhcnRzXG4gICAgICAgICAgICAgIHRoaXMubGlzdFBhcnRzKGJ1Y2tldCwgdXBsb2FkLmtleSwgdXBsb2FkLnVwbG9hZElkKS50aGVuKChwYXJ0cykgPT4ge1xuICAgICAgICAgICAgICAgIHVwbG9hZC5zaXplID0gcGFydHMucmVkdWNlKChhY2MsIGl0ZW0pID0+IGFjYyArIGl0ZW0uc2l6ZSwgMClcbiAgICAgICAgICAgICAgICB1cGxvYWRzLnB1c2godXBsb2FkKVxuICAgICAgICAgICAgICAgIGNiKClcbiAgICAgICAgICAgICAgfSwgY2IpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgKGVycikgPT4ge1xuICAgICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgcmVhZFN0cmVhbS5lbWl0KCdlcnJvcicsIGVycilcbiAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAocmVzdWx0LmlzVHJ1bmNhdGVkKSB7XG4gICAgICAgICAgICAgICAga2V5TWFya2VyID0gcmVzdWx0Lm5leHRLZXlNYXJrZXJcbiAgICAgICAgICAgICAgICB1cGxvYWRJZE1hcmtlciA9IHJlc3VsdC5uZXh0VXBsb2FkSWRNYXJrZXJcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBlbmRlZCA9IHRydWVcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZWFkU3RyZWFtLl9yZWFkKClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgKVxuICAgICAgICB9KVxuICAgIH1cbiAgICByZXR1cm4gcmVhZFN0cmVhbVxuICB9XG5cbiAgLy8gVG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sb2FkXG4gICAgdmFyIGxpc3ROZXh0ID0gKGtleU1hcmtlciwgdXBsb2FkSWRNYXJrZXIpID0+IHtcbiAgICAgIHRoaXMubGlzdEluY29tcGxldGVVcGxvYWRzUXVlcnkoYnVja2V0TmFtZSwgb2JqZWN0TmFtZSwga2V5TWFya2VyLCB1cGxvYWRJZE1hcmtlciwgJycpXG4gICAgICAgIC5vbignZXJyb3InLCAoZSkgPT4gY2IoZSkpXG4gICAgICAgIC5vbignZGF0YScsIChyZXN1bHQpID0+IHtcbiAgICAgICAgICByZXN1bHQudXBsb2Fkcy5mb3JFYWNoKCh1cGxvYWQpID0+IHtcbiAgICAgICAgICAgIGlmICh1cGxvYWQua2V5ID09PSBvYmplY3ROYW1lKSB7XG4gICAgICAgICAgICAgIGlmICghbGF0ZXN0VXBsb2FkIHx8IHVwbG9hZC5pbml0aWF0ZWQuZ2V0VGltZSgpID4gbGF0ZXN0VXBsb2FkLmluaXRpYXRlZC5nZXRUaW1lKCkpIHtcbiAgICAgICAgICAgICAgICBsYXRlc3RVcGxvYWQgPSB1cGxvYWRcbiAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pXG4gICAgICAgICAgaWYgKHJlc3VsdC5pc1RydW5jYXRlZCkge1xuICAgICAgICAgICAgbGlzdE5leHQocmVzdWx0Lm5leHRLZXlNYXJrZXIsIHJlc3VsdC5uZXh0VXBsb2FkSWRNYXJrZXIpXG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGxhdGVzdFVwbG9hZCkge1xuICAgICAgICAgICAgcmV0dXJuIGNiKG51bGwsIGxhdGVzdFVwbG9hZC51cGxvYWRJZClcbiAgICAgICAgICB9XG4gICAgICAgICAgY2IobnVsbCwgdW5kZWZpbmVkKVxuICAgICAgICB9KVxuICAgIH1cbiAgICBsaXN0TmV4dCgnJywgJycpXG4gIH1cblxuICAvLyBSZW1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lKSB7XG4gICAgICAgICAgICAvLyBTaW5jZSByYW5nZSBpcyBzcGVjaWZpZWQsXG4gICAgICAgICAgICAvLyAgICAwIDw9IHNyYy5zcmNTdGFydCA8PSBzcmMuc3JjRW5kXG4gICAgICAgICAgICAvLyBzbyBvbmx5IGludmFsaWQgY2FzZSB0byBjaGVjayBpczpcbiAgICAgICAgICAgIGNvbnN0IHNyY1N0YXJ0ID0gc3JjQ29uZmlnLlN0YXJ0XG4gICAgICAgICAgICBjb25zdCBzcmNFbmQgPSBzcmNDb25maWcuRW5kXG4gICAgICAgICAgICBpZiAoc3JjRW5kID49IHNyY0NvcHlTaXplIHx8IHNyY1N0YXJ0IDwgMCkge1xuICAgICAgICAgICAgICB0aHJvdyBuZXcgZXJyb3JzLkludmFsaWRBcmd1bWVudEVycm9yKFxuICAgICAgICAgICAgICAgIGBDb3B5U3JjT3B0aW9ucyAke2luZGV4fSBoYXMgaW52YWxpZCBzZWdtZW50LXRvLWNvcHkgWyR7c3JjU3RhcnR9LCAke3NyY0VuZH1dIChzaXplIGlzICR7c3JjQ29weVNpemV9KWAsXG4gICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNyY0NvcHlTaXplID0gc3JjRW5kIC0gc3JjU3RhcnQgKyAxXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgLy8gT25seSB0aGUgbGFzdCBzb3VyY2UgbWF5IGJlIGxlc3MgdGhhbiBgYWJzTWluUGFydFNpemVgXG4gICAgICAgICAgaWYgKHNyY0NvcHlTaXplIDwgUEFSVF9DT05TVFJBSU5UUy5BQlNfTUlOX1BBUlRfU0laRSAmJiBpbmRleCA8IHNvdXJjZUZpbGVzTGVuZ3RoIC0gMSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IGVycm9ycy5JbnZhbGlkQXJndW1lbnRFcnJvcihcbiAgICAgICAgICAgICAgYENvcHlTcmNPcHRpb25zICR7aW5kZXh9IGlzIHRvbyBzbWFsbCAoJHtzcmN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RJZCxcbiAgICAgICAgICAgICAgICBwYXJ0TnVtYmVyOiBwYXJ0SW5kZXgsXG4gICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcbiAgICAgICAgICAgICAgICBzb3VyY2VPYmo6IHNvdXJjZU9iaixcbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIHVwbG9hZFBhcnRDb25maWdMaXN0LnB1c2godXBsb2FkUGFydENvbmZpZylcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfSlcblxuICAgICAgICAgIHJldHVybiB1cGxvYWRQYXJ0Q29uZmlnTGlzdFxuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgcGVyZm9ybVVwbG9hZFBhcnRzID0gKHVwbG9hZElkKSA9PiB7XG4gICAgICAgICAgY29uc3QgdXBsb2FkTGlzdCA9IGdldFVwbG9hZFBhcnRDb25maWdMaXN0KHVwbG9hZElkKVxuXG4gICAgICAgICAgYXN5bmMubWFwKHVwbG9hZExpc3QsIG1lLnVwbG9hZFBhcnRDb3B5LmJpbmQobWUpLCAoZXJyLCByZXMpID0+IHtcbiAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgdGhpcy5hYm9ydE11bHRpcGFydFVwbG9hZChkZXN0T2JqQ29uZmlnLkJ1Y2tldCwgZGVzdE9iakNvbmZpZy5PYmplY3QsIHVwbG9hZElkKS50aGVuKFxuICAgICAgICAgICAgICAgICgpID0+IGNiKCksXG4gICAgICAgICAgICAgICAgKGVycikgPT4gY2IoZXJyKSxcbiAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHBhcnRzRG9uZSA9IHJlcy5tYXAoKHBhcnRDb3B5KSA9PiAoeyBldGFnOiBwYXJ0Q29weS5ldGFnLCBwYXJ0OiBwYXJ0Q29weS5wYXJ0IH0pKVxuICAgICAgICAgICAgcmV0dXJuIG1lLmNvbXBsZXRlTXVsd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ENBQUNzaEIsV0FBVyxHQUFHLElBQUFGLHdCQUFXLEVBQUNoZixNQUFNLENBQUNwQyxTQUFTLENBQUNzaEIsV0FBVyxDQUFDO0FBQ3hFbGYsTUFBTSxDQUFDcEMsU0FBUyxDQUFDdWhCLHVCQUF1QixHQUFHLElBQUFILHdCQUFXLEVBQUNoZixNQUFNLENBQUNwQyxTQUFTLENBQUN1aEIsdUJBQXVCLENBQUM7QUFDaEduZixNQUFNLENBQUNwQyxTQUFTLENBQUN3aEIsb0JBQW9CLEdBQUcsSUFBQUosd0JBQVcsRUFBQ2hmLE1BQU0sQ0FBQ3BDLFNBQVMsQ0FBQ3doQixvQkFBb0IsQ0FBQztBQUMxRnBmLE1BQU0sQ0FBQ3BDLFNBQVMsQ0FBQ3loQixvQkFBb0IsR0FBRyxJQUFBTCx3QkFBVyxFQUFDaGYsTUFBTSxDQUFDcEMsU0FBUyxDQUFDeWhCLG9CQUFvQixDQUFDIn0=
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3791:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var _events = __nccwpck_require__(2361);
|
|
var _helpers = __nccwpck_require__(9455);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var transformers = _interopRequireWildcard(__nccwpck_require__(9237), true);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2016 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// Notification config - array of target configs.
|
|
// Target configs can be
|
|
// 1. Topic (simple notification service)
|
|
// 2. Queue (simple queue service)
|
|
// 3. CloudFront (lambda function)
|
|
class NotificationConfig {
|
|
add(target) {
|
|
let instance = '';
|
|
if (target instanceof TopicConfig) {
|
|
instance = 'TopicConfiguration';
|
|
}
|
|
if (target instanceof QueueConfig) {
|
|
instance = 'QueueConfiguration';
|
|
}
|
|
if (target instanceof CloudFunctionConfig) {
|
|
instance = 'CloudFunctionConfiguration';
|
|
}
|
|
if (!this[instance]) {
|
|
this[instance] = [];
|
|
}
|
|
this[instance].push(target);
|
|
}
|
|
}
|
|
|
|
// Base class for three supported configs.
|
|
exports.NotificationConfig = NotificationConfig;
|
|
class TargetConfig {
|
|
setId(id) {
|
|
this.Id = id;
|
|
}
|
|
addEvent(newevent) {
|
|
if (!this.Event) {
|
|
this.Event = [];
|
|
}
|
|
this.Event.push(newevent);
|
|
}
|
|
addFilterSuffix(suffix) {
|
|
if (!this.Filter) {
|
|
this.Filter = {
|
|
S3Key: {
|
|
FilterRule: []
|
|
}
|
|
};
|
|
}
|
|
this.Filter.S3Key.FilterRule.push({
|
|
Name: 'suffix',
|
|
Value: suffix
|
|
});
|
|
}
|
|
addFilterPrefix(prefix) {
|
|
if (!this.Filter) {
|
|
this.Filter = {
|
|
S3Key: {
|
|
FilterRule: []
|
|
}
|
|
};
|
|
}
|
|
this.Filter.S3Key.FilterRule.push({
|
|
Name: 'prefix',
|
|
Value: prefix
|
|
});
|
|
}
|
|
}
|
|
|
|
// 1. Topic (simple notification service)
|
|
class TopicConfig extends TargetConfig {
|
|
constructor(arn) {
|
|
super();
|
|
this.Topic = arn;
|
|
}
|
|
}
|
|
|
|
// 2. Queue (simple queue service)
|
|
exports.TopicConfig = TopicConfig;
|
|
class QueueConfig extends TargetConfig {
|
|
constructor(arn) {
|
|
super();
|
|
this.Queue = arn;
|
|
}
|
|
}
|
|
|
|
// 3. CloudFront (lambda function)
|
|
exports.QueueConfig = QueueConfig;
|
|
class CloudFunctionConfig extends TargetConfig {
|
|
constructor(arn) {
|
|
super();
|
|
this.CloudFunction = arn;
|
|
}
|
|
}
|
|
exports.CloudFunctionConfig = CloudFunctionConfig;
|
|
const buildARN = (partition, service, region, accountId, resource) => {
|
|
return 'arn:' + partition + ':' + service + ':' + region + ':' + accountId + ':' + resource;
|
|
};
|
|
exports.buildARN = buildARN;
|
|
const ObjectCreatedAll = 's3:ObjectCreated:*';
|
|
exports.ObjectCreatedAll = ObjectCreatedAll;
|
|
const ObjectCreatedPut = 's3:ObjectCreated:Put';
|
|
exports.ObjectCreatedPut = ObjectCreatedPut;
|
|
const ObjectCreatedPost = 's3:ObjectCreated:Post';
|
|
exports.ObjectCreatedPost = ObjectCreatedPost;
|
|
const ObjectCreatedCopy = 's3:ObjectCreated:Copy';
|
|
exports.ObjectCreatedCopy = ObjectCreatedCopy;
|
|
const ObjectCreatedCompleteMultipartUpload = 's3:ObjectCreated:CompleteMultipartUpload';
|
|
exports.ObjectCreatedCompleteMultipartUpload = ObjectCreatedCompleteMultipartUpload;
|
|
const ObjectRemovedAll = 's3:ObjectRemoved:*';
|
|
exports.ObjectRemovedAll = ObjectRemovedAll;
|
|
const ObjectRemovedDelete = 's3:ObjectRemoved:Delete';
|
|
exports.ObjectRemovedDelete = ObjectRemovedDelete;
|
|
const ObjectRemovedDeleteMarkerCreated = 's3:ObjectRemoved:DeleteMarkerCreated';
|
|
exports.ObjectRemovedDeleteMarkerCreated = ObjectRemovedDeleteMarkerCreated;
|
|
const ObjectReducedRedundancyLostObject = 's3:ReducedRedundancyLostObject';
|
|
|
|
// Poll for notifications, used in #listenBucketNotification.
|
|
// Listening constitutes repeatedly requesting s3 whether or not any
|
|
// changes have occurred.
|
|
exports.ObjectReducedRedundancyLostObject = ObjectReducedRedundancyLostObject;
|
|
class NotificationPoller extends _events.EventEmitter {
|
|
constructor(client, bucketName, prefix, suffix, events) {
|
|
super();
|
|
this.client = client;
|
|
this.bucketName = bucketName;
|
|
this.prefix = prefix;
|
|
this.suffix = suffix;
|
|
this.events = events;
|
|
this.ending = false;
|
|
}
|
|
|
|
// Starts the polling.
|
|
start() {
|
|
this.ending = false;
|
|
process.nextTick(() => {
|
|
this.checkForChanges();
|
|
});
|
|
}
|
|
|
|
// Stops the polling.
|
|
stop() {
|
|
this.ending = true;
|
|
}
|
|
checkForChanges() {
|
|
// Don't continue if we're looping again but are cancelled.
|
|
if (this.ending) {
|
|
return;
|
|
}
|
|
let method = 'GET';
|
|
var queries = [];
|
|
if (this.prefix) {
|
|
var prefix = (0, _helper.uriEscape)(this.prefix);
|
|
queries.push(`prefix=${prefix}`);
|
|
}
|
|
if (this.suffix) {
|
|
var suffix = (0, _helper.uriEscape)(this.suffix);
|
|
queries.push(`suffix=${suffix}`);
|
|
}
|
|
if (this.events) {
|
|
this.events.forEach(s3event => queries.push('events=' + (0, _helper.uriEscape)(s3event)));
|
|
}
|
|
queries.sort();
|
|
var query = '';
|
|
if (queries.length > 0) {
|
|
query = `${queries.join('&')}`;
|
|
}
|
|
const region = this.client.region || _helpers.DEFAULT_REGION;
|
|
this.client.makeRequest({
|
|
method,
|
|
bucketName: this.bucketName,
|
|
query
|
|
}, '', [200], region, true, (e, response) => {
|
|
if (e) {
|
|
return this.emit('error', e);
|
|
}
|
|
let transformer = transformers.getNotificationTransformer();
|
|
(0, _helper.pipesetup)(response, transformer).on('data', result => {
|
|
// Data is flushed periodically (every 5 seconds), so we should
|
|
// handle it after flushing from the JSON parser.
|
|
let records = result.Records;
|
|
// If null (= no records), change to an empty array.
|
|
if (!records) {
|
|
records = [];
|
|
}
|
|
|
|
// Iterate over the notifications and emit them individually.
|
|
records.forEach(record => {
|
|
this.emit('notification', record);
|
|
});
|
|
|
|
// If we're done, stop.
|
|
if (this.ending) {
|
|
response.destroy();
|
|
}
|
|
}).on('error', e => this.emit('error', e)).on('end', () => {
|
|
// Do it again, if we haven't cancelled yet.
|
|
process.nextTick(() => {
|
|
this.checkForChanges();
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
exports.NotificationPoller = NotificationPoller;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfZXZlbnRzIiwicmVxdWlyZSIsIl9oZWxwZXJzIiwiX2hlbHBlciIsInRyYW5zZm9ybWVycyIsIl9pbnRlcm9wUmVxdWlyZVdpbGRjYXJkIiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwibm9kZUludGVyb3AiLCJXZWFrTWFwIiwiY2FjaGVCYWJlbEludGVyb3AiLCJjYWNoZU5vZGVJbnRlcm9wIiwib2JqIiwiX19lc01vZHVsZSIsImRlZmF1bHQiLCJjYWNoZSIsImhhcyIsImdldCIsIm5ld09iaiIsImhhc1Byb3BlcnR5RGVzY3JpcHRvciIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwia2V5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WMsRUFBRVEsTUFBTSxDQUFDO1FBQ25DLENBQUMsQ0FBQzs7UUFFRjtRQUNBLElBQUksSUFBSSxDQUFDM0IsTUFBTSxFQUFFO1VBQ2ZrQixRQUFRLENBQUNVLE9BQU8sQ0FBQyxDQUFDO1FBQ3BCO01BQ0YsQ0FBQyxDQUFDLENBQ0RMLEVBQUUsQ0FBQyxPQUFPLEVBQUdOLENBQUMsSUFBSyxJQUFJLENBQUNFLElBQUksQ0FBQyxPQUFPLEVBQUVGLENBQUMsQ0FBQyxDQUFDLENBQ3pDTSxFQUFFLENBQUMsS0FBSyxFQUFFLE1BQU07UUFDZjtRQUNBckIsT0FBTyxDQUFDQyxRQUFRLENBQUMsTUFBTTtVQUNyQixJQUFJLENBQUNDLGVBQWUsQ0FBQyxDQUFDO1FBQ3hCLENBQUMsQ0FBQztNQUNKLENBQUMsQ0FBQztJQUNOLENBQUMsQ0FBQztFQUNKO0FBQ0Y7QUFBQzlDLE9BQUEsQ0FBQXFDLGtCQUFBLEdBQUFBLGtCQUFBIn0=
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8373:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
var Crypto = _interopRequireWildcard(__nccwpck_require__(6113), true);
|
|
var _stream = __nccwpck_require__(2781);
|
|
var querystring = _interopRequireWildcard(__nccwpck_require__(293), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2016 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// We extend Transform because Writable does not implement ._flush().
|
|
class ObjectUploader extends _stream.Transform {
|
|
constructor(client, bucketName, objectName, partSize, metaData, callback) {
|
|
super();
|
|
this.emptyStream = true;
|
|
this.client = client;
|
|
this.bucketName = bucketName;
|
|
this.objectName = objectName;
|
|
// The size of each multipart, chunked by BlockStream2.
|
|
this.partSize = partSize;
|
|
// This is the metadata for the object.
|
|
this.metaData = metaData;
|
|
|
|
// Call like: callback(error, {etag, versionId}).
|
|
this.callback = callback;
|
|
|
|
// We need to keep track of what number chunk/part we're on. This increments
|
|
// each time _write() is called. Starts with 1, not 0.
|
|
this.partNumber = 1;
|
|
|
|
// A list of the previously uploaded chunks, for resuming a file upload. This
|
|
// will be null if we aren't resuming an upload.
|
|
this.oldParts = null;
|
|
|
|
// Keep track of the etags for aggregating the chunks together later. Each
|
|
// etag represents a single chunk of the file.
|
|
this.etags = [];
|
|
|
|
// This is for the multipart upload request — if null, we're either not initiated
|
|
// yet or we're flushing in one packet.
|
|
this.id = null;
|
|
|
|
// Handle errors.
|
|
this.on('error', err => {
|
|
callback(err);
|
|
});
|
|
}
|
|
_transform(chunk, encoding, callback) {
|
|
this.emptyStream = false;
|
|
let method = 'PUT';
|
|
let headers = {
|
|
'Content-Length': chunk.length
|
|
};
|
|
let md5digest = '';
|
|
|
|
// Calculate and set Content-MD5 header if SHA256 is not set.
|
|
// This will happen only when there is a secure connection to the s3 server.
|
|
if (!this.client.enableSHA256) {
|
|
md5digest = Crypto.createHash('md5').update(chunk).digest();
|
|
headers['Content-MD5'] = md5digest.toString('base64');
|
|
}
|
|
// We can flush the object in one packet if it fits in one chunk. This is true
|
|
// if the chunk size is smaller than the part size, signifying the end of the
|
|
// stream.
|
|
if (this.partNumber == 1 && chunk.length < this.partSize) {
|
|
// PUT the chunk in a single request — use an empty query.
|
|
let options = {
|
|
method,
|
|
// Set user metadata as this is not a multipart upload
|
|
headers: Object.assign({}, this.metaData, headers),
|
|
query: '',
|
|
bucketName: this.bucketName,
|
|
objectName: this.objectName
|
|
};
|
|
this.client.makeRequest(options, chunk, [200], '', true, (err, response) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
let result = {
|
|
etag: (0, _helper.sanitizeETag)(response.headers.etag),
|
|
versionId: (0, _helper.getVersionId)(response.headers)
|
|
};
|
|
// Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
|
|
response.on('data', () => {});
|
|
|
|
// Give the etag back, we're done!
|
|
|
|
process.nextTick(() => {
|
|
this.callback(null, result);
|
|
});
|
|
|
|
// Because we're sure the stream has ended, allow it to flush and end.
|
|
callback();
|
|
});
|
|
return;
|
|
}
|
|
|
|
// If we aren't flushing in one packet, we need to initiate the multipart upload,
|
|
// if it hasn't already been done. The write will be buffered until the upload has been
|
|
// initiated.
|
|
if (this.id === null) {
|
|
this.once('ready', () => {
|
|
this._transform(chunk, encoding, callback);
|
|
});
|
|
|
|
// Check for an incomplete previous upload.
|
|
this.client.findUploadId(this.bucketName, this.objectName, (err, id) => {
|
|
if (err) {
|
|
return this.emit('error', err);
|
|
}
|
|
|
|
// If no upload ID exists, initiate a new one.
|
|
if (!id) {
|
|
this.client.initiateNewMultipartUpload(this.bucketName, this.objectName, this.metaData).then(id => {
|
|
this.id = id;
|
|
|
|
// We are now ready to accept new chunks — this will flush the buffered chunk.
|
|
this.emit('ready');
|
|
}, err => callback(err));
|
|
return;
|
|
}
|
|
this.id = id;
|
|
|
|
// Retrieve the pre-uploaded parts, if we need to resume the upload.
|
|
this.client.listParts(this.bucketName, this.objectName, id).then(etags => {
|
|
// It is possible for no parts to be already uploaded.
|
|
if (!etags) {
|
|
etags = [];
|
|
}
|
|
|
|
// oldParts will become an object, allowing oldParts[partNumber].etag
|
|
this.oldParts = etags.reduce(function (prev, item) {
|
|
if (!prev[item.part]) {
|
|
prev[item.part] = item;
|
|
}
|
|
return prev;
|
|
}, {});
|
|
this.emit('ready');
|
|
}, err => {
|
|
return this.emit('error', err);
|
|
});
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Continue uploading various parts if we have initiated multipart upload.
|
|
let partNumber = this.partNumber++;
|
|
|
|
// Check to see if we've already uploaded this chunk. If the hash sums match,
|
|
// we can skip to the next chunk.
|
|
if (this.oldParts) {
|
|
let oldPart = this.oldParts[partNumber];
|
|
|
|
// Calulcate the md5 hash, if it has not already been calculated.
|
|
if (!md5digest) {
|
|
md5digest = Crypto.createHash('md5').update(chunk).digest();
|
|
}
|
|
if (oldPart && md5digest.toString('hex') === oldPart.etag) {
|
|
// The md5 matches, the chunk has already been uploaded.
|
|
this.etags.push({
|
|
part: partNumber,
|
|
etag: oldPart.etag
|
|
});
|
|
callback();
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Write the chunk with an uploader.
|
|
let query = querystring.stringify({
|
|
partNumber: partNumber,
|
|
uploadId: this.id
|
|
});
|
|
let options = {
|
|
method,
|
|
query,
|
|
headers,
|
|
bucketName: this.bucketName,
|
|
objectName: this.objectName
|
|
};
|
|
this.client.makeRequest(options, chunk, [200], '', true, (err, response) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
|
|
// In order to aggregate the parts together, we need to collect the etags.
|
|
let etag = response.headers.etag;
|
|
if (etag) {
|
|
etag = etag.replace(/^"/, '').replace(/"$/, '');
|
|
}
|
|
this.etags.push({
|
|
part: partNumber,
|
|
etag
|
|
});
|
|
|
|
// Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
|
|
response.on('data', () => {});
|
|
|
|
// We're ready for the next chunk.
|
|
callback();
|
|
});
|
|
}
|
|
_flush(callback) {
|
|
if (this.emptyStream) {
|
|
let method = 'PUT';
|
|
let headers = Object.assign({}, this.metaData, {
|
|
'Content-Length': 0
|
|
});
|
|
let options = {
|
|
method,
|
|
headers,
|
|
query: '',
|
|
bucketName: this.bucketName,
|
|
objectName: this.objectName
|
|
};
|
|
this.client.makeRequest(options, '', [200], '', true, (err, response) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
let result = {
|
|
etag: (0, _helper.sanitizeETag)(response.headers.etag),
|
|
versionId: (0, _helper.getVersionId)(response.headers)
|
|
};
|
|
|
|
// Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
|
|
response.on('data', () => {});
|
|
|
|
// Give the etag back, we're done!
|
|
process.nextTick(() => {
|
|
this.callback(null, result);
|
|
});
|
|
|
|
// Because we're sure the stream has ended, allow it to flush and end.
|
|
callback();
|
|
});
|
|
return;
|
|
}
|
|
// If it has been uploaded in a single packet, we don't have to do anything.
|
|
if (this.id === null) {
|
|
return;
|
|
}
|
|
|
|
// This is called when all of the chunks uploaded successfully, thus
|
|
// completing the multipart upload.
|
|
this.client.completeMultipartUpload(this.bucketName, this.objectName, this.id, this.etags, (err, etag) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
|
|
// Call our callback on the next tick to allow the streams infrastructure
|
|
// to finish what its doing before we continue.
|
|
process.nextTick(() => {
|
|
this.callback(null, etag);
|
|
});
|
|
callback();
|
|
});
|
|
}
|
|
}
|
|
|
|
// deprecated default export, please use named exports.
|
|
// keep for backward compatibility.
|
|
// eslint-disable-next-line import/no-default-export
|
|
exports.ObjectUploader = ObjectUploader;
|
|
var _default = ObjectUploader;
|
|
exports["default"] = _default;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDcnlwdG8iLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3RyZWFtIiwicXVlcnlzdHJpbmciLCJfaGVscGVyIiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwibm9kZUludGVyb3AiLCJXZWFrTWFwIiwiY2FjaGVCYWJlbEludGVyb3AiLCJjYWNoZU5vZGVJbnRlcm9wIiwib2JqIiwiX19lc01vZHVsZSIsImRlZmF1bHQiLCJjYWNoZSIsImhhcyIsImdldCIsIm5ld09iaiIsImhhc1Byb3BlcnR5RGVzY3JpcHRvciIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwia2V5IiwicHJvdG90eXBlIiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZGVzYyIsInNldCIsIk9iamVjdFVwbG9hZGVyIiwiVHJhbnNmb3JtIiwiY29uc3RydWN0b3IiLCJjbGllbnQiLCJidWNrZXROYW1lIiwib2JqZWN0TmFtZSIsInBhcnRTaXplIiwibWV0YURhdGEiLCJjYWxsYmFjayIsImVtcHR5U3RyZWFtIiwicGFydE51bWJlciIsIm9sZFBhcnRzIiwiZXRhZ3MiLCJpZCIsIm9uIiwiZXJyIiwiX3RyYW5zZm9ybSIsImNodW5rIiwiZW5jb2RpbmciLCJtZXRob2QiLCJoZWFkZXJzIiwibGVuZ3RoIiwibWQ1ZGlnZXN0IiwiZW5hYmxlU0hBMjU2Iiw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ICAgIGlmIChlcnIpIHtcbiAgICAgICAgICByZXR1cm4gdGhpcy5lbWl0KCdlcnJvcicsIGVycilcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIElmIG5vIHVwbG9hZCBJRCBleGlzdHMsIGluaXRpYXRlIGEgbmV3IG9uZS5cbiAgICAgICAgaWYgKCFpZCkge1xuICAgICAgICAgIHRoaXMuY2xpZW50LmluaXRpYXRlTmV3TXVsdGlwYXJ0VXBsb2FkKHRoaXMuYnVja2V0TmFtZSwgdGhpcy5vYmplY3ROYW1lLCB0aGlzLm1ldGFEYXRhKS50aGVuKFxuICAgICAgICAgICAgKGlkKSA9PiB7XG4gICAgICAgICAgICAgIHRoaXMuaWQgPSBpZFxuXG4gICAgICAgICAgICAgIC8vIFdlIGFyZSBub3cgcmVhZHkgdG8gYWNjZXB0IG5ldyBjaHVua3Mg4oCUIHRoaXMgd2lsbCBmbHVzaCB0aGUgYnVmZmVyZWQgY2h1bmsuXG4gICAgICAgICAgICAgIHRoaXMuZW1pdCgncmVhZHknKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIChlcnIpID0+IGNhbGxiYWNrKGVyciksXG4gICAgICAgICAgKVxuXG4gICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLmlkID0gaWRcblxuICAgICAgICAvLyBSZXRyaWV2ZSB0aGUgcHJlLXVwbG9hZGVkIHBhcnRzLCBpZiB3ZSBuZWVkIHRvIHJlc3VtZSB0aGUgdXBsb2FkLlxuICAgICAgICB0aGlzLmNsaWVudC5saXN0UGFydHModGhpcy5idWNrZXROYW1lLCB0aGlzLm9iamVjdE5hbWUsIGlkKS50aGVuKFxuICAgICAgICAgIChldGFncykgPT4ge1xuICAgICAgICAgICAgLy8gSXQgaXMgcG9zc2libGUgZm9yIG5vIHBhcnRzIHRvIGJlIGFscmVhZHkgdXBsb2FkZWQuXG4gICAgICAgICAgICBpZiAoIWV0YWdzKSB7XG4gICAgICAgICAgICAgIGV0Y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ELFFBQUEsR0FDZTFELGNBQWM7QUFBQXlELE9BQUEsQ0FBQXhFLE9BQUEsR0FBQXlFLFFBQUEifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5081:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.promisify = promisify;
|
|
// Returns a wrapper function that will promisify a given callback function.
|
|
// It will preserve 'this'.
|
|
function promisify(fn) {
|
|
return function () {
|
|
// If the last argument is a function, assume its the callback.
|
|
let callback = arguments[arguments.length - 1];
|
|
|
|
// If the callback is given, don't promisify, just pass straight in.
|
|
if (typeof callback === 'function') {
|
|
return fn.apply(this, arguments);
|
|
}
|
|
|
|
// Otherwise, create a new set of arguments, and wrap
|
|
// it in a promise.
|
|
let args = [...arguments];
|
|
return new Promise((resolve, reject) => {
|
|
// Add the callback function.
|
|
args.push((err, value) => {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
resolve(value);
|
|
});
|
|
|
|
// Call the function with our special adaptor callback added.
|
|
fn.apply(this, args);
|
|
});
|
|
};
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJwcm9taXNpZnkiLCJmbiIsImNhbGxiYWNrIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiYXBwbHkiLCJhcmdzIiwiUHJvbWlzZSIsInJlc29sdmUiLCJyZWplY3QiLCJwdXNoIiwiZXJyIiwidmFsdWUiXSwic291cmNlcyI6WyJwcm9taXNpZnkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gUmV0dXJucyBhIHdyYXBwZXIgZnVuY3Rpb24gdGhhdCB3aWxsIHByb21pc2lmeSBhIGdpdmVuIGNhbGxiYWNrIGZ1bmN0aW9uLlxuLy8gSXQgd2lsbCBwcmVzZXJ2ZSAndGhpcycuXG5leHBvcnQgZnVuY3Rpb24gcHJv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NBQVNBLENBQUNDLEVBQUUsRUFBRTtFQUM1QixPQUFPLFlBQVk7SUFDakI7SUFDQSxJQUFJQyxRQUFRLEdBQUdDLFNBQVMsQ0FBQ0EsU0FBUyxDQUFDQyxNQUFNLEdBQUcsQ0FBQyxDQUFDOztJQUU5QztJQUNBLElBQUksT0FBT0YsUUFBUSxLQUFLLFVBQVUsRUFBRTtNQUNsQyxPQUFPRCxFQUFFLENBQUNJLEtBQUssQ0FBQyxJQUFJLEVBQUVGLFNBQVMsQ0FBQztJQUNsQzs7SUFFQTtJQUNBO0lBQ0EsSUFBSUcsSUFBSSxHQUFHLENBQUMsR0FBR0gsU0FBUyxDQUFDO0lBRXpCLE9BQU8sSUFBSUksT0FBTyxDQUFDLENBQUNDLE9BQU8sRUFBRUMsTUFBTSxLQUFLO01BQ3RDO01BQ0FILElBQUksQ0FBQ0ksSUFBSSxDQUFDLENBQUNDLEdBQUcsRUFBRUMsS0FBSyxLQUFLO1FBQ3hCLElBQUlELEdBQUcsRUFBRTtVQUNQLE9BQU9GLE1BQU0sQ0FBQ0UsR0FBRyxDQUFDO1FBQ3BCO1FBRUFILE9BQU8sQ0FBQ0ksS0FBSyxDQUFDO01BQ2hCLENBQUMsQ0FBQzs7TUFFRjtNQUNBWCxFQUFFLENBQUNJLEtBQUssQ0FBQyxJQUFJLEVBQUVDLElBQUksQ0FBQztJQUN0QixDQUFDLENBQUM7RUFDSixDQUFDO0FBQ0gifQ==
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2029:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.postPresignSignatureV4 = postPresignSignatureV4;
|
|
exports.presignSignatureV4 = presignSignatureV4;
|
|
exports.signV4 = signV4;
|
|
exports.signV4ByServiceName = signV4ByServiceName;
|
|
var crypto = _interopRequireWildcard(__nccwpck_require__(6113), true);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helper = __nccwpck_require__(9921);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2016 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const signV4Algorithm = 'AWS4-HMAC-SHA256';
|
|
|
|
// getCanonicalRequest generate a canonical request of style.
|
|
//
|
|
// canonicalRequest =
|
|
// <HTTPMethod>\n
|
|
// <CanonicalURI>\n
|
|
// <CanonicalQueryString>\n
|
|
// <CanonicalHeaders>\n
|
|
// <SignedHeaders>\n
|
|
// <HashedPayload>
|
|
//
|
|
function getCanonicalRequest(method, path, headers, signedHeaders, hashedPayload) {
|
|
if (!(0, _helper.isString)(method)) {
|
|
throw new TypeError('method should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(path)) {
|
|
throw new TypeError('path should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(headers)) {
|
|
throw new TypeError('headers should be of type "object"');
|
|
}
|
|
if (!Array.isArray(signedHeaders)) {
|
|
throw new TypeError('signedHeaders should be of type "array"');
|
|
}
|
|
if (!(0, _helper.isString)(hashedPayload)) {
|
|
throw new TypeError('hashedPayload should be of type "string"');
|
|
}
|
|
const headersArray = signedHeaders.reduce((acc, i) => {
|
|
// Trim spaces from the value (required by V4 spec)
|
|
const val = `${headers[i]}`.replace(/ +/g, ' ');
|
|
acc.push(`${i.toLowerCase()}:${val}`);
|
|
return acc;
|
|
}, []);
|
|
const requestResource = path.split('?')[0];
|
|
let requestQuery = path.split('?')[1];
|
|
if (!requestQuery) {
|
|
requestQuery = '';
|
|
}
|
|
if (requestQuery) {
|
|
requestQuery = requestQuery.split('&').sort().map(element => !element.includes('=') ? element + '=' : element).join('&');
|
|
}
|
|
return [method.toUpperCase(), requestResource, requestQuery, headersArray.join('\n') + '\n', signedHeaders.join(';').toLowerCase(), hashedPayload].join('\n');
|
|
}
|
|
|
|
// generate a credential string
|
|
function getCredential(accessKey, region, requestDate, serviceName = 's3') {
|
|
if (!(0, _helper.isString)(accessKey)) {
|
|
throw new TypeError('accessKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(requestDate)) {
|
|
throw new TypeError('requestDate should be of type "object"');
|
|
}
|
|
return `${accessKey}/${(0, _helper.getScope)(region, requestDate, serviceName)}`;
|
|
}
|
|
|
|
// Returns signed headers array - alphabetically sorted
|
|
function getSignedHeaders(headers) {
|
|
if (!(0, _helper.isObject)(headers)) {
|
|
throw new TypeError('request should be of type "object"');
|
|
}
|
|
// Excerpts from @lsegal - https://github.com/aws/aws-sdk-js/issues/659#issuecomment-120477258
|
|
//
|
|
// User-Agent:
|
|
//
|
|
// This is ignored from signing because signing this causes problems with generating pre-signed URLs
|
|
// (that are executed by other agents) or when customers pass requests through proxies, which may
|
|
// modify the user-agent.
|
|
//
|
|
// Content-Length:
|
|
//
|
|
// This is ignored from signing because generating a pre-signed URL should not provide a content-length
|
|
// constraint, specifically when vending a S3 pre-signed PUT URL. The corollary to this is that when
|
|
// sending regular requests (non-pre-signed), the signature contains a checksum of the body, which
|
|
// implicitly validates the payload length (since changing the number of bytes would change the checksum)
|
|
// and therefore this header is not valuable in the signature.
|
|
//
|
|
// Content-Type:
|
|
//
|
|
// Signing this header causes quite a number of problems in browser environments, where browsers
|
|
// like to modify and normalize the content-type header in different ways. There is more information
|
|
// on this in https://github.com/aws/aws-sdk-js/issues/244. Avoiding this field simplifies logic
|
|
// and reduces the possibility of future bugs
|
|
//
|
|
// Authorization:
|
|
//
|
|
// Is skipped for obvious reasons
|
|
|
|
const ignoredHeaders = ['authorization', 'content-length', 'content-type', 'user-agent'];
|
|
return Object.keys(headers).filter(header => !ignoredHeaders.includes(header)).sort();
|
|
}
|
|
|
|
// returns the key used for calculating signature
|
|
function getSigningKey(date, region, secretKey, serviceName = 's3') {
|
|
if (!(0, _helper.isObject)(date)) {
|
|
throw new TypeError('date should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(secretKey)) {
|
|
throw new TypeError('secretKey should be of type "string"');
|
|
}
|
|
const dateLine = (0, _helper.makeDateShort)(date);
|
|
const hmac1 = crypto.createHmac('sha256', 'AWS4' + secretKey).update(dateLine).digest(),
|
|
hmac2 = crypto.createHmac('sha256', hmac1).update(region).digest(),
|
|
hmac3 = crypto.createHmac('sha256', hmac2).update(serviceName).digest();
|
|
return crypto.createHmac('sha256', hmac3).update('aws4_request').digest();
|
|
}
|
|
|
|
// returns the string that needs to be signed
|
|
function getStringToSign(canonicalRequest, requestDate, region, serviceName = 's3') {
|
|
if (!(0, _helper.isString)(canonicalRequest)) {
|
|
throw new TypeError('canonicalRequest should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(requestDate)) {
|
|
throw new TypeError('requestDate should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
const hash = crypto.createHash('sha256').update(canonicalRequest).digest('hex');
|
|
const scope = (0, _helper.getScope)(region, requestDate, serviceName);
|
|
const stringToSign = [signV4Algorithm, (0, _helper.makeDateLong)(requestDate), scope, hash];
|
|
return stringToSign.join('\n');
|
|
}
|
|
|
|
// calculate the signature of the POST policy
|
|
function postPresignSignatureV4(region, date, secretKey, policyBase64) {
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isObject)(date)) {
|
|
throw new TypeError('date should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(secretKey)) {
|
|
throw new TypeError('secretKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(policyBase64)) {
|
|
throw new TypeError('policyBase64 should be of type "string"');
|
|
}
|
|
const signingKey = getSigningKey(date, region, secretKey);
|
|
return crypto.createHmac('sha256', signingKey).update(policyBase64).digest('hex').toLowerCase();
|
|
}
|
|
|
|
// Returns the authorization header
|
|
function signV4(request, accessKey, secretKey, region, requestDate, sha256sum, serviceName = 's3') {
|
|
if (!(0, _helper.isObject)(request)) {
|
|
throw new TypeError('request should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(accessKey)) {
|
|
throw new TypeError('accessKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(secretKey)) {
|
|
throw new TypeError('secretKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!accessKey) {
|
|
throw new errors.AccessKeyRequiredError('accessKey is required for signing');
|
|
}
|
|
if (!secretKey) {
|
|
throw new errors.SecretKeyRequiredError('secretKey is required for signing');
|
|
}
|
|
const signedHeaders = getSignedHeaders(request.headers);
|
|
const canonicalRequest = getCanonicalRequest(request.method, request.path, request.headers, signedHeaders, sha256sum);
|
|
const serviceIdentifier = serviceName || 's3';
|
|
const stringToSign = getStringToSign(canonicalRequest, requestDate, region, serviceIdentifier);
|
|
const signingKey = getSigningKey(requestDate, region, secretKey, serviceIdentifier);
|
|
const credential = getCredential(accessKey, region, requestDate, serviceIdentifier);
|
|
const signature = crypto.createHmac('sha256', signingKey).update(stringToSign).digest('hex').toLowerCase();
|
|
return `${signV4Algorithm} Credential=${credential}, SignedHeaders=${signedHeaders.join(';').toLowerCase()}, Signature=${signature}`;
|
|
}
|
|
function signV4ByServiceName(request, accessKey, secretKey, region, requestDate, contentSha256, serviceName = 's3') {
|
|
return signV4(request, accessKey, secretKey, region, requestDate, contentSha256, serviceName);
|
|
}
|
|
|
|
// returns a presigned URL string
|
|
function presignSignatureV4(request, accessKey, secretKey, sessionToken, region, requestDate, expires) {
|
|
if (!(0, _helper.isObject)(request)) {
|
|
throw new TypeError('request should be of type "object"');
|
|
}
|
|
if (!(0, _helper.isString)(accessKey)) {
|
|
throw new TypeError('accessKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(secretKey)) {
|
|
throw new TypeError('secretKey should be of type "string"');
|
|
}
|
|
if (!(0, _helper.isString)(region)) {
|
|
throw new TypeError('region should be of type "string"');
|
|
}
|
|
if (!accessKey) {
|
|
throw new errors.AccessKeyRequiredError('accessKey is required for presigning');
|
|
}
|
|
if (!secretKey) {
|
|
throw new errors.SecretKeyRequiredError('secretKey is required for presigning');
|
|
}
|
|
if (!(0, _helper.isNumber)(expires)) {
|
|
throw new TypeError('expires should be of type "number"');
|
|
}
|
|
if (expires < 1) {
|
|
throw new errors.ExpiresParamError('expires param cannot be less than 1 seconds');
|
|
}
|
|
if (expires > 604800) {
|
|
throw new errors.ExpiresParamError('expires param cannot be greater than 7 days');
|
|
}
|
|
const iso8601Date = (0, _helper.makeDateLong)(requestDate);
|
|
const signedHeaders = getSignedHeaders(request.headers);
|
|
const credential = getCredential(accessKey, region, requestDate);
|
|
const hashedPayload = 'UNSIGNED-PAYLOAD';
|
|
const requestQuery = [];
|
|
requestQuery.push(`X-Amz-Algorithm=${signV4Algorithm}`);
|
|
requestQuery.push(`X-Amz-Credential=${(0, _helper.uriEscape)(credential)}`);
|
|
requestQuery.push(`X-Amz-Date=${iso8601Date}`);
|
|
requestQuery.push(`X-Amz-Expires=${expires}`);
|
|
requestQuery.push(`X-Amz-SignedHeaders=${(0, _helper.uriEscape)(signedHeaders.join(';').toLowerCase())}`);
|
|
if (sessionToken) {
|
|
requestQuery.push(`X-Amz-Security-Token=${(0, _helper.uriEscape)(sessionToken)}`);
|
|
}
|
|
const resource = request.path.split('?')[0];
|
|
let query = request.path.split('?')[1];
|
|
if (query) {
|
|
query = query + '&' + requestQuery.join('&');
|
|
} else {
|
|
query = requestQuery.join('&');
|
|
}
|
|
const path = resource + '?' + query;
|
|
const canonicalRequest = getCanonicalRequest(request.method, path, request.headers, signedHeaders, hashedPayload);
|
|
const stringToSign = getStringToSign(canonicalRequest, requestDate, region);
|
|
const signingKey = getSigningKey(requestDate, region, secretKey);
|
|
const signature = crypto.createHmac('sha256', signingKey).update(stringToSign).digest('hex').toLowerCase();
|
|
return request.protocol + '//' + request.headers.host + path + `&X-Amz-Signature=${signature}`;
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjcnlwdG8iLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJlcnJvcnMiLCJfaGVscGVyIiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwibm9kZUludGVy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U0sRUFBRVcsU0FBUyxDQUFDO0VBQ2hFLE1BQU0wQixTQUFTLEdBQUcvRixNQUFNLENBQUN5RSxVQUFVLENBQUMsUUFBUSxFQUFFYyxVQUFVLENBQUMsQ0FBQ2IsTUFBTSxDQUFDUyxZQUFZLENBQUMsQ0FBQ1IsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDN0IsV0FBVyxDQUFDLENBQUM7RUFDMUcsT0FBTzJDLE9BQU8sQ0FBQ2tCLFFBQVEsR0FBRyxJQUFJLEdBQUdsQixPQUFPLENBQUMxRCxPQUFPLENBQUM2RSxJQUFJLEdBQUc5RSxJQUFJLEdBQUksb0JBQW1CaUUsU0FBVSxFQUFDO0FBQ2hHIn0=
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9237:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.bucketEncryptionTransformer = bucketEncryptionTransformer;
|
|
exports.bucketVersioningTransformer = bucketVersioningTransformer;
|
|
exports.getBucketNotificationTransformer = getBucketNotificationTransformer;
|
|
exports.getCompleteMultipartTransformer = getCompleteMultipartTransformer;
|
|
exports.getConcater = getConcater;
|
|
exports.getCopyObjectTransformer = getCopyObjectTransformer;
|
|
exports.getHashSummer = getHashSummer;
|
|
exports.getListMultipartTransformer = getListMultipartTransformer;
|
|
exports.getListObjectsTransformer = getListObjectsTransformer;
|
|
exports.getListObjectsV2Transformer = getListObjectsV2Transformer;
|
|
exports.getListObjectsV2WithMetadataTransformer = getListObjectsV2WithMetadataTransformer;
|
|
exports.getNotificationTransformer = getNotificationTransformer;
|
|
exports.getTagsTransformer = getTagsTransformer;
|
|
exports.lifecycleTransformer = lifecycleTransformer;
|
|
exports.objectLegalHoldTransformer = objectLegalHoldTransformer;
|
|
exports.objectLockTransformer = objectLockTransformer;
|
|
exports.objectRetentionTransformer = objectRetentionTransformer;
|
|
exports.removeObjectsTransformer = removeObjectsTransformer;
|
|
exports.selectObjectContentTransformer = selectObjectContentTransformer;
|
|
exports.uploadPartTransformer = uploadPartTransformer;
|
|
var Crypto = _interopRequireWildcard(__nccwpck_require__(6113), true);
|
|
var _jsonStream = __nccwpck_require__(1676);
|
|
var _through = __nccwpck_require__(8180);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var xmlParsers = _interopRequireWildcard(__nccwpck_require__(714), true);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015, 2016 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// getConcater returns a stream that concatenates the input and emits
|
|
// the concatenated output when 'end' has reached. If an optional
|
|
// parser function is passed upon reaching the 'end' of the stream,
|
|
// `parser(concatenated_data)` will be emitted.
|
|
function getConcater(parser, emitError) {
|
|
var objectMode = false;
|
|
var bufs = [];
|
|
if (parser && !(0, _helper.isFunction)(parser)) {
|
|
throw new TypeError('parser should be of type "function"');
|
|
}
|
|
if (parser) {
|
|
objectMode = true;
|
|
}
|
|
return _through({
|
|
objectMode
|
|
}, function (chunk, enc, cb) {
|
|
bufs.push(chunk);
|
|
cb();
|
|
}, function (cb) {
|
|
if (emitError) {
|
|
cb(parser(Buffer.concat(bufs).toString()));
|
|
// cb(e) would mean we have to emit 'end' by explicitly calling this.push(null)
|
|
this.push(null);
|
|
return;
|
|
}
|
|
if (bufs.length) {
|
|
if (parser) {
|
|
this.push(parser(Buffer.concat(bufs).toString()));
|
|
} else {
|
|
this.push(Buffer.concat(bufs));
|
|
}
|
|
}
|
|
cb();
|
|
});
|
|
}
|
|
|
|
// A through stream that calculates md5sum and sha256sum
|
|
function getHashSummer(enableSHA256) {
|
|
var md5 = Crypto.createHash('md5');
|
|
var sha256 = Crypto.createHash('sha256');
|
|
return _through.obj(function (chunk, enc, cb) {
|
|
if (enableSHA256) {
|
|
sha256.update(chunk);
|
|
} else {
|
|
md5.update(chunk);
|
|
}
|
|
cb();
|
|
}, function (cb) {
|
|
var md5sum = '';
|
|
var sha256sum = '';
|
|
if (enableSHA256) {
|
|
sha256sum = sha256.digest('hex');
|
|
} else {
|
|
md5sum = md5.digest('base64');
|
|
}
|
|
var hashData = {
|
|
md5sum,
|
|
sha256sum
|
|
};
|
|
this.push(hashData);
|
|
this.push(null);
|
|
cb();
|
|
});
|
|
}
|
|
|
|
// Following functions return a stream object that parses XML
|
|
// and emits suitable Javascript objects.
|
|
|
|
// Parses CopyObject response.
|
|
function getCopyObjectTransformer() {
|
|
return getConcater(xmlParsers.parseCopyObject);
|
|
}
|
|
|
|
// Parses listMultipartUploads response.
|
|
function getListMultipartTransformer() {
|
|
return getConcater(xmlParsers.parseListMultipart);
|
|
}
|
|
|
|
// Parses listObjects response.
|
|
function getListObjectsTransformer() {
|
|
return getConcater(xmlParsers.parseListObjects);
|
|
}
|
|
|
|
// Parses listObjects response.
|
|
function getListObjectsV2Transformer() {
|
|
return getConcater(xmlParsers.parseListObjectsV2);
|
|
}
|
|
|
|
// Parses listObjects with metadata response.
|
|
function getListObjectsV2WithMetadataTransformer() {
|
|
return getConcater(xmlParsers.parseListObjectsV2WithMetadata);
|
|
}
|
|
|
|
// Parses completeMultipartUpload response.
|
|
function getCompleteMultipartTransformer() {
|
|
return getConcater(xmlParsers.parseCompleteMultipart);
|
|
}
|
|
|
|
// Parses GET/SET BucketNotification response
|
|
function getBucketNotificationTransformer() {
|
|
return getConcater(xmlParsers.parseBucketNotification);
|
|
}
|
|
|
|
// Parses a notification.
|
|
function getNotificationTransformer() {
|
|
// This will parse and return each object.
|
|
return new _jsonStream();
|
|
}
|
|
function bucketVersioningTransformer() {
|
|
return getConcater(xmlParsers.parseBucketVersioningConfig);
|
|
}
|
|
function getTagsTransformer() {
|
|
return getConcater(xmlParsers.parseTagging);
|
|
}
|
|
function lifecycleTransformer() {
|
|
return getConcater(xmlParsers.parseLifecycleConfig);
|
|
}
|
|
function objectLockTransformer() {
|
|
return getConcater(xmlParsers.parseObjectLockConfig);
|
|
}
|
|
function objectRetentionTransformer() {
|
|
return getConcater(xmlParsers.parseObjectRetentionConfig);
|
|
}
|
|
function bucketEncryptionTransformer() {
|
|
return getConcater(xmlParsers.parseBucketEncryptionConfig);
|
|
}
|
|
function objectLegalHoldTransformer() {
|
|
return getConcater(xmlParsers.parseObjectLegalHoldConfig);
|
|
}
|
|
function uploadPartTransformer() {
|
|
return getConcater(xmlParsers.uploadPartParser);
|
|
}
|
|
function selectObjectContentTransformer() {
|
|
return getConcater();
|
|
}
|
|
function removeObjects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),
|
|
|
|
/***/ 714:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.parseBucketEncryptionConfig = parseBucketEncryptionConfig;
|
|
exports.parseBucketNotification = parseBucketNotification;
|
|
exports.parseBucketVersioningConfig = parseBucketVersioningConfig;
|
|
exports.parseCompleteMultipart = parseCompleteMultipart;
|
|
exports.parseCopyObject = parseCopyObject;
|
|
exports.parseLifecycleConfig = parseLifecycleConfig;
|
|
exports.parseListMultipart = parseListMultipart;
|
|
exports.parseListObjects = parseListObjects;
|
|
exports.parseListObjectsV2 = parseListObjectsV2;
|
|
exports.parseListObjectsV2WithMetadata = parseListObjectsV2WithMetadata;
|
|
exports.parseObjectLegalHoldConfig = parseObjectLegalHoldConfig;
|
|
exports.parseObjectLockConfig = parseObjectLockConfig;
|
|
exports.parseObjectRetentionConfig = parseObjectRetentionConfig;
|
|
exports.parseSelectObjectContentResponse = parseSelectObjectContentResponse;
|
|
exports.parseTagging = parseTagging;
|
|
exports.removeObjectsParser = removeObjectsParser;
|
|
exports.uploadPartParser = uploadPartParser;
|
|
var _bufferCrc = __nccwpck_require__(4794);
|
|
var _fastXmlParser = __nccwpck_require__(2603);
|
|
var errors = _interopRequireWildcard(__nccwpck_require__(1174), true);
|
|
var _helpers = __nccwpck_require__(9455);
|
|
var _helper = __nccwpck_require__(9921);
|
|
var _type = __nccwpck_require__(7293);
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
/*
|
|
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const fxpWithoutNumParser = new _fastXmlParser.XMLParser({
|
|
numberParseOptions: {
|
|
skipLike: /./
|
|
}
|
|
});
|
|
|
|
// parse XML response for copy object
|
|
function parseCopyObject(xml) {
|
|
var result = {
|
|
etag: '',
|
|
lastModified: ''
|
|
};
|
|
var xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.CopyObjectResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "CopyObjectResult"');
|
|
}
|
|
xmlobj = xmlobj.CopyObjectResult;
|
|
if (xmlobj.ETag) {
|
|
result.etag = xmlobj.ETag.replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
|
|
}
|
|
if (xmlobj.LastModified) {
|
|
result.lastModified = new Date(xmlobj.LastModified);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// parse XML response for listing in-progress multipart uploads
|
|
function parseListMultipart(xml) {
|
|
var result = {
|
|
uploads: [],
|
|
prefixes: [],
|
|
isTruncated: false
|
|
};
|
|
var xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.ListMultipartUploadsResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListMultipartUploadsResult"');
|
|
}
|
|
xmlobj = xmlobj.ListMultipartUploadsResult;
|
|
if (xmlobj.IsTruncated) {
|
|
result.isTruncated = xmlobj.IsTruncated;
|
|
}
|
|
if (xmlobj.NextKeyMarker) {
|
|
result.nextKeyMarker = xmlobj.NextKeyMarker;
|
|
}
|
|
if (xmlobj.NextUploadIdMarker) {
|
|
result.nextUploadIdMarker = xmlobj.nextUploadIdMarker || '';
|
|
}
|
|
if (xmlobj.CommonPrefixes) {
|
|
(0, _helper.toArray)(xmlobj.CommonPrefixes).forEach(prefix => {
|
|
result.prefixes.push({
|
|
prefix: (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(prefix.Prefix)[0])
|
|
});
|
|
});
|
|
}
|
|
if (xmlobj.Upload) {
|
|
(0, _helper.toArray)(xmlobj.Upload).forEach(upload => {
|
|
var key = upload.Key;
|
|
var uploadId = upload.UploadId;
|
|
var initiator = {
|
|
id: upload.Initiator.ID,
|
|
displayName: upload.Initiator.DisplayName
|
|
};
|
|
var owner = {
|
|
id: upload.Owner.ID,
|
|
displayName: upload.Owner.DisplayName
|
|
};
|
|
var storageClass = upload.StorageClass;
|
|
var initiated = new Date(upload.Initiated);
|
|
result.uploads.push({
|
|
key,
|
|
uploadId,
|
|
initiator,
|
|
owner,
|
|
storageClass,
|
|
initiated
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// parse XML response to list all the owned buckets
|
|
|
|
// parse XML response for bucket notification
|
|
function parseBucketNotification(xml) {
|
|
var result = {
|
|
TopicConfiguration: [],
|
|
QueueConfiguration: [],
|
|
CloudFunctionConfiguration: []
|
|
};
|
|
// Parse the events list
|
|
var genEvents = function (events) {
|
|
var result = [];
|
|
if (events) {
|
|
(0, _helper.toArray)(events).forEach(s3event => {
|
|
result.push(s3event);
|
|
});
|
|
}
|
|
return result;
|
|
};
|
|
// Parse all filter rules
|
|
var genFilterRules = function (filters) {
|
|
var result = [];
|
|
if (filters) {
|
|
filters = (0, _helper.toArray)(filters);
|
|
if (filters[0].S3Key) {
|
|
filters[0].S3Key = (0, _helper.toArray)(filters[0].S3Key);
|
|
if (filters[0].S3Key[0].FilterRule) {
|
|
(0, _helper.toArray)(filters[0].S3Key[0].FilterRule).forEach(rule => {
|
|
var Name = (0, _helper.toArray)(rule.Name)[0];
|
|
var Value = (0, _helper.toArray)(rule.Value)[0];
|
|
result.push({
|
|
Name,
|
|
Value
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
var xmlobj = (0, _helper.parseXml)(xml);
|
|
xmlobj = xmlobj.NotificationConfiguration;
|
|
|
|
// Parse all topic configurations in the xml
|
|
if (xmlobj.TopicConfiguration) {
|
|
(0, _helper.toArray)(xmlobj.TopicConfiguration).forEach(config => {
|
|
var Id = (0, _helper.toArray)(config.Id)[0];
|
|
var Topic = (0, _helper.toArray)(config.Topic)[0];
|
|
var Event = genEvents(config.Event);
|
|
var Filter = genFilterRules(config.Filter);
|
|
result.TopicConfiguration.push({
|
|
Id,
|
|
Topic,
|
|
Event,
|
|
Filter
|
|
});
|
|
});
|
|
}
|
|
// Parse all topic configurations in the xml
|
|
if (xmlobj.QueueConfiguration) {
|
|
(0, _helper.toArray)(xmlobj.QueueConfiguration).forEach(config => {
|
|
var Id = (0, _helper.toArray)(config.Id)[0];
|
|
var Queue = (0, _helper.toArray)(config.Queue)[0];
|
|
var Event = genEvents(config.Event);
|
|
var Filter = genFilterRules(config.Filter);
|
|
result.QueueConfiguration.push({
|
|
Id,
|
|
Queue,
|
|
Event,
|
|
Filter
|
|
});
|
|
});
|
|
}
|
|
// Parse all QueueConfiguration arrays
|
|
if (xmlobj.CloudFunctionConfiguration) {
|
|
(0, _helper.toArray)(xmlobj.CloudFunctionConfiguration).forEach(config => {
|
|
var Id = (0, _helper.toArray)(config.Id)[0];
|
|
var CloudFunction = (0, _helper.toArray)(config.CloudFunction)[0];
|
|
var Event = genEvents(config.Event);
|
|
var Filter = genFilterRules(config.Filter);
|
|
result.CloudFunctionConfiguration.push({
|
|
Id,
|
|
CloudFunction,
|
|
Event,
|
|
Filter
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// parse XML response when a multipart upload is completed
|
|
function parseCompleteMultipart(xml) {
|
|
var xmlobj = (0, _helper.parseXml)(xml).CompleteMultipartUploadResult;
|
|
if (xmlobj.Location) {
|
|
var location = (0, _helper.toArray)(xmlobj.Location)[0];
|
|
var bucket = (0, _helper.toArray)(xmlobj.Bucket)[0];
|
|
var key = xmlobj.Key;
|
|
var etag = xmlobj.ETag.replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
|
|
return {
|
|
location,
|
|
bucket,
|
|
key,
|
|
etag
|
|
};
|
|
}
|
|
// Complete Multipart can return XML Error after a 200 OK response
|
|
if (xmlobj.Code && xmlobj.Message) {
|
|
var errCode = (0, _helper.toArray)(xmlobj.Code)[0];
|
|
var errMessage = (0, _helper.toArray)(xmlobj.Message)[0];
|
|
return {
|
|
errCode,
|
|
errMessage
|
|
};
|
|
}
|
|
}
|
|
const formatObjInfo = (content, opts = {}) => {
|
|
let {
|
|
Key,
|
|
LastModified,
|
|
ETag,
|
|
Size,
|
|
VersionId,
|
|
IsLatest
|
|
} = content;
|
|
if (!(0, _helper.isObject)(opts)) {
|
|
opts = {};
|
|
}
|
|
const name = (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(Key)[0]);
|
|
const lastModified = new Date((0, _helper.toArray)(LastModified)[0]);
|
|
const etag = (0, _helper.sanitizeETag)((0, _helper.toArray)(ETag)[0]);
|
|
const size = (0, _helper.sanitizeSize)(Size);
|
|
return {
|
|
name,
|
|
lastModified,
|
|
etag,
|
|
size,
|
|
versionId: VersionId,
|
|
isLatest: IsLatest,
|
|
isDeleteMarker: opts.IsDeleteMarker ? opts.IsDeleteMarker : false
|
|
};
|
|
};
|
|
|
|
// parse XML response for list objects in a bucket
|
|
function parseListObjects(xml) {
|
|
var result = {
|
|
objects: [],
|
|
isTruncated: false
|
|
};
|
|
let isTruncated = false;
|
|
let nextMarker, nextVersionKeyMarker;
|
|
const xmlobj = fxpWithoutNumParser.parse(xml);
|
|
const parseCommonPrefixesEntity = responseEntity => {
|
|
if (responseEntity) {
|
|
(0, _helper.toArray)(responseEntity).forEach(commonPrefix => {
|
|
result.objects.push({
|
|
prefix: (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(commonPrefix.Prefix)[0]),
|
|
size: 0
|
|
});
|
|
});
|
|
}
|
|
};
|
|
const listBucketResult = xmlobj.ListBucketResult;
|
|
const listVersionsResult = xmlobj.ListVersionsResult;
|
|
if (listBucketResult) {
|
|
if (listBucketResult.IsTruncated) {
|
|
isTruncated = listBucketResult.IsTruncated;
|
|
}
|
|
if (listBucketResult.Contents) {
|
|
(0, _helper.toArray)(listBucketResult.Contents).forEach(content => {
|
|
const name = (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(content.Key)[0]);
|
|
const lastModified = new Date((0, _helper.toArray)(content.LastModified)[0]);
|
|
const etag = (0, _helper.sanitizeETag)((0, _helper.toArray)(content.ETag)[0]);
|
|
const size = (0, _helper.sanitizeSize)(content.Size);
|
|
result.objects.push({
|
|
name,
|
|
lastModified,
|
|
etag,
|
|
size
|
|
});
|
|
});
|
|
}
|
|
if (listBucketResult.NextMarker) {
|
|
nextMarker = listBucketResult.NextMarker;
|
|
}
|
|
parseCommonPrefixesEntity(listBucketResult.CommonPrefixes);
|
|
}
|
|
if (listVersionsResult) {
|
|
if (listVersionsResult.IsTruncated) {
|
|
isTruncated = listVersionsResult.IsTruncated;
|
|
}
|
|
if (listVersionsResult.Version) {
|
|
(0, _helper.toArray)(listVersionsResult.Version).forEach(content => {
|
|
result.objects.push(formatObjInfo(content));
|
|
});
|
|
}
|
|
if (listVersionsResult.DeleteMarker) {
|
|
(0, _helper.toArray)(listVersionsResult.DeleteMarker).forEach(content => {
|
|
result.objects.push(formatObjInfo(content, {
|
|
IsDeleteMarker: true
|
|
}));
|
|
});
|
|
}
|
|
if (listVersionsResult.NextKeyMarker) {
|
|
nextVersionKeyMarker = listVersionsResult.NextKeyMarker;
|
|
}
|
|
if (listVersionsResult.NextVersionIdMarker) {
|
|
result.versionIdMarker = listVersionsResult.NextVersionIdMarker;
|
|
}
|
|
parseCommonPrefixesEntity(listVersionsResult.CommonPrefixes);
|
|
}
|
|
result.isTruncated = isTruncated;
|
|
if (isTruncated) {
|
|
result.nextMarker = nextVersionKeyMarker || nextMarker;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// parse XML response for list objects v2 in a bucket
|
|
function parseListObjectsV2(xml) {
|
|
var result = {
|
|
objects: [],
|
|
isTruncated: false
|
|
};
|
|
var xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.ListBucketResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListBucketResult"');
|
|
}
|
|
xmlobj = xmlobj.ListBucketResult;
|
|
if (xmlobj.IsTruncated) {
|
|
result.isTruncated = xmlobj.IsTruncated;
|
|
}
|
|
if (xmlobj.NextContinuationToken) {
|
|
result.nextContinuationToken = xmlobj.NextContinuationToken;
|
|
}
|
|
if (xmlobj.Contents) {
|
|
(0, _helper.toArray)(xmlobj.Contents).forEach(content => {
|
|
var name = (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(content.Key)[0]);
|
|
var lastModified = new Date(content.LastModified);
|
|
var etag = (0, _helper.sanitizeETag)(content.ETag);
|
|
var size = content.Size;
|
|
result.objects.push({
|
|
name,
|
|
lastModified,
|
|
etag,
|
|
size
|
|
});
|
|
});
|
|
}
|
|
if (xmlobj.CommonPrefixes) {
|
|
(0, _helper.toArray)(xmlobj.CommonPrefixes).forEach(commonPrefix => {
|
|
result.objects.push({
|
|
prefix: (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(commonPrefix.Prefix)[0]),
|
|
size: 0
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// parse XML response for list objects v2 with metadata in a bucket
|
|
function parseListObjectsV2WithMetadata(xml) {
|
|
var result = {
|
|
objects: [],
|
|
isTruncated: false
|
|
};
|
|
var xmlobj = (0, _helper.parseXml)(xml);
|
|
if (!xmlobj.ListBucketResult) {
|
|
throw new errors.InvalidXMLError('Missing tag: "ListBucketResult"');
|
|
}
|
|
xmlobj = xmlobj.ListBucketResult;
|
|
if (xmlobj.IsTruncated) {
|
|
result.isTruncated = xmlobj.IsTruncated;
|
|
}
|
|
if (xmlobj.NextContinuationToken) {
|
|
result.nextContinuationToken = xmlobj.NextContinuationToken;
|
|
}
|
|
if (xmlobj.Contents) {
|
|
(0, _helper.toArray)(xmlobj.Contents).forEach(content => {
|
|
var name = (0, _helper.sanitizeObjectKey)(content.Key);
|
|
var lastModified = new Date(content.LastModified);
|
|
var etag = (0, _helper.sanitizeETag)(content.ETag);
|
|
var size = content.Size;
|
|
var metadata;
|
|
if (content.UserMetadata != null) {
|
|
metadata = (0, _helper.toArray)(content.UserMetadata)[0];
|
|
} else {
|
|
metadata = null;
|
|
}
|
|
result.objects.push({
|
|
name,
|
|
lastModified,
|
|
etag,
|
|
size,
|
|
metadata
|
|
});
|
|
});
|
|
}
|
|
if (xmlobj.CommonPrefixes) {
|
|
(0, _helper.toArray)(xmlobj.CommonPrefixes).forEach(commonPrefix => {
|
|
result.objects.push({
|
|
prefix: (0, _helper.sanitizeObjectKey)((0, _helper.toArray)(commonPrefix.Prefix)[0]),
|
|
size: 0
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
function parseBucketVersioningConfig(xml) {
|
|
var xmlObj = (0, _helper.parseXml)(xml);
|
|
return xmlObj.VersioningConfiguration;
|
|
}
|
|
function parseTagging(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
let result = [];
|
|
if (xmlObj.Tagging && xmlObj.Tagging.TagSet && xmlObj.Tagging.TagSet.Tag) {
|
|
const tagResult = xmlObj.Tagging.TagSet.Tag;
|
|
// if it is a single tag convert into an array so that the return value is always an array.
|
|
if ((0, _helper.isObject)(tagResult)) {
|
|
result.push(tagResult);
|
|
} else {
|
|
result = tagResult;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function parseLifecycleConfig(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
return xmlObj.LifecycleConfiguration;
|
|
}
|
|
function parseObjectLockConfig(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
let lockConfigResult = {};
|
|
if (xmlObj.ObjectLockConfiguration) {
|
|
lockConfigResult = {
|
|
objectLockEnabled: xmlObj.ObjectLockConfiguration.ObjectLockEnabled
|
|
};
|
|
let retentionResp;
|
|
if (xmlObj.ObjectLockConfiguration && xmlObj.ObjectLockConfiguration.Rule && xmlObj.ObjectLockConfiguration.Rule.DefaultRetention) {
|
|
retentionResp = xmlObj.ObjectLockConfiguration.Rule.DefaultRetention || {};
|
|
lockConfigResult.mode = retentionResp.Mode;
|
|
}
|
|
if (retentionResp) {
|
|
const isUnitYears = retentionResp.Years;
|
|
if (isUnitYears) {
|
|
lockConfigResult.validity = isUnitYears;
|
|
lockConfigResult.unit = _type.RETENTION_VALIDITY_UNITS.YEARS;
|
|
} else {
|
|
lockConfigResult.validity = retentionResp.Days;
|
|
lockConfigResult.unit = _type.RETENTION_VALIDITY_UNITS.DAYS;
|
|
}
|
|
}
|
|
return lockConfigResult;
|
|
}
|
|
}
|
|
function parseObjectRetentionConfig(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
const retentionConfig = xmlObj.Retention;
|
|
return {
|
|
mode: retentionConfig.Mode,
|
|
retainUntilDate: retentionConfig.RetainUntilDate
|
|
};
|
|
}
|
|
function parseBucketEncryptionConfig(xml) {
|
|
let encConfig = (0, _helper.parseXml)(xml);
|
|
return encConfig;
|
|
}
|
|
function parseObjectLegalHoldConfig(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
return xmlObj.LegalHold;
|
|
}
|
|
function uploadPartParser(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
const respEl = xmlObj.CopyPartResult;
|
|
return respEl;
|
|
}
|
|
function removeObjectsParser(xml) {
|
|
const xmlObj = (0, _helper.parseXml)(xml);
|
|
if (xmlObj.DeleteResult && xmlObj.DeleteResult.Error) {
|
|
// return errors as array always. as the response is object in case of single object passed in removeObjects
|
|
return (0, _helper.toArray)(xmlObj.DeleteResult.Error);
|
|
}
|
|
return [];
|
|
}
|
|
function parseSelectObjectContentResponse(res) {
|
|
// extractHeaderType extracts the first half of the header message, the header type.
|
|
function extractHeaderType(stream) {
|
|
const headerNameLen = Buffer.from(stream.read(1)).readUInt8();
|
|
const headerNameWithSeparator = Buffer.from(stream.read(headerNameLen)).toString();
|
|
const splitBySeparator = (headerNameWithSeparator || '').split(':');
|
|
const headerName = splitBySeparator.length >= 1 ? splitBySeparator[1] : '';
|
|
return headerName;
|
|
}
|
|
function extractHeaderValue(stream) {
|
|
const bodyLen = Buffer.from(stream.read(2)).readUInt16BE();
|
|
const bodyName = Buffer.from(stream.read(bodyLen)).toString();
|
|
return bodyName;
|
|
}
|
|
const selectResults = new _helpers.SelectResults({}); // will be returned
|
|
|
|
const responseStream = (0, _helper.readableStream)(res); // convert byte array to a readable responseStream
|
|
while (responseStream._readableState.length) {
|
|
// Top level responseStream read tracker.
|
|
let msgCrcAccumulator; // accumulate from start of the message till the message crc start.
|
|
|
|
const totalByteLengthBuffer = Buffer.from(responseStream.read(4));
|
|
msgCrcAccumulator = _bufferCrc(totalByteLengthBuffer);
|
|
const headerBytesBuffer = Buffer.from(responseStream.read(4));
|
|
msgCrcAccumulator = _bufferCrc(headerBytesBuffer, msgCrcAccumulator);
|
|
const calculatedPreludeCrc = msgCrcAccumulator.readInt32BE(); // use it to check if any CRC mismatch in header itself.
|
|
|
|
const preludeCrcBuffer = Buffer.from(responseStream.read(4)); // read 4 bytes i.e 4+4 =8 + 4 = 12 ( prelude + prelude crc)
|
|
msgCrcAccumulator = _bufferCrc(preludeCrcBuffer, msgCrcAccumulator);
|
|
const totalMsgLength = totalByteLengthBuffer.readInt32BE();
|
|
const headerLength = headerBytesBuffer.readInt32BE();
|
|
const preludeCrcByteValue = preludeCrcBuffer.readInt32BE();
|
|
if (preludeCrcByteValue !== calculatedPreludeCrc) {
|
|
// Handle Header CRC mismatch Error
|
|
throw new Error(`Header Checksum Mismatch, Prelude CRC of ${preludeCrcByteValue} does not equal expected CRC of ${calculatedPreludeCrc}`);
|
|
}
|
|
const headers = {};
|
|
if (headerLength > 0) {
|
|
const headerBytes = Buffer.from(responseStream.read(headerLength));
|
|
msgCrcAccumulator = _bufferCrc(headerBytes, msgCrcAccumulator);
|
|
const headerReaderStream = (0, _helper.readableStream)(headerBytes);
|
|
while (headerReaderStream._readableState.length) {
|
|
let headerTypeName = extractHeaderType(headerReaderStream);
|
|
headerReaderStream.read(1); // just read and ignore it.
|
|
headers[headerTypeName] = extractHeaderValue(headerReaderStream);
|
|
}
|
|
}
|
|
let payloadStream;
|
|
const payLoadLength = totalMsgLength - headerLength - 16;
|
|
if (payLoadLength > 0) {
|
|
const payLoadBuffer = Buffer.from(responseStream.read(payLoadLength));
|
|
msgCrcAccumulator = _bufferCrc(payLoadBuffer, msgCrcAccumulator);
|
|
// read the checksum early and detect any mismatch so we can avoid unnecessary further processing.
|
|
const messageCrcByteValue = Buffer.from(responseStream.read(4)).readInt32BE();
|
|
const calculatedCrc = msgCrcAccumulator.readInt32BE();
|
|
// Handle message CRC Error
|
|
if (messageCrcByteValue !== calculatedCrc) {
|
|
throw new Error(`Message Checksum Mismatch, Message CRC of ${messageCrcByteValue} does not equal expected CRC of ${calculatedCrc}`);
|
|
}
|
|
payloadStream = (0, _helper.readableStream)(payLoadBuffer);
|
|
}
|
|
const messageType = headers['message-type'];
|
|
switch (messageType) {
|
|
case 'error':
|
|
{
|
|
const errorMessage = headers['error-code'] + ':"' + headers['error-message'] + '"';
|
|
throw new Error(errorMessage);
|
|
}
|
|
case 'event':
|
|
{
|
|
const contentType = headers['content-type'];
|
|
const eventType = headers['event-type'];
|
|
switch (eventType) {
|
|
case 'End':
|
|
{
|
|
selectResults.setResponse(res);
|
|
return selectResults;
|
|
}
|
|
case 'Records':
|
|
{
|
|
const readData = payloadStream.read(payLoadLength);
|
|
selectResults.setRecords(readData);
|
|
break;
|
|
}
|
|
case 'Progress':
|
|
{
|
|
switch (contentType) {
|
|
case 'text/xml':
|
|
{
|
|
const progressData = payloadStream.read(payLoadLength);
|
|
selectResults.setProgress(progressData.toString());
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
const errorMessage = `Unexpected content-type ${contentType} sent for event-type Progress`;
|
|
throw new Error(errorMessage);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case 'Stats':
|
|
{
|
|
switch (contentType) {
|
|
case 'text/xml':
|
|
{
|
|
const statsData = payloadStream.read(payLoadLength);
|
|
selectResults.setStats(statsData.toString());
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
const errorMessage = `Unexpected content-type ${contentType} sent for event-type Stats`;
|
|
throw new Error(errorMessage);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
{
|
|
// Continuation message: Not sure if it is supported. did not find a reference or any message in response.
|
|
// It does not have a payload.
|
|
const warningMessage = `Un implemented event detected ${messageType}.`;
|
|
// eslint-disable-next-line no-console
|
|
console.warn(warningMessage);
|
|
}
|
|
} // eventType End
|
|
}
|
|
// Event End
|
|
} // messageType End
|
|
} // Top Level Stream End
|
|
}
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYnVmZmVyQ3JjIi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udFR5cGUpIHtcbiAgICAgICAgICBjYXNlICdFbmQnOiB7XG4gICAgICAgICAgICBzZWxlY3RSZXN1bHRzLnNldFJlc3BvbnNlKHJlcylcbiAgICAgICAgICAgIHJldHVybiBzZWxlY3RSZXN1bHRzXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FzZSAnUmVjb3Jkcyc6IHtcbiAgICAgICAgICAgIGNvbnN0IHJlYWREYXRhID0gcGF5bG9hZFN0cmVhbS5yZWFkKHBheUxvYWRMZW5ndGgpXG4gICAgICAgICAgICBzZWxlY3RSZXN1bHRzLnNldFJlY29yZHMocmVhZERhdGEpXG4gICAgICAgICAgICBicmVha1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGNhc2UgJ1Byb2dyZXNzJzpcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgc3dpdGNoIChjb250ZW50VHlwZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgJ3RleHQveG1sJzoge1xuICAgICAgICAgICAgICAgICAgY29uc3QgcHJvZ3Jlc3NEYXRhID0gcGF5bG9hZFN0cmVhbS5yZWFkKHBheUxvYWRMZW5ndGgpXG4gICAgICAgICAgICAgICAgICBzZWxlY3RSZXN1bHRzLnNldFByb2dyZXNzKHByb2dyZXNzRGF0YS50b1N0cmluZygpKVxuICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZGVmYXVsdDoge1xuICAgICAgICAgICAgICAgICAgY29uc3QgZXJyb3JNZXNzYWdlID0gYFVuZXhwZWN0ZWQgY29udGVudC10eXBlICR7Y29udGVudFR5cGV9IHNlbnQgZm9yIGV2ZW50LXR5cGUgUHJvZ3Jlc3NgXG4gICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyb3JNZXNzYWdlKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICBjYXNlICdTdGF0cyc6XG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIHN3aXRjaCAoY29udGVudFR5cGUpIHtcbiAgICAgICAgICAgICAgICBjYXNlICd0ZXh0L3htbCc6IHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRzRGF0YSA9IHBheWxvYWRTdHJlYW0ucmVhZChwYXlMb2FkTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgc2VsZWN0UmVzdWx0cy5zZXRTdGF0cyhzdGF0c0RhdGEudG9TdHJpbmcoKSlcbiAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IGVycm9yTWVzc2FnZSA9IGBVbmV4cGVjdGVkIGNvbnRlbnQtdHlwZSAke2NvbnRlbnRUeXBlfSBzZW50IGZvciBldmVudC10eXBlIFN0YXRzYFxuICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yTWVzc2FnZSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgZGVmYXVsdDoge1xuICAgICAgICAgICAgLy8gQ29udGludWF0aW9uIG1lc3NhZ2U6IE5vdCBzdXJlIGlmIGl0IGlzIHN1cHBvcnRlZC4gZGlkIG5vdCBmaW5kIGEgcmVmZXJlbmNlIG9yIGFueSBtZXNzYWdlIGluIHJlc3BvbnNlLlxuICAgICAgICAgICAgLy8gSXQgZG9lcyBub3QgaGF2ZSBhIHBheWxvYWQuXG4gICAgICAgICAgICBjb25zdCB3YXJuaW5nTWVzc2FnZSA9IGBVbiBpbXBsZW1lbnRlZCBldmVudCBkZXRlY3RlZCAgJHttZXNzYWdlVHlwZX0uYFxuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG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MEJDLFdBQVksNEJBQTJCO3NCQUN2RixNQUFNLElBQUk5QyxLQUFLLENBQUM2QyxZQUFZLENBQUM7b0JBQy9CO2dCQUNGO2NBQ0Y7Y0FDQTtZQUNGO2NBQVM7Z0JBQ1A7Z0JBQ0E7Z0JBQ0EsTUFBTVUsY0FBYyxHQUFJLGtDQUFpQ1gsV0FBWSxHQUFFO2dCQUN2RTtnQkFDQVksT0FBTyxDQUFDQyxJQUFJLENBQUNGLGNBQWMsQ0FBQztjQUM5QjtVQUNGLENBQUMsQ0FBQztRQUNKO01BQUU7SUFDSixDQUFDLENBQUM7RUFDSixDQUFDLENBQUM7QUFDSiJ9
|
|
|
|
/***/ }),
|
|
|
|
/***/ 293:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
const strictUriEncode = __nccwpck_require__(3605);
|
|
const decodeComponent = __nccwpck_require__(3186);
|
|
const splitOnFirst = __nccwpck_require__(4878);
|
|
const filterObject = __nccwpck_require__(4940);
|
|
|
|
const isNullOrUndefined = value => value === null || value === undefined;
|
|
|
|
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');
|
|
|
|
function encoderForArrayFormat(options) {
|
|
switch (options.arrayFormat) {
|
|
case 'index':
|
|
return key => (result, value) => {
|
|
const index = result.length;
|
|
|
|
if (
|
|
value === undefined ||
|
|
(options.skipNull && value === null) ||
|
|
(options.skipEmptyString && value === '')
|
|
) {
|
|
return result;
|
|
}
|
|
|
|
if (value === null) {
|
|
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
}
|
|
|
|
return [
|
|
...result,
|
|
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
];
|
|
};
|
|
|
|
case 'bracket':
|
|
return key => (result, value) => {
|
|
if (
|
|
value === undefined ||
|
|
(options.skipNull && value === null) ||
|
|
(options.skipEmptyString && value === '')
|
|
) {
|
|
return result;
|
|
}
|
|
|
|
if (value === null) {
|
|
return [...result, [encode(key, options), '[]'].join('')];
|
|
}
|
|
|
|
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
};
|
|
|
|
case 'colon-list-separator':
|
|
return key => (result, value) => {
|
|
if (
|
|
value === undefined ||
|
|
(options.skipNull && value === null) ||
|
|
(options.skipEmptyString && value === '')
|
|
) {
|
|
return result;
|
|
}
|
|
|
|
if (value === null) {
|
|
return [...result, [encode(key, options), ':list='].join('')];
|
|
}
|
|
|
|
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')];
|
|
};
|
|
|
|
case 'comma':
|
|
case 'separator':
|
|
case 'bracket-separator': {
|
|
const keyValueSep = options.arrayFormat === 'bracket-separator' ?
|
|
'[]=' :
|
|
'=';
|
|
|
|
return key => (result, value) => {
|
|
if (
|
|
value === undefined ||
|
|
(options.skipNull && value === null) ||
|
|
(options.skipEmptyString && value === '')
|
|
) {
|
|
return result;
|
|
}
|
|
|
|
// Translate null to an empty string so that it doesn't serialize as 'null'
|
|
value = value === null ? '' : value;
|
|
|
|
if (result.length === 0) {
|
|
return [[encode(key, options), keyValueSep, encode(value, options)].join('')];
|
|
}
|
|
|
|
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
};
|
|
}
|
|
|
|
default:
|
|
return key => (result, value) => {
|
|
if (
|
|
value === undefined ||
|
|
(options.skipNull && value === null) ||
|
|
(options.skipEmptyString && value === '')
|
|
) {
|
|
return result;
|
|
}
|
|
|
|
if (value === null) {
|
|
return [...result, encode(key, options)];
|
|
}
|
|
|
|
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
};
|
|
}
|
|
}
|
|
|
|
function parserForArrayFormat(options) {
|
|
let result;
|
|
|
|
switch (options.arrayFormat) {
|
|
case 'index':
|
|
return (key, value, accumulator) => {
|
|
result = /\[(\d*)\]$/.exec(key);
|
|
|
|
key = key.replace(/\[\d*\]$/, '');
|
|
|
|
if (!result) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = {};
|
|
}
|
|
|
|
accumulator[key][result[1]] = value;
|
|
};
|
|
|
|
case 'bracket':
|
|
return (key, value, accumulator) => {
|
|
result = /(\[\])$/.exec(key);
|
|
key = key.replace(/\[\]$/, '');
|
|
|
|
if (!result) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = [value];
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], value);
|
|
};
|
|
|
|
case 'colon-list-separator':
|
|
return (key, value, accumulator) => {
|
|
result = /(:list)$/.exec(key);
|
|
key = key.replace(/:list$/, '');
|
|
|
|
if (!result) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = [value];
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], value);
|
|
};
|
|
|
|
case 'comma':
|
|
case 'separator':
|
|
return (key, value, accumulator) => {
|
|
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
value = isEncodedArray ? decode(value, options) : value;
|
|
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
accumulator[key] = newValue;
|
|
};
|
|
|
|
case 'bracket-separator':
|
|
return (key, value, accumulator) => {
|
|
const isArray = /(\[\])$/.test(key);
|
|
key = key.replace(/\[\]$/, '');
|
|
|
|
if (!isArray) {
|
|
accumulator[key] = value ? decode(value, options) : value;
|
|
return;
|
|
}
|
|
|
|
const arrayValue = value === null ?
|
|
[] :
|
|
value.split(options.arrayFormatSeparator).map(item => decode(item, options));
|
|
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = arrayValue;
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], arrayValue);
|
|
};
|
|
|
|
default:
|
|
return (key, value, accumulator) => {
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], value);
|
|
};
|
|
}
|
|
}
|
|
|
|
function validateArrayFormatSeparator(value) {
|
|
if (typeof value !== 'string' || value.length !== 1) {
|
|
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
}
|
|
}
|
|
|
|
function encode(value, options) {
|
|
if (options.encode) {
|
|
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function decode(value, options) {
|
|
if (options.decode) {
|
|
return decodeComponent(value);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function keysSorter(input) {
|
|
if (Array.isArray(input)) {
|
|
return input.sort();
|
|
}
|
|
|
|
if (typeof input === 'object') {
|
|
return keysSorter(Object.keys(input))
|
|
.sort((a, b) => Number(a) - Number(b))
|
|
.map(key => input[key]);
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
function removeHash(input) {
|
|
const hashStart = input.indexOf('#');
|
|
if (hashStart !== -1) {
|
|
input = input.slice(0, hashStart);
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
function getHash(url) {
|
|
let hash = '';
|
|
const hashStart = url.indexOf('#');
|
|
if (hashStart !== -1) {
|
|
hash = url.slice(hashStart);
|
|
}
|
|
|
|
return hash;
|
|
}
|
|
|
|
function extract(input) {
|
|
input = removeHash(input);
|
|
const queryStart = input.indexOf('?');
|
|
if (queryStart === -1) {
|
|
return '';
|
|
}
|
|
|
|
return input.slice(queryStart + 1);
|
|
}
|
|
|
|
function parseValue(value, options) {
|
|
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
value = Number(value);
|
|
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
value = value.toLowerCase() === 'true';
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function parse(query, options) {
|
|
options = Object.assign({
|
|
decode: true,
|
|
sort: true,
|
|
arrayFormat: 'none',
|
|
arrayFormatSeparator: ',',
|
|
parseNumbers: false,
|
|
parseBooleans: false
|
|
}, options);
|
|
|
|
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
|
|
const formatter = parserForArrayFormat(options);
|
|
|
|
// Create an object with no prototype
|
|
const ret = Object.create(null);
|
|
|
|
if (typeof query !== 'string') {
|
|
return ret;
|
|
}
|
|
|
|
query = query.trim().replace(/^[?#&]/, '');
|
|
|
|
if (!query) {
|
|
return ret;
|
|
}
|
|
|
|
for (const param of query.split('&')) {
|
|
if (param === '') {
|
|
continue;
|
|
}
|
|
|
|
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
|
|
// Missing `=` should be `null`:
|
|
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
formatter(decode(key, options), value, ret);
|
|
}
|
|
|
|
for (const key of Object.keys(ret)) {
|
|
const value = ret[key];
|
|
if (typeof value === 'object' && value !== null) {
|
|
for (const k of Object.keys(value)) {
|
|
value[k] = parseValue(value[k], options);
|
|
}
|
|
} else {
|
|
ret[key] = parseValue(value, options);
|
|
}
|
|
}
|
|
|
|
if (options.sort === false) {
|
|
return ret;
|
|
}
|
|
|
|
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
const value = ret[key];
|
|
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
// Sort object keys, not values
|
|
result[key] = keysSorter(value);
|
|
} else {
|
|
result[key] = value;
|
|
}
|
|
|
|
return result;
|
|
}, Object.create(null));
|
|
}
|
|
|
|
exports.extract = extract;
|
|
exports.parse = parse;
|
|
|
|
exports.stringify = (object, options) => {
|
|
if (!object) {
|
|
return '';
|
|
}
|
|
|
|
options = Object.assign({
|
|
encode: true,
|
|
strict: true,
|
|
arrayFormat: 'none',
|
|
arrayFormatSeparator: ','
|
|
}, options);
|
|
|
|
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
|
|
const shouldFilter = key => (
|
|
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
(options.skipEmptyString && object[key] === '')
|
|
);
|
|
|
|
const formatter = encoderForArrayFormat(options);
|
|
|
|
const objectCopy = {};
|
|
|
|
for (const key of Object.keys(object)) {
|
|
if (!shouldFilter(key)) {
|
|
objectCopy[key] = object[key];
|
|
}
|
|
}
|
|
|
|
const keys = Object.keys(objectCopy);
|
|
|
|
if (options.sort !== false) {
|
|
keys.sort(options.sort);
|
|
}
|
|
|
|
return keys.map(key => {
|
|
const value = object[key];
|
|
|
|
if (value === undefined) {
|
|
return '';
|
|
}
|
|
|
|
if (value === null) {
|
|
return encode(key, options);
|
|
}
|
|
|
|
if (Array.isArray(value)) {
|
|
if (value.length === 0 && options.arrayFormat === 'bracket-separator') {
|
|
return encode(key, options) + '[]';
|
|
}
|
|
|
|
return value
|
|
.reduce(formatter(key), [])
|
|
.join('&');
|
|
}
|
|
|
|
return encode(key, options) + '=' + encode(value, options);
|
|
}).filter(x => x.length > 0).join('&');
|
|
};
|
|
|
|
exports.parseUrl = (url, options) => {
|
|
options = Object.assign({
|
|
decode: true
|
|
}, options);
|
|
|
|
const [url_, hash] = splitOnFirst(url, '#');
|
|
|
|
return Object.assign(
|
|
{
|
|
url: url_.split('?')[0] || '',
|
|
query: parse(extract(url), options)
|
|
},
|
|
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
);
|
|
};
|
|
|
|
exports.stringifyUrl = (object, options) => {
|
|
options = Object.assign({
|
|
encode: true,
|
|
strict: true,
|
|
[encodeFragmentIdentifier]: true
|
|
}, options);
|
|
|
|
const url = removeHash(object.url).split('?')[0] || '';
|
|
const queryFromUrl = exports.extract(object.url);
|
|
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
|
|
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
let queryString = exports.stringify(query, options);
|
|
if (queryString) {
|
|
queryString = `?${queryString}`;
|
|
}
|
|
|
|
let hash = getHash(object.url);
|
|
if (object.fragmentIdentifier) {
|
|
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;
|
|
}
|
|
|
|
return `${url}${queryString}${hash}`;
|
|
};
|
|
|
|
exports.pick = (input, filter, options) => {
|
|
options = Object.assign({
|
|
parseFragmentIdentifier: true,
|
|
[encodeFragmentIdentifier]: false
|
|
}, options);
|
|
|
|
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options);
|
|
return exports.stringifyUrl({
|
|
url,
|
|
query: filterObject(query, filter),
|
|
fragmentIdentifier
|
|
}, options);
|
|
};
|
|
|
|
exports.exclude = (input, filter, options) => {
|
|
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);
|
|
|
|
return exports.pick(input, exclusionFilter, options);
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7214:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
const codes = {};
|
|
|
|
function createErrorType(code, message, Base) {
|
|
if (!Base) {
|
|
Base = Error
|
|
}
|
|
|
|
function getMessage (arg1, arg2, arg3) {
|
|
if (typeof message === 'string') {
|
|
return message
|
|
} else {
|
|
return message(arg1, arg2, arg3)
|
|
}
|
|
}
|
|
|
|
class NodeError extends Base {
|
|
constructor (arg1, arg2, arg3) {
|
|
super(getMessage(arg1, arg2, arg3));
|
|
}
|
|
}
|
|
|
|
NodeError.prototype.name = Base.name;
|
|
NodeError.prototype.code = code;
|
|
|
|
codes[code] = NodeError;
|
|
}
|
|
|
|
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
function oneOf(expected, thing) {
|
|
if (Array.isArray(expected)) {
|
|
const len = expected.length;
|
|
expected = expected.map((i) => String(i));
|
|
if (len > 2) {
|
|
return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
|
|
expected[len - 1];
|
|
} else if (len === 2) {
|
|
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
|
} else {
|
|
return `of ${thing} ${expected[0]}`;
|
|
}
|
|
} else {
|
|
return `of ${thing} ${String(expected)}`;
|
|
}
|
|
}
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
function startsWith(str, search, pos) {
|
|
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
|
}
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
function endsWith(str, search, this_len) {
|
|
if (this_len === undefined || this_len > str.length) {
|
|
this_len = str.length;
|
|
}
|
|
return str.substring(this_len - search.length, this_len) === search;
|
|
}
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
function includes(str, search, start) {
|
|
if (typeof start !== 'number') {
|
|
start = 0;
|
|
}
|
|
|
|
if (start + search.length > str.length) {
|
|
return false;
|
|
} else {
|
|
return str.indexOf(search, start) !== -1;
|
|
}
|
|
}
|
|
|
|
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
|
return 'The value "' + value + '" is invalid for option "' + name + '"'
|
|
}, TypeError);
|
|
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
|
// determiner: 'must be' or 'must not be'
|
|
let determiner;
|
|
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
|
determiner = 'must not be';
|
|
expected = expected.replace(/^not /, '');
|
|
} else {
|
|
determiner = 'must be';
|
|
}
|
|
|
|
let msg;
|
|
if (endsWith(name, ' argument')) {
|
|
// For cases like 'first argument'
|
|
msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
|
|
} else {
|
|
const type = includes(name, '.') ? 'property' : 'argument';
|
|
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
|
|
}
|
|
|
|
msg += `. Received type ${typeof actual}`;
|
|
return msg;
|
|
}, TypeError);
|
|
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
|
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
|
return 'The ' + name + ' method is not implemented'
|
|
});
|
|
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
|
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
|
return 'Cannot call ' + name + ' after a stream was destroyed';
|
|
});
|
|
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
|
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
|
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
|
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
|
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
return 'Unknown encoding: ' + arg
|
|
}, TypeError);
|
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
|
|
|
module.exports.q = codes;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1359:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
// a duplex stream is just a stream that is both readable and writable.
|
|
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
// prototypally inherits from Readable, and then parasitically from
|
|
// Writable.
|
|
|
|
|
|
|
|
/*<replacement>*/
|
|
var objectKeys = Object.keys || function (obj) {
|
|
var keys = [];
|
|
for (var key in obj) keys.push(key);
|
|
return keys;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
module.exports = Duplex;
|
|
var Readable = __nccwpck_require__(1433);
|
|
var Writable = __nccwpck_require__(2094);
|
|
__nccwpck_require__(4124)(Duplex, Readable);
|
|
{
|
|
// Allow the keys array to be GC'ed.
|
|
var keys = objectKeys(Writable.prototype);
|
|
for (var v = 0; v < keys.length; v++) {
|
|
var method = keys[v];
|
|
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
|
}
|
|
}
|
|
function Duplex(options) {
|
|
if (!(this instanceof Duplex)) return new Duplex(options);
|
|
Readable.call(this, options);
|
|
Writable.call(this, options);
|
|
this.allowHalfOpen = true;
|
|
if (options) {
|
|
if (options.readable === false) this.readable = false;
|
|
if (options.writable === false) this.writable = false;
|
|
if (options.allowHalfOpen === false) {
|
|
this.allowHalfOpen = false;
|
|
this.once('end', onend);
|
|
}
|
|
}
|
|
}
|
|
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.highWaterMark;
|
|
}
|
|
});
|
|
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState && this._writableState.getBuffer();
|
|
}
|
|
});
|
|
Object.defineProperty(Duplex.prototype, 'writableLength', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.length;
|
|
}
|
|
});
|
|
|
|
// the no-half-open enforcer
|
|
function onend() {
|
|
// If the writable side ended, then we're ok.
|
|
if (this._writableState.ended) return;
|
|
|
|
// no more data can be written.
|
|
// But allow more writes to happen in this tick.
|
|
process.nextTick(onEndNT, this);
|
|
}
|
|
function onEndNT(self) {
|
|
self.end();
|
|
}
|
|
Object.defineProperty(Duplex.prototype, 'destroyed', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._readableState === undefined || this._writableState === undefined) {
|
|
return false;
|
|
}
|
|
return this._readableState.destroyed && this._writableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (this._readableState === undefined || this._writableState === undefined) {
|
|
return;
|
|
}
|
|
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._readableState.destroyed = value;
|
|
this._writableState.destroyed = value;
|
|
}
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1542:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
// a passthrough stream.
|
|
// basically just the most minimal sort of Transform stream.
|
|
// Every written chunk gets output as-is.
|
|
|
|
|
|
|
|
module.exports = PassThrough;
|
|
var Transform = __nccwpck_require__(4415);
|
|
__nccwpck_require__(4124)(PassThrough, Transform);
|
|
function PassThrough(options) {
|
|
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
|
Transform.call(this, options);
|
|
}
|
|
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
|
cb(null, chunk);
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1433:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
|
|
|
|
module.exports = Readable;
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Readable.ReadableState = ReadableState;
|
|
|
|
/*<replacement>*/
|
|
var EE = (__nccwpck_require__(2361).EventEmitter);
|
|
var EElistenerCount = function EElistenerCount(emitter, type) {
|
|
return emitter.listeners(type).length;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream = __nccwpck_require__(2387);
|
|
/*</replacement>*/
|
|
|
|
var Buffer = (__nccwpck_require__(4300).Buffer);
|
|
var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
|
|
function _uint8ArrayToBuffer(chunk) {
|
|
return Buffer.from(chunk);
|
|
}
|
|
function _isUint8Array(obj) {
|
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
}
|
|
|
|
/*<replacement>*/
|
|
var debugUtil = __nccwpck_require__(3837);
|
|
var debug;
|
|
if (debugUtil && debugUtil.debuglog) {
|
|
debug = debugUtil.debuglog('stream');
|
|
} else {
|
|
debug = function debug() {};
|
|
}
|
|
/*</replacement>*/
|
|
|
|
var BufferList = __nccwpck_require__(2746);
|
|
var destroyImpl = __nccwpck_require__(7049);
|
|
var _require = __nccwpck_require__(9948),
|
|
getHighWaterMark = _require.getHighWaterMark;
|
|
var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
|
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
|
ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
|
|
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
|
ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
|
|
// Lazy loaded to improve the startup performance.
|
|
var StringDecoder;
|
|
var createReadableStreamAsyncIterator;
|
|
var from;
|
|
__nccwpck_require__(4124)(Readable, Stream);
|
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
|
function prependListener(emitter, event, fn) {
|
|
// Sadly this is not cacheable as some libraries bundle their own
|
|
// event emitter implementation with them.
|
|
if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
|
|
|
// This is a hack to make sure that our error handler is attached before any
|
|
// userland ones. NEVER DO THIS. This is here only because this code needs
|
|
// to continue to work with older versions of Node.js that do not include
|
|
// the prependListener() method. The goal is to eventually remove this hack.
|
|
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
|
}
|
|
function ReadableState(options, stream, isDuplex) {
|
|
Duplex = Duplex || __nccwpck_require__(1359);
|
|
options = options || {};
|
|
|
|
// Duplex streams are both readable and writable, but share
|
|
// the same options object.
|
|
// However, some cases require setting options to different
|
|
// values for the readable and the writable sides of the duplex stream.
|
|
// These options can be provided separately as readableXXX and writableXXX.
|
|
if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
|
|
|
|
// object stream flag. Used to make read(n) ignore n and to
|
|
// make all the buffer merging and length checks go away
|
|
this.objectMode = !!options.objectMode;
|
|
if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
|
|
|
// the point at which it stops calling _read() to fill the buffer
|
|
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
|
this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);
|
|
|
|
// A linked list is used to store data chunks instead of an array because the
|
|
// linked list can remove elements from the beginning faster than
|
|
// array.shift()
|
|
this.buffer = new BufferList();
|
|
this.length = 0;
|
|
this.pipes = null;
|
|
this.pipesCount = 0;
|
|
this.flowing = null;
|
|
this.ended = false;
|
|
this.endEmitted = false;
|
|
this.reading = false;
|
|
|
|
// a flag to be able to tell if the event 'readable'/'data' is emitted
|
|
// immediately, or on a later tick. We set this to true at first, because
|
|
// any actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first read call.
|
|
this.sync = true;
|
|
|
|
// whenever we return null, then we set a flag to say
|
|
// that we're awaiting a 'readable' event emission.
|
|
this.needReadable = false;
|
|
this.emittedReadable = false;
|
|
this.readableListening = false;
|
|
this.resumeScheduled = false;
|
|
this.paused = true;
|
|
|
|
// Should close be emitted on destroy. Defaults to true.
|
|
this.emitClose = options.emitClose !== false;
|
|
|
|
// Should .destroy() be called after 'end' (and potentially 'finish')
|
|
this.autoDestroy = !!options.autoDestroy;
|
|
|
|
// has it been destroyed
|
|
this.destroyed = false;
|
|
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
|
|
|
// the number of writers that are awaiting a drain event in .pipe()s
|
|
this.awaitDrain = 0;
|
|
|
|
// if true, a maybeReadMore has been scheduled
|
|
this.readingMore = false;
|
|
this.decoder = null;
|
|
this.encoding = null;
|
|
if (options.encoding) {
|
|
if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s);
|
|
this.decoder = new StringDecoder(options.encoding);
|
|
this.encoding = options.encoding;
|
|
}
|
|
}
|
|
function Readable(options) {
|
|
Duplex = Duplex || __nccwpck_require__(1359);
|
|
if (!(this instanceof Readable)) return new Readable(options);
|
|
|
|
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
// the ReadableState constructor, at least with V8 6.5
|
|
var isDuplex = this instanceof Duplex;
|
|
this._readableState = new ReadableState(options, this, isDuplex);
|
|
|
|
// legacy
|
|
this.readable = true;
|
|
if (options) {
|
|
if (typeof options.read === 'function') this._read = options.read;
|
|
if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
|
}
|
|
Stream.call(this);
|
|
}
|
|
Object.defineProperty(Readable.prototype, 'destroyed', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._readableState === undefined) {
|
|
return false;
|
|
}
|
|
return this._readableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (!this._readableState) {
|
|
return;
|
|
}
|
|
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._readableState.destroyed = value;
|
|
}
|
|
});
|
|
Readable.prototype.destroy = destroyImpl.destroy;
|
|
Readable.prototype._undestroy = destroyImpl.undestroy;
|
|
Readable.prototype._destroy = function (err, cb) {
|
|
cb(err);
|
|
};
|
|
|
|
// Manually shove something into the read() buffer.
|
|
// This returns true if the highWaterMark has not been hit yet,
|
|
// similar to how Writable.write() returns true if you should
|
|
// write() some more.
|
|
Readable.prototype.push = function (chunk, encoding) {
|
|
var state = this._readableState;
|
|
var skipChunkCheck;
|
|
if (!state.objectMode) {
|
|
if (typeof chunk === 'string') {
|
|
encoding = encoding || state.defaultEncoding;
|
|
if (encoding !== state.encoding) {
|
|
chunk = Buffer.from(chunk, encoding);
|
|
encoding = '';
|
|
}
|
|
skipChunkCheck = true;
|
|
}
|
|
} else {
|
|
skipChunkCheck = true;
|
|
}
|
|
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
|
};
|
|
|
|
// Unshift should *always* be something directly out of read()
|
|
Readable.prototype.unshift = function (chunk) {
|
|
return readableAddChunk(this, chunk, null, true, false);
|
|
};
|
|
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
|
debug('readableAddChunk', chunk);
|
|
var state = stream._readableState;
|
|
if (chunk === null) {
|
|
state.reading = false;
|
|
onEofChunk(stream, state);
|
|
} else {
|
|
var er;
|
|
if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
|
if (er) {
|
|
errorOrDestroy(stream, er);
|
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
}
|
|
if (addToFront) {
|
|
if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
|
|
} else if (state.ended) {
|
|
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
|
|
} else if (state.destroyed) {
|
|
return false;
|
|
} else {
|
|
state.reading = false;
|
|
if (state.decoder && !encoding) {
|
|
chunk = state.decoder.write(chunk);
|
|
if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
|
} else {
|
|
addChunk(stream, state, chunk, false);
|
|
}
|
|
}
|
|
} else if (!addToFront) {
|
|
state.reading = false;
|
|
maybeReadMore(stream, state);
|
|
}
|
|
}
|
|
|
|
// We can push more data if we are below the highWaterMark.
|
|
// Also, if we have no data yet, we can stand some more bytes.
|
|
// This is to work around cases where hwm=0, such as the repl.
|
|
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
|
|
}
|
|
function addChunk(stream, state, chunk, addToFront) {
|
|
if (state.flowing && state.length === 0 && !state.sync) {
|
|
state.awaitDrain = 0;
|
|
stream.emit('data', chunk);
|
|
} else {
|
|
// update the buffer info.
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
|
if (state.needReadable) emitReadable(stream);
|
|
}
|
|
maybeReadMore(stream, state);
|
|
}
|
|
function chunkInvalid(state, chunk) {
|
|
var er;
|
|
if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
|
er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
|
|
}
|
|
return er;
|
|
}
|
|
Readable.prototype.isPaused = function () {
|
|
return this._readableState.flowing === false;
|
|
};
|
|
|
|
// backwards compatibility.
|
|
Readable.prototype.setEncoding = function (enc) {
|
|
if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s);
|
|
var decoder = new StringDecoder(enc);
|
|
this._readableState.decoder = decoder;
|
|
// If setEncoding(null), decoder.encoding equals utf8
|
|
this._readableState.encoding = this._readableState.decoder.encoding;
|
|
|
|
// Iterate over current buffer to convert already stored Buffers:
|
|
var p = this._readableState.buffer.head;
|
|
var content = '';
|
|
while (p !== null) {
|
|
content += decoder.write(p.data);
|
|
p = p.next;
|
|
}
|
|
this._readableState.buffer.clear();
|
|
if (content !== '') this._readableState.buffer.push(content);
|
|
this._readableState.length = content.length;
|
|
return this;
|
|
};
|
|
|
|
// Don't raise the hwm > 1GB
|
|
var MAX_HWM = 0x40000000;
|
|
function computeNewHighWaterMark(n) {
|
|
if (n >= MAX_HWM) {
|
|
// TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
|
|
n = MAX_HWM;
|
|
} else {
|
|
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
|
// tiny amounts
|
|
n--;
|
|
n |= n >>> 1;
|
|
n |= n >>> 2;
|
|
n |= n >>> 4;
|
|
n |= n >>> 8;
|
|
n |= n >>> 16;
|
|
n++;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function howMuchToRead(n, state) {
|
|
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
|
if (state.objectMode) return 1;
|
|
if (n !== n) {
|
|
// Only flow one buffer at a time
|
|
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
|
}
|
|
// If we're asking for more than the current hwm, then raise the hwm.
|
|
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
|
if (n <= state.length) return n;
|
|
// Don't have enough
|
|
if (!state.ended) {
|
|
state.needReadable = true;
|
|
return 0;
|
|
}
|
|
return state.length;
|
|
}
|
|
|
|
// you can override either this method, or the async _read(n) below.
|
|
Readable.prototype.read = function (n) {
|
|
debug('read', n);
|
|
n = parseInt(n, 10);
|
|
var state = this._readableState;
|
|
var nOrig = n;
|
|
if (n !== 0) state.emittedReadable = false;
|
|
|
|
// if we're doing read(0) to trigger a readable event, but we
|
|
// already have a bunch of data in the buffer, then just trigger
|
|
// the 'readable' event and move on.
|
|
if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
|
|
debug('read: emitReadable', state.length, state.ended);
|
|
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
|
return null;
|
|
}
|
|
n = howMuchToRead(n, state);
|
|
|
|
// if we've ended, and we're now clear, then finish it up.
|
|
if (n === 0 && state.ended) {
|
|
if (state.length === 0) endReadable(this);
|
|
return null;
|
|
}
|
|
|
|
// All the actual chunk generation logic needs to be
|
|
// *below* the call to _read. The reason is that in certain
|
|
// synthetic stream cases, such as passthrough streams, _read
|
|
// may be a completely synchronous operation which may change
|
|
// the state of the read buffer, providing enough data when
|
|
// before there was *not* enough.
|
|
//
|
|
// So, the steps are:
|
|
// 1. Figure out what the state of things will be after we do
|
|
// a read from the buffer.
|
|
//
|
|
// 2. If that resulting state will trigger a _read, then call _read.
|
|
// Note that this may be asynchronous, or synchronous. Yes, it is
|
|
// deeply ugly to write APIs this way, but that still doesn't mean
|
|
// that the Readable class should behave improperly, as streams are
|
|
// designed to be sync/async agnostic.
|
|
// Take note if the _read call is sync or async (ie, if the read call
|
|
// has returned yet), so that we know whether or not it's safe to emit
|
|
// 'readable' etc.
|
|
//
|
|
// 3. Actually pull the requested chunks out of the buffer and return.
|
|
|
|
// if we need a readable event, then we need to do some reading.
|
|
var doRead = state.needReadable;
|
|
debug('need readable', doRead);
|
|
|
|
// if we currently have less than the highWaterMark, then also read some
|
|
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
|
doRead = true;
|
|
debug('length less than watermark', doRead);
|
|
}
|
|
|
|
// however, if we've ended, then there's no point, and if we're already
|
|
// reading, then it's unnecessary.
|
|
if (state.ended || state.reading) {
|
|
doRead = false;
|
|
debug('reading or ended', doRead);
|
|
} else if (doRead) {
|
|
debug('do read');
|
|
state.reading = true;
|
|
state.sync = true;
|
|
// if the length is currently zero, then we *need* a readable event.
|
|
if (state.length === 0) state.needReadable = true;
|
|
// call internal read method
|
|
this._read(state.highWaterMark);
|
|
state.sync = false;
|
|
// If _read pushed data synchronously, then `reading` will be false,
|
|
// and we need to re-evaluate how much data we can return to the user.
|
|
if (!state.reading) n = howMuchToRead(nOrig, state);
|
|
}
|
|
var ret;
|
|
if (n > 0) ret = fromList(n, state);else ret = null;
|
|
if (ret === null) {
|
|
state.needReadable = state.length <= state.highWaterMark;
|
|
n = 0;
|
|
} else {
|
|
state.length -= n;
|
|
state.awaitDrain = 0;
|
|
}
|
|
if (state.length === 0) {
|
|
// If we have nothing in the buffer, then we want to know
|
|
// as soon as we *do* get something into the buffer.
|
|
if (!state.ended) state.needReadable = true;
|
|
|
|
// If we tried to read() past the EOF, then emit end on the next tick.
|
|
if (nOrig !== n && state.ended) endReadable(this);
|
|
}
|
|
if (ret !== null) this.emit('data', ret);
|
|
return ret;
|
|
};
|
|
function onEofChunk(stream, state) {
|
|
debug('onEofChunk');
|
|
if (state.ended) return;
|
|
if (state.decoder) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) {
|
|
state.buffer.push(chunk);
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
}
|
|
}
|
|
state.ended = true;
|
|
if (state.sync) {
|
|
// if we are sync, wait until next tick to emit the data.
|
|
// Otherwise we risk emitting data in the flow()
|
|
// the readable code triggers during a read() call
|
|
emitReadable(stream);
|
|
} else {
|
|
// emit 'readable' now to make sure it gets picked up.
|
|
state.needReadable = false;
|
|
if (!state.emittedReadable) {
|
|
state.emittedReadable = true;
|
|
emitReadable_(stream);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Don't emit readable right away in sync mode, because this can trigger
|
|
// another read() call => stack overflow. This way, it might trigger
|
|
// a nextTick recursion warning, but that's not so bad.
|
|
function emitReadable(stream) {
|
|
var state = stream._readableState;
|
|
debug('emitReadable', state.needReadable, state.emittedReadable);
|
|
state.needReadable = false;
|
|
if (!state.emittedReadable) {
|
|
debug('emitReadable', state.flowing);
|
|
state.emittedReadable = true;
|
|
process.nextTick(emitReadable_, stream);
|
|
}
|
|
}
|
|
function emitReadable_(stream) {
|
|
var state = stream._readableState;
|
|
debug('emitReadable_', state.destroyed, state.length, state.ended);
|
|
if (!state.destroyed && (state.length || state.ended)) {
|
|
stream.emit('readable');
|
|
state.emittedReadable = false;
|
|
}
|
|
|
|
// The stream needs another readable event if
|
|
// 1. It is not flowing, as the flow mechanism will take
|
|
// care of it.
|
|
// 2. It is not ended.
|
|
// 3. It is below the highWaterMark, so we can schedule
|
|
// another readable later.
|
|
state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
|
|
flow(stream);
|
|
}
|
|
|
|
// at this point, the user has presumably seen the 'readable' event,
|
|
// and called read() to consume some data. that may have triggered
|
|
// in turn another _read(n) call, in which case reading = true if
|
|
// it's in progress.
|
|
// However, if we're not ended, or reading, and the length < hwm,
|
|
// then go ahead and try to read some more preemptively.
|
|
function maybeReadMore(stream, state) {
|
|
if (!state.readingMore) {
|
|
state.readingMore = true;
|
|
process.nextTick(maybeReadMore_, stream, state);
|
|
}
|
|
}
|
|
function maybeReadMore_(stream, state) {
|
|
// Attempt to read more data if we should.
|
|
//
|
|
// The conditions for reading more data are (one of):
|
|
// - Not enough data buffered (state.length < state.highWaterMark). The loop
|
|
// is responsible for filling the buffer with enough data if such data
|
|
// is available. If highWaterMark is 0 and we are not in the flowing mode
|
|
// we should _not_ attempt to buffer any extra data. We'll get more data
|
|
// when the stream consumer calls read() instead.
|
|
// - No data in the buffer, and the stream is in flowing mode. In this mode
|
|
// the loop below is responsible for ensuring read() is called. Failing to
|
|
// call read here would abort the flow and there's no other mechanism for
|
|
// continuing the flow if the stream consumer has just subscribed to the
|
|
// 'data' event.
|
|
//
|
|
// In addition to the above conditions to keep reading data, the following
|
|
// conditions prevent the data from being read:
|
|
// - The stream has ended (state.ended).
|
|
// - There is already a pending 'read' operation (state.reading). This is a
|
|
// case where the the stream has called the implementation defined _read()
|
|
// method, but they are processing the call asynchronously and have _not_
|
|
// called push() with new data. In this case we skip performing more
|
|
// read()s. The execution ends in this method again after the _read() ends
|
|
// up calling push() with more data.
|
|
while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
|
|
var len = state.length;
|
|
debug('maybeReadMore read 0');
|
|
stream.read(0);
|
|
if (len === state.length)
|
|
// didn't get any data, stop spinning.
|
|
break;
|
|
}
|
|
state.readingMore = false;
|
|
}
|
|
|
|
// abstract method. to be overridden in specific implementation classes.
|
|
// call cb(er, data) where data is <= n in length.
|
|
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
|
// arbitrary, and perhaps not very meaningful.
|
|
Readable.prototype._read = function (n) {
|
|
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
|
|
};
|
|
Readable.prototype.pipe = function (dest, pipeOpts) {
|
|
var src = this;
|
|
var state = this._readableState;
|
|
switch (state.pipesCount) {
|
|
case 0:
|
|
state.pipes = dest;
|
|
break;
|
|
case 1:
|
|
state.pipes = [state.pipes, dest];
|
|
break;
|
|
default:
|
|
state.pipes.push(dest);
|
|
break;
|
|
}
|
|
state.pipesCount += 1;
|
|
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
|
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
|
var endFn = doEnd ? onend : unpipe;
|
|
if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
|
|
dest.on('unpipe', onunpipe);
|
|
function onunpipe(readable, unpipeInfo) {
|
|
debug('onunpipe');
|
|
if (readable === src) {
|
|
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
|
unpipeInfo.hasUnpiped = true;
|
|
cleanup();
|
|
}
|
|
}
|
|
}
|
|
function onend() {
|
|
debug('onend');
|
|
dest.end();
|
|
}
|
|
|
|
// when the dest drains, it reduces the awaitDrain counter
|
|
// on the source. This would be more elegant with a .once()
|
|
// handler in flow(), but adding and removing repeatedly is
|
|
// too slow.
|
|
var ondrain = pipeOnDrain(src);
|
|
dest.on('drain', ondrain);
|
|
var cleanedUp = false;
|
|
function cleanup() {
|
|
debug('cleanup');
|
|
// cleanup event handlers once the pipe is broken
|
|
dest.removeListener('close', onclose);
|
|
dest.removeListener('finish', onfinish);
|
|
dest.removeListener('drain', ondrain);
|
|
dest.removeListener('error', onerror);
|
|
dest.removeListener('unpipe', onunpipe);
|
|
src.removeListener('end', onend);
|
|
src.removeListener('end', unpipe);
|
|
src.removeListener('data', ondata);
|
|
cleanedUp = true;
|
|
|
|
// if the reader is waiting for a drain event from this
|
|
// specific writer, then it would cause it to never start
|
|
// flowing again.
|
|
// So, if this is awaiting a drain, then we just call it now.
|
|
// If we don't know, then assume that we are waiting for one.
|
|
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
|
}
|
|
src.on('data', ondata);
|
|
function ondata(chunk) {
|
|
debug('ondata');
|
|
var ret = dest.write(chunk);
|
|
debug('dest.write', ret);
|
|
if (ret === false) {
|
|
// If the user unpiped during `dest.write()`, it is possible
|
|
// to get stuck in a permanently paused state if that write
|
|
// also returned false.
|
|
// => Check whether `dest` is still a piping destination.
|
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
debug('false write response, pause', state.awaitDrain);
|
|
state.awaitDrain++;
|
|
}
|
|
src.pause();
|
|
}
|
|
}
|
|
|
|
// if the dest has an error, then stop piping into it.
|
|
// however, don't suppress the throwing behavior for this.
|
|
function onerror(er) {
|
|
debug('onerror', er);
|
|
unpipe();
|
|
dest.removeListener('error', onerror);
|
|
if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
|
|
}
|
|
|
|
// Make sure our error handler is attached before userland ones.
|
|
prependListener(dest, 'error', onerror);
|
|
|
|
// Both close and finish should trigger unpipe, but only once.
|
|
function onclose() {
|
|
dest.removeListener('finish', onfinish);
|
|
unpipe();
|
|
}
|
|
dest.once('close', onclose);
|
|
function onfinish() {
|
|
debug('onfinish');
|
|
dest.removeListener('close', onclose);
|
|
unpipe();
|
|
}
|
|
dest.once('finish', onfinish);
|
|
function unpipe() {
|
|
debug('unpipe');
|
|
src.unpipe(dest);
|
|
}
|
|
|
|
// tell the dest that it's being piped to
|
|
dest.emit('pipe', src);
|
|
|
|
// start the flow if it hasn't been started already.
|
|
if (!state.flowing) {
|
|
debug('pipe resume');
|
|
src.resume();
|
|
}
|
|
return dest;
|
|
};
|
|
function pipeOnDrain(src) {
|
|
return function pipeOnDrainFunctionResult() {
|
|
var state = src._readableState;
|
|
debug('pipeOnDrain', state.awaitDrain);
|
|
if (state.awaitDrain) state.awaitDrain--;
|
|
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
|
state.flowing = true;
|
|
flow(src);
|
|
}
|
|
};
|
|
}
|
|
Readable.prototype.unpipe = function (dest) {
|
|
var state = this._readableState;
|
|
var unpipeInfo = {
|
|
hasUnpiped: false
|
|
};
|
|
|
|
// if we're not piping anywhere, then do nothing.
|
|
if (state.pipesCount === 0) return this;
|
|
|
|
// just one destination. most common case.
|
|
if (state.pipesCount === 1) {
|
|
// passed in one, but it's not the right one.
|
|
if (dest && dest !== state.pipes) return this;
|
|
if (!dest) dest = state.pipes;
|
|
|
|
// got a match.
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
if (dest) dest.emit('unpipe', this, unpipeInfo);
|
|
return this;
|
|
}
|
|
|
|
// slow case. multiple pipe destinations.
|
|
|
|
if (!dest) {
|
|
// remove all.
|
|
var dests = state.pipes;
|
|
var len = state.pipesCount;
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {
|
|
hasUnpiped: false
|
|
});
|
|
return this;
|
|
}
|
|
|
|
// try to find the right one.
|
|
var index = indexOf(state.pipes, dest);
|
|
if (index === -1) return this;
|
|
state.pipes.splice(index, 1);
|
|
state.pipesCount -= 1;
|
|
if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
|
dest.emit('unpipe', this, unpipeInfo);
|
|
return this;
|
|
};
|
|
|
|
// set up data events if they are asked for
|
|
// Ensure readable listeners eventually get something
|
|
Readable.prototype.on = function (ev, fn) {
|
|
var res = Stream.prototype.on.call(this, ev, fn);
|
|
var state = this._readableState;
|
|
if (ev === 'data') {
|
|
// update readableListening so that resume() may be a no-op
|
|
// a few lines down. This is needed to support once('readable').
|
|
state.readableListening = this.listenerCount('readable') > 0;
|
|
|
|
// Try start flowing on next tick if stream isn't explicitly paused
|
|
if (state.flowing !== false) this.resume();
|
|
} else if (ev === 'readable') {
|
|
if (!state.endEmitted && !state.readableListening) {
|
|
state.readableListening = state.needReadable = true;
|
|
state.flowing = false;
|
|
state.emittedReadable = false;
|
|
debug('on readable', state.length, state.reading);
|
|
if (state.length) {
|
|
emitReadable(this);
|
|
} else if (!state.reading) {
|
|
process.nextTick(nReadingNextTick, this);
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
};
|
|
Readable.prototype.addListener = Readable.prototype.on;
|
|
Readable.prototype.removeListener = function (ev, fn) {
|
|
var res = Stream.prototype.removeListener.call(this, ev, fn);
|
|
if (ev === 'readable') {
|
|
// We need to check if there is someone still listening to
|
|
// readable and reset the state. However this needs to happen
|
|
// after readable has been emitted but before I/O (nextTick) to
|
|
// support once('readable', fn) cycles. This means that calling
|
|
// resume within the same tick will have no
|
|
// effect.
|
|
process.nextTick(updateReadableListening, this);
|
|
}
|
|
return res;
|
|
};
|
|
Readable.prototype.removeAllListeners = function (ev) {
|
|
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
|
|
if (ev === 'readable' || ev === undefined) {
|
|
// We need to check if there is someone still listening to
|
|
// readable and reset the state. However this needs to happen
|
|
// after readable has been emitted but before I/O (nextTick) to
|
|
// support once('readable', fn) cycles. This means that calling
|
|
// resume within the same tick will have no
|
|
// effect.
|
|
process.nextTick(updateReadableListening, this);
|
|
}
|
|
return res;
|
|
};
|
|
function updateReadableListening(self) {
|
|
var state = self._readableState;
|
|
state.readableListening = self.listenerCount('readable') > 0;
|
|
if (state.resumeScheduled && !state.paused) {
|
|
// flowing needs to be set to true now, otherwise
|
|
// the upcoming resume will not flow.
|
|
state.flowing = true;
|
|
|
|
// crude way to check if we should resume
|
|
} else if (self.listenerCount('data') > 0) {
|
|
self.resume();
|
|
}
|
|
}
|
|
function nReadingNextTick(self) {
|
|
debug('readable nexttick read 0');
|
|
self.read(0);
|
|
}
|
|
|
|
// pause() and resume() are remnants of the legacy readable stream API
|
|
// If the user uses them, then switch into old mode.
|
|
Readable.prototype.resume = function () {
|
|
var state = this._readableState;
|
|
if (!state.flowing) {
|
|
debug('resume');
|
|
// we flow only if there is no one listening
|
|
// for readable, but we still have to call
|
|
// resume()
|
|
state.flowing = !state.readableListening;
|
|
resume(this, state);
|
|
}
|
|
state.paused = false;
|
|
return this;
|
|
};
|
|
function resume(stream, state) {
|
|
if (!state.resumeScheduled) {
|
|
state.resumeScheduled = true;
|
|
process.nextTick(resume_, stream, state);
|
|
}
|
|
}
|
|
function resume_(stream, state) {
|
|
debug('resume', state.reading);
|
|
if (!state.reading) {
|
|
stream.read(0);
|
|
}
|
|
state.resumeScheduled = false;
|
|
stream.emit('resume');
|
|
flow(stream);
|
|
if (state.flowing && !state.reading) stream.read(0);
|
|
}
|
|
Readable.prototype.pause = function () {
|
|
debug('call pause flowing=%j', this._readableState.flowing);
|
|
if (this._readableState.flowing !== false) {
|
|
debug('pause');
|
|
this._readableState.flowing = false;
|
|
this.emit('pause');
|
|
}
|
|
this._readableState.paused = true;
|
|
return this;
|
|
};
|
|
function flow(stream) {
|
|
var state = stream._readableState;
|
|
debug('flow', state.flowing);
|
|
while (state.flowing && stream.read() !== null);
|
|
}
|
|
|
|
// wrap an old-style stream as the async data source.
|
|
// This is *not* part of the readable stream interface.
|
|
// It is an ugly unfortunate mess of history.
|
|
Readable.prototype.wrap = function (stream) {
|
|
var _this = this;
|
|
var state = this._readableState;
|
|
var paused = false;
|
|
stream.on('end', function () {
|
|
debug('wrapped end');
|
|
if (state.decoder && !state.ended) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) _this.push(chunk);
|
|
}
|
|
_this.push(null);
|
|
});
|
|
stream.on('data', function (chunk) {
|
|
debug('wrapped data');
|
|
if (state.decoder) chunk = state.decoder.write(chunk);
|
|
|
|
// don't skip over falsy values in objectMode
|
|
if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
|
var ret = _this.push(chunk);
|
|
if (!ret) {
|
|
paused = true;
|
|
stream.pause();
|
|
}
|
|
});
|
|
|
|
// proxy all the other methods.
|
|
// important when wrapping filters and duplexes.
|
|
for (var i in stream) {
|
|
if (this[i] === undefined && typeof stream[i] === 'function') {
|
|
this[i] = function methodWrap(method) {
|
|
return function methodWrapReturnFunction() {
|
|
return stream[method].apply(stream, arguments);
|
|
};
|
|
}(i);
|
|
}
|
|
}
|
|
|
|
// proxy certain important events.
|
|
for (var n = 0; n < kProxyEvents.length; n++) {
|
|
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
|
}
|
|
|
|
// when we try to consume some more bytes, simply unpause the
|
|
// underlying stream.
|
|
this._read = function (n) {
|
|
debug('wrapped _read', n);
|
|
if (paused) {
|
|
paused = false;
|
|
stream.resume();
|
|
}
|
|
};
|
|
return this;
|
|
};
|
|
if (typeof Symbol === 'function') {
|
|
Readable.prototype[Symbol.asyncIterator] = function () {
|
|
if (createReadableStreamAsyncIterator === undefined) {
|
|
createReadableStreamAsyncIterator = __nccwpck_require__(3306);
|
|
}
|
|
return createReadableStreamAsyncIterator(this);
|
|
};
|
|
}
|
|
Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.highWaterMark;
|
|
}
|
|
});
|
|
Object.defineProperty(Readable.prototype, 'readableBuffer', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState && this._readableState.buffer;
|
|
}
|
|
});
|
|
Object.defineProperty(Readable.prototype, 'readableFlowing', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.flowing;
|
|
},
|
|
set: function set(state) {
|
|
if (this._readableState) {
|
|
this._readableState.flowing = state;
|
|
}
|
|
}
|
|
});
|
|
|
|
// exposed for testing purposes only.
|
|
Readable._fromList = fromList;
|
|
Object.defineProperty(Readable.prototype, 'readableLength', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._readableState.length;
|
|
}
|
|
});
|
|
|
|
// Pluck off n bytes from an array of buffers.
|
|
// Length is the combined lengths of all the buffers in the list.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function fromList(n, state) {
|
|
// nothing buffered
|
|
if (state.length === 0) return null;
|
|
var ret;
|
|
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
|
// read it all, truncate the list
|
|
if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
|
|
state.buffer.clear();
|
|
} else {
|
|
// read part of list
|
|
ret = state.buffer.consume(n, state.decoder);
|
|
}
|
|
return ret;
|
|
}
|
|
function endReadable(stream) {
|
|
var state = stream._readableState;
|
|
debug('endReadable', state.endEmitted);
|
|
if (!state.endEmitted) {
|
|
state.ended = true;
|
|
process.nextTick(endReadableNT, state, stream);
|
|
}
|
|
}
|
|
function endReadableNT(state, stream) {
|
|
debug('endReadableNT', state.endEmitted, state.length);
|
|
|
|
// Check that we didn't get one last unshift.
|
|
if (!state.endEmitted && state.length === 0) {
|
|
state.endEmitted = true;
|
|
stream.readable = false;
|
|
stream.emit('end');
|
|
if (state.autoDestroy) {
|
|
// In case of duplex streams we need a way to detect
|
|
// if the writable side is ready for autoDestroy as well
|
|
var wState = stream._writableState;
|
|
if (!wState || wState.autoDestroy && wState.finished) {
|
|
stream.destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (typeof Symbol === 'function') {
|
|
Readable.from = function (iterable, opts) {
|
|
if (from === undefined) {
|
|
from = __nccwpck_require__(9082);
|
|
}
|
|
return from(Readable, iterable, opts);
|
|
};
|
|
}
|
|
function indexOf(xs, x) {
|
|
for (var i = 0, l = xs.length; i < l; i++) {
|
|
if (xs[i] === x) return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4415:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
// a transform stream is a readable/writable stream where you do
|
|
// something with the data. Sometimes it's called a "filter",
|
|
// but that's not a great name for it, since that implies a thing where
|
|
// some bits pass through, and others are simply ignored. (That would
|
|
// be a valid example of a transform, of course.)
|
|
//
|
|
// While the output is causally related to the input, it's not a
|
|
// necessarily symmetric or synchronous transformation. For example,
|
|
// a zlib stream might take multiple plain-text writes(), and then
|
|
// emit a single compressed chunk some time in the future.
|
|
//
|
|
// Here's how this works:
|
|
//
|
|
// The Transform stream has all the aspects of the readable and writable
|
|
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
|
// internally, and returns false if there's a lot of pending writes
|
|
// buffered up. When you call read(), that calls _read(n) until
|
|
// there's enough pending readable data buffered up.
|
|
//
|
|
// In a transform stream, the written data is placed in a buffer. When
|
|
// _read(n) is called, it transforms the queued up data, calling the
|
|
// buffered _write cb's as it consumes chunks. If consuming a single
|
|
// written chunk would result in multiple output chunks, then the first
|
|
// outputted bit calls the readcb, and subsequent chunks just go into
|
|
// the read buffer, and will cause it to emit 'readable' if necessary.
|
|
//
|
|
// This way, back-pressure is actually determined by the reading side,
|
|
// since _read has to be called to start processing a new chunk. However,
|
|
// a pathological inflate type of transform can cause excessive buffering
|
|
// here. For example, imagine a stream where every byte of input is
|
|
// interpreted as an integer from 0-255, and then results in that many
|
|
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
|
// 1kb of data being output. In this case, you could write a very small
|
|
// amount of input, and end up with a very large amount of output. In
|
|
// such a pathological inflating mechanism, there'd be no way to tell
|
|
// the system to stop doing the transform. A single 4MB write could
|
|
// cause the system to run out of memory.
|
|
//
|
|
// However, even in such a pathological case, only a single written chunk
|
|
// would be consumed, and then the rest would wait (un-transformed) until
|
|
// the results of the previous transformed chunk were consumed.
|
|
|
|
|
|
|
|
module.exports = Transform;
|
|
var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
|
|
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
|
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
|
ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
|
|
ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
|
var Duplex = __nccwpck_require__(1359);
|
|
__nccwpck_require__(4124)(Transform, Duplex);
|
|
function afterTransform(er, data) {
|
|
var ts = this._transformState;
|
|
ts.transforming = false;
|
|
var cb = ts.writecb;
|
|
if (cb === null) {
|
|
return this.emit('error', new ERR_MULTIPLE_CALLBACK());
|
|
}
|
|
ts.writechunk = null;
|
|
ts.writecb = null;
|
|
if (data != null)
|
|
// single equals check for both `null` and `undefined`
|
|
this.push(data);
|
|
cb(er);
|
|
var rs = this._readableState;
|
|
rs.reading = false;
|
|
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
|
this._read(rs.highWaterMark);
|
|
}
|
|
}
|
|
function Transform(options) {
|
|
if (!(this instanceof Transform)) return new Transform(options);
|
|
Duplex.call(this, options);
|
|
this._transformState = {
|
|
afterTransform: afterTransform.bind(this),
|
|
needTransform: false,
|
|
transforming: false,
|
|
writecb: null,
|
|
writechunk: null,
|
|
writeencoding: null
|
|
};
|
|
|
|
// start out asking for a readable event once data is transformed.
|
|
this._readableState.needReadable = true;
|
|
|
|
// we have implemented the _read method, and done the other things
|
|
// that Readable wants before the first _read call, so unset the
|
|
// sync guard flag.
|
|
this._readableState.sync = false;
|
|
if (options) {
|
|
if (typeof options.transform === 'function') this._transform = options.transform;
|
|
if (typeof options.flush === 'function') this._flush = options.flush;
|
|
}
|
|
|
|
// When the writable side finishes, then flush out anything remaining.
|
|
this.on('prefinish', prefinish);
|
|
}
|
|
function prefinish() {
|
|
var _this = this;
|
|
if (typeof this._flush === 'function' && !this._readableState.destroyed) {
|
|
this._flush(function (er, data) {
|
|
done(_this, er, data);
|
|
});
|
|
} else {
|
|
done(this, null, null);
|
|
}
|
|
}
|
|
Transform.prototype.push = function (chunk, encoding) {
|
|
this._transformState.needTransform = false;
|
|
return Duplex.prototype.push.call(this, chunk, encoding);
|
|
};
|
|
|
|
// This is the part where you do stuff!
|
|
// override this function in implementation classes.
|
|
// 'chunk' is an input chunk.
|
|
//
|
|
// Call `push(newChunk)` to pass along transformed output
|
|
// to the readable side. You may call 'push' zero or more times.
|
|
//
|
|
// Call `cb(err)` when you are done with this chunk. If you pass
|
|
// an error, then that'll put the hurt on the whole operation. If you
|
|
// never call cb(), then you'll never get another chunk.
|
|
Transform.prototype._transform = function (chunk, encoding, cb) {
|
|
cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
|
|
};
|
|
Transform.prototype._write = function (chunk, encoding, cb) {
|
|
var ts = this._transformState;
|
|
ts.writecb = cb;
|
|
ts.writechunk = chunk;
|
|
ts.writeencoding = encoding;
|
|
if (!ts.transforming) {
|
|
var rs = this._readableState;
|
|
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
|
}
|
|
};
|
|
|
|
// Doesn't matter what the args are here.
|
|
// _transform does all the work.
|
|
// That we got here means that the readable side wants more data.
|
|
Transform.prototype._read = function (n) {
|
|
var ts = this._transformState;
|
|
if (ts.writechunk !== null && !ts.transforming) {
|
|
ts.transforming = true;
|
|
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
|
} else {
|
|
// mark that we need a transform, so that any data that comes in
|
|
// will get processed, now that we've asked for it.
|
|
ts.needTransform = true;
|
|
}
|
|
};
|
|
Transform.prototype._destroy = function (err, cb) {
|
|
Duplex.prototype._destroy.call(this, err, function (err2) {
|
|
cb(err2);
|
|
});
|
|
};
|
|
function done(stream, er, data) {
|
|
if (er) return stream.emit('error', er);
|
|
if (data != null)
|
|
// single equals check for both `null` and `undefined`
|
|
stream.push(data);
|
|
|
|
// TODO(BridgeAR): Write a test for these two error cases
|
|
// if there's nothing in the write buffer, then that means
|
|
// that nothing more will ever be provided
|
|
if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
|
|
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
|
return stream.push(null);
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2094:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
// A bit simpler than readable streams.
|
|
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
|
|
// the drain event emission and buffering.
|
|
|
|
|
|
|
|
module.exports = Writable;
|
|
|
|
/* <replacement> */
|
|
function WriteReq(chunk, encoding, cb) {
|
|
this.chunk = chunk;
|
|
this.encoding = encoding;
|
|
this.callback = cb;
|
|
this.next = null;
|
|
}
|
|
|
|
// It seems a linked list but it is not
|
|
// there will be only 2 of these for each stream
|
|
function CorkedRequest(state) {
|
|
var _this = this;
|
|
this.next = null;
|
|
this.entry = null;
|
|
this.finish = function () {
|
|
onCorkedFinish(_this, state);
|
|
};
|
|
}
|
|
/* </replacement> */
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Writable.WritableState = WritableState;
|
|
|
|
/*<replacement>*/
|
|
var internalUtil = {
|
|
deprecate: __nccwpck_require__(7127)
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream = __nccwpck_require__(2387);
|
|
/*</replacement>*/
|
|
|
|
var Buffer = (__nccwpck_require__(4300).Buffer);
|
|
var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
|
|
function _uint8ArrayToBuffer(chunk) {
|
|
return Buffer.from(chunk);
|
|
}
|
|
function _isUint8Array(obj) {
|
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
}
|
|
var destroyImpl = __nccwpck_require__(7049);
|
|
var _require = __nccwpck_require__(9948),
|
|
getHighWaterMark = _require.getHighWaterMark;
|
|
var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
|
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
|
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
|
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
|
ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
|
|
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
|
|
ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
|
|
ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
|
|
ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
__nccwpck_require__(4124)(Writable, Stream);
|
|
function nop() {}
|
|
function WritableState(options, stream, isDuplex) {
|
|
Duplex = Duplex || __nccwpck_require__(1359);
|
|
options = options || {};
|
|
|
|
// Duplex streams are both readable and writable, but share
|
|
// the same options object.
|
|
// However, some cases require setting options to different
|
|
// values for the readable and the writable sides of the duplex stream,
|
|
// e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
|
|
if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
|
|
|
|
// object stream flag to indicate whether or not this stream
|
|
// contains buffers or objects.
|
|
this.objectMode = !!options.objectMode;
|
|
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
|
|
|
// the point at which write() starts returning false
|
|
// Note: 0 is a valid value, means that we always return false if
|
|
// the entire buffer is not flushed immediately on write()
|
|
this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
|
|
|
|
// if _final has been called
|
|
this.finalCalled = false;
|
|
|
|
// drain event flag.
|
|
this.needDrain = false;
|
|
// at the start of calling end()
|
|
this.ending = false;
|
|
// when end() has been called, and returned
|
|
this.ended = false;
|
|
// when 'finish' is emitted
|
|
this.finished = false;
|
|
|
|
// has it been destroyed
|
|
this.destroyed = false;
|
|
|
|
// should we decode strings into buffers before passing to _write?
|
|
// this is here so that some node-core streams can optimize string
|
|
// handling at a lower level.
|
|
var noDecode = options.decodeStrings === false;
|
|
this.decodeStrings = !noDecode;
|
|
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
|
|
|
// not an actual buffer we keep track of, but a measurement
|
|
// of how much we're waiting to get pushed to some underlying
|
|
// socket or file.
|
|
this.length = 0;
|
|
|
|
// a flag to see when we're in the middle of a write.
|
|
this.writing = false;
|
|
|
|
// when true all writes will be buffered until .uncork() call
|
|
this.corked = 0;
|
|
|
|
// a flag to be able to tell if the onwrite cb is called immediately,
|
|
// or on a later tick. We set this to true at first, because any
|
|
// actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first write call.
|
|
this.sync = true;
|
|
|
|
// a flag to know if we're processing previously buffered items, which
|
|
// may call the _write() callback in the same tick, so that we don't
|
|
// end up in an overlapped onwrite situation.
|
|
this.bufferProcessing = false;
|
|
|
|
// the callback that's passed to _write(chunk,cb)
|
|
this.onwrite = function (er) {
|
|
onwrite(stream, er);
|
|
};
|
|
|
|
// the callback that the user supplies to write(chunk,encoding,cb)
|
|
this.writecb = null;
|
|
|
|
// the amount that is being written when _write is called.
|
|
this.writelen = 0;
|
|
this.bufferedRequest = null;
|
|
this.lastBufferedRequest = null;
|
|
|
|
// number of pending user-supplied write callbacks
|
|
// this must be 0 before 'finish' can be emitted
|
|
this.pendingcb = 0;
|
|
|
|
// emit prefinish if the only thing we're waiting for is _write cbs
|
|
// This is relevant for synchronous Transform streams
|
|
this.prefinished = false;
|
|
|
|
// True if the error was already emitted and should not be thrown again
|
|
this.errorEmitted = false;
|
|
|
|
// Should close be emitted on destroy. Defaults to true.
|
|
this.emitClose = options.emitClose !== false;
|
|
|
|
// Should .destroy() be called after 'finish' (and potentially 'end')
|
|
this.autoDestroy = !!options.autoDestroy;
|
|
|
|
// count buffered requests
|
|
this.bufferedRequestCount = 0;
|
|
|
|
// allocate the first CorkedRequest, there is always
|
|
// one allocated and free to use, and we maintain at most two
|
|
this.corkedRequestsFree = new CorkedRequest(this);
|
|
}
|
|
WritableState.prototype.getBuffer = function getBuffer() {
|
|
var current = this.bufferedRequest;
|
|
var out = [];
|
|
while (current) {
|
|
out.push(current);
|
|
current = current.next;
|
|
}
|
|
return out;
|
|
};
|
|
(function () {
|
|
try {
|
|
Object.defineProperty(WritableState.prototype, 'buffer', {
|
|
get: internalUtil.deprecate(function writableStateBufferGetter() {
|
|
return this.getBuffer();
|
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
|
});
|
|
} catch (_) {}
|
|
})();
|
|
|
|
// Test _writableState for inheritance to account for Duplex streams,
|
|
// whose prototype chain only points to Readable.
|
|
var realHasInstance;
|
|
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
|
realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
Object.defineProperty(Writable, Symbol.hasInstance, {
|
|
value: function value(object) {
|
|
if (realHasInstance.call(this, object)) return true;
|
|
if (this !== Writable) return false;
|
|
return object && object._writableState instanceof WritableState;
|
|
}
|
|
});
|
|
} else {
|
|
realHasInstance = function realHasInstance(object) {
|
|
return object instanceof this;
|
|
};
|
|
}
|
|
function Writable(options) {
|
|
Duplex = Duplex || __nccwpck_require__(1359);
|
|
|
|
// Writable ctor is applied to Duplexes, too.
|
|
// `realHasInstance` is necessary because using plain `instanceof`
|
|
// would return false, as no `_writableState` property is attached.
|
|
|
|
// Trying to use the custom `instanceof` for Writable here will also break the
|
|
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
|
// `_writableState` that would lead to infinite recursion.
|
|
|
|
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
// the WritableState constructor, at least with V8 6.5
|
|
var isDuplex = this instanceof Duplex;
|
|
if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
|
|
this._writableState = new WritableState(options, this, isDuplex);
|
|
|
|
// legacy.
|
|
this.writable = true;
|
|
if (options) {
|
|
if (typeof options.write === 'function') this._write = options.write;
|
|
if (typeof options.writev === 'function') this._writev = options.writev;
|
|
if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
|
if (typeof options.final === 'function') this._final = options.final;
|
|
}
|
|
Stream.call(this);
|
|
}
|
|
|
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
|
Writable.prototype.pipe = function () {
|
|
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
|
|
};
|
|
function writeAfterEnd(stream, cb) {
|
|
var er = new ERR_STREAM_WRITE_AFTER_END();
|
|
// TODO: defer error events consistently everywhere, not just the cb
|
|
errorOrDestroy(stream, er);
|
|
process.nextTick(cb, er);
|
|
}
|
|
|
|
// Checks that a user-supplied chunk is valid, especially for the particular
|
|
// mode the stream is in. Currently this means that `null` is never accepted
|
|
// and undefined/non-string values are only allowed in object mode.
|
|
function validChunk(stream, state, chunk, cb) {
|
|
var er;
|
|
if (chunk === null) {
|
|
er = new ERR_STREAM_NULL_VALUES();
|
|
} else if (typeof chunk !== 'string' && !state.objectMode) {
|
|
er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
|
|
}
|
|
if (er) {
|
|
errorOrDestroy(stream, er);
|
|
process.nextTick(cb, er);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
Writable.prototype.write = function (chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
var ret = false;
|
|
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
if (isBuf && !Buffer.isBuffer(chunk)) {
|
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
}
|
|
if (typeof encoding === 'function') {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
|
if (typeof cb !== 'function') cb = nop;
|
|
if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
|
state.pendingcb++;
|
|
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
|
}
|
|
return ret;
|
|
};
|
|
Writable.prototype.cork = function () {
|
|
this._writableState.corked++;
|
|
};
|
|
Writable.prototype.uncork = function () {
|
|
var state = this._writableState;
|
|
if (state.corked) {
|
|
state.corked--;
|
|
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
}
|
|
};
|
|
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
// node::ParseEncoding() requires lower case.
|
|
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
|
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
|
|
this._writableState.defaultEncoding = encoding;
|
|
return this;
|
|
};
|
|
Object.defineProperty(Writable.prototype, 'writableBuffer', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState && this._writableState.getBuffer();
|
|
}
|
|
});
|
|
function decodeChunk(state, chunk, encoding) {
|
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
|
chunk = Buffer.from(chunk, encoding);
|
|
}
|
|
return chunk;
|
|
}
|
|
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.highWaterMark;
|
|
}
|
|
});
|
|
|
|
// if we're already writing something, then just put this
|
|
// in the queue, and wait our turn. Otherwise, call _write
|
|
// If we return false, then we need a drain event, so set that flag.
|
|
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
|
if (!isBuf) {
|
|
var newChunk = decodeChunk(state, chunk, encoding);
|
|
if (chunk !== newChunk) {
|
|
isBuf = true;
|
|
encoding = 'buffer';
|
|
chunk = newChunk;
|
|
}
|
|
}
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
state.length += len;
|
|
var ret = state.length < state.highWaterMark;
|
|
// we must ensure that previous needDrain will not be reset to false.
|
|
if (!ret) state.needDrain = true;
|
|
if (state.writing || state.corked) {
|
|
var last = state.lastBufferedRequest;
|
|
state.lastBufferedRequest = {
|
|
chunk: chunk,
|
|
encoding: encoding,
|
|
isBuf: isBuf,
|
|
callback: cb,
|
|
next: null
|
|
};
|
|
if (last) {
|
|
last.next = state.lastBufferedRequest;
|
|
} else {
|
|
state.bufferedRequest = state.lastBufferedRequest;
|
|
}
|
|
state.bufferedRequestCount += 1;
|
|
} else {
|
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
}
|
|
return ret;
|
|
}
|
|
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
|
state.writelen = len;
|
|
state.writecb = cb;
|
|
state.writing = true;
|
|
state.sync = true;
|
|
if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
|
state.sync = false;
|
|
}
|
|
function onwriteError(stream, state, sync, er, cb) {
|
|
--state.pendingcb;
|
|
if (sync) {
|
|
// defer the callback if we are being called synchronously
|
|
// to avoid piling up things on the stack
|
|
process.nextTick(cb, er);
|
|
// this can emit finish, and it will always happen
|
|
// after error
|
|
process.nextTick(finishMaybe, stream, state);
|
|
stream._writableState.errorEmitted = true;
|
|
errorOrDestroy(stream, er);
|
|
} else {
|
|
// the caller expect this to happen before if
|
|
// it is async
|
|
cb(er);
|
|
stream._writableState.errorEmitted = true;
|
|
errorOrDestroy(stream, er);
|
|
// this can emit finish, but finish must
|
|
// always follow error
|
|
finishMaybe(stream, state);
|
|
}
|
|
}
|
|
function onwriteStateUpdate(state) {
|
|
state.writing = false;
|
|
state.writecb = null;
|
|
state.length -= state.writelen;
|
|
state.writelen = 0;
|
|
}
|
|
function onwrite(stream, er) {
|
|
var state = stream._writableState;
|
|
var sync = state.sync;
|
|
var cb = state.writecb;
|
|
if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
|
|
onwriteStateUpdate(state);
|
|
if (er) onwriteError(stream, state, sync, er, cb);else {
|
|
// Check if we're actually ready to finish, but don't emit yet
|
|
var finished = needFinish(state) || stream.destroyed;
|
|
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
|
clearBuffer(stream, state);
|
|
}
|
|
if (sync) {
|
|
process.nextTick(afterWrite, stream, state, finished, cb);
|
|
} else {
|
|
afterWrite(stream, state, finished, cb);
|
|
}
|
|
}
|
|
}
|
|
function afterWrite(stream, state, finished, cb) {
|
|
if (!finished) onwriteDrain(stream, state);
|
|
state.pendingcb--;
|
|
cb();
|
|
finishMaybe(stream, state);
|
|
}
|
|
|
|
// Must force callback to be called on nextTick, so that we don't
|
|
// emit 'drain' before the write() consumer gets the 'false' return
|
|
// value, and has a chance to attach a 'drain' listener.
|
|
function onwriteDrain(stream, state) {
|
|
if (state.length === 0 && state.needDrain) {
|
|
state.needDrain = false;
|
|
stream.emit('drain');
|
|
}
|
|
}
|
|
|
|
// if there's something in the buffer waiting, then process it
|
|
function clearBuffer(stream, state) {
|
|
state.bufferProcessing = true;
|
|
var entry = state.bufferedRequest;
|
|
if (stream._writev && entry && entry.next) {
|
|
// Fast case, write everything using _writev()
|
|
var l = state.bufferedRequestCount;
|
|
var buffer = new Array(l);
|
|
var holder = state.corkedRequestsFree;
|
|
holder.entry = entry;
|
|
var count = 0;
|
|
var allBuffers = true;
|
|
while (entry) {
|
|
buffer[count] = entry;
|
|
if (!entry.isBuf) allBuffers = false;
|
|
entry = entry.next;
|
|
count += 1;
|
|
}
|
|
buffer.allBuffers = allBuffers;
|
|
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
|
|
|
// doWrite is almost always async, defer these to save a bit of time
|
|
// as the hot path ends with doWrite
|
|
state.pendingcb++;
|
|
state.lastBufferedRequest = null;
|
|
if (holder.next) {
|
|
state.corkedRequestsFree = holder.next;
|
|
holder.next = null;
|
|
} else {
|
|
state.corkedRequestsFree = new CorkedRequest(state);
|
|
}
|
|
state.bufferedRequestCount = 0;
|
|
} else {
|
|
// Slow case, write chunks one-by-one
|
|
while (entry) {
|
|
var chunk = entry.chunk;
|
|
var encoding = entry.encoding;
|
|
var cb = entry.callback;
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
entry = entry.next;
|
|
state.bufferedRequestCount--;
|
|
// if we didn't call the onwrite immediately, then
|
|
// it means that we need to wait until it does.
|
|
// also, that means that the chunk and cb are currently
|
|
// being processed, so move the buffer counter past them.
|
|
if (state.writing) {
|
|
break;
|
|
}
|
|
}
|
|
if (entry === null) state.lastBufferedRequest = null;
|
|
}
|
|
state.bufferedRequest = entry;
|
|
state.bufferProcessing = false;
|
|
}
|
|
Writable.prototype._write = function (chunk, encoding, cb) {
|
|
cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
|
|
};
|
|
Writable.prototype._writev = null;
|
|
Writable.prototype.end = function (chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
if (typeof chunk === 'function') {
|
|
cb = chunk;
|
|
chunk = null;
|
|
encoding = null;
|
|
} else if (typeof encoding === 'function') {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
|
|
|
// .end() fully uncorks
|
|
if (state.corked) {
|
|
state.corked = 1;
|
|
this.uncork();
|
|
}
|
|
|
|
// ignore unnecessary end() calls.
|
|
if (!state.ending) endWritable(this, state, cb);
|
|
return this;
|
|
};
|
|
Object.defineProperty(Writable.prototype, 'writableLength', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
return this._writableState.length;
|
|
}
|
|
});
|
|
function needFinish(state) {
|
|
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
|
}
|
|
function callFinal(stream, state) {
|
|
stream._final(function (err) {
|
|
state.pendingcb--;
|
|
if (err) {
|
|
errorOrDestroy(stream, err);
|
|
}
|
|
state.prefinished = true;
|
|
stream.emit('prefinish');
|
|
finishMaybe(stream, state);
|
|
});
|
|
}
|
|
function prefinish(stream, state) {
|
|
if (!state.prefinished && !state.finalCalled) {
|
|
if (typeof stream._final === 'function' && !state.destroyed) {
|
|
state.pendingcb++;
|
|
state.finalCalled = true;
|
|
process.nextTick(callFinal, stream, state);
|
|
} else {
|
|
state.prefinished = true;
|
|
stream.emit('prefinish');
|
|
}
|
|
}
|
|
}
|
|
function finishMaybe(stream, state) {
|
|
var need = needFinish(state);
|
|
if (need) {
|
|
prefinish(stream, state);
|
|
if (state.pendingcb === 0) {
|
|
state.finished = true;
|
|
stream.emit('finish');
|
|
if (state.autoDestroy) {
|
|
// In case of duplex streams we need a way to detect
|
|
// if the readable side is ready for autoDestroy as well
|
|
var rState = stream._readableState;
|
|
if (!rState || rState.autoDestroy && rState.endEmitted) {
|
|
stream.destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return need;
|
|
}
|
|
function endWritable(stream, state, cb) {
|
|
state.ending = true;
|
|
finishMaybe(stream, state);
|
|
if (cb) {
|
|
if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
|
|
}
|
|
state.ended = true;
|
|
stream.writable = false;
|
|
}
|
|
function onCorkedFinish(corkReq, state, err) {
|
|
var entry = corkReq.entry;
|
|
corkReq.entry = null;
|
|
while (entry) {
|
|
var cb = entry.callback;
|
|
state.pendingcb--;
|
|
cb(err);
|
|
entry = entry.next;
|
|
}
|
|
|
|
// reuse the free corkReq.
|
|
state.corkedRequestsFree.next = corkReq;
|
|
}
|
|
Object.defineProperty(Writable.prototype, 'destroyed', {
|
|
// making it explicit this property is not enumerable
|
|
// because otherwise some prototype manipulation in
|
|
// userland will fail
|
|
enumerable: false,
|
|
get: function get() {
|
|
if (this._writableState === undefined) {
|
|
return false;
|
|
}
|
|
return this._writableState.destroyed;
|
|
},
|
|
set: function set(value) {
|
|
// we ignore the value if the stream
|
|
// has not been initialized yet
|
|
if (!this._writableState) {
|
|
return;
|
|
}
|
|
|
|
// backward compatibility, the user is explicitly
|
|
// managing destroyed
|
|
this._writableState.destroyed = value;
|
|
}
|
|
});
|
|
Writable.prototype.destroy = destroyImpl.destroy;
|
|
Writable.prototype._undestroy = destroyImpl.undestroy;
|
|
Writable.prototype._destroy = function (err, cb) {
|
|
cb(err);
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3306:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
var _Object$setPrototypeO;
|
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
var finished = __nccwpck_require__(6080);
|
|
var kLastResolve = Symbol('lastResolve');
|
|
var kLastReject = Symbol('lastReject');
|
|
var kError = Symbol('error');
|
|
var kEnded = Symbol('ended');
|
|
var kLastPromise = Symbol('lastPromise');
|
|
var kHandlePromise = Symbol('handlePromise');
|
|
var kStream = Symbol('stream');
|
|
function createIterResult(value, done) {
|
|
return {
|
|
value: value,
|
|
done: done
|
|
};
|
|
}
|
|
function readAndResolve(iter) {
|
|
var resolve = iter[kLastResolve];
|
|
if (resolve !== null) {
|
|
var data = iter[kStream].read();
|
|
// we defer if data is null
|
|
// we can be expecting either 'end' or
|
|
// 'error'
|
|
if (data !== null) {
|
|
iter[kLastPromise] = null;
|
|
iter[kLastResolve] = null;
|
|
iter[kLastReject] = null;
|
|
resolve(createIterResult(data, false));
|
|
}
|
|
}
|
|
}
|
|
function onReadable(iter) {
|
|
// we wait for the next tick, because it might
|
|
// emit an error with process.nextTick
|
|
process.nextTick(readAndResolve, iter);
|
|
}
|
|
function wrapForNext(lastPromise, iter) {
|
|
return function (resolve, reject) {
|
|
lastPromise.then(function () {
|
|
if (iter[kEnded]) {
|
|
resolve(createIterResult(undefined, true));
|
|
return;
|
|
}
|
|
iter[kHandlePromise](resolve, reject);
|
|
}, reject);
|
|
};
|
|
}
|
|
var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
|
|
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
|
|
get stream() {
|
|
return this[kStream];
|
|
},
|
|
next: function next() {
|
|
var _this = this;
|
|
// if we have detected an error in the meanwhile
|
|
// reject straight away
|
|
var error = this[kError];
|
|
if (error !== null) {
|
|
return Promise.reject(error);
|
|
}
|
|
if (this[kEnded]) {
|
|
return Promise.resolve(createIterResult(undefined, true));
|
|
}
|
|
if (this[kStream].destroyed) {
|
|
// We need to defer via nextTick because if .destroy(err) is
|
|
// called, the error will be emitted via nextTick, and
|
|
// we cannot guarantee that there is no error lingering around
|
|
// waiting to be emitted.
|
|
return new Promise(function (resolve, reject) {
|
|
process.nextTick(function () {
|
|
if (_this[kError]) {
|
|
reject(_this[kError]);
|
|
} else {
|
|
resolve(createIterResult(undefined, true));
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// if we have multiple next() calls
|
|
// we will wait for the previous Promise to finish
|
|
// this logic is optimized to support for await loops,
|
|
// where next() is only called once at a time
|
|
var lastPromise = this[kLastPromise];
|
|
var promise;
|
|
if (lastPromise) {
|
|
promise = new Promise(wrapForNext(lastPromise, this));
|
|
} else {
|
|
// fast path needed to support multiple this.push()
|
|
// without triggering the next() queue
|
|
var data = this[kStream].read();
|
|
if (data !== null) {
|
|
return Promise.resolve(createIterResult(data, false));
|
|
}
|
|
promise = new Promise(this[kHandlePromise]);
|
|
}
|
|
this[kLastPromise] = promise;
|
|
return promise;
|
|
}
|
|
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
|
|
return this;
|
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
var _this2 = this;
|
|
// destroy(err, cb) is a private API
|
|
// we can guarantee we have that here, because we control the
|
|
// Readable class this is attached to
|
|
return new Promise(function (resolve, reject) {
|
|
_this2[kStream].destroy(null, function (err) {
|
|
if (err) {
|
|
reject(err);
|
|
return;
|
|
}
|
|
resolve(createIterResult(undefined, true));
|
|
});
|
|
});
|
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
|
var _Object$create;
|
|
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
|
|
value: stream,
|
|
writable: true
|
|
}), _defineProperty(_Object$create, kLastResolve, {
|
|
value: null,
|
|
writable: true
|
|
}), _defineProperty(_Object$create, kLastReject, {
|
|
value: null,
|
|
writable: true
|
|
}), _defineProperty(_Object$create, kError, {
|
|
value: null,
|
|
writable: true
|
|
}), _defineProperty(_Object$create, kEnded, {
|
|
value: stream._readableState.endEmitted,
|
|
writable: true
|
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
value: function value(resolve, reject) {
|
|
var data = iterator[kStream].read();
|
|
if (data) {
|
|
iterator[kLastPromise] = null;
|
|
iterator[kLastResolve] = null;
|
|
iterator[kLastReject] = null;
|
|
resolve(createIterResult(data, false));
|
|
} else {
|
|
iterator[kLastResolve] = resolve;
|
|
iterator[kLastReject] = reject;
|
|
}
|
|
},
|
|
writable: true
|
|
}), _Object$create));
|
|
iterator[kLastPromise] = null;
|
|
finished(stream, function (err) {
|
|
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
|
|
var reject = iterator[kLastReject];
|
|
// reject if we are waiting for data in the Promise
|
|
// returned by next() and store the error
|
|
if (reject !== null) {
|
|
iterator[kLastPromise] = null;
|
|
iterator[kLastResolve] = null;
|
|
iterator[kLastReject] = null;
|
|
reject(err);
|
|
}
|
|
iterator[kError] = err;
|
|
return;
|
|
}
|
|
var resolve = iterator[kLastResolve];
|
|
if (resolve !== null) {
|
|
iterator[kLastPromise] = null;
|
|
iterator[kLastResolve] = null;
|
|
iterator[kLastReject] = null;
|
|
resolve(createIterResult(undefined, true));
|
|
}
|
|
iterator[kEnded] = true;
|
|
});
|
|
stream.on('readable', onReadable.bind(null, iterator));
|
|
return iterator;
|
|
};
|
|
module.exports = createReadableStreamAsyncIterator;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2746:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
var _require = __nccwpck_require__(4300),
|
|
Buffer = _require.Buffer;
|
|
var _require2 = __nccwpck_require__(3837),
|
|
inspect = _require2.inspect;
|
|
var custom = inspect && inspect.custom || 'inspect';
|
|
function copyBuffer(src, target, offset) {
|
|
Buffer.prototype.copy.call(src, target, offset);
|
|
}
|
|
module.exports = /*#__PURE__*/function () {
|
|
function BufferList() {
|
|
_classCallCheck(this, BufferList);
|
|
this.head = null;
|
|
this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
_createClass(BufferList, [{
|
|
key: "push",
|
|
value: function push(v) {
|
|
var entry = {
|
|
data: v,
|
|
next: null
|
|
};
|
|
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
|
this.tail = entry;
|
|
++this.length;
|
|
}
|
|
}, {
|
|
key: "unshift",
|
|
value: function unshift(v) {
|
|
var entry = {
|
|
data: v,
|
|
next: this.head
|
|
};
|
|
if (this.length === 0) this.tail = entry;
|
|
this.head = entry;
|
|
++this.length;
|
|
}
|
|
}, {
|
|
key: "shift",
|
|
value: function shift() {
|
|
if (this.length === 0) return;
|
|
var ret = this.head.data;
|
|
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
|
--this.length;
|
|
return ret;
|
|
}
|
|
}, {
|
|
key: "clear",
|
|
value: function clear() {
|
|
this.head = this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
}, {
|
|
key: "join",
|
|
value: function join(s) {
|
|
if (this.length === 0) return '';
|
|
var p = this.head;
|
|
var ret = '' + p.data;
|
|
while (p = p.next) ret += s + p.data;
|
|
return ret;
|
|
}
|
|
}, {
|
|
key: "concat",
|
|
value: function concat(n) {
|
|
if (this.length === 0) return Buffer.alloc(0);
|
|
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
var p = this.head;
|
|
var i = 0;
|
|
while (p) {
|
|
copyBuffer(p.data, ret, i);
|
|
i += p.data.length;
|
|
p = p.next;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
// Consumes a specified amount of bytes or characters from the buffered data.
|
|
}, {
|
|
key: "consume",
|
|
value: function consume(n, hasStrings) {
|
|
var ret;
|
|
if (n < this.head.data.length) {
|
|
// `slice` is the same for buffers and strings.
|
|
ret = this.head.data.slice(0, n);
|
|
this.head.data = this.head.data.slice(n);
|
|
} else if (n === this.head.data.length) {
|
|
// First chunk is a perfect match.
|
|
ret = this.shift();
|
|
} else {
|
|
// Result spans more than one buffer.
|
|
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
|
|
}
|
|
return ret;
|
|
}
|
|
}, {
|
|
key: "first",
|
|
value: function first() {
|
|
return this.head.data;
|
|
}
|
|
|
|
// Consumes a specified amount of characters from the buffered data.
|
|
}, {
|
|
key: "_getString",
|
|
value: function _getString(n) {
|
|
var p = this.head;
|
|
var c = 1;
|
|
var ret = p.data;
|
|
n -= ret.length;
|
|
while (p = p.next) {
|
|
var str = p.data;
|
|
var nb = n > str.length ? str.length : n;
|
|
if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === str.length) {
|
|
++c;
|
|
if (p.next) this.head = p.next;else this.head = this.tail = null;
|
|
} else {
|
|
this.head = p;
|
|
p.data = str.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
this.length -= c;
|
|
return ret;
|
|
}
|
|
|
|
// Consumes a specified amount of bytes from the buffered data.
|
|
}, {
|
|
key: "_getBuffer",
|
|
value: function _getBuffer(n) {
|
|
var ret = Buffer.allocUnsafe(n);
|
|
var p = this.head;
|
|
var c = 1;
|
|
p.data.copy(ret);
|
|
n -= p.data.length;
|
|
while (p = p.next) {
|
|
var buf = p.data;
|
|
var nb = n > buf.length ? buf.length : n;
|
|
buf.copy(ret, ret.length - n, 0, nb);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === buf.length) {
|
|
++c;
|
|
if (p.next) this.head = p.next;else this.head = this.tail = null;
|
|
} else {
|
|
this.head = p;
|
|
p.data = buf.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
this.length -= c;
|
|
return ret;
|
|
}
|
|
|
|
// Make sure the linked list only shows the minimal necessary information.
|
|
}, {
|
|
key: custom,
|
|
value: function value(_, options) {
|
|
return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
|
|
// Only inspect one level.
|
|
depth: 0,
|
|
// It should not recurse.
|
|
customInspect: false
|
|
}));
|
|
}
|
|
}]);
|
|
return BufferList;
|
|
}();
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7049:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
// undocumented cb() API, needed for core, not for public API
|
|
function destroy(err, cb) {
|
|
var _this = this;
|
|
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
|
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
|
if (readableDestroyed || writableDestroyed) {
|
|
if (cb) {
|
|
cb(err);
|
|
} else if (err) {
|
|
if (!this._writableState) {
|
|
process.nextTick(emitErrorNT, this, err);
|
|
} else if (!this._writableState.errorEmitted) {
|
|
this._writableState.errorEmitted = true;
|
|
process.nextTick(emitErrorNT, this, err);
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// we set destroyed to true before firing error callbacks in order
|
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
|
|
if (this._readableState) {
|
|
this._readableState.destroyed = true;
|
|
}
|
|
|
|
// if this is a duplex stream mark the writable part as destroyed as well
|
|
if (this._writableState) {
|
|
this._writableState.destroyed = true;
|
|
}
|
|
this._destroy(err || null, function (err) {
|
|
if (!cb && err) {
|
|
if (!_this._writableState) {
|
|
process.nextTick(emitErrorAndCloseNT, _this, err);
|
|
} else if (!_this._writableState.errorEmitted) {
|
|
_this._writableState.errorEmitted = true;
|
|
process.nextTick(emitErrorAndCloseNT, _this, err);
|
|
} else {
|
|
process.nextTick(emitCloseNT, _this);
|
|
}
|
|
} else if (cb) {
|
|
process.nextTick(emitCloseNT, _this);
|
|
cb(err);
|
|
} else {
|
|
process.nextTick(emitCloseNT, _this);
|
|
}
|
|
});
|
|
return this;
|
|
}
|
|
function emitErrorAndCloseNT(self, err) {
|
|
emitErrorNT(self, err);
|
|
emitCloseNT(self);
|
|
}
|
|
function emitCloseNT(self) {
|
|
if (self._writableState && !self._writableState.emitClose) return;
|
|
if (self._readableState && !self._readableState.emitClose) return;
|
|
self.emit('close');
|
|
}
|
|
function undestroy() {
|
|
if (this._readableState) {
|
|
this._readableState.destroyed = false;
|
|
this._readableState.reading = false;
|
|
this._readableState.ended = false;
|
|
this._readableState.endEmitted = false;
|
|
}
|
|
if (this._writableState) {
|
|
this._writableState.destroyed = false;
|
|
this._writableState.ended = false;
|
|
this._writableState.ending = false;
|
|
this._writableState.finalCalled = false;
|
|
this._writableState.prefinished = false;
|
|
this._writableState.finished = false;
|
|
this._writableState.errorEmitted = false;
|
|
}
|
|
}
|
|
function emitErrorNT(self, err) {
|
|
self.emit('error', err);
|
|
}
|
|
function errorOrDestroy(stream, err) {
|
|
// We have tests that rely on errors being emitted
|
|
// in the same tick, so changing this is semver major.
|
|
// For now when you opt-in to autoDestroy we allow
|
|
// the error to be emitted nextTick. In a future
|
|
// semver major update we should change the default to this.
|
|
|
|
var rState = stream._readableState;
|
|
var wState = stream._writableState;
|
|
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
|
}
|
|
module.exports = {
|
|
destroy: destroy,
|
|
undestroy: undestroy,
|
|
errorOrDestroy: errorOrDestroy
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6080:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Ported from https://github.com/mafintosh/end-of-stream with
|
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
|
|
|
|
|
|
var ERR_STREAM_PREMATURE_CLOSE = (__nccwpck_require__(7214)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE);
|
|
function once(callback) {
|
|
var called = false;
|
|
return function () {
|
|
if (called) return;
|
|
called = true;
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
callback.apply(this, args);
|
|
};
|
|
}
|
|
function noop() {}
|
|
function isRequest(stream) {
|
|
return stream.setHeader && typeof stream.abort === 'function';
|
|
}
|
|
function eos(stream, opts, callback) {
|
|
if (typeof opts === 'function') return eos(stream, null, opts);
|
|
if (!opts) opts = {};
|
|
callback = once(callback || noop);
|
|
var readable = opts.readable || opts.readable !== false && stream.readable;
|
|
var writable = opts.writable || opts.writable !== false && stream.writable;
|
|
var onlegacyfinish = function onlegacyfinish() {
|
|
if (!stream.writable) onfinish();
|
|
};
|
|
var writableEnded = stream._writableState && stream._writableState.finished;
|
|
var onfinish = function onfinish() {
|
|
writable = false;
|
|
writableEnded = true;
|
|
if (!readable) callback.call(stream);
|
|
};
|
|
var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
|
var onend = function onend() {
|
|
readable = false;
|
|
readableEnded = true;
|
|
if (!writable) callback.call(stream);
|
|
};
|
|
var onerror = function onerror(err) {
|
|
callback.call(stream, err);
|
|
};
|
|
var onclose = function onclose() {
|
|
var err;
|
|
if (readable && !readableEnded) {
|
|
if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
|
return callback.call(stream, err);
|
|
}
|
|
if (writable && !writableEnded) {
|
|
if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
|
return callback.call(stream, err);
|
|
}
|
|
};
|
|
var onrequest = function onrequest() {
|
|
stream.req.on('finish', onfinish);
|
|
};
|
|
if (isRequest(stream)) {
|
|
stream.on('complete', onfinish);
|
|
stream.on('abort', onclose);
|
|
if (stream.req) onrequest();else stream.on('request', onrequest);
|
|
} else if (writable && !stream._writableState) {
|
|
// legacy streams
|
|
stream.on('end', onlegacyfinish);
|
|
stream.on('close', onlegacyfinish);
|
|
}
|
|
stream.on('end', onend);
|
|
stream.on('finish', onfinish);
|
|
if (opts.error !== false) stream.on('error', onerror);
|
|
stream.on('close', onclose);
|
|
return function () {
|
|
stream.removeListener('complete', onfinish);
|
|
stream.removeListener('abort', onclose);
|
|
stream.removeListener('request', onrequest);
|
|
if (stream.req) stream.req.removeListener('finish', onfinish);
|
|
stream.removeListener('end', onlegacyfinish);
|
|
stream.removeListener('close', onlegacyfinish);
|
|
stream.removeListener('finish', onfinish);
|
|
stream.removeListener('end', onend);
|
|
stream.removeListener('error', onerror);
|
|
stream.removeListener('close', onclose);
|
|
};
|
|
}
|
|
module.exports = eos;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9082:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
var ERR_INVALID_ARG_TYPE = (__nccwpck_require__(7214)/* .codes.ERR_INVALID_ARG_TYPE */ .q.ERR_INVALID_ARG_TYPE);
|
|
function from(Readable, iterable, opts) {
|
|
var iterator;
|
|
if (iterable && typeof iterable.next === 'function') {
|
|
iterator = iterable;
|
|
} else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
|
|
var readable = new Readable(_objectSpread({
|
|
objectMode: true
|
|
}, opts));
|
|
// Reading boolean to protect against _read
|
|
// being called before last iteration completion.
|
|
var reading = false;
|
|
readable._read = function () {
|
|
if (!reading) {
|
|
reading = true;
|
|
next();
|
|
}
|
|
};
|
|
function next() {
|
|
return _next2.apply(this, arguments);
|
|
}
|
|
function _next2() {
|
|
_next2 = _asyncToGenerator(function* () {
|
|
try {
|
|
var _yield$iterator$next = yield iterator.next(),
|
|
value = _yield$iterator$next.value,
|
|
done = _yield$iterator$next.done;
|
|
if (done) {
|
|
readable.push(null);
|
|
} else if (readable.push(yield value)) {
|
|
next();
|
|
} else {
|
|
reading = false;
|
|
}
|
|
} catch (err) {
|
|
readable.destroy(err);
|
|
}
|
|
});
|
|
return _next2.apply(this, arguments);
|
|
}
|
|
return readable;
|
|
}
|
|
module.exports = from;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6989:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Ported from https://github.com/mafintosh/pump with
|
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
|
|
|
|
|
|
var eos;
|
|
function once(callback) {
|
|
var called = false;
|
|
return function () {
|
|
if (called) return;
|
|
called = true;
|
|
callback.apply(void 0, arguments);
|
|
};
|
|
}
|
|
var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
|
|
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
|
|
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
|
function noop(err) {
|
|
// Rethrow the error if it exists to avoid swallowing it
|
|
if (err) throw err;
|
|
}
|
|
function isRequest(stream) {
|
|
return stream.setHeader && typeof stream.abort === 'function';
|
|
}
|
|
function destroyer(stream, reading, writing, callback) {
|
|
callback = once(callback);
|
|
var closed = false;
|
|
stream.on('close', function () {
|
|
closed = true;
|
|
});
|
|
if (eos === undefined) eos = __nccwpck_require__(6080);
|
|
eos(stream, {
|
|
readable: reading,
|
|
writable: writing
|
|
}, function (err) {
|
|
if (err) return callback(err);
|
|
closed = true;
|
|
callback();
|
|
});
|
|
var destroyed = false;
|
|
return function (err) {
|
|
if (closed) return;
|
|
if (destroyed) return;
|
|
destroyed = true;
|
|
|
|
// request.destroy just do .end - .abort is what we want
|
|
if (isRequest(stream)) return stream.abort();
|
|
if (typeof stream.destroy === 'function') return stream.destroy();
|
|
callback(err || new ERR_STREAM_DESTROYED('pipe'));
|
|
};
|
|
}
|
|
function call(fn) {
|
|
fn();
|
|
}
|
|
function pipe(from, to) {
|
|
return from.pipe(to);
|
|
}
|
|
function popCallback(streams) {
|
|
if (!streams.length) return noop;
|
|
if (typeof streams[streams.length - 1] !== 'function') return noop;
|
|
return streams.pop();
|
|
}
|
|
function pipeline() {
|
|
for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
streams[_key] = arguments[_key];
|
|
}
|
|
var callback = popCallback(streams);
|
|
if (Array.isArray(streams[0])) streams = streams[0];
|
|
if (streams.length < 2) {
|
|
throw new ERR_MISSING_ARGS('streams');
|
|
}
|
|
var error;
|
|
var destroys = streams.map(function (stream, i) {
|
|
var reading = i < streams.length - 1;
|
|
var writing = i > 0;
|
|
return destroyer(stream, reading, writing, function (err) {
|
|
if (!error) error = err;
|
|
if (err) destroys.forEach(call);
|
|
if (reading) return;
|
|
destroys.forEach(call);
|
|
callback(error);
|
|
});
|
|
});
|
|
return streams.reduce(pipe);
|
|
}
|
|
module.exports = pipeline;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9948:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
var ERR_INVALID_OPT_VALUE = (__nccwpck_require__(7214)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE);
|
|
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
|
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
|
}
|
|
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
|
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
|
if (hwm != null) {
|
|
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
|
var name = isDuplex ? duplexKey : 'highWaterMark';
|
|
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
|
}
|
|
return Math.floor(hwm);
|
|
}
|
|
|
|
// Default value
|
|
return state.objectMode ? 16 : 16 * 1024;
|
|
}
|
|
module.exports = {
|
|
getHighWaterMark: getHighWaterMark
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2387:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
module.exports = __nccwpck_require__(2781);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1642:
|
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|
|
|
var Stream = __nccwpck_require__(2781);
|
|
if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
|
module.exports = Stream.Readable;
|
|
Object.assign(module.exports, Stream);
|
|
module.exports.Stream = Stream;
|
|
} else {
|
|
exports = module.exports = __nccwpck_require__(1433);
|
|
exports.Stream = Stream || exports;
|
|
exports.Readable = exports;
|
|
exports.Writable = __nccwpck_require__(2094);
|
|
exports.Duplex = __nccwpck_require__(1359);
|
|
exports.Transform = __nccwpck_require__(4415);
|
|
exports.PassThrough = __nccwpck_require__(1542);
|
|
exports.finished = __nccwpck_require__(6080);
|
|
exports.pipeline = __nccwpck_require__(6989);
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2043:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
;(function (sax) { // wrapper for non-node envs
|
|
sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
|
|
sax.SAXParser = SAXParser
|
|
sax.SAXStream = SAXStream
|
|
sax.createStream = createStream
|
|
|
|
// When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
|
|
// When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
|
|
// since that's the earliest that a buffer overrun could occur. This way, checks are
|
|
// as rare as required, but as often as necessary to ensure never crossing this bound.
|
|
// Furthermore, buffers are only tested at most once per write(), so passing a very
|
|
// large string into write() might have undesirable effects, but this is manageable by
|
|
// the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
|
|
// edge case, result in creating at most one complete copy of the string passed in.
|
|
// Set to Infinity to have unlimited buffers.
|
|
sax.MAX_BUFFER_LENGTH = 64 * 1024
|
|
|
|
var buffers = [
|
|
'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
|
|
'procInstName', 'procInstBody', 'entity', 'attribName',
|
|
'attribValue', 'cdata', 'script'
|
|
]
|
|
|
|
sax.EVENTS = [
|
|
'text',
|
|
'processinginstruction',
|
|
'sgmldeclaration',
|
|
'doctype',
|
|
'comment',
|
|
'opentagstart',
|
|
'attribute',
|
|
'opentag',
|
|
'closetag',
|
|
'opencdata',
|
|
'cdata',
|
|
'closecdata',
|
|
'error',
|
|
'end',
|
|
'ready',
|
|
'script',
|
|
'opennamespace',
|
|
'closenamespace'
|
|
]
|
|
|
|
function SAXParser (strict, opt) {
|
|
if (!(this instanceof SAXParser)) {
|
|
return new SAXParser(strict, opt)
|
|
}
|
|
|
|
var parser = this
|
|
clearBuffers(parser)
|
|
parser.q = parser.c = ''
|
|
parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
|
|
parser.opt = opt || {}
|
|
parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
|
|
parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
|
|
parser.tags = []
|
|
parser.closed = parser.closedRoot = parser.sawRoot = false
|
|
parser.tag = parser.error = null
|
|
parser.strict = !!strict
|
|
parser.noscript = !!(strict || parser.opt.noscript)
|
|
parser.state = S.BEGIN
|
|
parser.strictEntities = parser.opt.strictEntities
|
|
parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
|
|
parser.attribList = []
|
|
|
|
// namespaces form a prototype chain.
|
|
// it always points at the current tag,
|
|
// which protos to its parent tag.
|
|
if (parser.opt.xmlns) {
|
|
parser.ns = Object.create(rootNS)
|
|
}
|
|
|
|
// mostly just for error reporting
|
|
parser.trackPosition = parser.opt.position !== false
|
|
if (parser.trackPosition) {
|
|
parser.position = parser.line = parser.column = 0
|
|
}
|
|
emit(parser, 'onready')
|
|
}
|
|
|
|
if (!Object.create) {
|
|
Object.create = function (o) {
|
|
function F () {}
|
|
F.prototype = o
|
|
var newf = new F()
|
|
return newf
|
|
}
|
|
}
|
|
|
|
if (!Object.keys) {
|
|
Object.keys = function (o) {
|
|
var a = []
|
|
for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
|
|
return a
|
|
}
|
|
}
|
|
|
|
function checkBufferLength (parser) {
|
|
var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
|
|
var maxActual = 0
|
|
for (var i = 0, l = buffers.length; i < l; i++) {
|
|
var len = parser[buffers[i]].length
|
|
if (len > maxAllowed) {
|
|
// Text/cdata nodes can get big, and since they're buffered,
|
|
// we can get here under normal conditions.
|
|
// Avoid issues by emitting the text node now,
|
|
// so at least it won't get any bigger.
|
|
switch (buffers[i]) {
|
|
case 'textNode':
|
|
closeText(parser)
|
|
break
|
|
|
|
case 'cdata':
|
|
emitNode(parser, 'oncdata', parser.cdata)
|
|
parser.cdata = ''
|
|
break
|
|
|
|
case 'script':
|
|
emitNode(parser, 'onscript', parser.script)
|
|
parser.script = ''
|
|
break
|
|
|
|
default:
|
|
error(parser, 'Max buffer length exceeded: ' + buffers[i])
|
|
}
|
|
}
|
|
maxActual = Math.max(maxActual, len)
|
|
}
|
|
// schedule the next check for the earliest possible buffer overrun.
|
|
var m = sax.MAX_BUFFER_LENGTH - maxActual
|
|
parser.bufferCheckPosition = m + parser.position
|
|
}
|
|
|
|
function clearBuffers (parser) {
|
|
for (var i = 0, l = buffers.length; i < l; i++) {
|
|
parser[buffers[i]] = ''
|
|
}
|
|
}
|
|
|
|
function flushBuffers (parser) {
|
|
closeText(parser)
|
|
if (parser.cdata !== '') {
|
|
emitNode(parser, 'oncdata', parser.cdata)
|
|
parser.cdata = ''
|
|
}
|
|
if (parser.script !== '') {
|
|
emitNode(parser, 'onscript', parser.script)
|
|
parser.script = ''
|
|
}
|
|
}
|
|
|
|
SAXParser.prototype = {
|
|
end: function () { end(this) },
|
|
write: write,
|
|
resume: function () { this.error = null; return this },
|
|
close: function () { return this.write(null) },
|
|
flush: function () { flushBuffers(this) }
|
|
}
|
|
|
|
var Stream
|
|
try {
|
|
Stream = (__nccwpck_require__(2781).Stream)
|
|
} catch (ex) {
|
|
Stream = function () {}
|
|
}
|
|
|
|
var streamWraps = sax.EVENTS.filter(function (ev) {
|
|
return ev !== 'error' && ev !== 'end'
|
|
})
|
|
|
|
function createStream (strict, opt) {
|
|
return new SAXStream(strict, opt)
|
|
}
|
|
|
|
function SAXStream (strict, opt) {
|
|
if (!(this instanceof SAXStream)) {
|
|
return new SAXStream(strict, opt)
|
|
}
|
|
|
|
Stream.apply(this)
|
|
|
|
this._parser = new SAXParser(strict, opt)
|
|
this.writable = true
|
|
this.readable = true
|
|
|
|
var me = this
|
|
|
|
this._parser.onend = function () {
|
|
me.emit('end')
|
|
}
|
|
|
|
this._parser.onerror = function (er) {
|
|
me.emit('error', er)
|
|
|
|
// if didn't throw, then means error was handled.
|
|
// go ahead and clear error, so we can write again.
|
|
me._parser.error = null
|
|
}
|
|
|
|
this._decoder = null
|
|
|
|
streamWraps.forEach(function (ev) {
|
|
Object.defineProperty(me, 'on' + ev, {
|
|
get: function () {
|
|
return me._parser['on' + ev]
|
|
},
|
|
set: function (h) {
|
|
if (!h) {
|
|
me.removeAllListeners(ev)
|
|
me._parser['on' + ev] = h
|
|
return h
|
|
}
|
|
me.on(ev, h)
|
|
},
|
|
enumerable: true,
|
|
configurable: false
|
|
})
|
|
})
|
|
}
|
|
|
|
SAXStream.prototype = Object.create(Stream.prototype, {
|
|
constructor: {
|
|
value: SAXStream
|
|
}
|
|
})
|
|
|
|
SAXStream.prototype.write = function (data) {
|
|
if (typeof Buffer === 'function' &&
|
|
typeof Buffer.isBuffer === 'function' &&
|
|
Buffer.isBuffer(data)) {
|
|
if (!this._decoder) {
|
|
var SD = (__nccwpck_require__(1576).StringDecoder)
|
|
this._decoder = new SD('utf8')
|
|
}
|
|
data = this._decoder.write(data)
|
|
}
|
|
|
|
this._parser.write(data.toString())
|
|
this.emit('data', data)
|
|
return true
|
|
}
|
|
|
|
SAXStream.prototype.end = function (chunk) {
|
|
if (chunk && chunk.length) {
|
|
this.write(chunk)
|
|
}
|
|
this._parser.end()
|
|
return true
|
|
}
|
|
|
|
SAXStream.prototype.on = function (ev, handler) {
|
|
var me = this
|
|
if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
|
|
me._parser['on' + ev] = function () {
|
|
var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
|
|
args.splice(0, 0, ev)
|
|
me.emit.apply(me, args)
|
|
}
|
|
}
|
|
|
|
return Stream.prototype.on.call(me, ev, handler)
|
|
}
|
|
|
|
// this really needs to be replaced with character classes.
|
|
// XML allows all manner of ridiculous numbers and digits.
|
|
var CDATA = '[CDATA['
|
|
var DOCTYPE = 'DOCTYPE'
|
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
|
|
var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
|
|
var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
|
|
|
|
// http://www.w3.org/TR/REC-xml/#NT-NameStartChar
|
|
// This implementation works on strings, a single character at a time
|
|
// as such, it cannot ever support astral-plane characters (10000-EFFFF)
|
|
// without a significant breaking change to either this parser, or the
|
|
// JavaScript language. Implementation of an emoji-capable xml parser
|
|
// is left as an exercise for the reader.
|
|
var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
|
|
|
|
var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
|
|
|
|
var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
|
|
var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
|
|
|
|
function isWhitespace (c) {
|
|
return c === ' ' || c === '\n' || c === '\r' || c === '\t'
|
|
}
|
|
|
|
function isQuote (c) {
|
|
return c === '"' || c === '\''
|
|
}
|
|
|
|
function isAttribEnd (c) {
|
|
return c === '>' || isWhitespace(c)
|
|
}
|
|
|
|
function isMatch (regex, c) {
|
|
return regex.test(c)
|
|
}
|
|
|
|
function notMatch (regex, c) {
|
|
return !isMatch(regex, c)
|
|
}
|
|
|
|
var S = 0
|
|
sax.STATE = {
|
|
BEGIN: S++, // leading byte order mark or whitespace
|
|
BEGIN_WHITESPACE: S++, // leading whitespace
|
|
TEXT: S++, // general stuff
|
|
TEXT_ENTITY: S++, // & and such.
|
|
OPEN_WAKA: S++, // <
|
|
SGML_DECL: S++, // <!BLARG
|
|
SGML_DECL_QUOTED: S++, // <!BLARG foo "bar
|
|
DOCTYPE: S++, // <!DOCTYPE
|
|
DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah
|
|
DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...
|
|
DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo
|
|
COMMENT_STARTING: S++, // <!-
|
|
COMMENT: S++, // <!--
|
|
COMMENT_ENDING: S++, // <!-- blah -
|
|
COMMENT_ENDED: S++, // <!-- blah --
|
|
CDATA: S++, // <![CDATA[ something
|
|
CDATA_ENDING: S++, // ]
|
|
CDATA_ENDING_2: S++, // ]]
|
|
PROC_INST: S++, // <?hi
|
|
PROC_INST_BODY: S++, // <?hi there
|
|
PROC_INST_ENDING: S++, // <?hi "there" ?
|
|
OPEN_TAG: S++, // <strong
|
|
OPEN_TAG_SLASH: S++, // <strong /
|
|
ATTRIB: S++, // <a
|
|
ATTRIB_NAME: S++, // <a foo
|
|
ATTRIB_NAME_SAW_WHITE: S++, // <a foo _
|
|
ATTRIB_VALUE: S++, // <a foo=
|
|
ATTRIB_VALUE_QUOTED: S++, // <a foo="bar
|
|
ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"
|
|
ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar
|
|
ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="""
|
|
ATTRIB_VALUE_ENTITY_U: S++, // <foo bar="
|
|
CLOSE_TAG: S++, // </a
|
|
CLOSE_TAG_SAW_WHITE: S++, // </a >
|
|
SCRIPT: S++, // <script> ...
|
|
SCRIPT_ENDING: S++ // <script> ... <
|
|
}
|
|
|
|
sax.XML_ENTITIES = {
|
|
'amp': '&',
|
|
'gt': '>',
|
|
'lt': '<',
|
|
'quot': '"',
|
|
'apos': "'"
|
|
}
|
|
|
|
sax.ENTITIES = {
|
|
'amp': '&',
|
|
'gt': '>',
|
|
'lt': '<',
|
|
'quot': '"',
|
|
'apos': "'",
|
|
'AElig': 198,
|
|
'Aacute': 193,
|
|
'Acirc': 194,
|
|
'Agrave': 192,
|
|
'Aring': 197,
|
|
'Atilde': 195,
|
|
'Auml': 196,
|
|
'Ccedil': 199,
|
|
'ETH': 208,
|
|
'Eacute': 201,
|
|
'Ecirc': 202,
|
|
'Egrave': 200,
|
|
'Euml': 203,
|
|
'Iacute': 205,
|
|
'Icirc': 206,
|
|
'Igrave': 204,
|
|
'Iuml': 207,
|
|
'Ntilde': 209,
|
|
'Oacute': 211,
|
|
'Ocirc': 212,
|
|
'Ograve': 210,
|
|
'Oslash': 216,
|
|
'Otilde': 213,
|
|
'Ouml': 214,
|
|
'THORN': 222,
|
|
'Uacute': 218,
|
|
'Ucirc': 219,
|
|
'Ugrave': 217,
|
|
'Uuml': 220,
|
|
'Yacute': 221,
|
|
'aacute': 225,
|
|
'acirc': 226,
|
|
'aelig': 230,
|
|
'agrave': 224,
|
|
'aring': 229,
|
|
'atilde': 227,
|
|
'auml': 228,
|
|
'ccedil': 231,
|
|
'eacute': 233,
|
|
'ecirc': 234,
|
|
'egrave': 232,
|
|
'eth': 240,
|
|
'euml': 235,
|
|
'iacute': 237,
|
|
'icirc': 238,
|
|
'igrave': 236,
|
|
'iuml': 239,
|
|
'ntilde': 241,
|
|
'oacute': 243,
|
|
'ocirc': 244,
|
|
'ograve': 242,
|
|
'oslash': 248,
|
|
'otilde': 245,
|
|
'ouml': 246,
|
|
'szlig': 223,
|
|
'thorn': 254,
|
|
'uacute': 250,
|
|
'ucirc': 251,
|
|
'ugrave': 249,
|
|
'uuml': 252,
|
|
'yacute': 253,
|
|
'yuml': 255,
|
|
'copy': 169,
|
|
'reg': 174,
|
|
'nbsp': 160,
|
|
'iexcl': 161,
|
|
'cent': 162,
|
|
'pound': 163,
|
|
'curren': 164,
|
|
'yen': 165,
|
|
'brvbar': 166,
|
|
'sect': 167,
|
|
'uml': 168,
|
|
'ordf': 170,
|
|
'laquo': 171,
|
|
'not': 172,
|
|
'shy': 173,
|
|
'macr': 175,
|
|
'deg': 176,
|
|
'plusmn': 177,
|
|
'sup1': 185,
|
|
'sup2': 178,
|
|
'sup3': 179,
|
|
'acute': 180,
|
|
'micro': 181,
|
|
'para': 182,
|
|
'middot': 183,
|
|
'cedil': 184,
|
|
'ordm': 186,
|
|
'raquo': 187,
|
|
'frac14': 188,
|
|
'frac12': 189,
|
|
'frac34': 190,
|
|
'iquest': 191,
|
|
'times': 215,
|
|
'divide': 247,
|
|
'OElig': 338,
|
|
'oelig': 339,
|
|
'Scaron': 352,
|
|
'scaron': 353,
|
|
'Yuml': 376,
|
|
'fnof': 402,
|
|
'circ': 710,
|
|
'tilde': 732,
|
|
'Alpha': 913,
|
|
'Beta': 914,
|
|
'Gamma': 915,
|
|
'Delta': 916,
|
|
'Epsilon': 917,
|
|
'Zeta': 918,
|
|
'Eta': 919,
|
|
'Theta': 920,
|
|
'Iota': 921,
|
|
'Kappa': 922,
|
|
'Lambda': 923,
|
|
'Mu': 924,
|
|
'Nu': 925,
|
|
'Xi': 926,
|
|
'Omicron': 927,
|
|
'Pi': 928,
|
|
'Rho': 929,
|
|
'Sigma': 931,
|
|
'Tau': 932,
|
|
'Upsilon': 933,
|
|
'Phi': 934,
|
|
'Chi': 935,
|
|
'Psi': 936,
|
|
'Omega': 937,
|
|
'alpha': 945,
|
|
'beta': 946,
|
|
'gamma': 947,
|
|
'delta': 948,
|
|
'epsilon': 949,
|
|
'zeta': 950,
|
|
'eta': 951,
|
|
'theta': 952,
|
|
'iota': 953,
|
|
'kappa': 954,
|
|
'lambda': 955,
|
|
'mu': 956,
|
|
'nu': 957,
|
|
'xi': 958,
|
|
'omicron': 959,
|
|
'pi': 960,
|
|
'rho': 961,
|
|
'sigmaf': 962,
|
|
'sigma': 963,
|
|
'tau': 964,
|
|
'upsilon': 965,
|
|
'phi': 966,
|
|
'chi': 967,
|
|
'psi': 968,
|
|
'omega': 969,
|
|
'thetasym': 977,
|
|
'upsih': 978,
|
|
'piv': 982,
|
|
'ensp': 8194,
|
|
'emsp': 8195,
|
|
'thinsp': 8201,
|
|
'zwnj': 8204,
|
|
'zwj': 8205,
|
|
'lrm': 8206,
|
|
'rlm': 8207,
|
|
'ndash': 8211,
|
|
'mdash': 8212,
|
|
'lsquo': 8216,
|
|
'rsquo': 8217,
|
|
'sbquo': 8218,
|
|
'ldquo': 8220,
|
|
'rdquo': 8221,
|
|
'bdquo': 8222,
|
|
'dagger': 8224,
|
|
'Dagger': 8225,
|
|
'bull': 8226,
|
|
'hellip': 8230,
|
|
'permil': 8240,
|
|
'prime': 8242,
|
|
'Prime': 8243,
|
|
'lsaquo': 8249,
|
|
'rsaquo': 8250,
|
|
'oline': 8254,
|
|
'frasl': 8260,
|
|
'euro': 8364,
|
|
'image': 8465,
|
|
'weierp': 8472,
|
|
'real': 8476,
|
|
'trade': 8482,
|
|
'alefsym': 8501,
|
|
'larr': 8592,
|
|
'uarr': 8593,
|
|
'rarr': 8594,
|
|
'darr': 8595,
|
|
'harr': 8596,
|
|
'crarr': 8629,
|
|
'lArr': 8656,
|
|
'uArr': 8657,
|
|
'rArr': 8658,
|
|
'dArr': 8659,
|
|
'hArr': 8660,
|
|
'forall': 8704,
|
|
'part': 8706,
|
|
'exist': 8707,
|
|
'empty': 8709,
|
|
'nabla': 8711,
|
|
'isin': 8712,
|
|
'notin': 8713,
|
|
'ni': 8715,
|
|
'prod': 8719,
|
|
'sum': 8721,
|
|
'minus': 8722,
|
|
'lowast': 8727,
|
|
'radic': 8730,
|
|
'prop': 8733,
|
|
'infin': 8734,
|
|
'ang': 8736,
|
|
'and': 8743,
|
|
'or': 8744,
|
|
'cap': 8745,
|
|
'cup': 8746,
|
|
'int': 8747,
|
|
'there4': 8756,
|
|
'sim': 8764,
|
|
'cong': 8773,
|
|
'asymp': 8776,
|
|
'ne': 8800,
|
|
'equiv': 8801,
|
|
'le': 8804,
|
|
'ge': 8805,
|
|
'sub': 8834,
|
|
'sup': 8835,
|
|
'nsub': 8836,
|
|
'sube': 8838,
|
|
'supe': 8839,
|
|
'oplus': 8853,
|
|
'otimes': 8855,
|
|
'perp': 8869,
|
|
'sdot': 8901,
|
|
'lceil': 8968,
|
|
'rceil': 8969,
|
|
'lfloor': 8970,
|
|
'rfloor': 8971,
|
|
'lang': 9001,
|
|
'rang': 9002,
|
|
'loz': 9674,
|
|
'spades': 9824,
|
|
'clubs': 9827,
|
|
'hearts': 9829,
|
|
'diams': 9830
|
|
}
|
|
|
|
Object.keys(sax.ENTITIES).forEach(function (key) {
|
|
var e = sax.ENTITIES[key]
|
|
var s = typeof e === 'number' ? String.fromCharCode(e) : e
|
|
sax.ENTITIES[key] = s
|
|
})
|
|
|
|
for (var s in sax.STATE) {
|
|
sax.STATE[sax.STATE[s]] = s
|
|
}
|
|
|
|
// shorthand
|
|
S = sax.STATE
|
|
|
|
function emit (parser, event, data) {
|
|
parser[event] && parser[event](data)
|
|
}
|
|
|
|
function emitNode (parser, nodeType, data) {
|
|
if (parser.textNode) closeText(parser)
|
|
emit(parser, nodeType, data)
|
|
}
|
|
|
|
function closeText (parser) {
|
|
parser.textNode = textopts(parser.opt, parser.textNode)
|
|
if (parser.textNode) emit(parser, 'ontext', parser.textNode)
|
|
parser.textNode = ''
|
|
}
|
|
|
|
function textopts (opt, text) {
|
|
if (opt.trim) text = text.trim()
|
|
if (opt.normalize) text = text.replace(/\s+/g, ' ')
|
|
return text
|
|
}
|
|
|
|
function error (parser, er) {
|
|
closeText(parser)
|
|
if (parser.trackPosition) {
|
|
er += '\nLine: ' + parser.line +
|
|
'\nColumn: ' + parser.column +
|
|
'\nChar: ' + parser.c
|
|
}
|
|
er = new Error(er)
|
|
parser.error = er
|
|
emit(parser, 'onerror', er)
|
|
return parser
|
|
}
|
|
|
|
function end (parser) {
|
|
if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
|
|
if ((parser.state !== S.BEGIN) &&
|
|
(parser.state !== S.BEGIN_WHITESPACE) &&
|
|
(parser.state !== S.TEXT)) {
|
|
error(parser, 'Unexpected end')
|
|
}
|
|
closeText(parser)
|
|
parser.c = ''
|
|
parser.closed = true
|
|
emit(parser, 'onend')
|
|
SAXParser.call(parser, parser.strict, parser.opt)
|
|
return parser
|
|
}
|
|
|
|
function strictFail (parser, message) {
|
|
if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
|
|
throw new Error('bad call to strictFail')
|
|
}
|
|
if (parser.strict) {
|
|
error(parser, message)
|
|
}
|
|
}
|
|
|
|
function newTag (parser) {
|
|
if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
|
|
var parent = parser.tags[parser.tags.length - 1] || parser
|
|
var tag = parser.tag = { name: parser.tagName, attributes: {} }
|
|
|
|
// will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
|
|
if (parser.opt.xmlns) {
|
|
tag.ns = parent.ns
|
|
}
|
|
parser.attribList.length = 0
|
|
emitNode(parser, 'onopentagstart', tag)
|
|
}
|
|
|
|
function qname (name, attribute) {
|
|
var i = name.indexOf(':')
|
|
var qualName = i < 0 ? [ '', name ] : name.split(':')
|
|
var prefix = qualName[0]
|
|
var local = qualName[1]
|
|
|
|
// <x "xmlns"="http://foo">
|
|
if (attribute && name === 'xmlns') {
|
|
prefix = 'xmlns'
|
|
local = ''
|
|
}
|
|
|
|
return { prefix: prefix, local: local }
|
|
}
|
|
|
|
function attrib (parser) {
|
|
if (!parser.strict) {
|
|
parser.attribName = parser.attribName[parser.looseCase]()
|
|
}
|
|
|
|
if (parser.attribList.indexOf(parser.attribName) !== -1 ||
|
|
parser.tag.attributes.hasOwnProperty(parser.attribName)) {
|
|
parser.attribName = parser.attribValue = ''
|
|
return
|
|
}
|
|
|
|
if (parser.opt.xmlns) {
|
|
var qn = qname(parser.attribName, true)
|
|
var prefix = qn.prefix
|
|
var local = qn.local
|
|
|
|
if (prefix === 'xmlns') {
|
|
// namespace binding attribute. push the binding into scope
|
|
if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
|
|
strictFail(parser,
|
|
'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
|
|
'Actual: ' + parser.attribValue)
|
|
} else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
|
|
strictFail(parser,
|
|
'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
|
|
'Actual: ' + parser.attribValue)
|
|
} else {
|
|
var tag = parser.tag
|
|
var parent = parser.tags[parser.tags.length - 1] || parser
|
|
if (tag.ns === parent.ns) {
|
|
tag.ns = Object.create(parent.ns)
|
|
}
|
|
tag.ns[local] = parser.attribValue
|
|
}
|
|
}
|
|
|
|
// defer onattribute events until all attributes have been seen
|
|
// so any new bindings can take effect. preserve attribute order
|
|
// so deferred events can be emitted in document order
|
|
parser.attribList.push([parser.attribName, parser.attribValue])
|
|
} else {
|
|
// in non-xmlns mode, we can emit the event right away
|
|
parser.tag.attributes[parser.attribName] = parser.attribValue
|
|
emitNode(parser, 'onattribute', {
|
|
name: parser.attribName,
|
|
value: parser.attribValue
|
|
})
|
|
}
|
|
|
|
parser.attribName = parser.attribValue = ''
|
|
}
|
|
|
|
function openTag (parser, selfClosing) {
|
|
if (parser.opt.xmlns) {
|
|
// emit namespace binding events
|
|
var tag = parser.tag
|
|
|
|
// add namespace info to tag
|
|
var qn = qname(parser.tagName)
|
|
tag.prefix = qn.prefix
|
|
tag.local = qn.local
|
|
tag.uri = tag.ns[qn.prefix] || ''
|
|
|
|
if (tag.prefix && !tag.uri) {
|
|
strictFail(parser, 'Unbound namespace prefix: ' +
|
|
JSON.stringify(parser.tagName))
|
|
tag.uri = qn.prefix
|
|
}
|
|
|
|
var parent = parser.tags[parser.tags.length - 1] || parser
|
|
if (tag.ns && parent.ns !== tag.ns) {
|
|
Object.keys(tag.ns).forEach(function (p) {
|
|
emitNode(parser, 'onopennamespace', {
|
|
prefix: p,
|
|
uri: tag.ns[p]
|
|
})
|
|
})
|
|
}
|
|
|
|
// handle deferred onattribute events
|
|
// Note: do not apply default ns to attributes:
|
|
// http://www.w3.org/TR/REC-xml-names/#defaulting
|
|
for (var i = 0, l = parser.attribList.length; i < l; i++) {
|
|
var nv = parser.attribList[i]
|
|
var name = nv[0]
|
|
var value = nv[1]
|
|
var qualName = qname(name, true)
|
|
var prefix = qualName.prefix
|
|
var local = qualName.local
|
|
var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
|
|
var a = {
|
|
name: name,
|
|
value: value,
|
|
prefix: prefix,
|
|
local: local,
|
|
uri: uri
|
|
}
|
|
|
|
// if there's any attributes with an undefined namespace,
|
|
// then fail on them now.
|
|
if (prefix && prefix !== 'xmlns' && !uri) {
|
|
strictFail(parser, 'Unbound namespace prefix: ' +
|
|
JSON.stringify(prefix))
|
|
a.uri = prefix
|
|
}
|
|
parser.tag.attributes[name] = a
|
|
emitNode(parser, 'onattribute', a)
|
|
}
|
|
parser.attribList.length = 0
|
|
}
|
|
|
|
parser.tag.isSelfClosing = !!selfClosing
|
|
|
|
// process the tag
|
|
parser.sawRoot = true
|
|
parser.tags.push(parser.tag)
|
|
emitNode(parser, 'onopentag', parser.tag)
|
|
if (!selfClosing) {
|
|
// special case for <script> in non-strict mode.
|
|
if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
|
|
parser.state = S.SCRIPT
|
|
} else {
|
|
parser.state = S.TEXT
|
|
}
|
|
parser.tag = null
|
|
parser.tagName = ''
|
|
}
|
|
parser.attribName = parser.attribValue = ''
|
|
parser.attribList.length = 0
|
|
}
|
|
|
|
function closeTag (parser) {
|
|
if (!parser.tagName) {
|
|
strictFail(parser, 'Weird empty close tag.')
|
|
parser.textNode += '</>'
|
|
parser.state = S.TEXT
|
|
return
|
|
}
|
|
|
|
if (parser.script) {
|
|
if (parser.tagName !== 'script') {
|
|
parser.script += '</' + parser.tagName + '>'
|
|
parser.tagName = ''
|
|
parser.state = S.SCRIPT
|
|
return
|
|
}
|
|
emitNode(parser, 'onscript', parser.script)
|
|
parser.script = ''
|
|
}
|
|
|
|
// first make sure that the closing tag actually exists.
|
|
// <a><b></c></b></a> will close everything, otherwise.
|
|
var t = parser.tags.length
|
|
var tagName = parser.tagName
|
|
if (!parser.strict) {
|
|
tagName = tagName[parser.looseCase]()
|
|
}
|
|
var closeTo = tagName
|
|
while (t--) {
|
|
var close = parser.tags[t]
|
|
if (close.name !== closeTo) {
|
|
// fail the first time in strict mode
|
|
strictFail(parser, 'Unexpected close tag')
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
|
|
// didn't find it. we already failed for strict, so just abort.
|
|
if (t < 0) {
|
|
strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
|
|
parser.textNode += '</' + parser.tagName + '>'
|
|
parser.state = S.TEXT
|
|
return
|
|
}
|
|
parser.tagName = tagName
|
|
var s = parser.tags.length
|
|
while (s-- > t) {
|
|
var tag = parser.tag = parser.tags.pop()
|
|
parser.tagName = parser.tag.name
|
|
emitNode(parser, 'onclosetag', parser.tagName)
|
|
|
|
var x = {}
|
|
for (var i in tag.ns) {
|
|
x[i] = tag.ns[i]
|
|
}
|
|
|
|
var parent = parser.tags[parser.tags.length - 1] || parser
|
|
if (parser.opt.xmlns && tag.ns !== parent.ns) {
|
|
// remove namespace bindings introduced by tag
|
|
Object.keys(tag.ns).forEach(function (p) {
|
|
var n = tag.ns[p]
|
|
emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
|
|
})
|
|
}
|
|
}
|
|
if (t === 0) parser.closedRoot = true
|
|
parser.tagName = parser.attribValue = parser.attribName = ''
|
|
parser.attribList.length = 0
|
|
parser.state = S.TEXT
|
|
}
|
|
|
|
function parseEntity (parser) {
|
|
var entity = parser.entity
|
|
var entityLC = entity.toLowerCase()
|
|
var num
|
|
var numStr = ''
|
|
|
|
if (parser.ENTITIES[entity]) {
|
|
return parser.ENTITIES[entity]
|
|
}
|
|
if (parser.ENTITIES[entityLC]) {
|
|
return parser.ENTITIES[entityLC]
|
|
}
|
|
entity = entityLC
|
|
if (entity.charAt(0) === '#') {
|
|
if (entity.charAt(1) === 'x') {
|
|
entity = entity.slice(2)
|
|
num = parseInt(entity, 16)
|
|
numStr = num.toString(16)
|
|
} else {
|
|
entity = entity.slice(1)
|
|
num = parseInt(entity, 10)
|
|
numStr = num.toString(10)
|
|
}
|
|
}
|
|
entity = entity.replace(/^0+/, '')
|
|
if (isNaN(num) || numStr.toLowerCase() !== entity) {
|
|
strictFail(parser, 'Invalid character entity')
|
|
return '&' + parser.entity + ';'
|
|
}
|
|
|
|
return String.fromCodePoint(num)
|
|
}
|
|
|
|
function beginWhiteSpace (parser, c) {
|
|
if (c === '<') {
|
|
parser.state = S.OPEN_WAKA
|
|
parser.startTagPosition = parser.position
|
|
} else if (!isWhitespace(c)) {
|
|
// have to process this as a text node.
|
|
// weird, but happens.
|
|
strictFail(parser, 'Non-whitespace before first tag.')
|
|
parser.textNode = c
|
|
parser.state = S.TEXT
|
|
}
|
|
}
|
|
|
|
function charAt (chunk, i) {
|
|
var result = ''
|
|
if (i < chunk.length) {
|
|
result = chunk.charAt(i)
|
|
}
|
|
return result
|
|
}
|
|
|
|
function write (chunk) {
|
|
var parser = this
|
|
if (this.error) {
|
|
throw this.error
|
|
}
|
|
if (parser.closed) {
|
|
return error(parser,
|
|
'Cannot write after close. Assign an onready handler.')
|
|
}
|
|
if (chunk === null) {
|
|
return end(parser)
|
|
}
|
|
if (typeof chunk === 'object') {
|
|
chunk = chunk.toString()
|
|
}
|
|
var i = 0
|
|
var c = ''
|
|
while (true) {
|
|
c = charAt(chunk, i++)
|
|
parser.c = c
|
|
|
|
if (!c) {
|
|
break
|
|
}
|
|
|
|
if (parser.trackPosition) {
|
|
parser.position++
|
|
if (c === '\n') {
|
|
parser.line++
|
|
parser.column = 0
|
|
} else {
|
|
parser.column++
|
|
}
|
|
}
|
|
|
|
switch (parser.state) {
|
|
case S.BEGIN:
|
|
parser.state = S.BEGIN_WHITESPACE
|
|
if (c === '\uFEFF') {
|
|
continue
|
|
}
|
|
beginWhiteSpace(parser, c)
|
|
continue
|
|
|
|
case S.BEGIN_WHITESPACE:
|
|
beginWhiteSpace(parser, c)
|
|
continue
|
|
|
|
case S.TEXT:
|
|
if (parser.sawRoot && !parser.closedRoot) {
|
|
var starti = i - 1
|
|
while (c && c !== '<' && c !== '&') {
|
|
c = charAt(chunk, i++)
|
|
if (c && parser.trackPosition) {
|
|
parser.position++
|
|
if (c === '\n') {
|
|
parser.line++
|
|
parser.column = 0
|
|
} else {
|
|
parser.column++
|
|
}
|
|
}
|
|
}
|
|
parser.textNode += chunk.substring(starti, i - 1)
|
|
}
|
|
if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
|
|
parser.state = S.OPEN_WAKA
|
|
parser.startTagPosition = parser.position
|
|
} else {
|
|
if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
|
|
strictFail(parser, 'Text data outside of root node.')
|
|
}
|
|
if (c === '&') {
|
|
parser.state = S.TEXT_ENTITY
|
|
} else {
|
|
parser.textNode += c
|
|
}
|
|
}
|
|
continue
|
|
|
|
case S.SCRIPT:
|
|
// only non-strict
|
|
if (c === '<') {
|
|
parser.state = S.SCRIPT_ENDING
|
|
} else {
|
|
parser.script += c
|
|
}
|
|
continue
|
|
|
|
case S.SCRIPT_ENDING:
|
|
if (c === '/') {
|
|
parser.state = S.CLOSE_TAG
|
|
} else {
|
|
parser.script += '<' + c
|
|
parser.state = S.SCRIPT
|
|
}
|
|
continue
|
|
|
|
case S.OPEN_WAKA:
|
|
// either a /, ?, !, or text is coming next.
|
|
if (c === '!') {
|
|
parser.state = S.SGML_DECL
|
|
parser.sgmlDecl = ''
|
|
} else if (isWhitespace(c)) {
|
|
// wait for it...
|
|
} else if (isMatch(nameStart, c)) {
|
|
parser.state = S.OPEN_TAG
|
|
parser.tagName = c
|
|
} else if (c === '/') {
|
|
parser.state = S.CLOSE_TAG
|
|
parser.tagName = ''
|
|
} else if (c === '?') {
|
|
parser.state = S.PROC_INST
|
|
parser.procInstName = parser.procInstBody = ''
|
|
} else {
|
|
strictFail(parser, 'Unencoded <')
|
|
// if there was some whitespace, then add that in.
|
|
if (parser.startTagPosition + 1 < parser.position) {
|
|
var pad = parser.position - parser.startTagPosition
|
|
c = new Array(pad).join(' ') + c
|
|
}
|
|
parser.textNode += '<' + c
|
|
parser.state = S.TEXT
|
|
}
|
|
continue
|
|
|
|
case S.SGML_DECL:
|
|
if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
|
|
emitNode(parser, 'onopencdata')
|
|
parser.state = S.CDATA
|
|
parser.sgmlDecl = ''
|
|
parser.cdata = ''
|
|
} else if (parser.sgmlDecl + c === '--') {
|
|
parser.state = S.COMMENT
|
|
parser.comment = ''
|
|
parser.sgmlDecl = ''
|
|
} else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
|
|
parser.state = S.DOCTYPE
|
|
if (parser.doctype || parser.sawRoot) {
|
|
strictFail(parser,
|
|
'Inappropriately located doctype declaration')
|
|
}
|
|
parser.doctype = ''
|
|
parser.sgmlDecl = ''
|
|
} else if (c === '>') {
|
|
emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
|
|
parser.sgmlDecl = ''
|
|
parser.state = S.TEXT
|
|
} else if (isQuote(c)) {
|
|
parser.state = S.SGML_DECL_QUOTED
|
|
parser.sgmlDecl += c
|
|
} else {
|
|
parser.sgmlDecl += c
|
|
}
|
|
continue
|
|
|
|
case S.SGML_DECL_QUOTED:
|
|
if (c === parser.q) {
|
|
parser.state = S.SGML_DECL
|
|
parser.q = ''
|
|
}
|
|
parser.sgmlDecl += c
|
|
continue
|
|
|
|
case S.DOCTYPE:
|
|
if (c === '>') {
|
|
parser.state = S.TEXT
|
|
emitNode(parser, 'ondoctype', parser.doctype)
|
|
parser.doctype = true // just remember that we saw it.
|
|
} else {
|
|
parser.doctype += c
|
|
if (c === '[') {
|
|
parser.state = S.DOCTYPE_DTD
|
|
} else if (isQuote(c)) {
|
|
parser.state = S.DOCTYPE_QUOTED
|
|
parser.q = c
|
|
}
|
|
}
|
|
continue
|
|
|
|
case S.DOCTYPE_QUOTED:
|
|
parser.doctype += c
|
|
if (c === parser.q) {
|
|
parser.q = ''
|
|
parser.state = S.DOCTYPE
|
|
}
|
|
continue
|
|
|
|
case S.DOCTYPE_DTD:
|
|
parser.doctype += c
|
|
if (c === ']') {
|
|
parser.state = S.DOCTYPE
|
|
} else if (isQuote(c)) {
|
|
parser.state = S.DOCTYPE_DTD_QUOTED
|
|
parser.q = c
|
|
}
|
|
continue
|
|
|
|
case S.DOCTYPE_DTD_QUOTED:
|
|
parser.doctype += c
|
|
if (c === parser.q) {
|
|
parser.state = S.DOCTYPE_DTD
|
|
parser.q = ''
|
|
}
|
|
continue
|
|
|
|
case S.COMMENT:
|
|
if (c === '-') {
|
|
parser.state = S.COMMENT_ENDING
|
|
} else {
|
|
parser.comment += c
|
|
}
|
|
continue
|
|
|
|
case S.COMMENT_ENDING:
|
|
if (c === '-') {
|
|
parser.state = S.COMMENT_ENDED
|
|
parser.comment = textopts(parser.opt, parser.comment)
|
|
if (parser.comment) {
|
|
emitNode(parser, 'oncomment', parser.comment)
|
|
}
|
|
parser.comment = ''
|
|
} else {
|
|
parser.comment += '-' + c
|
|
parser.state = S.COMMENT
|
|
}
|
|
continue
|
|
|
|
case S.COMMENT_ENDED:
|
|
if (c !== '>') {
|
|
strictFail(parser, 'Malformed comment')
|
|
// allow <!-- blah -- bloo --> in non-strict mode,
|
|
// which is a comment of " blah -- bloo "
|
|
parser.comment += '--' + c
|
|
parser.state = S.COMMENT
|
|
} else {
|
|
parser.state = S.TEXT
|
|
}
|
|
continue
|
|
|
|
case S.CDATA:
|
|
if (c === ']') {
|
|
parser.state = S.CDATA_ENDING
|
|
} else {
|
|
parser.cdata += c
|
|
}
|
|
continue
|
|
|
|
case S.CDATA_ENDING:
|
|
if (c === ']') {
|
|
parser.state = S.CDATA_ENDING_2
|
|
} else {
|
|
parser.cdata += ']' + c
|
|
parser.state = S.CDATA
|
|
}
|
|
continue
|
|
|
|
case S.CDATA_ENDING_2:
|
|
if (c === '>') {
|
|
if (parser.cdata) {
|
|
emitNode(parser, 'oncdata', parser.cdata)
|
|
}
|
|
emitNode(parser, 'onclosecdata')
|
|
parser.cdata = ''
|
|
parser.state = S.TEXT
|
|
} else if (c === ']') {
|
|
parser.cdata += ']'
|
|
} else {
|
|
parser.cdata += ']]' + c
|
|
parser.state = S.CDATA
|
|
}
|
|
continue
|
|
|
|
case S.PROC_INST:
|
|
if (c === '?') {
|
|
parser.state = S.PROC_INST_ENDING
|
|
} else if (isWhitespace(c)) {
|
|
parser.state = S.PROC_INST_BODY
|
|
} else {
|
|
parser.procInstName += c
|
|
}
|
|
continue
|
|
|
|
case S.PROC_INST_BODY:
|
|
if (!parser.procInstBody && isWhitespace(c)) {
|
|
continue
|
|
} else if (c === '?') {
|
|
parser.state = S.PROC_INST_ENDING
|
|
} else {
|
|
parser.procInstBody += c
|
|
}
|
|
continue
|
|
|
|
case S.PROC_INST_ENDING:
|
|
if (c === '>') {
|
|
emitNode(parser, 'onprocessinginstruction', {
|
|
name: parser.procInstName,
|
|
body: parser.procInstBody
|
|
})
|
|
parser.procInstName = parser.procInstBody = ''
|
|
parser.state = S.TEXT
|
|
} else {
|
|
parser.procInstBody += '?' + c
|
|
parser.state = S.PROC_INST_BODY
|
|
}
|
|
continue
|
|
|
|
case S.OPEN_TAG:
|
|
if (isMatch(nameBody, c)) {
|
|
parser.tagName += c
|
|
} else {
|
|
newTag(parser)
|
|
if (c === '>') {
|
|
openTag(parser)
|
|
} else if (c === '/') {
|
|
parser.state = S.OPEN_TAG_SLASH
|
|
} else {
|
|
if (!isWhitespace(c)) {
|
|
strictFail(parser, 'Invalid character in tag name')
|
|
}
|
|
parser.state = S.ATTRIB
|
|
}
|
|
}
|
|
continue
|
|
|
|
case S.OPEN_TAG_SLASH:
|
|
if (c === '>') {
|
|
openTag(parser, true)
|
|
closeTag(parser)
|
|
} else {
|
|
strictFail(parser, 'Forward-slash in opening tag not followed by >')
|
|
parser.state = S.ATTRIB
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB:
|
|
// haven't read the attribute name yet.
|
|
if (isWhitespace(c)) {
|
|
continue
|
|
} else if (c === '>') {
|
|
openTag(parser)
|
|
} else if (c === '/') {
|
|
parser.state = S.OPEN_TAG_SLASH
|
|
} else if (isMatch(nameStart, c)) {
|
|
parser.attribName = c
|
|
parser.attribValue = ''
|
|
parser.state = S.ATTRIB_NAME
|
|
} else {
|
|
strictFail(parser, 'Invalid attribute name')
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB_NAME:
|
|
if (c === '=') {
|
|
parser.state = S.ATTRIB_VALUE
|
|
} else if (c === '>') {
|
|
strictFail(parser, 'Attribute without value')
|
|
parser.attribValue = parser.attribName
|
|
attrib(parser)
|
|
openTag(parser)
|
|
} else if (isWhitespace(c)) {
|
|
parser.state = S.ATTRIB_NAME_SAW_WHITE
|
|
} else if (isMatch(nameBody, c)) {
|
|
parser.attribName += c
|
|
} else {
|
|
strictFail(parser, 'Invalid attribute name')
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB_NAME_SAW_WHITE:
|
|
if (c === '=') {
|
|
parser.state = S.ATTRIB_VALUE
|
|
} else if (isWhitespace(c)) {
|
|
continue
|
|
} else {
|
|
strictFail(parser, 'Attribute without value')
|
|
parser.tag.attributes[parser.attribName] = ''
|
|
parser.attribValue = ''
|
|
emitNode(parser, 'onattribute', {
|
|
name: parser.attribName,
|
|
value: ''
|
|
})
|
|
parser.attribName = ''
|
|
if (c === '>') {
|
|
openTag(parser)
|
|
} else if (isMatch(nameStart, c)) {
|
|
parser.attribName = c
|
|
parser.state = S.ATTRIB_NAME
|
|
} else {
|
|
strictFail(parser, 'Invalid attribute name')
|
|
parser.state = S.ATTRIB
|
|
}
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB_VALUE:
|
|
if (isWhitespace(c)) {
|
|
continue
|
|
} else if (isQuote(c)) {
|
|
parser.q = c
|
|
parser.state = S.ATTRIB_VALUE_QUOTED
|
|
} else {
|
|
strictFail(parser, 'Unquoted attribute value')
|
|
parser.state = S.ATTRIB_VALUE_UNQUOTED
|
|
parser.attribValue = c
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB_VALUE_QUOTED:
|
|
if (c !== parser.q) {
|
|
if (c === '&') {
|
|
parser.state = S.ATTRIB_VALUE_ENTITY_Q
|
|
} else {
|
|
parser.attribValue += c
|
|
}
|
|
continue
|
|
}
|
|
attrib(parser)
|
|
parser.q = ''
|
|
parser.state = S.ATTRIB_VALUE_CLOSED
|
|
continue
|
|
|
|
case S.ATTRIB_VALUE_CLOSED:
|
|
if (isWhitespace(c)) {
|
|
parser.state = S.ATTRIB
|
|
} else if (c === '>') {
|
|
openTag(parser)
|
|
} else if (c === '/') {
|
|
parser.state = S.OPEN_TAG_SLASH
|
|
} else if (isMatch(nameStart, c)) {
|
|
strictFail(parser, 'No whitespace between attributes')
|
|
parser.attribName = c
|
|
parser.attribValue = ''
|
|
parser.state = S.ATTRIB_NAME
|
|
} else {
|
|
strictFail(parser, 'Invalid attribute name')
|
|
}
|
|
continue
|
|
|
|
case S.ATTRIB_VALUE_UNQUOTED:
|
|
if (!isAttribEnd(c)) {
|
|
if (c === '&') {
|
|
parser.state = S.ATTRIB_VALUE_ENTITY_U
|
|
} else {
|
|
parser.attribValue += c
|
|
}
|
|
continue
|
|
}
|
|
attrib(parser)
|
|
if (c === '>') {
|
|
openTag(parser)
|
|
} else {
|
|
parser.state = S.ATTRIB
|
|
}
|
|
continue
|
|
|
|
case S.CLOSE_TAG:
|
|
if (!parser.tagName) {
|
|
if (isWhitespace(c)) {
|
|
continue
|
|
} else if (notMatch(nameStart, c)) {
|
|
if (parser.script) {
|
|
parser.script += '</' + c
|
|
parser.state = S.SCRIPT
|
|
} else {
|
|
strictFail(parser, 'Invalid tagname in closing tag.')
|
|
}
|
|
} else {
|
|
parser.tagName = c
|
|
}
|
|
} else if (c === '>') {
|
|
closeTag(parser)
|
|
} else if (isMatch(nameBody, c)) {
|
|
parser.tagName += c
|
|
} else if (parser.script) {
|
|
parser.script += '</' + parser.tagName
|
|
parser.tagName = ''
|
|
parser.state = S.SCRIPT
|
|
} else {
|
|
if (!isWhitespace(c)) {
|
|
strictFail(parser, 'Invalid tagname in closing tag')
|
|
}
|
|
parser.state = S.CLOSE_TAG_SAW_WHITE
|
|
}
|
|
continue
|
|
|
|
case S.CLOSE_TAG_SAW_WHITE:
|
|
if (isWhitespace(c)) {
|
|
continue
|
|
}
|
|
if (c === '>') {
|
|
closeTag(parser)
|
|
} else {
|
|
strictFail(parser, 'Invalid characters in closing tag')
|
|
}
|
|
continue
|
|
|
|
case S.TEXT_ENTITY:
|
|
case S.ATTRIB_VALUE_ENTITY_Q:
|
|
case S.ATTRIB_VALUE_ENTITY_U:
|
|
var returnState
|
|
var buffer
|
|
switch (parser.state) {
|
|
case S.TEXT_ENTITY:
|
|
returnState = S.TEXT
|
|
buffer = 'textNode'
|
|
break
|
|
|
|
case S.ATTRIB_VALUE_ENTITY_Q:
|
|
returnState = S.ATTRIB_VALUE_QUOTED
|
|
buffer = 'attribValue'
|
|
break
|
|
|
|
case S.ATTRIB_VALUE_ENTITY_U:
|
|
returnState = S.ATTRIB_VALUE_UNQUOTED
|
|
buffer = 'attribValue'
|
|
break
|
|
}
|
|
|
|
if (c === ';') {
|
|
parser[buffer] += parseEntity(parser)
|
|
parser.entity = ''
|
|
parser.state = returnState
|
|
} else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
|
|
parser.entity += c
|
|
} else {
|
|
strictFail(parser, 'Invalid character in entity name')
|
|
parser[buffer] += '&' + parser.entity + c
|
|
parser.entity = ''
|
|
parser.state = returnState
|
|
}
|
|
|
|
continue
|
|
|
|
default:
|
|
throw new Error(parser, 'Unknown state: ' + parser.state)
|
|
}
|
|
} // while
|
|
|
|
if (parser.position >= parser.bufferCheckPosition) {
|
|
checkBufferLength(parser)
|
|
}
|
|
return parser
|
|
}
|
|
|
|
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
|
|
/* istanbul ignore next */
|
|
if (!String.fromCodePoint) {
|
|
(function () {
|
|
var stringFromCharCode = String.fromCharCode
|
|
var floor = Math.floor
|
|
var fromCodePoint = function () {
|
|
var MAX_SIZE = 0x4000
|
|
var codeUnits = []
|
|
var highSurrogate
|
|
var lowSurrogate
|
|
var index = -1
|
|
var length = arguments.length
|
|
if (!length) {
|
|
return ''
|
|
}
|
|
var result = ''
|
|
while (++index < length) {
|
|
var codePoint = Number(arguments[index])
|
|
if (
|
|
!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
|
|
codePoint < 0 || // not a valid Unicode code point
|
|
codePoint > 0x10FFFF || // not a valid Unicode code point
|
|
floor(codePoint) !== codePoint // not an integer
|
|
) {
|
|
throw RangeError('Invalid code point: ' + codePoint)
|
|
}
|
|
if (codePoint <= 0xFFFF) { // BMP code point
|
|
codeUnits.push(codePoint)
|
|
} else { // Astral code point; split in surrogate halves
|
|
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
codePoint -= 0x10000
|
|
highSurrogate = (codePoint >> 10) + 0xD800
|
|
lowSurrogate = (codePoint % 0x400) + 0xDC00
|
|
codeUnits.push(highSurrogate, lowSurrogate)
|
|
}
|
|
if (index + 1 === length || codeUnits.length > MAX_SIZE) {
|
|
result += stringFromCharCode.apply(null, codeUnits)
|
|
codeUnits.length = 0
|
|
}
|
|
}
|
|
return result
|
|
}
|
|
/* istanbul ignore next */
|
|
if (Object.defineProperty) {
|
|
Object.defineProperty(String, 'fromCodePoint', {
|
|
value: fromCodePoint,
|
|
configurable: true,
|
|
writable: true
|
|
})
|
|
} else {
|
|
String.fromCodePoint = fromCodePoint
|
|
}
|
|
}())
|
|
}
|
|
})( false ? 0 : exports)
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5911:
|
|
/***/ ((module, exports) => {
|
|
|
|
exports = module.exports = SemVer
|
|
|
|
var debug
|
|
/* istanbul ignore next */
|
|
if (typeof process === 'object' &&
|
|
process.env &&
|
|
process.env.NODE_DEBUG &&
|
|
/\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
debug = function () {
|
|
var args = Array.prototype.slice.call(arguments, 0)
|
|
args.unshift('SEMVER')
|
|
console.log.apply(console, args)
|
|
}
|
|
} else {
|
|
debug = function () {}
|
|
}
|
|
|
|
// Note: this is the semver.org version of the spec that it implements
|
|
// Not necessarily the package version of this code.
|
|
exports.SEMVER_SPEC_VERSION = '2.0.0'
|
|
|
|
var MAX_LENGTH = 256
|
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|
/* istanbul ignore next */ 9007199254740991
|
|
|
|
// Max safe segment length for coercion.
|
|
var MAX_SAFE_COMPONENT_LENGTH = 16
|
|
|
|
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
|
|
|
// The actual regexps go on exports.re
|
|
var re = exports.re = []
|
|
var safeRe = exports.safeRe = []
|
|
var src = exports.src = []
|
|
var t = exports.tokens = {}
|
|
var R = 0
|
|
|
|
function tok (n) {
|
|
t[n] = R++
|
|
}
|
|
|
|
var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
|
|
|
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
// used internally via the safeRe object since all inputs in this library get
|
|
// normalized first to trim and collapse all extra whitespace. The original
|
|
// regexes are exported for userland consumption and lower level usage. A
|
|
// future breaking change could export the safer regex only with a note that
|
|
// all input should have extra whitespace removed.
|
|
var safeRegexReplacements = [
|
|
['\\s', 1],
|
|
['\\d', MAX_LENGTH],
|
|
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
|
]
|
|
|
|
function makeSafeRe (value) {
|
|
for (var i = 0; i < safeRegexReplacements.length; i++) {
|
|
var token = safeRegexReplacements[i][0]
|
|
var max = safeRegexReplacements[i][1]
|
|
value = value
|
|
.split(token + '*').join(token + '{0,' + max + '}')
|
|
.split(token + '+').join(token + '{1,' + max + '}')
|
|
}
|
|
return value
|
|
}
|
|
|
|
// The following Regular Expressions can be used for tokenizing,
|
|
// validating, and parsing SemVer version strings.
|
|
|
|
// ## Numeric Identifier
|
|
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
|
|
tok('NUMERICIDENTIFIER')
|
|
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
|
tok('NUMERICIDENTIFIERLOOSE')
|
|
src[t.NUMERICIDENTIFIERLOOSE] = '\\d+'
|
|
|
|
// ## Non-numeric Identifier
|
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
// more letters, digits, or hyphens.
|
|
|
|
tok('NONNUMERICIDENTIFIER')
|
|
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
|
|
|
|
// ## Main Version
|
|
// Three dot-separated numeric identifiers.
|
|
|
|
tok('MAINVERSION')
|
|
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
'(' + src[t.NUMERICIDENTIFIER] + ')'
|
|
|
|
tok('MAINVERSIONLOOSE')
|
|
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'
|
|
|
|
// ## Pre-release Version Identifier
|
|
// A numeric identifier, or a non-numeric identifier.
|
|
|
|
tok('PRERELEASEIDENTIFIER')
|
|
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
|
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
|
|
|
tok('PRERELEASEIDENTIFIERLOOSE')
|
|
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
|
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
|
|
|
// ## Pre-release Version
|
|
// Hyphen, followed by one or more dot-separated pre-release version
|
|
// identifiers.
|
|
|
|
tok('PRERELEASE')
|
|
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
|
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'
|
|
|
|
tok('PRERELEASELOOSE')
|
|
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
|
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
|
|
|
// ## Build Metadata Identifier
|
|
// Any combination of digits, letters, or hyphens.
|
|
|
|
tok('BUILDIDENTIFIER')
|
|
src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
|
|
|
|
// ## Build Metadata
|
|
// Plus sign, followed by one or more period-separated build metadata
|
|
// identifiers.
|
|
|
|
tok('BUILD')
|
|
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
|
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'
|
|
|
|
// ## Full Version String
|
|
// A main version, followed optionally by a pre-release version and
|
|
// build metadata.
|
|
|
|
// Note that the only major, minor, patch, and pre-release sections of
|
|
// the version string are capturing groups. The build metadata is not a
|
|
// capturing group, because it should not ever be used in version
|
|
// comparison.
|
|
|
|
tok('FULL')
|
|
tok('FULLPLAIN')
|
|
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
|
src[t.PRERELEASE] + '?' +
|
|
src[t.BUILD] + '?'
|
|
|
|
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'
|
|
|
|
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
// common in the npm registry.
|
|
tok('LOOSEPLAIN')
|
|
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
|
src[t.PRERELEASELOOSE] + '?' +
|
|
src[t.BUILD] + '?'
|
|
|
|
tok('LOOSE')
|
|
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'
|
|
|
|
tok('GTLT')
|
|
src[t.GTLT] = '((?:<|>)?=?)'
|
|
|
|
// Something like "2.*" or "1.2.x".
|
|
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
// Only the first item is strictly required.
|
|
tok('XRANGEIDENTIFIERLOOSE')
|
|
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
|
tok('XRANGEIDENTIFIER')
|
|
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'
|
|
|
|
tok('XRANGEPLAIN')
|
|
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
'(?:' + src[t.PRERELEASE] + ')?' +
|
|
src[t.BUILD] + '?' +
|
|
')?)?'
|
|
|
|
tok('XRANGEPLAINLOOSE')
|
|
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
|
src[t.BUILD] + '?' +
|
|
')?)?'
|
|
|
|
tok('XRANGE')
|
|
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'
|
|
tok('XRANGELOOSE')
|
|
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'
|
|
|
|
// Coercion.
|
|
// Extract anything that could conceivably be a part of a valid semver
|
|
tok('COERCE')
|
|
src[t.COERCE] = '(^|[^\\d])' +
|
|
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
|
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
'(?:$|[^\\d])'
|
|
tok('COERCERTL')
|
|
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
|
safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g')
|
|
|
|
// Tilde ranges.
|
|
// Meaning is "reasonably at or greater than"
|
|
tok('LONETILDE')
|
|
src[t.LONETILDE] = '(?:~>?)'
|
|
|
|
tok('TILDETRIM')
|
|
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
|
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
|
safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g')
|
|
var tildeTrimReplace = '$1~'
|
|
|
|
tok('TILDE')
|
|
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'
|
|
tok('TILDELOOSE')
|
|
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'
|
|
|
|
// Caret ranges.
|
|
// Meaning is "at least and backwards compatible with"
|
|
tok('LONECARET')
|
|
src[t.LONECARET] = '(?:\\^)'
|
|
|
|
tok('CARETTRIM')
|
|
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
|
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
|
safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g')
|
|
var caretTrimReplace = '$1^'
|
|
|
|
tok('CARET')
|
|
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'
|
|
tok('CARETLOOSE')
|
|
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'
|
|
|
|
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
tok('COMPARATORLOOSE')
|
|
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'
|
|
tok('COMPARATOR')
|
|
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'
|
|
|
|
// An expression to strip any whitespace between the gtlt and the thing
|
|
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
tok('COMPARATORTRIM')
|
|
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
|
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'
|
|
|
|
// this one has to use the /g flag
|
|
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
|
safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g')
|
|
var comparatorTrimReplace = '$1$2$3'
|
|
|
|
// Something like `1.2.3 - 1.2.4`
|
|
// Note that these all use the loose form, because they'll be
|
|
// checked against either the strict or loose comparator form
|
|
// later.
|
|
tok('HYPHENRANGE')
|
|
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
|
'\\s+-\\s+' +
|
|
'(' + src[t.XRANGEPLAIN] + ')' +
|
|
'\\s*$'
|
|
|
|
tok('HYPHENRANGELOOSE')
|
|
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
'\\s+-\\s+' +
|
|
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
'\\s*$'
|
|
|
|
// Star ranges basically just allow anything at all.
|
|
tok('STAR')
|
|
src[t.STAR] = '(<|>)?=?\\s*\\*'
|
|
|
|
// Compile to actual regexp objects.
|
|
// All are flag-free, unless they were created above with a flag.
|
|
for (var i = 0; i < R; i++) {
|
|
debug(i, src[i])
|
|
if (!re[i]) {
|
|
re[i] = new RegExp(src[i])
|
|
|
|
// Replace all greedy whitespace to prevent regex dos issues. These regex are
|
|
// used internally via the safeRe object since all inputs in this library get
|
|
// normalized first to trim and collapse all extra whitespace. The original
|
|
// regexes are exported for userland consumption and lower level usage. A
|
|
// future breaking change could export the safer regex only with a note that
|
|
// all input should have extra whitespace removed.
|
|
safeRe[i] = new RegExp(makeSafeRe(src[i]))
|
|
}
|
|
}
|
|
|
|
exports.parse = parse
|
|
function parse (version, options) {
|
|
if (!options || typeof options !== 'object') {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
}
|
|
}
|
|
|
|
if (version instanceof SemVer) {
|
|
return version
|
|
}
|
|
|
|
if (typeof version !== 'string') {
|
|
return null
|
|
}
|
|
|
|
if (version.length > MAX_LENGTH) {
|
|
return null
|
|
}
|
|
|
|
var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
|
|
if (!r.test(version)) {
|
|
return null
|
|
}
|
|
|
|
try {
|
|
return new SemVer(version, options)
|
|
} catch (er) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
exports.valid = valid
|
|
function valid (version, options) {
|
|
var v = parse(version, options)
|
|
return v ? v.version : null
|
|
}
|
|
|
|
exports.clean = clean
|
|
function clean (version, options) {
|
|
var s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
|
return s ? s.version : null
|
|
}
|
|
|
|
exports.SemVer = SemVer
|
|
|
|
function SemVer (version, options) {
|
|
if (!options || typeof options !== 'object') {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
}
|
|
}
|
|
if (version instanceof SemVer) {
|
|
if (version.loose === options.loose) {
|
|
return version
|
|
} else {
|
|
version = version.version
|
|
}
|
|
} else if (typeof version !== 'string') {
|
|
throw new TypeError('Invalid Version: ' + version)
|
|
}
|
|
|
|
if (version.length > MAX_LENGTH) {
|
|
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
|
|
}
|
|
|
|
if (!(this instanceof SemVer)) {
|
|
return new SemVer(version, options)
|
|
}
|
|
|
|
debug('SemVer', version, options)
|
|
this.options = options
|
|
this.loose = !!options.loose
|
|
|
|
var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
|
|
|
|
if (!m) {
|
|
throw new TypeError('Invalid Version: ' + version)
|
|
}
|
|
|
|
this.raw = version
|
|
|
|
// these are actually numbers
|
|
this.major = +m[1]
|
|
this.minor = +m[2]
|
|
this.patch = +m[3]
|
|
|
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
throw new TypeError('Invalid major version')
|
|
}
|
|
|
|
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
throw new TypeError('Invalid minor version')
|
|
}
|
|
|
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
throw new TypeError('Invalid patch version')
|
|
}
|
|
|
|
// numberify any prerelease numeric ids
|
|
if (!m[4]) {
|
|
this.prerelease = []
|
|
} else {
|
|
this.prerelease = m[4].split('.').map(function (id) {
|
|
if (/^[0-9]+$/.test(id)) {
|
|
var num = +id
|
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
return num
|
|
}
|
|
}
|
|
return id
|
|
})
|
|
}
|
|
|
|
this.build = m[5] ? m[5].split('.') : []
|
|
this.format()
|
|
}
|
|
|
|
SemVer.prototype.format = function () {
|
|
this.version = this.major + '.' + this.minor + '.' + this.patch
|
|
if (this.prerelease.length) {
|
|
this.version += '-' + this.prerelease.join('.')
|
|
}
|
|
return this.version
|
|
}
|
|
|
|
SemVer.prototype.toString = function () {
|
|
return this.version
|
|
}
|
|
|
|
SemVer.prototype.compare = function (other) {
|
|
debug('SemVer.compare', this.version, this.options, other)
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options)
|
|
}
|
|
|
|
return this.compareMain(other) || this.comparePre(other)
|
|
}
|
|
|
|
SemVer.prototype.compareMain = function (other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options)
|
|
}
|
|
|
|
return compareIdentifiers(this.major, other.major) ||
|
|
compareIdentifiers(this.minor, other.minor) ||
|
|
compareIdentifiers(this.patch, other.patch)
|
|
}
|
|
|
|
SemVer.prototype.comparePre = function (other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options)
|
|
}
|
|
|
|
// NOT having a prerelease is > having one
|
|
if (this.prerelease.length && !other.prerelease.length) {
|
|
return -1
|
|
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
return 1
|
|
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
return 0
|
|
}
|
|
|
|
var i = 0
|
|
do {
|
|
var a = this.prerelease[i]
|
|
var b = other.prerelease[i]
|
|
debug('prerelease compare', i, a, b)
|
|
if (a === undefined && b === undefined) {
|
|
return 0
|
|
} else if (b === undefined) {
|
|
return 1
|
|
} else if (a === undefined) {
|
|
return -1
|
|
} else if (a === b) {
|
|
continue
|
|
} else {
|
|
return compareIdentifiers(a, b)
|
|
}
|
|
} while (++i)
|
|
}
|
|
|
|
SemVer.prototype.compareBuild = function (other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options)
|
|
}
|
|
|
|
var i = 0
|
|
do {
|
|
var a = this.build[i]
|
|
var b = other.build[i]
|
|
debug('prerelease compare', i, a, b)
|
|
if (a === undefined && b === undefined) {
|
|
return 0
|
|
} else if (b === undefined) {
|
|
return 1
|
|
} else if (a === undefined) {
|
|
return -1
|
|
} else if (a === b) {
|
|
continue
|
|
} else {
|
|
return compareIdentifiers(a, b)
|
|
}
|
|
} while (++i)
|
|
}
|
|
|
|
// preminor will bump the version up to the next minor release, and immediately
|
|
// down to pre-release. premajor and prepatch work the same way.
|
|
SemVer.prototype.inc = function (release, identifier) {
|
|
switch (release) {
|
|
case 'premajor':
|
|
this.prerelease.length = 0
|
|
this.patch = 0
|
|
this.minor = 0
|
|
this.major++
|
|
this.inc('pre', identifier)
|
|
break
|
|
case 'preminor':
|
|
this.prerelease.length = 0
|
|
this.patch = 0
|
|
this.minor++
|
|
this.inc('pre', identifier)
|
|
break
|
|
case 'prepatch':
|
|
// If this is already a prerelease, it will bump to the next version
|
|
// drop any prereleases that might already exist, since they are not
|
|
// relevant at this point.
|
|
this.prerelease.length = 0
|
|
this.inc('patch', identifier)
|
|
this.inc('pre', identifier)
|
|
break
|
|
// If the input is a non-prerelease version, this acts the same as
|
|
// prepatch.
|
|
case 'prerelease':
|
|
if (this.prerelease.length === 0) {
|
|
this.inc('patch', identifier)
|
|
}
|
|
this.inc('pre', identifier)
|
|
break
|
|
|
|
case 'major':
|
|
// If this is a pre-major version, bump up to the same major version.
|
|
// Otherwise increment major.
|
|
// 1.0.0-5 bumps to 1.0.0
|
|
// 1.1.0 bumps to 2.0.0
|
|
if (this.minor !== 0 ||
|
|
this.patch !== 0 ||
|
|
this.prerelease.length === 0) {
|
|
this.major++
|
|
}
|
|
this.minor = 0
|
|
this.patch = 0
|
|
this.prerelease = []
|
|
break
|
|
case 'minor':
|
|
// If this is a pre-minor version, bump up to the same minor version.
|
|
// Otherwise increment minor.
|
|
// 1.2.0-5 bumps to 1.2.0
|
|
// 1.2.1 bumps to 1.3.0
|
|
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
this.minor++
|
|
}
|
|
this.patch = 0
|
|
this.prerelease = []
|
|
break
|
|
case 'patch':
|
|
// If this is not a pre-release version, it will increment the patch.
|
|
// If it is a pre-release it will bump up to the same patch version.
|
|
// 1.2.0-5 patches to 1.2.0
|
|
// 1.2.0 patches to 1.2.1
|
|
if (this.prerelease.length === 0) {
|
|
this.patch++
|
|
}
|
|
this.prerelease = []
|
|
break
|
|
// This probably shouldn't be used publicly.
|
|
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
case 'pre':
|
|
if (this.prerelease.length === 0) {
|
|
this.prerelease = [0]
|
|
} else {
|
|
var i = this.prerelease.length
|
|
while (--i >= 0) {
|
|
if (typeof this.prerelease[i] === 'number') {
|
|
this.prerelease[i]++
|
|
i = -2
|
|
}
|
|
}
|
|
if (i === -1) {
|
|
// didn't increment anything
|
|
this.prerelease.push(0)
|
|
}
|
|
}
|
|
if (identifier) {
|
|
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
if (this.prerelease[0] === identifier) {
|
|
if (isNaN(this.prerelease[1])) {
|
|
this.prerelease = [identifier, 0]
|
|
}
|
|
} else {
|
|
this.prerelease = [identifier, 0]
|
|
}
|
|
}
|
|
break
|
|
|
|
default:
|
|
throw new Error('invalid increment argument: ' + release)
|
|
}
|
|
this.format()
|
|
this.raw = this.version
|
|
return this
|
|
}
|
|
|
|
exports.inc = inc
|
|
function inc (version, release, loose, identifier) {
|
|
if (typeof (loose) === 'string') {
|
|
identifier = loose
|
|
loose = undefined
|
|
}
|
|
|
|
try {
|
|
return new SemVer(version, loose).inc(release, identifier).version
|
|
} catch (er) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
exports.diff = diff
|
|
function diff (version1, version2) {
|
|
if (eq(version1, version2)) {
|
|
return null
|
|
} else {
|
|
var v1 = parse(version1)
|
|
var v2 = parse(version2)
|
|
var prefix = ''
|
|
if (v1.prerelease.length || v2.prerelease.length) {
|
|
prefix = 'pre'
|
|
var defaultResult = 'prerelease'
|
|
}
|
|
for (var key in v1) {
|
|
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
if (v1[key] !== v2[key]) {
|
|
return prefix + key
|
|
}
|
|
}
|
|
}
|
|
return defaultResult // may be undefined
|
|
}
|
|
}
|
|
|
|
exports.compareIdentifiers = compareIdentifiers
|
|
|
|
var numeric = /^[0-9]+$/
|
|
function compareIdentifiers (a, b) {
|
|
var anum = numeric.test(a)
|
|
var bnum = numeric.test(b)
|
|
|
|
if (anum && bnum) {
|
|
a = +a
|
|
b = +b
|
|
}
|
|
|
|
return a === b ? 0
|
|
: (anum && !bnum) ? -1
|
|
: (bnum && !anum) ? 1
|
|
: a < b ? -1
|
|
: 1
|
|
}
|
|
|
|
exports.rcompareIdentifiers = rcompareIdentifiers
|
|
function rcompareIdentifiers (a, b) {
|
|
return compareIdentifiers(b, a)
|
|
}
|
|
|
|
exports.major = major
|
|
function major (a, loose) {
|
|
return new SemVer(a, loose).major
|
|
}
|
|
|
|
exports.minor = minor
|
|
function minor (a, loose) {
|
|
return new SemVer(a, loose).minor
|
|
}
|
|
|
|
exports.patch = patch
|
|
function patch (a, loose) {
|
|
return new SemVer(a, loose).patch
|
|
}
|
|
|
|
exports.compare = compare
|
|
function compare (a, b, loose) {
|
|
return new SemVer(a, loose).compare(new SemVer(b, loose))
|
|
}
|
|
|
|
exports.compareLoose = compareLoose
|
|
function compareLoose (a, b) {
|
|
return compare(a, b, true)
|
|
}
|
|
|
|
exports.compareBuild = compareBuild
|
|
function compareBuild (a, b, loose) {
|
|
var versionA = new SemVer(a, loose)
|
|
var versionB = new SemVer(b, loose)
|
|
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
|
}
|
|
|
|
exports.rcompare = rcompare
|
|
function rcompare (a, b, loose) {
|
|
return compare(b, a, loose)
|
|
}
|
|
|
|
exports.sort = sort
|
|
function sort (list, loose) {
|
|
return list.sort(function (a, b) {
|
|
return exports.compareBuild(a, b, loose)
|
|
})
|
|
}
|
|
|
|
exports.rsort = rsort
|
|
function rsort (list, loose) {
|
|
return list.sort(function (a, b) {
|
|
return exports.compareBuild(b, a, loose)
|
|
})
|
|
}
|
|
|
|
exports.gt = gt
|
|
function gt (a, b, loose) {
|
|
return compare(a, b, loose) > 0
|
|
}
|
|
|
|
exports.lt = lt
|
|
function lt (a, b, loose) {
|
|
return compare(a, b, loose) < 0
|
|
}
|
|
|
|
exports.eq = eq
|
|
function eq (a, b, loose) {
|
|
return compare(a, b, loose) === 0
|
|
}
|
|
|
|
exports.neq = neq
|
|
function neq (a, b, loose) {
|
|
return compare(a, b, loose) !== 0
|
|
}
|
|
|
|
exports.gte = gte
|
|
function gte (a, b, loose) {
|
|
return compare(a, b, loose) >= 0
|
|
}
|
|
|
|
exports.lte = lte
|
|
function lte (a, b, loose) {
|
|
return compare(a, b, loose) <= 0
|
|
}
|
|
|
|
exports.cmp = cmp
|
|
function cmp (a, op, b, loose) {
|
|
switch (op) {
|
|
case '===':
|
|
if (typeof a === 'object')
|
|
a = a.version
|
|
if (typeof b === 'object')
|
|
b = b.version
|
|
return a === b
|
|
|
|
case '!==':
|
|
if (typeof a === 'object')
|
|
a = a.version
|
|
if (typeof b === 'object')
|
|
b = b.version
|
|
return a !== b
|
|
|
|
case '':
|
|
case '=':
|
|
case '==':
|
|
return eq(a, b, loose)
|
|
|
|
case '!=':
|
|
return neq(a, b, loose)
|
|
|
|
case '>':
|
|
return gt(a, b, loose)
|
|
|
|
case '>=':
|
|
return gte(a, b, loose)
|
|
|
|
case '<':
|
|
return lt(a, b, loose)
|
|
|
|
case '<=':
|
|
return lte(a, b, loose)
|
|
|
|
default:
|
|
throw new TypeError('Invalid operator: ' + op)
|
|
}
|
|
}
|
|
|
|
exports.Comparator = Comparator
|
|
function Comparator (comp, options) {
|
|
if (!options || typeof options !== 'object') {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
}
|
|
}
|
|
|
|
if (comp instanceof Comparator) {
|
|
if (comp.loose === !!options.loose) {
|
|
return comp
|
|
} else {
|
|
comp = comp.value
|
|
}
|
|
}
|
|
|
|
if (!(this instanceof Comparator)) {
|
|
return new Comparator(comp, options)
|
|
}
|
|
|
|
comp = comp.trim().split(/\s+/).join(' ')
|
|
debug('comparator', comp, options)
|
|
this.options = options
|
|
this.loose = !!options.loose
|
|
this.parse(comp)
|
|
|
|
if (this.semver === ANY) {
|
|
this.value = ''
|
|
} else {
|
|
this.value = this.operator + this.semver.version
|
|
}
|
|
|
|
debug('comp', this)
|
|
}
|
|
|
|
var ANY = {}
|
|
Comparator.prototype.parse = function (comp) {
|
|
var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
|
var m = comp.match(r)
|
|
|
|
if (!m) {
|
|
throw new TypeError('Invalid comparator: ' + comp)
|
|
}
|
|
|
|
this.operator = m[1] !== undefined ? m[1] : ''
|
|
if (this.operator === '=') {
|
|
this.operator = ''
|
|
}
|
|
|
|
// if it literally is just '>' or '' then allow anything.
|
|
if (!m[2]) {
|
|
this.semver = ANY
|
|
} else {
|
|
this.semver = new SemVer(m[2], this.options.loose)
|
|
}
|
|
}
|
|
|
|
Comparator.prototype.toString = function () {
|
|
return this.value
|
|
}
|
|
|
|
Comparator.prototype.test = function (version) {
|
|
debug('Comparator.test', version, this.options.loose)
|
|
|
|
if (this.semver === ANY || version === ANY) {
|
|
return true
|
|
}
|
|
|
|
if (typeof version === 'string') {
|
|
try {
|
|
version = new SemVer(version, this.options)
|
|
} catch (er) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return cmp(version, this.operator, this.semver, this.options)
|
|
}
|
|
|
|
Comparator.prototype.intersects = function (comp, options) {
|
|
if (!(comp instanceof Comparator)) {
|
|
throw new TypeError('a Comparator is required')
|
|
}
|
|
|
|
if (!options || typeof options !== 'object') {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
}
|
|
}
|
|
|
|
var rangeTmp
|
|
|
|
if (this.operator === '') {
|
|
if (this.value === '') {
|
|
return true
|
|
}
|
|
rangeTmp = new Range(comp.value, options)
|
|
return satisfies(this.value, rangeTmp, options)
|
|
} else if (comp.operator === '') {
|
|
if (comp.value === '') {
|
|
return true
|
|
}
|
|
rangeTmp = new Range(this.value, options)
|
|
return satisfies(comp.semver, rangeTmp, options)
|
|
}
|
|
|
|
var sameDirectionIncreasing =
|
|
(this.operator === '>=' || this.operator === '>') &&
|
|
(comp.operator === '>=' || comp.operator === '>')
|
|
var sameDirectionDecreasing =
|
|
(this.operator === '<=' || this.operator === '<') &&
|
|
(comp.operator === '<=' || comp.operator === '<')
|
|
var sameSemVer = this.semver.version === comp.semver.version
|
|
var differentDirectionsInclusive =
|
|
(this.operator === '>=' || this.operator === '<=') &&
|
|
(comp.operator === '>=' || comp.operator === '<=')
|
|
var oppositeDirectionsLessThan =
|
|
cmp(this.semver, '<', comp.semver, options) &&
|
|
((this.operator === '>=' || this.operator === '>') &&
|
|
(comp.operator === '<=' || comp.operator === '<'))
|
|
var oppositeDirectionsGreaterThan =
|
|
cmp(this.semver, '>', comp.semver, options) &&
|
|
((this.operator === '<=' || this.operator === '<') &&
|
|
(comp.operator === '>=' || comp.operator === '>'))
|
|
|
|
return sameDirectionIncreasing || sameDirectionDecreasing ||
|
|
(sameSemVer && differentDirectionsInclusive) ||
|
|
oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
|
|
}
|
|
|
|
exports.Range = Range
|
|
function Range (range, options) {
|
|
if (!options || typeof options !== 'object') {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
}
|
|
}
|
|
|
|
if (range instanceof Range) {
|
|
if (range.loose === !!options.loose &&
|
|
range.includePrerelease === !!options.includePrerelease) {
|
|
return range
|
|
} else {
|
|
return new Range(range.raw, options)
|
|
}
|
|
}
|
|
|
|
if (range instanceof Comparator) {
|
|
return new Range(range.value, options)
|
|
}
|
|
|
|
if (!(this instanceof Range)) {
|
|
return new Range(range, options)
|
|
}
|
|
|
|
this.options = options
|
|
this.loose = !!options.loose
|
|
this.includePrerelease = !!options.includePrerelease
|
|
|
|
// First reduce all whitespace as much as possible so we do not have to rely
|
|
// on potentially slow regexes like \s*. This is then stored and used for
|
|
// future error messages as well.
|
|
this.raw = range
|
|
.trim()
|
|
.split(/\s+/)
|
|
.join(' ')
|
|
|
|
// First, split based on boolean or ||
|
|
this.set = this.raw.split('||').map(function (range) {
|
|
return this.parseRange(range.trim())
|
|
}, this).filter(function (c) {
|
|
// throw out any that are not relevant for whatever reason
|
|
return c.length
|
|
})
|
|
|
|
if (!this.set.length) {
|
|
throw new TypeError('Invalid SemVer Range: ' + this.raw)
|
|
}
|
|
|
|
this.format()
|
|
}
|
|
|
|
Range.prototype.format = function () {
|
|
this.range = this.set.map(function (comps) {
|
|
return comps.join(' ').trim()
|
|
}).join('||').trim()
|
|
return this.range
|
|
}
|
|
|
|
Range.prototype.toString = function () {
|
|
return this.range
|
|
}
|
|
|
|
Range.prototype.parseRange = function (range) {
|
|
var loose = this.options.loose
|
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE]
|
|
range = range.replace(hr, hyphenReplace)
|
|
debug('hyphen replace', range)
|
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace)
|
|
debug('comparator trim', range, safeRe[t.COMPARATORTRIM])
|
|
|
|
// `~ 1.2.3` => `~1.2.3`
|
|
range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace)
|
|
|
|
// `^ 1.2.3` => `^1.2.3`
|
|
range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace)
|
|
|
|
// normalize spaces
|
|
range = range.split(/\s+/).join(' ')
|
|
|
|
// At this point, the range is completely trimmed and
|
|
// ready to be split into comparators.
|
|
|
|
var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
|
var set = range.split(' ').map(function (comp) {
|
|
return parseComparator(comp, this.options)
|
|
}, this).join(' ').split(/\s+/)
|
|
if (this.options.loose) {
|
|
// in loose mode, throw out any that are not valid comparators
|
|
set = set.filter(function (comp) {
|
|
return !!comp.match(compRe)
|
|
})
|
|
}
|
|
set = set.map(function (comp) {
|
|
return new Comparator(comp, this.options)
|
|
}, this)
|
|
|
|
return set
|
|
}
|
|
|
|
Range.prototype.intersects = function (range, options) {
|
|
if (!(range instanceof Range)) {
|
|
throw new TypeError('a Range is required')
|
|
}
|
|
|
|
return this.set.some(function (thisComparators) {
|
|
return (
|
|
isSatisfiable(thisComparators, options) &&
|
|
range.set.some(function (rangeComparators) {
|
|
return (
|
|
isSatisfiable(rangeComparators, options) &&
|
|
thisComparators.every(function (thisComparator) {
|
|
return rangeComparators.every(function (rangeComparator) {
|
|
return thisComparator.intersects(rangeComparator, options)
|
|
})
|
|
})
|
|
)
|
|
})
|
|
)
|
|
})
|
|
}
|
|
|
|
// take a set of comparators and determine whether there
|
|
// exists a version which can satisfy it
|
|
function isSatisfiable (comparators, options) {
|
|
var result = true
|
|
var remainingComparators = comparators.slice()
|
|
var testComparator = remainingComparators.pop()
|
|
|
|
while (result && remainingComparators.length) {
|
|
result = remainingComparators.every(function (otherComparator) {
|
|
return testComparator.intersects(otherComparator, options)
|
|
})
|
|
|
|
testComparator = remainingComparators.pop()
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
// Mostly just for testing and legacy API reasons
|
|
exports.toComparators = toComparators
|
|
function toComparators (range, options) {
|
|
return new Range(range, options).set.map(function (comp) {
|
|
return comp.map(function (c) {
|
|
return c.value
|
|
}).join(' ').trim().split(' ')
|
|
})
|
|
}
|
|
|
|
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
// already replaced the hyphen ranges
|
|
// turn into a set of JUST comparators.
|
|
function parseComparator (comp, options) {
|
|
debug('comp', comp, options)
|
|
comp = replaceCarets(comp, options)
|
|
debug('caret', comp)
|
|
comp = replaceTildes(comp, options)
|
|
debug('tildes', comp)
|
|
comp = replaceXRanges(comp, options)
|
|
debug('xrange', comp)
|
|
comp = replaceStars(comp, options)
|
|
debug('stars', comp)
|
|
return comp
|
|
}
|
|
|
|
function isX (id) {
|
|
return !id || id.toLowerCase() === 'x' || id === '*'
|
|
}
|
|
|
|
// ~, ~> --> * (any, kinda silly)
|
|
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
function replaceTildes (comp, options) {
|
|
return comp.trim().split(/\s+/).map(function (comp) {
|
|
return replaceTilde(comp, options)
|
|
}).join(' ')
|
|
}
|
|
|
|
function replaceTilde (comp, options) {
|
|
var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE]
|
|
return comp.replace(r, function (_, M, m, p, pr) {
|
|
debug('tilde', comp, _, M, m, p, pr)
|
|
var ret
|
|
|
|
if (isX(M)) {
|
|
ret = ''
|
|
} else if (isX(m)) {
|
|
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
|
|
} else if (isX(p)) {
|
|
// ~1.2 == >=1.2.0 <1.3.0
|
|
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
|
|
} else if (pr) {
|
|
debug('replaceTilde pr', pr)
|
|
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
' <' + M + '.' + (+m + 1) + '.0'
|
|
} else {
|
|
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
ret = '>=' + M + '.' + m + '.' + p +
|
|
' <' + M + '.' + (+m + 1) + '.0'
|
|
}
|
|
|
|
debug('tilde return', ret)
|
|
return ret
|
|
})
|
|
}
|
|
|
|
// ^ --> * (any, kinda silly)
|
|
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
|
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
|
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
|
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
function replaceCarets (comp, options) {
|
|
return comp.trim().split(/\s+/).map(function (comp) {
|
|
return replaceCaret(comp, options)
|
|
}).join(' ')
|
|
}
|
|
|
|
function replaceCaret (comp, options) {
|
|
debug('caret', comp, options)
|
|
var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET]
|
|
return comp.replace(r, function (_, M, m, p, pr) {
|
|
debug('caret', comp, _, M, m, p, pr)
|
|
var ret
|
|
|
|
if (isX(M)) {
|
|
ret = ''
|
|
} else if (isX(m)) {
|
|
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
|
|
} else if (isX(p)) {
|
|
if (M === '0') {
|
|
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
|
|
} else {
|
|
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'
|
|
}
|
|
} else if (pr) {
|
|
debug('replaceCaret pr', pr)
|
|
if (M === '0') {
|
|
if (m === '0') {
|
|
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
' <' + M + '.' + m + '.' + (+p + 1)
|
|
} else {
|
|
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
' <' + M + '.' + (+m + 1) + '.0'
|
|
}
|
|
} else {
|
|
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
' <' + (+M + 1) + '.0.0'
|
|
}
|
|
} else {
|
|
debug('no pr')
|
|
if (M === '0') {
|
|
if (m === '0') {
|
|
ret = '>=' + M + '.' + m + '.' + p +
|
|
' <' + M + '.' + m + '.' + (+p + 1)
|
|
} else {
|
|
ret = '>=' + M + '.' + m + '.' + p +
|
|
' <' + M + '.' + (+m + 1) + '.0'
|
|
}
|
|
} else {
|
|
ret = '>=' + M + '.' + m + '.' + p +
|
|
' <' + (+M + 1) + '.0.0'
|
|
}
|
|
}
|
|
|
|
debug('caret return', ret)
|
|
return ret
|
|
})
|
|
}
|
|
|
|
function replaceXRanges (comp, options) {
|
|
debug('replaceXRanges', comp, options)
|
|
return comp.split(/\s+/).map(function (comp) {
|
|
return replaceXRange(comp, options)
|
|
}).join(' ')
|
|
}
|
|
|
|
function replaceXRange (comp, options) {
|
|
comp = comp.trim()
|
|
var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE]
|
|
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
|
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
|
var xM = isX(M)
|
|
var xm = xM || isX(m)
|
|
var xp = xm || isX(p)
|
|
var anyX = xp
|
|
|
|
if (gtlt === '=' && anyX) {
|
|
gtlt = ''
|
|
}
|
|
|
|
// if we're including prereleases in the match, then we need
|
|
// to fix this to -0, the lowest possible prerelease value
|
|
pr = options.includePrerelease ? '-0' : ''
|
|
|
|
if (xM) {
|
|
if (gtlt === '>' || gtlt === '<') {
|
|
// nothing is allowed
|
|
ret = '<0.0.0-0'
|
|
} else {
|
|
// nothing is forbidden
|
|
ret = '*'
|
|
}
|
|
} else if (gtlt && anyX) {
|
|
// we know patch is an x, because we have any x at all.
|
|
// replace X with 0
|
|
if (xm) {
|
|
m = 0
|
|
}
|
|
p = 0
|
|
|
|
if (gtlt === '>') {
|
|
// >1 => >=2.0.0
|
|
// >1.2 => >=1.3.0
|
|
// >1.2.3 => >= 1.2.4
|
|
gtlt = '>='
|
|
if (xm) {
|
|
M = +M + 1
|
|
m = 0
|
|
p = 0
|
|
} else {
|
|
m = +m + 1
|
|
p = 0
|
|
}
|
|
} else if (gtlt === '<=') {
|
|
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
gtlt = '<'
|
|
if (xm) {
|
|
M = +M + 1
|
|
} else {
|
|
m = +m + 1
|
|
}
|
|
}
|
|
|
|
ret = gtlt + M + '.' + m + '.' + p + pr
|
|
} else if (xm) {
|
|
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr
|
|
} else if (xp) {
|
|
ret = '>=' + M + '.' + m + '.0' + pr +
|
|
' <' + M + '.' + (+m + 1) + '.0' + pr
|
|
}
|
|
|
|
debug('xRange return', ret)
|
|
|
|
return ret
|
|
})
|
|
}
|
|
|
|
// Because * is AND-ed with everything else in the comparator,
|
|
// and '' means "any version", just remove the *s entirely.
|
|
function replaceStars (comp, options) {
|
|
debug('replaceStars', comp, options)
|
|
// Looseness is ignored here. star is always as loose as it gets!
|
|
return comp.trim().replace(safeRe[t.STAR], '')
|
|
}
|
|
|
|
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
// M, m, patch, prerelease, build
|
|
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
|
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
|
function hyphenReplace ($0,
|
|
from, fM, fm, fp, fpr, fb,
|
|
to, tM, tm, tp, tpr, tb) {
|
|
if (isX(fM)) {
|
|
from = ''
|
|
} else if (isX(fm)) {
|
|
from = '>=' + fM + '.0.0'
|
|
} else if (isX(fp)) {
|
|
from = '>=' + fM + '.' + fm + '.0'
|
|
} else {
|
|
from = '>=' + from
|
|
}
|
|
|
|
if (isX(tM)) {
|
|
to = ''
|
|
} else if (isX(tm)) {
|
|
to = '<' + (+tM + 1) + '.0.0'
|
|
} else if (isX(tp)) {
|
|
to = '<' + tM + '.' + (+tm + 1) + '.0'
|
|
} else if (tpr) {
|
|
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr
|
|
} else {
|
|
to = '<=' + to
|
|
}
|
|
|
|
return (from + ' ' + to).trim()
|
|
}
|
|
|
|
// if ANY of the sets match ALL of its comparators, then pass
|
|
Range.prototype.test = function (version) {
|
|
if (!version) {
|
|
return false
|
|
}
|
|
|
|
if (typeof version === 'string') {
|
|
try {
|
|
version = new SemVer(version, this.options)
|
|
} catch (er) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < this.set.length; i++) {
|
|
if (testSet(this.set[i], version, this.options)) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
function testSet (set, version, options) {
|
|
for (var i = 0; i < set.length; i++) {
|
|
if (!set[i].test(version)) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
if (version.prerelease.length && !options.includePrerelease) {
|
|
// Find the set of versions that are allowed to have prereleases
|
|
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
// That should allow `1.2.3-pr.2` to pass.
|
|
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
// even though it's within the range set by the comparators.
|
|
for (i = 0; i < set.length; i++) {
|
|
debug(set[i].semver)
|
|
if (set[i].semver === ANY) {
|
|
continue
|
|
}
|
|
|
|
if (set[i].semver.prerelease.length > 0) {
|
|
var allowed = set[i].semver
|
|
if (allowed.major === version.major &&
|
|
allowed.minor === version.minor &&
|
|
allowed.patch === version.patch) {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
|
|
// Version has a -pre, but it's not one of the ones we like.
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
exports.satisfies = satisfies
|
|
function satisfies (version, range, options) {
|
|
try {
|
|
range = new Range(range, options)
|
|
} catch (er) {
|
|
return false
|
|
}
|
|
return range.test(version)
|
|
}
|
|
|
|
exports.maxSatisfying = maxSatisfying
|
|
function maxSatisfying (versions, range, options) {
|
|
var max = null
|
|
var maxSV = null
|
|
try {
|
|
var rangeObj = new Range(range, options)
|
|
} catch (er) {
|
|
return null
|
|
}
|
|
versions.forEach(function (v) {
|
|
if (rangeObj.test(v)) {
|
|
// satisfies(v, range, options)
|
|
if (!max || maxSV.compare(v) === -1) {
|
|
// compare(max, v, true)
|
|
max = v
|
|
maxSV = new SemVer(max, options)
|
|
}
|
|
}
|
|
})
|
|
return max
|
|
}
|
|
|
|
exports.minSatisfying = minSatisfying
|
|
function minSatisfying (versions, range, options) {
|
|
var min = null
|
|
var minSV = null
|
|
try {
|
|
var rangeObj = new Range(range, options)
|
|
} catch (er) {
|
|
return null
|
|
}
|
|
versions.forEach(function (v) {
|
|
if (rangeObj.test(v)) {
|
|
// satisfies(v, range, options)
|
|
if (!min || minSV.compare(v) === 1) {
|
|
// compare(min, v, true)
|
|
min = v
|
|
minSV = new SemVer(min, options)
|
|
}
|
|
}
|
|
})
|
|
return min
|
|
}
|
|
|
|
exports.minVersion = minVersion
|
|
function minVersion (range, loose) {
|
|
range = new Range(range, loose)
|
|
|
|
var minver = new SemVer('0.0.0')
|
|
if (range.test(minver)) {
|
|
return minver
|
|
}
|
|
|
|
minver = new SemVer('0.0.0-0')
|
|
if (range.test(minver)) {
|
|
return minver
|
|
}
|
|
|
|
minver = null
|
|
for (var i = 0; i < range.set.length; ++i) {
|
|
var comparators = range.set[i]
|
|
|
|
comparators.forEach(function (comparator) {
|
|
// Clone to avoid manipulating the comparator's semver object.
|
|
var compver = new SemVer(comparator.semver.version)
|
|
switch (comparator.operator) {
|
|
case '>':
|
|
if (compver.prerelease.length === 0) {
|
|
compver.patch++
|
|
} else {
|
|
compver.prerelease.push(0)
|
|
}
|
|
compver.raw = compver.format()
|
|
/* fallthrough */
|
|
case '':
|
|
case '>=':
|
|
if (!minver || gt(minver, compver)) {
|
|
minver = compver
|
|
}
|
|
break
|
|
case '<':
|
|
case '<=':
|
|
/* Ignore maximum versions */
|
|
break
|
|
/* istanbul ignore next */
|
|
default:
|
|
throw new Error('Unexpected operation: ' + comparator.operator)
|
|
}
|
|
})
|
|
}
|
|
|
|
if (minver && range.test(minver)) {
|
|
return minver
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
exports.validRange = validRange
|
|
function validRange (range, options) {
|
|
try {
|
|
// Return '*' instead of '' so that truthiness works.
|
|
// This will throw if it's invalid anyway
|
|
return new Range(range, options).range || '*'
|
|
} catch (er) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
// Determine if version is less than all the versions possible in the range
|
|
exports.ltr = ltr
|
|
function ltr (version, range, options) {
|
|
return outside(version, range, '<', options)
|
|
}
|
|
|
|
// Determine if version is greater than all the versions possible in the range.
|
|
exports.gtr = gtr
|
|
function gtr (version, range, options) {
|
|
return outside(version, range, '>', options)
|
|
}
|
|
|
|
exports.outside = outside
|
|
function outside (version, range, hilo, options) {
|
|
version = new SemVer(version, options)
|
|
range = new Range(range, options)
|
|
|
|
var gtfn, ltefn, ltfn, comp, ecomp
|
|
switch (hilo) {
|
|
case '>':
|
|
gtfn = gt
|
|
ltefn = lte
|
|
ltfn = lt
|
|
comp = '>'
|
|
ecomp = '>='
|
|
break
|
|
case '<':
|
|
gtfn = lt
|
|
ltefn = gte
|
|
ltfn = gt
|
|
comp = '<'
|
|
ecomp = '<='
|
|
break
|
|
default:
|
|
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
|
}
|
|
|
|
// If it satisifes the range it is not outside
|
|
if (satisfies(version, range, options)) {
|
|
return false
|
|
}
|
|
|
|
// From now on, variable terms are as if we're in "gtr" mode.
|
|
// but note that everything is flipped for the "ltr" function.
|
|
|
|
for (var i = 0; i < range.set.length; ++i) {
|
|
var comparators = range.set[i]
|
|
|
|
var high = null
|
|
var low = null
|
|
|
|
comparators.forEach(function (comparator) {
|
|
if (comparator.semver === ANY) {
|
|
comparator = new Comparator('>=0.0.0')
|
|
}
|
|
high = high || comparator
|
|
low = low || comparator
|
|
if (gtfn(comparator.semver, high.semver, options)) {
|
|
high = comparator
|
|
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
low = comparator
|
|
}
|
|
})
|
|
|
|
// If the edge version comparator has a operator then our version
|
|
// isn't outside it
|
|
if (high.operator === comp || high.operator === ecomp) {
|
|
return false
|
|
}
|
|
|
|
// If the lowest version comparator has an operator and our version
|
|
// is less than it then it isn't higher than the range
|
|
if ((!low.operator || low.operator === comp) &&
|
|
ltefn(version, low.semver)) {
|
|
return false
|
|
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
exports.prerelease = prerelease
|
|
function prerelease (version, options) {
|
|
var parsed = parse(version, options)
|
|
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
|
}
|
|
|
|
exports.intersects = intersects
|
|
function intersects (r1, r2, options) {
|
|
r1 = new Range(r1, options)
|
|
r2 = new Range(r2, options)
|
|
return r1.intersects(r2)
|
|
}
|
|
|
|
exports.coerce = coerce
|
|
function coerce (version, options) {
|
|
if (version instanceof SemVer) {
|
|
return version
|
|
}
|
|
|
|
if (typeof version === 'number') {
|
|
version = String(version)
|
|
}
|
|
|
|
if (typeof version !== 'string') {
|
|
return null
|
|
}
|
|
|
|
options = options || {}
|
|
|
|
var match = null
|
|
if (!options.rtl) {
|
|
match = version.match(safeRe[t.COERCE])
|
|
} else {
|
|
// Find the right-most coercible string that does not share
|
|
// a terminus with a more left-ward coercible string.
|
|
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
|
//
|
|
// Walk through the string checking with a /g regexp
|
|
// Manually set the index so as to pick up overlapping matches.
|
|
// Stop when we get a match that ends at the string end, since no
|
|
// coercible string can be more right-ward without the same terminus.
|
|
var next
|
|
while ((next = safeRe[t.COERCERTL].exec(version)) &&
|
|
(!match || match.index + match[0].length !== version.length)
|
|
) {
|
|
if (!match ||
|
|
next.index + next[0].length !== match.index + match[0].length) {
|
|
match = next
|
|
}
|
|
safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
|
}
|
|
// leave it in a clean state
|
|
safeRe[t.COERCERTL].lastIndex = -1
|
|
}
|
|
|
|
if (match === null) {
|
|
return null
|
|
}
|
|
|
|
return parse(match[2] +
|
|
'.' + (match[3] || '0') +
|
|
'.' + (match[4] || '0'), options)
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4878:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = (string, separator) => {
|
|
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
throw new TypeError('Expected the arguments to be of type `string`');
|
|
}
|
|
|
|
if (separator === '') {
|
|
return [string];
|
|
}
|
|
|
|
const separatorIndex = string.indexOf(separator);
|
|
|
|
if (separatorIndex === -1) {
|
|
return [string];
|
|
}
|
|
|
|
return [
|
|
string.slice(0, separatorIndex),
|
|
string.slice(separatorIndex + separator.length)
|
|
];
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3605:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
|
|
module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4841:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// 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.
|
|
|
|
|
|
|
|
/*<replacement>*/
|
|
|
|
var Buffer = (__nccwpck_require__(2279).Buffer);
|
|
/*</replacement>*/
|
|
|
|
var isEncoding = Buffer.isEncoding || function (encoding) {
|
|
encoding = '' + encoding;
|
|
switch (encoding && encoding.toLowerCase()) {
|
|
case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
};
|
|
|
|
function _normalizeEncoding(enc) {
|
|
if (!enc) return 'utf8';
|
|
var retried;
|
|
while (true) {
|
|
switch (enc) {
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
return 'utf8';
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return 'utf16le';
|
|
case 'latin1':
|
|
case 'binary':
|
|
return 'latin1';
|
|
case 'base64':
|
|
case 'ascii':
|
|
case 'hex':
|
|
return enc;
|
|
default:
|
|
if (retried) return; // undefined
|
|
enc = ('' + enc).toLowerCase();
|
|
retried = true;
|
|
}
|
|
}
|
|
};
|
|
|
|
// Do not cache `Buffer.isEncoding` when checking encoding names as some
|
|
// modules monkey-patch it to support additional encodings
|
|
function normalizeEncoding(enc) {
|
|
var nenc = _normalizeEncoding(enc);
|
|
if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
|
return nenc || enc;
|
|
}
|
|
|
|
// StringDecoder provides an interface for efficiently splitting a series of
|
|
// buffers into a series of JS strings without breaking apart multi-byte
|
|
// characters.
|
|
exports.s = StringDecoder;
|
|
function StringDecoder(encoding) {
|
|
this.encoding = normalizeEncoding(encoding);
|
|
var nb;
|
|
switch (this.encoding) {
|
|
case 'utf16le':
|
|
this.text = utf16Text;
|
|
this.end = utf16End;
|
|
nb = 4;
|
|
break;
|
|
case 'utf8':
|
|
this.fillLast = utf8FillLast;
|
|
nb = 4;
|
|
break;
|
|
case 'base64':
|
|
this.text = base64Text;
|
|
this.end = base64End;
|
|
nb = 3;
|
|
break;
|
|
default:
|
|
this.write = simpleWrite;
|
|
this.end = simpleEnd;
|
|
return;
|
|
}
|
|
this.lastNeed = 0;
|
|
this.lastTotal = 0;
|
|
this.lastChar = Buffer.allocUnsafe(nb);
|
|
}
|
|
|
|
StringDecoder.prototype.write = function (buf) {
|
|
if (buf.length === 0) return '';
|
|
var r;
|
|
var i;
|
|
if (this.lastNeed) {
|
|
r = this.fillLast(buf);
|
|
if (r === undefined) return '';
|
|
i = this.lastNeed;
|
|
this.lastNeed = 0;
|
|
} else {
|
|
i = 0;
|
|
}
|
|
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
|
return r || '';
|
|
};
|
|
|
|
StringDecoder.prototype.end = utf8End;
|
|
|
|
// Returns only complete characters in a Buffer
|
|
StringDecoder.prototype.text = utf8Text;
|
|
|
|
// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
|
StringDecoder.prototype.fillLast = function (buf) {
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
};
|
|
|
|
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
|
// continuation byte. If an invalid byte is detected, -2 is returned.
|
|
function utf8CheckByte(byte) {
|
|
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
|
return byte >> 6 === 0x02 ? -1 : -2;
|
|
}
|
|
|
|
// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
|
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
|
// needed to complete the UTF-8 character (if applicable) are returned.
|
|
function utf8CheckIncomplete(self, buf, i) {
|
|
var j = buf.length - 1;
|
|
if (j < i) return 0;
|
|
var nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 1;
|
|
return nb;
|
|
}
|
|
if (--j < i || nb === -2) return 0;
|
|
nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 2;
|
|
return nb;
|
|
}
|
|
if (--j < i || nb === -2) return 0;
|
|
nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) {
|
|
if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
|
}
|
|
return nb;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
|
// needed or are available. If we see a non-continuation byte where we expect
|
|
// one, we "replace" the validated continuation bytes we've seen so far with
|
|
// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
|
|
// behavior. The continuation byte check is included three times in the case
|
|
// where all of the continuation bytes for a character exist in the same buffer.
|
|
// It is also done this way as a slight performance increase instead of using a
|
|
// loop.
|
|
function utf8CheckExtraBytes(self, buf, p) {
|
|
if ((buf[0] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 0;
|
|
return '\ufffd';
|
|
}
|
|
if (self.lastNeed > 1 && buf.length > 1) {
|
|
if ((buf[1] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 1;
|
|
return '\ufffd';
|
|
}
|
|
if (self.lastNeed > 2 && buf.length > 2) {
|
|
if ((buf[2] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 2;
|
|
return '\ufffd';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
|
|
function utf8FillLast(buf) {
|
|
var p = this.lastTotal - this.lastNeed;
|
|
var r = utf8CheckExtraBytes(this, buf, p);
|
|
if (r !== undefined) return r;
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, p, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
}
|
|
|
|
// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
|
|
// partial character, the character's bytes are buffered until the required
|
|
// number of bytes are available.
|
|
function utf8Text(buf, i) {
|
|
var total = utf8CheckIncomplete(this, buf, i);
|
|
if (!this.lastNeed) return buf.toString('utf8', i);
|
|
this.lastTotal = total;
|
|
var end = buf.length - (total - this.lastNeed);
|
|
buf.copy(this.lastChar, 0, end);
|
|
return buf.toString('utf8', i, end);
|
|
}
|
|
|
|
// For UTF-8, a replacement character is added when ending on a partial
|
|
// character.
|
|
function utf8End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) return r + '\ufffd';
|
|
return r;
|
|
}
|
|
|
|
// UTF-16LE typically needs two bytes per character, but even if we have an even
|
|
// number of bytes available, we need to check if we end on a leading/high
|
|
// surrogate. In that case, we need to wait for the next two bytes in order to
|
|
// decode the last character properly.
|
|
function utf16Text(buf, i) {
|
|
if ((buf.length - i) % 2 === 0) {
|
|
var r = buf.toString('utf16le', i);
|
|
if (r) {
|
|
var c = r.charCodeAt(r.length - 1);
|
|
if (c >= 0xD800 && c <= 0xDBFF) {
|
|
this.lastNeed = 2;
|
|
this.lastTotal = 4;
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
return r.slice(0, -1);
|
|
}
|
|
}
|
|
return r;
|
|
}
|
|
this.lastNeed = 1;
|
|
this.lastTotal = 2;
|
|
this.lastChar[0] = buf[buf.length - 1];
|
|
return buf.toString('utf16le', i, buf.length - 1);
|
|
}
|
|
|
|
// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
// end on a partial character, we simply let v8 handle that.
|
|
function utf16End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) {
|
|
var end = this.lastTotal - this.lastNeed;
|
|
return r + this.lastChar.toString('utf16le', 0, end);
|
|
}
|
|
return r;
|
|
}
|
|
|
|
function base64Text(buf, i) {
|
|
var n = (buf.length - i) % 3;
|
|
if (n === 0) return buf.toString('base64', i);
|
|
this.lastNeed = 3 - n;
|
|
this.lastTotal = 3;
|
|
if (n === 1) {
|
|
this.lastChar[0] = buf[buf.length - 1];
|
|
} else {
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
}
|
|
return buf.toString('base64', i, buf.length - n);
|
|
}
|
|
|
|
function base64End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
|
return r;
|
|
}
|
|
|
|
// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
function simpleWrite(buf) {
|
|
return buf.toString(this.encoding);
|
|
}
|
|
|
|
function simpleEnd(buf) {
|
|
return buf && buf.length ? this.write(buf) : '';
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2279:
|
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|
|
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
/* eslint-disable node/no-deprecated-api */
|
|
var buffer = __nccwpck_require__(4300)
|
|
var Buffer = buffer.Buffer
|
|
|
|
// alternative to using Object.keys for old browsers
|
|
function copyProps (src, dst) {
|
|
for (var key in src) {
|
|
dst[key] = src[key]
|
|
}
|
|
}
|
|
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
module.exports = buffer
|
|
} else {
|
|
// Copy properties from require('buffer')
|
|
copyProps(buffer, exports)
|
|
exports.Buffer = SafeBuffer
|
|
}
|
|
|
|
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
return Buffer(arg, encodingOrOffset, length)
|
|
}
|
|
|
|
SafeBuffer.prototype = Object.create(Buffer.prototype)
|
|
|
|
// Copy static methods from Buffer
|
|
copyProps(Buffer, SafeBuffer)
|
|
|
|
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
if (typeof arg === 'number') {
|
|
throw new TypeError('Argument must not be a number')
|
|
}
|
|
return Buffer(arg, encodingOrOffset, length)
|
|
}
|
|
|
|
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('Argument must be a number')
|
|
}
|
|
var buf = Buffer(size)
|
|
if (fill !== undefined) {
|
|
if (typeof encoding === 'string') {
|
|
buf.fill(fill, encoding)
|
|
} else {
|
|
buf.fill(fill)
|
|
}
|
|
} else {
|
|
buf.fill(0)
|
|
}
|
|
return buf
|
|
}
|
|
|
|
SafeBuffer.allocUnsafe = function (size) {
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('Argument must be a number')
|
|
}
|
|
return Buffer(size)
|
|
}
|
|
|
|
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('Argument must be a number')
|
|
}
|
|
return buffer.SlowBuffer(size)
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4526:
|
|
/***/ ((module) => {
|
|
|
|
const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
|
|
// const octRegex = /0x[a-z0-9]+/;
|
|
// const binRegex = /0x[a-z0-9]+/;
|
|
|
|
|
|
//polyfill
|
|
if (!Number.parseInt && window.parseInt) {
|
|
Number.parseInt = window.parseInt;
|
|
}
|
|
if (!Number.parseFloat && window.parseFloat) {
|
|
Number.parseFloat = window.parseFloat;
|
|
}
|
|
|
|
|
|
const consider = {
|
|
hex : true,
|
|
leadingZeros: true,
|
|
decimalPoint: "\.",
|
|
eNotation: true
|
|
//skipLike: /regex/
|
|
};
|
|
|
|
function toNumber(str, options = {}){
|
|
// const options = Object.assign({}, consider);
|
|
// if(opt.leadingZeros === false){
|
|
// options.leadingZeros = false;
|
|
// }else if(opt.hex === false){
|
|
// options.hex = false;
|
|
// }
|
|
|
|
options = Object.assign({}, consider, options );
|
|
if(!str || typeof str !== "string" ) return str;
|
|
|
|
let trimmedStr = str.trim();
|
|
// if(trimmedStr === "0.0") return 0;
|
|
// else if(trimmedStr === "+0.0") return 0;
|
|
// else if(trimmedStr === "-0.0") return -0;
|
|
|
|
if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
|
|
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
return Number.parseInt(trimmedStr, 16);
|
|
// } else if (options.parseOct && octRegex.test(str)) {
|
|
// return Number.parseInt(val, 8);
|
|
// }else if (options.parseBin && binRegex.test(str)) {
|
|
// return Number.parseInt(val, 2);
|
|
}else{
|
|
//separate negative sign, leading zeros, and rest number
|
|
const match = numRegex.exec(trimmedStr);
|
|
if(match){
|
|
const sign = match[1];
|
|
const leadingZeros = match[2];
|
|
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
|
|
//trim ending zeros for floating number
|
|
|
|
const eNotation = match[4] || match[6];
|
|
if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
|
|
else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
|
|
else{//no leading zeros or leading zeros are allowed
|
|
const num = Number(trimmedStr);
|
|
const numStr = "" + num;
|
|
if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
|
|
if(options.eNotation) return num;
|
|
else return str;
|
|
}else if(eNotation){ //given number has enotation
|
|
if(options.eNotation) return num;
|
|
else return str;
|
|
}else if(trimmedStr.indexOf(".") !== -1){ //floating number
|
|
// const decimalPart = match[5].substr(1);
|
|
// const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
|
|
|
|
|
|
// const p = numStr.indexOf(".");
|
|
// const givenIntPart = numStr.substr(0,p);
|
|
// const givenDecPart = numStr.substr(p+1);
|
|
if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
|
|
else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
|
|
else if( sign && numStr === "-"+numTrimmedByZeros) return num;
|
|
else return str;
|
|
}
|
|
|
|
if(leadingZeros){
|
|
// if(numTrimmedByZeros === numStr){
|
|
// if(options.leadingZeros) return num;
|
|
// else return str;
|
|
// }else return str;
|
|
if(numTrimmedByZeros === numStr) return num;
|
|
else if(sign+numTrimmedByZeros === numStr) return num;
|
|
else return str;
|
|
}
|
|
|
|
if(trimmedStr === numStr) return num;
|
|
else if(trimmedStr === sign+numStr) return num;
|
|
// else{
|
|
// //number with +/- sign
|
|
// trimmedStr.test(/[-+][0-9]);
|
|
|
|
// }
|
|
return str;
|
|
}
|
|
// else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
|
|
|
|
}else{ //non-numeric string
|
|
return str;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {string} numStr without leading zeros
|
|
* @returns
|
|
*/
|
|
function trimZeros(numStr){
|
|
if(numStr && numStr.indexOf(".") !== -1){//float
|
|
numStr = numStr.replace(/0+$/, ""); //remove ending zeros
|
|
if(numStr === ".") numStr = "0";
|
|
else if(numStr[0] === ".") numStr = "0"+numStr;
|
|
else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1);
|
|
return numStr;
|
|
}
|
|
return numStr;
|
|
}
|
|
module.exports = toNumber
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8180:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
const { Transform } = __nccwpck_require__(1642)
|
|
|
|
function inherits (fn, sup) {
|
|
fn.super_ = sup
|
|
fn.prototype = Object.create(sup.prototype, {
|
|
constructor: { value: fn, enumerable: false, writable: true, configurable: true }
|
|
})
|
|
}
|
|
|
|
// create a new export function, used by both the main export and
|
|
// the .ctor export, contains common logic for dealing with arguments
|
|
function through2 (construct) {
|
|
return (options, transform, flush) => {
|
|
if (typeof options === 'function') {
|
|
flush = transform
|
|
transform = options
|
|
options = {}
|
|
}
|
|
|
|
if (typeof transform !== 'function') {
|
|
// noop
|
|
transform = (chunk, enc, cb) => cb(null, chunk)
|
|
}
|
|
|
|
if (typeof flush !== 'function') {
|
|
flush = null
|
|
}
|
|
|
|
return construct(options, transform, flush)
|
|
}
|
|
}
|
|
|
|
// main export, just make me a transform stream!
|
|
const make = through2((options, transform, flush) => {
|
|
const t2 = new Transform(options)
|
|
|
|
t2._transform = transform
|
|
|
|
if (flush) {
|
|
t2._flush = flush
|
|
}
|
|
|
|
return t2
|
|
})
|
|
|
|
// make me a reusable prototype that I can `new`, or implicitly `new`
|
|
// with a constructor call
|
|
const ctor = through2((options, transform, flush) => {
|
|
function Through2 (override) {
|
|
if (!(this instanceof Through2)) {
|
|
return new Through2(override)
|
|
}
|
|
|
|
this.options = Object.assign({}, options, override)
|
|
|
|
Transform.call(this, this.options)
|
|
|
|
this._transform = transform
|
|
if (flush) {
|
|
this._flush = flush
|
|
}
|
|
}
|
|
|
|
inherits(Through2, Transform)
|
|
|
|
return Through2
|
|
})
|
|
|
|
const obj = through2(function (options, transform, flush) {
|
|
const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options))
|
|
|
|
t2._transform = transform
|
|
|
|
if (flush) {
|
|
t2._flush = flush
|
|
}
|
|
|
|
return t2
|
|
})
|
|
|
|
module.exports = make
|
|
module.exports.ctor = ctor
|
|
module.exports.obj = obj
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4294:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
module.exports = __nccwpck_require__(4219);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4219:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
var net = __nccwpck_require__(1808);
|
|
var tls = __nccwpck_require__(4404);
|
|
var http = __nccwpck_require__(3685);
|
|
var https = __nccwpck_require__(5687);
|
|
var events = __nccwpck_require__(2361);
|
|
var assert = __nccwpck_require__(9491);
|
|
var util = __nccwpck_require__(3837);
|
|
|
|
|
|
exports.httpOverHttp = httpOverHttp;
|
|
exports.httpsOverHttp = httpsOverHttp;
|
|
exports.httpOverHttps = httpOverHttps;
|
|
exports.httpsOverHttps = httpsOverHttps;
|
|
|
|
|
|
function httpOverHttp(options) {
|
|
var agent = new TunnelingAgent(options);
|
|
agent.request = http.request;
|
|
return agent;
|
|
}
|
|
|
|
function httpsOverHttp(options) {
|
|
var agent = new TunnelingAgent(options);
|
|
agent.request = http.request;
|
|
agent.createSocket = createSecureSocket;
|
|
agent.defaultPort = 443;
|
|
return agent;
|
|
}
|
|
|
|
function httpOverHttps(options) {
|
|
var agent = new TunnelingAgent(options);
|
|
agent.request = https.request;
|
|
return agent;
|
|
}
|
|
|
|
function httpsOverHttps(options) {
|
|
var agent = new TunnelingAgent(options);
|
|
agent.request = https.request;
|
|
agent.createSocket = createSecureSocket;
|
|
agent.defaultPort = 443;
|
|
return agent;
|
|
}
|
|
|
|
|
|
function TunnelingAgent(options) {
|
|
var self = this;
|
|
self.options = options || {};
|
|
self.proxyOptions = self.options.proxy || {};
|
|
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
|
self.requests = [];
|
|
self.sockets = [];
|
|
|
|
self.on('free', function onFree(socket, host, port, localAddress) {
|
|
var options = toOptions(host, port, localAddress);
|
|
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
|
var pending = self.requests[i];
|
|
if (pending.host === options.host && pending.port === options.port) {
|
|
// Detect the request to connect same origin server,
|
|
// reuse the connection.
|
|
self.requests.splice(i, 1);
|
|
pending.request.onSocket(socket);
|
|
return;
|
|
}
|
|
}
|
|
socket.destroy();
|
|
self.removeSocket(socket);
|
|
});
|
|
}
|
|
util.inherits(TunnelingAgent, events.EventEmitter);
|
|
|
|
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
|
var self = this;
|
|
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
|
|
|
if (self.sockets.length >= this.maxSockets) {
|
|
// We are over limit so we'll add it to the queue.
|
|
self.requests.push(options);
|
|
return;
|
|
}
|
|
|
|
// If we are under maxSockets create a new one.
|
|
self.createSocket(options, function(socket) {
|
|
socket.on('free', onFree);
|
|
socket.on('close', onCloseOrRemove);
|
|
socket.on('agentRemove', onCloseOrRemove);
|
|
req.onSocket(socket);
|
|
|
|
function onFree() {
|
|
self.emit('free', socket, options);
|
|
}
|
|
|
|
function onCloseOrRemove(err) {
|
|
self.removeSocket(socket);
|
|
socket.removeListener('free', onFree);
|
|
socket.removeListener('close', onCloseOrRemove);
|
|
socket.removeListener('agentRemove', onCloseOrRemove);
|
|
}
|
|
});
|
|
};
|
|
|
|
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
|
var self = this;
|
|
var placeholder = {};
|
|
self.sockets.push(placeholder);
|
|
|
|
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
|
method: 'CONNECT',
|
|
path: options.host + ':' + options.port,
|
|
agent: false,
|
|
headers: {
|
|
host: options.host + ':' + options.port
|
|
}
|
|
});
|
|
if (options.localAddress) {
|
|
connectOptions.localAddress = options.localAddress;
|
|
}
|
|
if (connectOptions.proxyAuth) {
|
|
connectOptions.headers = connectOptions.headers || {};
|
|
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
|
new Buffer(connectOptions.proxyAuth).toString('base64');
|
|
}
|
|
|
|
debug('making CONNECT request');
|
|
var connectReq = self.request(connectOptions);
|
|
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
|
connectReq.once('response', onResponse); // for v0.6
|
|
connectReq.once('upgrade', onUpgrade); // for v0.6
|
|
connectReq.once('connect', onConnect); // for v0.7 or later
|
|
connectReq.once('error', onError);
|
|
connectReq.end();
|
|
|
|
function onResponse(res) {
|
|
// Very hacky. This is necessary to avoid http-parser leaks.
|
|
res.upgrade = true;
|
|
}
|
|
|
|
function onUpgrade(res, socket, head) {
|
|
// Hacky.
|
|
process.nextTick(function() {
|
|
onConnect(res, socket, head);
|
|
});
|
|
}
|
|
|
|
function onConnect(res, socket, head) {
|
|
connectReq.removeAllListeners();
|
|
socket.removeAllListeners();
|
|
|
|
if (res.statusCode !== 200) {
|
|
debug('tunneling socket could not be established, statusCode=%d',
|
|
res.statusCode);
|
|
socket.destroy();
|
|
var error = new Error('tunneling socket could not be established, ' +
|
|
'statusCode=' + res.statusCode);
|
|
error.code = 'ECONNRESET';
|
|
options.request.emit('error', error);
|
|
self.removeSocket(placeholder);
|
|
return;
|
|
}
|
|
if (head.length > 0) {
|
|
debug('got illegal response body from proxy');
|
|
socket.destroy();
|
|
var error = new Error('got illegal response body from proxy');
|
|
error.code = 'ECONNRESET';
|
|
options.request.emit('error', error);
|
|
self.removeSocket(placeholder);
|
|
return;
|
|
}
|
|
debug('tunneling connection has established');
|
|
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
|
return cb(socket);
|
|
}
|
|
|
|
function onError(cause) {
|
|
connectReq.removeAllListeners();
|
|
|
|
debug('tunneling socket could not be established, cause=%s\n',
|
|
cause.message, cause.stack);
|
|
var error = new Error('tunneling socket could not be established, ' +
|
|
'cause=' + cause.message);
|
|
error.code = 'ECONNRESET';
|
|
options.request.emit('error', error);
|
|
self.removeSocket(placeholder);
|
|
}
|
|
};
|
|
|
|
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
|
var pos = this.sockets.indexOf(socket)
|
|
if (pos === -1) {
|
|
return;
|
|
}
|
|
this.sockets.splice(pos, 1);
|
|
|
|
var pending = this.requests.shift();
|
|
if (pending) {
|
|
// If we have pending requests and a socket gets closed a new one
|
|
// needs to be created to take over in the pool for the one that closed.
|
|
this.createSocket(pending, function(socket) {
|
|
pending.request.onSocket(socket);
|
|
});
|
|
}
|
|
};
|
|
|
|
function createSecureSocket(options, cb) {
|
|
var self = this;
|
|
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
|
var hostHeader = options.request.getHeader('host');
|
|
var tlsOptions = mergeOptions({}, self.options, {
|
|
socket: socket,
|
|
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
|
});
|
|
|
|
// 0 is dummy port for v0.6
|
|
var secureSocket = tls.connect(0, tlsOptions);
|
|
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
|
cb(secureSocket);
|
|
});
|
|
}
|
|
|
|
|
|
function toOptions(host, port, localAddress) {
|
|
if (typeof host === 'string') { // since v0.10
|
|
return {
|
|
host: host,
|
|
port: port,
|
|
localAddress: localAddress
|
|
};
|
|
}
|
|
return host; // for v0.11 or later
|
|
}
|
|
|
|
function mergeOptions(target) {
|
|
for (var i = 1, len = arguments.length; i < len; ++i) {
|
|
var overrides = arguments[i];
|
|
if (typeof overrides === 'object') {
|
|
var keys = Object.keys(overrides);
|
|
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
|
var k = keys[j];
|
|
if (overrides[k] !== undefined) {
|
|
target[k] = overrides[k];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
|
|
|
|
var debug;
|
|
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|
debug = function() {
|
|
var args = Array.prototype.slice.call(arguments);
|
|
if (typeof args[0] === 'string') {
|
|
args[0] = 'TUNNEL: ' + args[0];
|
|
} else {
|
|
args.unshift('TUNNEL:');
|
|
}
|
|
console.error.apply(console, args);
|
|
}
|
|
} else {
|
|
debug = function() {};
|
|
}
|
|
exports.debug = debug; // for test
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7127:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
|
|
/**
|
|
* For Node.js, simply re-export the core `util.deprecate` function.
|
|
*/
|
|
|
|
module.exports = __nccwpck_require__(3837).deprecate;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2155:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var v1 = __nccwpck_require__(8749);
|
|
var v4 = __nccwpck_require__(824);
|
|
|
|
var uuid = v4;
|
|
uuid.v1 = v1;
|
|
uuid.v4 = v4;
|
|
|
|
module.exports = uuid;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2707:
|
|
/***/ ((module) => {
|
|
|
|
/**
|
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
*/
|
|
var byteToHex = [];
|
|
for (var i = 0; i < 256; ++i) {
|
|
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
}
|
|
|
|
function bytesToUuid(buf, offset) {
|
|
var i = offset || 0;
|
|
var bth = byteToHex;
|
|
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
return ([
|
|
bth[buf[i++]], bth[buf[i++]],
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
bth[buf[i++]], bth[buf[i++]],
|
|
bth[buf[i++]], bth[buf[i++]],
|
|
bth[buf[i++]], bth[buf[i++]]
|
|
]).join('');
|
|
}
|
|
|
|
module.exports = bytesToUuid;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5859:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
// Unique ID creation requires a high quality random # generator. In node.js
|
|
// this is pretty straight-forward - we use the crypto API.
|
|
|
|
var crypto = __nccwpck_require__(6113);
|
|
|
|
module.exports = function nodeRNG() {
|
|
return crypto.randomBytes(16);
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8749:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var rng = __nccwpck_require__(5859);
|
|
var bytesToUuid = __nccwpck_require__(2707);
|
|
|
|
// **`v1()` - Generate time-based UUID**
|
|
//
|
|
// Inspired by https://github.com/LiosK/UUID.js
|
|
// and http://docs.python.org/library/uuid.html
|
|
|
|
var _nodeId;
|
|
var _clockseq;
|
|
|
|
// Previous uuid creation time
|
|
var _lastMSecs = 0;
|
|
var _lastNSecs = 0;
|
|
|
|
// See https://github.com/uuidjs/uuid for API details
|
|
function v1(options, buf, offset) {
|
|
var i = buf && offset || 0;
|
|
var b = buf || [];
|
|
|
|
options = options || {};
|
|
var node = options.node || _nodeId;
|
|
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
|
|
// node and clockseq need to be initialized to random values if they're not
|
|
// specified. We do this lazily to minimize issues related to insufficient
|
|
// system entropy. See #189
|
|
if (node == null || clockseq == null) {
|
|
var seedBytes = rng();
|
|
if (node == null) {
|
|
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
node = _nodeId = [
|
|
seedBytes[0] | 0x01,
|
|
seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
|
|
];
|
|
}
|
|
if (clockseq == null) {
|
|
// Per 4.2.2, randomize (14 bit) clockseq
|
|
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
}
|
|
}
|
|
|
|
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
|
|
|
|
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
// cycle to simulate higher resolution clock
|
|
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
|
|
// Time since last uuid creation (in msecs)
|
|
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
|
|
|
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
if (dt < 0 && options.clockseq === undefined) {
|
|
clockseq = clockseq + 1 & 0x3fff;
|
|
}
|
|
|
|
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
// time interval
|
|
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
nsecs = 0;
|
|
}
|
|
|
|
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
if (nsecs >= 10000) {
|
|
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
|
}
|
|
|
|
_lastMSecs = msecs;
|
|
_lastNSecs = nsecs;
|
|
_clockseq = clockseq;
|
|
|
|
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
msecs += 12219292800000;
|
|
|
|
// `time_low`
|
|
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
b[i++] = tl >>> 24 & 0xff;
|
|
b[i++] = tl >>> 16 & 0xff;
|
|
b[i++] = tl >>> 8 & 0xff;
|
|
b[i++] = tl & 0xff;
|
|
|
|
// `time_mid`
|
|
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
|
b[i++] = tmh >>> 8 & 0xff;
|
|
b[i++] = tmh & 0xff;
|
|
|
|
// `time_high_and_version`
|
|
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
b[i++] = tmh >>> 16 & 0xff;
|
|
|
|
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
b[i++] = clockseq >>> 8 | 0x80;
|
|
|
|
// `clock_seq_low`
|
|
b[i++] = clockseq & 0xff;
|
|
|
|
// `node`
|
|
for (var n = 0; n < 6; ++n) {
|
|
b[i + n] = node[n];
|
|
}
|
|
|
|
return buf ? buf : bytesToUuid(b);
|
|
}
|
|
|
|
module.exports = v1;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 824:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var rng = __nccwpck_require__(5859);
|
|
var bytesToUuid = __nccwpck_require__(2707);
|
|
|
|
function v4(options, buf, offset) {
|
|
var i = buf && offset || 0;
|
|
|
|
if (typeof(options) == 'string') {
|
|
buf = options === 'binary' ? new Array(16) : null;
|
|
options = null;
|
|
}
|
|
options = options || {};
|
|
|
|
var rnds = options.random || (options.rng || rng)();
|
|
|
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
|
|
// Copy bytes to buffer, if provided
|
|
if (buf) {
|
|
for (var ii = 0; ii < 16; ++ii) {
|
|
buf[i + ii] = rnds[ii];
|
|
}
|
|
}
|
|
|
|
return buf || bytesToUuid(rnds);
|
|
}
|
|
|
|
module.exports = v4;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1430:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.TextEncoder =
|
|
typeof TextEncoder !== "undefined" ? TextEncoder : (__nccwpck_require__(3837).TextEncoder)
|
|
|
|
exports.TextDecoder =
|
|
typeof TextDecoder !== "undefined" ? TextDecoder : (__nccwpck_require__(3837).TextDecoder)
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4769:
|
|
/***/ ((module) => {
|
|
|
|
|
|
var XML_CHARACTER_MAP = {
|
|
'&': '&',
|
|
'"': '"',
|
|
"'": ''',
|
|
'<': '<',
|
|
'>': '>'
|
|
};
|
|
|
|
function escapeForXML(string) {
|
|
return string && string.replace
|
|
? string.replace(/([&"<>'])/g, function(str, item) {
|
|
return XML_CHARACTER_MAP[item];
|
|
})
|
|
: string;
|
|
}
|
|
|
|
module.exports = escapeForXML;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7578:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
var escapeForXML = __nccwpck_require__(4769);
|
|
var Stream = (__nccwpck_require__(2781).Stream);
|
|
|
|
var DEFAULT_INDENT = ' ';
|
|
|
|
function xml(input, options) {
|
|
|
|
if (typeof options !== 'object') {
|
|
options = {
|
|
indent: options
|
|
};
|
|
}
|
|
|
|
var stream = options.stream ? new Stream() : null,
|
|
output = "",
|
|
interrupted = false,
|
|
indent = !options.indent ? ''
|
|
: options.indent === true ? DEFAULT_INDENT
|
|
: options.indent,
|
|
instant = true;
|
|
|
|
|
|
function delay (func) {
|
|
if (!instant) {
|
|
func();
|
|
} else {
|
|
process.nextTick(func);
|
|
}
|
|
}
|
|
|
|
function append (interrupt, out) {
|
|
if (out !== undefined) {
|
|
output += out;
|
|
}
|
|
if (interrupt && !interrupted) {
|
|
stream = stream || new Stream();
|
|
interrupted = true;
|
|
}
|
|
if (interrupt && interrupted) {
|
|
var data = output;
|
|
delay(function () { stream.emit('data', data) });
|
|
output = "";
|
|
}
|
|
}
|
|
|
|
function add (value, last) {
|
|
format(append, resolve(value, indent, indent ? 1 : 0), last);
|
|
}
|
|
|
|
function end() {
|
|
if (stream) {
|
|
var data = output;
|
|
delay(function () {
|
|
stream.emit('data', data);
|
|
stream.emit('end');
|
|
stream.readable = false;
|
|
stream.emit('close');
|
|
});
|
|
}
|
|
}
|
|
|
|
function addXmlDeclaration(declaration) {
|
|
var encoding = declaration.encoding || 'UTF-8',
|
|
attr = { version: '1.0', encoding: encoding };
|
|
|
|
if (declaration.standalone) {
|
|
attr.standalone = declaration.standalone
|
|
}
|
|
|
|
add({'?xml': { _attr: attr } });
|
|
output = output.replace('/>', '?>');
|
|
}
|
|
|
|
// disable delay delayed
|
|
delay(function () { instant = false });
|
|
|
|
if (options.declaration) {
|
|
addXmlDeclaration(options.declaration);
|
|
}
|
|
|
|
if (input && input.forEach) {
|
|
input.forEach(function (value, i) {
|
|
var last;
|
|
if (i + 1 === input.length)
|
|
last = end;
|
|
add(value, last);
|
|
});
|
|
} else {
|
|
add(input, end);
|
|
}
|
|
|
|
if (stream) {
|
|
stream.readable = true;
|
|
return stream;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
function element (/*input, …*/) {
|
|
var input = Array.prototype.slice.call(arguments),
|
|
self = {
|
|
_elem: resolve(input)
|
|
};
|
|
|
|
self.push = function (input) {
|
|
if (!this.append) {
|
|
throw new Error("not assigned to a parent!");
|
|
}
|
|
var that = this;
|
|
var indent = this._elem.indent;
|
|
format(this.append, resolve(
|
|
input, indent, this._elem.icount + (indent ? 1 : 0)),
|
|
function () { that.append(true) });
|
|
};
|
|
|
|
self.close = function (input) {
|
|
if (input !== undefined) {
|
|
this.push(input);
|
|
}
|
|
if (this.end) {
|
|
this.end();
|
|
}
|
|
};
|
|
|
|
return self;
|
|
}
|
|
|
|
function create_indent(character, count) {
|
|
return (new Array(count || 0).join(character || ''))
|
|
}
|
|
|
|
function resolve(data, indent, indent_count) {
|
|
indent_count = indent_count || 0;
|
|
var indent_spaces = create_indent(indent, indent_count);
|
|
var name;
|
|
var values = data;
|
|
var interrupt = false;
|
|
|
|
if (typeof data === 'object') {
|
|
var keys = Object.keys(data);
|
|
name = keys[0];
|
|
values = data[name];
|
|
|
|
if (values && values._elem) {
|
|
values._elem.name = name;
|
|
values._elem.icount = indent_count;
|
|
values._elem.indent = indent;
|
|
values._elem.indents = indent_spaces;
|
|
values._elem.interrupt = values;
|
|
return values._elem;
|
|
}
|
|
}
|
|
|
|
var attributes = [],
|
|
content = [];
|
|
|
|
var isStringContent;
|
|
|
|
function get_attributes(obj){
|
|
var keys = Object.keys(obj);
|
|
keys.forEach(function(key){
|
|
attributes.push(attribute(key, obj[key]));
|
|
});
|
|
}
|
|
|
|
switch(typeof values) {
|
|
case 'object':
|
|
if (values === null) break;
|
|
|
|
if (values._attr) {
|
|
get_attributes(values._attr);
|
|
}
|
|
|
|
if (values._cdata) {
|
|
content.push(
|
|
('<![CDATA[' + values._cdata).replace(/\]\]>/g, ']]]]><![CDATA[>') + ']]>'
|
|
);
|
|
}
|
|
|
|
if (values.forEach) {
|
|
isStringContent = false;
|
|
content.push('');
|
|
values.forEach(function(value) {
|
|
if (typeof value == 'object') {
|
|
var _name = Object.keys(value)[0];
|
|
|
|
if (_name == '_attr') {
|
|
get_attributes(value._attr);
|
|
} else {
|
|
content.push(resolve(
|
|
value, indent, indent_count + 1));
|
|
}
|
|
} else {
|
|
//string
|
|
content.pop();
|
|
isStringContent=true;
|
|
content.push(escapeForXML(value));
|
|
}
|
|
|
|
});
|
|
if (!isStringContent) {
|
|
content.push('');
|
|
}
|
|
}
|
|
break;
|
|
|
|
default:
|
|
//string
|
|
content.push(escapeForXML(values));
|
|
|
|
}
|
|
|
|
return {
|
|
name: name,
|
|
interrupt: interrupt,
|
|
attributes: attributes,
|
|
content: content,
|
|
icount: indent_count,
|
|
indents: indent_spaces,
|
|
indent: indent
|
|
};
|
|
}
|
|
|
|
function format(append, elem, end) {
|
|
|
|
if (typeof elem != 'object') {
|
|
return append(false, elem);
|
|
}
|
|
|
|
var len = elem.interrupt ? 1 : elem.content.length;
|
|
|
|
function proceed () {
|
|
while (elem.content.length) {
|
|
var value = elem.content.shift();
|
|
|
|
if (value === undefined) continue;
|
|
if (interrupt(value)) return;
|
|
|
|
format(append, value);
|
|
}
|
|
|
|
append(false, (len > 1 ? elem.indents : '')
|
|
+ (elem.name ? '</' + elem.name + '>' : '')
|
|
+ (elem.indent && !end ? '\n' : ''));
|
|
|
|
if (end) {
|
|
end();
|
|
}
|
|
}
|
|
|
|
function interrupt(value) {
|
|
if (value.interrupt) {
|
|
value.interrupt.append = append;
|
|
value.interrupt.end = proceed;
|
|
value.interrupt = false;
|
|
append(true);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
append(false, elem.indents
|
|
+ (elem.name ? '<' + elem.name : '')
|
|
+ (elem.attributes.length ? ' ' + elem.attributes.join(' ') : '')
|
|
+ (len ? (elem.name ? '>' : '') : (elem.name ? '/>' : ''))
|
|
+ (elem.indent && len > 1 ? '\n' : ''));
|
|
|
|
if (!len) {
|
|
return append(false, elem.indent ? '\n' : '');
|
|
}
|
|
|
|
if (!interrupt(elem)) {
|
|
proceed();
|
|
}
|
|
}
|
|
|
|
function attribute(key, value) {
|
|
return key + '=' + '"' + escapeForXML(value) + '"';
|
|
}
|
|
|
|
module.exports = xml;
|
|
module.exports.element = module.exports.Element = element;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2624:
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
"use strict";
|
|
exports.stripBOM = function(str) {
|
|
if (str[0] === '\uFEFF') {
|
|
return str.substring(1);
|
|
} else {
|
|
return str;
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3337:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
"use strict";
|
|
var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
builder = __nccwpck_require__(2958);
|
|
|
|
defaults = (__nccwpck_require__(7251).defaults);
|
|
|
|
requiresCDATA = function(entry) {
|
|
return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
|
|
};
|
|
|
|
wrapCDATA = function(entry) {
|
|
return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
|
|
};
|
|
|
|
escapeCDATA = function(entry) {
|
|
return entry.replace(']]>', ']]]]><![CDATA[>');
|
|
};
|
|
|
|
exports.Builder = (function() {
|
|
function Builder(opts) {
|
|
var key, ref, value;
|
|
this.options = {};
|
|
ref = defaults["0.2"];
|
|
for (key in ref) {
|
|
if (!hasProp.call(ref, key)) continue;
|
|
value = ref[key];
|
|
this.options[key] = value;
|
|
}
|
|
for (key in opts) {
|
|
if (!hasProp.call(opts, key)) continue;
|
|
value = opts[key];
|
|
this.options[key] = value;
|
|
}
|
|
}
|
|
|
|
Builder.prototype.buildObject = function(rootObj) {
|
|
var attrkey, charkey, render, rootElement, rootName;
|
|
attrkey = this.options.attrkey;
|
|
charkey = this.options.charkey;
|
|
if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
|
|
rootName = Object.keys(rootObj)[0];
|
|
rootObj = rootObj[rootName];
|
|
} else {
|
|
rootName = this.options.rootName;
|
|
}
|
|
render = (function(_this) {
|
|
return function(element, obj) {
|
|
var attr, child, entry, index, key, value;
|
|
if (typeof obj !== 'object') {
|
|
if (_this.options.cdata && requiresCDATA(obj)) {
|
|
element.raw(wrapCDATA(obj));
|
|
} else {
|
|
element.txt(obj);
|
|
}
|
|
} else if (Array.isArray(obj)) {
|
|
for (index in obj) {
|
|
if (!hasProp.call(obj, index)) continue;
|
|
child = obj[index];
|
|
for (key in child) {
|
|
entry = child[key];
|
|
element = render(element.ele(key), entry).up();
|
|
}
|
|
}
|
|
} else {
|
|
for (key in obj) {
|
|
if (!hasProp.call(obj, key)) continue;
|
|
child = obj[key];
|
|
if (key === attrkey) {
|
|
if (typeof child === "object") {
|
|
for (attr in child) {
|
|
value = child[attr];
|
|
element = element.att(attr, value);
|
|
}
|
|
}
|
|
} else if (key === charkey) {
|
|
if (_this.options.cdata && requiresCDATA(child)) {
|
|
element = element.raw(wrapCDATA(child));
|
|
} else {
|
|
element = element.txt(child);
|
|
}
|
|
} else if (Array.isArray(child)) {
|
|
for (index in child) {
|
|
if (!hasProp.call(child, index)) continue;
|
|
entry = child[index];
|
|
if (typeof entry === 'string') {
|
|
if (_this.options.cdata && requiresCDATA(entry)) {
|
|
element = element.ele(key).raw(wrapCDATA(entry)).up();
|
|
} else {
|
|
element = element.ele(key, entry).up();
|
|
}
|
|
} else {
|
|
element = render(element.ele(key), entry).up();
|
|
}
|
|
}
|
|
} else if (typeof child === "object") {
|
|
element = render(element.ele(key), child).up();
|
|
} else {
|
|
if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
|
|
element = element.ele(key).raw(wrapCDATA(child)).up();
|
|
} else {
|
|
if (child == null) {
|
|
child = '';
|
|
}
|
|
element = element.ele(key, child.toString()).up();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return element;
|
|
};
|
|
})(this);
|
|
rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
|
|
headless: this.options.headless,
|
|
allowSurrogateChars: this.options.allowSurrogateChars
|
|
});
|
|
return render(rootElement, rootObj).end(this.options.renderOpts);
|
|
};
|
|
|
|
return Builder;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7251:
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
exports.defaults = {
|
|
"0.1": {
|
|
explicitCharkey: false,
|
|
trim: true,
|
|
normalize: true,
|
|
normalizeTags: false,
|
|
attrkey: "@",
|
|
charkey: "#",
|
|
explicitArray: false,
|
|
ignoreAttrs: false,
|
|
mergeAttrs: false,
|
|
explicitRoot: false,
|
|
validator: null,
|
|
xmlns: false,
|
|
explicitChildren: false,
|
|
childkey: '@@',
|
|
charsAsChildren: false,
|
|
includeWhiteChars: false,
|
|
async: false,
|
|
strict: true,
|
|
attrNameProcessors: null,
|
|
attrValueProcessors: null,
|
|
tagNameProcessors: null,
|
|
valueProcessors: null,
|
|
emptyTag: ''
|
|
},
|
|
"0.2": {
|
|
explicitCharkey: false,
|
|
trim: false,
|
|
normalize: false,
|
|
normalizeTags: false,
|
|
attrkey: "$",
|
|
charkey: "_",
|
|
explicitArray: true,
|
|
ignoreAttrs: false,
|
|
mergeAttrs: false,
|
|
explicitRoot: true,
|
|
validator: null,
|
|
xmlns: false,
|
|
explicitChildren: false,
|
|
preserveChildrenOrder: false,
|
|
childkey: '$$',
|
|
charsAsChildren: false,
|
|
includeWhiteChars: false,
|
|
async: false,
|
|
strict: true,
|
|
attrNameProcessors: null,
|
|
attrValueProcessors: null,
|
|
tagNameProcessors: null,
|
|
valueProcessors: null,
|
|
rootName: 'root',
|
|
xmldec: {
|
|
'version': '1.0',
|
|
'encoding': 'UTF-8',
|
|
'standalone': true
|
|
},
|
|
doctype: null,
|
|
renderOpts: {
|
|
'pretty': true,
|
|
'indent': ' ',
|
|
'newline': '\n'
|
|
},
|
|
headless: false,
|
|
chunkSize: 10000,
|
|
emptyTag: '',
|
|
cdata: false
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3314:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
"use strict";
|
|
var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
|
|
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
sax = __nccwpck_require__(2043);
|
|
|
|
events = __nccwpck_require__(2361);
|
|
|
|
bom = __nccwpck_require__(2624);
|
|
|
|
processors = __nccwpck_require__(9236);
|
|
|
|
setImmediate = (__nccwpck_require__(9512).setImmediate);
|
|
|
|
defaults = (__nccwpck_require__(7251).defaults);
|
|
|
|
isEmpty = function(thing) {
|
|
return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
|
|
};
|
|
|
|
processItem = function(processors, item, key) {
|
|
var i, len, process;
|
|
for (i = 0, len = processors.length; i < len; i++) {
|
|
process = processors[i];
|
|
item = process(item, key);
|
|
}
|
|
return item;
|
|
};
|
|
|
|
exports.Parser = (function(superClass) {
|
|
extend(Parser, superClass);
|
|
|
|
function Parser(opts) {
|
|
this.parseStringPromise = bind(this.parseStringPromise, this);
|
|
this.parseString = bind(this.parseString, this);
|
|
this.reset = bind(this.reset, this);
|
|
this.assignOrPush = bind(this.assignOrPush, this);
|
|
this.processAsync = bind(this.processAsync, this);
|
|
var key, ref, value;
|
|
if (!(this instanceof exports.Parser)) {
|
|
return new exports.Parser(opts);
|
|
}
|
|
this.options = {};
|
|
ref = defaults["0.2"];
|
|
for (key in ref) {
|
|
if (!hasProp.call(ref, key)) continue;
|
|
value = ref[key];
|
|
this.options[key] = value;
|
|
}
|
|
for (key in opts) {
|
|
if (!hasProp.call(opts, key)) continue;
|
|
value = opts[key];
|
|
this.options[key] = value;
|
|
}
|
|
if (this.options.xmlns) {
|
|
this.options.xmlnskey = this.options.attrkey + "ns";
|
|
}
|
|
if (this.options.normalizeTags) {
|
|
if (!this.options.tagNameProcessors) {
|
|
this.options.tagNameProcessors = [];
|
|
}
|
|
this.options.tagNameProcessors.unshift(processors.normalize);
|
|
}
|
|
this.reset();
|
|
}
|
|
|
|
Parser.prototype.processAsync = function() {
|
|
var chunk, err;
|
|
try {
|
|
if (this.remaining.length <= this.options.chunkSize) {
|
|
chunk = this.remaining;
|
|
this.remaining = '';
|
|
this.saxParser = this.saxParser.write(chunk);
|
|
return this.saxParser.close();
|
|
} else {
|
|
chunk = this.remaining.substr(0, this.options.chunkSize);
|
|
this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
|
|
this.saxParser = this.saxParser.write(chunk);
|
|
return setImmediate(this.processAsync);
|
|
}
|
|
} catch (error1) {
|
|
err = error1;
|
|
if (!this.saxParser.errThrown) {
|
|
this.saxParser.errThrown = true;
|
|
return this.emit(err);
|
|
}
|
|
}
|
|
};
|
|
|
|
Parser.prototype.assignOrPush = function(obj, key, newValue) {
|
|
if (!(key in obj)) {
|
|
if (!this.options.explicitArray) {
|
|
return obj[key] = newValue;
|
|
} else {
|
|
return obj[key] = [newValue];
|
|
}
|
|
} else {
|
|
if (!(obj[key] instanceof Array)) {
|
|
obj[key] = [obj[key]];
|
|
}
|
|
return obj[key].push(newValue);
|
|
}
|
|
};
|
|
|
|
Parser.prototype.reset = function() {
|
|
var attrkey, charkey, ontext, stack;
|
|
this.removeAllListeners();
|
|
this.saxParser = sax.parser(this.options.strict, {
|
|
trim: false,
|
|
normalize: false,
|
|
xmlns: this.options.xmlns
|
|
});
|
|
this.saxParser.errThrown = false;
|
|
this.saxParser.onerror = (function(_this) {
|
|
return function(error) {
|
|
_this.saxParser.resume();
|
|
if (!_this.saxParser.errThrown) {
|
|
_this.saxParser.errThrown = true;
|
|
return _this.emit("error", error);
|
|
}
|
|
};
|
|
})(this);
|
|
this.saxParser.onend = (function(_this) {
|
|
return function() {
|
|
if (!_this.saxParser.ended) {
|
|
_this.saxParser.ended = true;
|
|
return _this.emit("end", _this.resultObject);
|
|
}
|
|
};
|
|
})(this);
|
|
this.saxParser.ended = false;
|
|
this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
|
|
this.resultObject = null;
|
|
stack = [];
|
|
attrkey = this.options.attrkey;
|
|
charkey = this.options.charkey;
|
|
this.saxParser.onopentag = (function(_this) {
|
|
return function(node) {
|
|
var key, newValue, obj, processedKey, ref;
|
|
obj = Object.create(null);
|
|
obj[charkey] = "";
|
|
if (!_this.options.ignoreAttrs) {
|
|
ref = node.attributes;
|
|
for (key in ref) {
|
|
if (!hasProp.call(ref, key)) continue;
|
|
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
|
|
obj[attrkey] = Object.create(null);
|
|
}
|
|
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
|
|
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
|
|
if (_this.options.mergeAttrs) {
|
|
_this.assignOrPush(obj, processedKey, newValue);
|
|
} else {
|
|
obj[attrkey][processedKey] = newValue;
|
|
}
|
|
}
|
|
}
|
|
obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
|
|
if (_this.options.xmlns) {
|
|
obj[_this.options.xmlnskey] = {
|
|
uri: node.uri,
|
|
local: node.local
|
|
};
|
|
}
|
|
return stack.push(obj);
|
|
};
|
|
})(this);
|
|
this.saxParser.onclosetag = (function(_this) {
|
|
return function() {
|
|
var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
|
|
obj = stack.pop();
|
|
nodeName = obj["#name"];
|
|
if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
|
|
delete obj["#name"];
|
|
}
|
|
if (obj.cdata === true) {
|
|
cdata = obj.cdata;
|
|
delete obj.cdata;
|
|
}
|
|
s = stack[stack.length - 1];
|
|
if (obj[charkey].match(/^\s*$/) && !cdata) {
|
|
emptyStr = obj[charkey];
|
|
delete obj[charkey];
|
|
} else {
|
|
if (_this.options.trim) {
|
|
obj[charkey] = obj[charkey].trim();
|
|
}
|
|
if (_this.options.normalize) {
|
|
obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
|
|
}
|
|
obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
|
|
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
|
obj = obj[charkey];
|
|
}
|
|
}
|
|
if (isEmpty(obj)) {
|
|
if (typeof _this.options.emptyTag === 'function') {
|
|
obj = _this.options.emptyTag();
|
|
} else {
|
|
obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
|
|
}
|
|
}
|
|
if (_this.options.validator != null) {
|
|
xpath = "/" + ((function() {
|
|
var i, len, results;
|
|
results = [];
|
|
for (i = 0, len = stack.length; i < len; i++) {
|
|
node = stack[i];
|
|
results.push(node["#name"]);
|
|
}
|
|
return results;
|
|
})()).concat(nodeName).join("/");
|
|
(function() {
|
|
var err;
|
|
try {
|
|
return obj = _this.options.validator(xpath, s && s[nodeName], obj);
|
|
} catch (error1) {
|
|
err = error1;
|
|
return _this.emit("error", err);
|
|
}
|
|
})();
|
|
}
|
|
if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
|
|
if (!_this.options.preserveChildrenOrder) {
|
|
node = Object.create(null);
|
|
if (_this.options.attrkey in obj) {
|
|
node[_this.options.attrkey] = obj[_this.options.attrkey];
|
|
delete obj[_this.options.attrkey];
|
|
}
|
|
if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
|
|
node[_this.options.charkey] = obj[_this.options.charkey];
|
|
delete obj[_this.options.charkey];
|
|
}
|
|
if (Object.getOwnPropertyNames(obj).length > 0) {
|
|
node[_this.options.childkey] = obj;
|
|
}
|
|
obj = node;
|
|
} else if (s) {
|
|
s[_this.options.childkey] = s[_this.options.childkey] || [];
|
|
objClone = Object.create(null);
|
|
for (key in obj) {
|
|
if (!hasProp.call(obj, key)) continue;
|
|
objClone[key] = obj[key];
|
|
}
|
|
s[_this.options.childkey].push(objClone);
|
|
delete obj["#name"];
|
|
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
|
obj = obj[charkey];
|
|
}
|
|
}
|
|
}
|
|
if (stack.length > 0) {
|
|
return _this.assignOrPush(s, nodeName, obj);
|
|
} else {
|
|
if (_this.options.explicitRoot) {
|
|
old = obj;
|
|
obj = Object.create(null);
|
|
obj[nodeName] = old;
|
|
}
|
|
_this.resultObject = obj;
|
|
_this.saxParser.ended = true;
|
|
return _this.emit("end", _this.resultObject);
|
|
}
|
|
};
|
|
})(this);
|
|
ontext = (function(_this) {
|
|
return function(text) {
|
|
var charChild, s;
|
|
s = stack[stack.length - 1];
|
|
if (s) {
|
|
s[charkey] += text;
|
|
if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
|
|
s[_this.options.childkey] = s[_this.options.childkey] || [];
|
|
charChild = {
|
|
'#name': '__text__'
|
|
};
|
|
charChild[charkey] = text;
|
|
if (_this.options.normalize) {
|
|
charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
|
|
}
|
|
s[_this.options.childkey].push(charChild);
|
|
}
|
|
return s;
|
|
}
|
|
};
|
|
})(this);
|
|
this.saxParser.ontext = ontext;
|
|
return this.saxParser.oncdata = (function(_this) {
|
|
return function(text) {
|
|
var s;
|
|
s = ontext(text);
|
|
if (s) {
|
|
return s.cdata = true;
|
|
}
|
|
};
|
|
})(this);
|
|
};
|
|
|
|
Parser.prototype.parseString = function(str, cb) {
|
|
var err;
|
|
if ((cb != null) && typeof cb === "function") {
|
|
this.on("end", function(result) {
|
|
this.reset();
|
|
return cb(null, result);
|
|
});
|
|
this.on("error", function(err) {
|
|
this.reset();
|
|
return cb(err);
|
|
});
|
|
}
|
|
try {
|
|
str = str.toString();
|
|
if (str.trim() === '') {
|
|
this.emit("end", null);
|
|
return true;
|
|
}
|
|
str = bom.stripBOM(str);
|
|
if (this.options.async) {
|
|
this.remaining = str;
|
|
setImmediate(this.processAsync);
|
|
return this.saxParser;
|
|
}
|
|
return this.saxParser.write(str).close();
|
|
} catch (error1) {
|
|
err = error1;
|
|
if (!(this.saxParser.errThrown || this.saxParser.ended)) {
|
|
this.emit('error', err);
|
|
return this.saxParser.errThrown = true;
|
|
} else if (this.saxParser.ended) {
|
|
throw err;
|
|
}
|
|
}
|
|
};
|
|
|
|
Parser.prototype.parseStringPromise = function(str) {
|
|
return new Promise((function(_this) {
|
|
return function(resolve, reject) {
|
|
return _this.parseString(str, function(err, value) {
|
|
if (err) {
|
|
return reject(err);
|
|
} else {
|
|
return resolve(value);
|
|
}
|
|
});
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
return Parser;
|
|
|
|
})(events);
|
|
|
|
exports.parseString = function(str, a, b) {
|
|
var cb, options, parser;
|
|
if (b != null) {
|
|
if (typeof b === 'function') {
|
|
cb = b;
|
|
}
|
|
if (typeof a === 'object') {
|
|
options = a;
|
|
}
|
|
} else {
|
|
if (typeof a === 'function') {
|
|
cb = a;
|
|
}
|
|
options = {};
|
|
}
|
|
parser = new exports.Parser(options);
|
|
return parser.parseString(str, cb);
|
|
};
|
|
|
|
exports.parseStringPromise = function(str, a) {
|
|
var options, parser;
|
|
if (typeof a === 'object') {
|
|
options = a;
|
|
}
|
|
parser = new exports.Parser(options);
|
|
return parser.parseStringPromise(str);
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9236:
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
"use strict";
|
|
var prefixMatch;
|
|
|
|
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
|
|
|
|
exports.normalize = function(str) {
|
|
return str.toLowerCase();
|
|
};
|
|
|
|
exports.firstCharLowerCase = function(str) {
|
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
};
|
|
|
|
exports.stripPrefix = function(str) {
|
|
return str.replace(prefixMatch, '');
|
|
};
|
|
|
|
exports.parseNumbers = function(str) {
|
|
if (!isNaN(str)) {
|
|
str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
|
|
}
|
|
return str;
|
|
};
|
|
|
|
exports.parseBooleans = function(str) {
|
|
if (/^(?:true|false)$/i.test(str)) {
|
|
str = str.toLowerCase() === 'true';
|
|
}
|
|
return str;
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6189:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
"use strict";
|
|
var builder, defaults, parser, processors,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
defaults = __nccwpck_require__(7251);
|
|
|
|
builder = __nccwpck_require__(3337);
|
|
|
|
parser = __nccwpck_require__(3314);
|
|
|
|
processors = __nccwpck_require__(9236);
|
|
|
|
exports.defaults = defaults.defaults;
|
|
|
|
exports.processors = processors;
|
|
|
|
exports.ValidationError = (function(superClass) {
|
|
extend(ValidationError, superClass);
|
|
|
|
function ValidationError(message) {
|
|
this.message = message;
|
|
}
|
|
|
|
return ValidationError;
|
|
|
|
})(Error);
|
|
|
|
exports.Builder = builder.Builder;
|
|
|
|
exports.Parser = parser.Parser;
|
|
|
|
exports.parseString = parser.parseString;
|
|
|
|
exports.parseStringPromise = parser.parseStringPromise;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2839:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
module.exports = {
|
|
Disconnected: 1,
|
|
Preceding: 2,
|
|
Following: 4,
|
|
Contains: 8,
|
|
ContainedBy: 16,
|
|
ImplementationSpecific: 32
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9267:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
module.exports = {
|
|
Element: 1,
|
|
Attribute: 2,
|
|
Text: 3,
|
|
CData: 4,
|
|
EntityReference: 5,
|
|
EntityDeclaration: 6,
|
|
ProcessingInstruction: 7,
|
|
Comment: 8,
|
|
Document: 9,
|
|
DocType: 10,
|
|
DocumentFragment: 11,
|
|
NotationDeclaration: 12,
|
|
Declaration: 201,
|
|
Raw: 202,
|
|
AttributeDeclaration: 203,
|
|
ElementDeclaration: 204,
|
|
Dummy: 205
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8229:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
|
|
slice = [].slice,
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
assign = function() {
|
|
var i, key, len, source, sources, target;
|
|
target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
|
if (isFunction(Object.assign)) {
|
|
Object.assign.apply(null, arguments);
|
|
} else {
|
|
for (i = 0, len = sources.length; i < len; i++) {
|
|
source = sources[i];
|
|
if (source != null) {
|
|
for (key in source) {
|
|
if (!hasProp.call(source, key)) continue;
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return target;
|
|
};
|
|
|
|
isFunction = function(val) {
|
|
return !!val && Object.prototype.toString.call(val) === '[object Function]';
|
|
};
|
|
|
|
isObject = function(val) {
|
|
var ref;
|
|
return !!val && ((ref = typeof val) === 'function' || ref === 'object');
|
|
};
|
|
|
|
isArray = function(val) {
|
|
if (isFunction(Array.isArray)) {
|
|
return Array.isArray(val);
|
|
} else {
|
|
return Object.prototype.toString.call(val) === '[object Array]';
|
|
}
|
|
};
|
|
|
|
isEmpty = function(val) {
|
|
var key;
|
|
if (isArray(val)) {
|
|
return !val.length;
|
|
} else {
|
|
for (key in val) {
|
|
if (!hasProp.call(val, key)) continue;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
|
|
isPlainObject = function(val) {
|
|
var ctor, proto;
|
|
return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
|
|
};
|
|
|
|
getValue = function(obj) {
|
|
if (isFunction(obj.valueOf)) {
|
|
return obj.valueOf();
|
|
} else {
|
|
return obj;
|
|
}
|
|
};
|
|
|
|
module.exports.assign = assign;
|
|
|
|
module.exports.isFunction = isFunction;
|
|
|
|
module.exports.isObject = isObject;
|
|
|
|
module.exports.isArray = isArray;
|
|
|
|
module.exports.isEmpty = isEmpty;
|
|
|
|
module.exports.isPlainObject = isPlainObject;
|
|
|
|
module.exports.getValue = getValue;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9766:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
module.exports = {
|
|
None: 0,
|
|
OpenTag: 1,
|
|
InsideTag: 2,
|
|
CloseTag: 3
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8376:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLAttribute, XMLNode;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
module.exports = XMLAttribute = (function() {
|
|
function XMLAttribute(parent, name, value) {
|
|
this.parent = parent;
|
|
if (this.parent) {
|
|
this.options = this.parent.options;
|
|
this.stringify = this.parent.stringify;
|
|
}
|
|
if (name == null) {
|
|
throw new Error("Missing attribute name. " + this.debugInfo(name));
|
|
}
|
|
this.name = this.stringify.name(name);
|
|
this.value = this.stringify.attValue(value);
|
|
this.type = NodeType.Attribute;
|
|
this.isId = false;
|
|
this.schemaTypeInfo = null;
|
|
}
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
|
|
get: function() {
|
|
return this.type;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
|
|
get: function() {
|
|
return this.parent;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'textContent', {
|
|
get: function() {
|
|
return this.value;
|
|
},
|
|
set: function(value) {
|
|
return this.value = value || '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
|
|
get: function() {
|
|
return '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'prefix', {
|
|
get: function() {
|
|
return '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'localName', {
|
|
get: function() {
|
|
return this.name;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLAttribute.prototype, 'specified', {
|
|
get: function() {
|
|
return true;
|
|
}
|
|
});
|
|
|
|
XMLAttribute.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLAttribute.prototype.toString = function(options) {
|
|
return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLAttribute.prototype.debugInfo = function(name) {
|
|
name = name || this.name;
|
|
if (name == null) {
|
|
return "parent: <" + this.parent.name + ">";
|
|
} else {
|
|
return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
|
|
}
|
|
};
|
|
|
|
XMLAttribute.prototype.isEqualNode = function(node) {
|
|
if (node.namespaceURI !== this.namespaceURI) {
|
|
return false;
|
|
}
|
|
if (node.prefix !== this.prefix) {
|
|
return false;
|
|
}
|
|
if (node.localName !== this.localName) {
|
|
return false;
|
|
}
|
|
if (node.value !== this.value) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
|
|
return XMLAttribute;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 333:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLCData, XMLCharacterData,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLCharacterData = __nccwpck_require__(7709);
|
|
|
|
module.exports = XMLCData = (function(superClass) {
|
|
extend(XMLCData, superClass);
|
|
|
|
function XMLCData(parent, text) {
|
|
XMLCData.__super__.constructor.call(this, parent);
|
|
if (text == null) {
|
|
throw new Error("Missing CDATA text. " + this.debugInfo());
|
|
}
|
|
this.name = "#cdata-section";
|
|
this.type = NodeType.CData;
|
|
this.value = this.stringify.cdata(text);
|
|
}
|
|
|
|
XMLCData.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLCData.prototype.toString = function(options) {
|
|
return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLCData;
|
|
|
|
})(XMLCharacterData);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7709:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLCharacterData, XMLNode,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
module.exports = XMLCharacterData = (function(superClass) {
|
|
extend(XMLCharacterData, superClass);
|
|
|
|
function XMLCharacterData(parent) {
|
|
XMLCharacterData.__super__.constructor.call(this, parent);
|
|
this.value = '';
|
|
}
|
|
|
|
Object.defineProperty(XMLCharacterData.prototype, 'data', {
|
|
get: function() {
|
|
return this.value;
|
|
},
|
|
set: function(value) {
|
|
return this.value = value || '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLCharacterData.prototype, 'length', {
|
|
get: function() {
|
|
return this.value.length;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
|
|
get: function() {
|
|
return this.value;
|
|
},
|
|
set: function(value) {
|
|
return this.value = value || '';
|
|
}
|
|
});
|
|
|
|
XMLCharacterData.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLCharacterData.prototype.substringData = function(offset, count) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLCharacterData.prototype.appendData = function(arg) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLCharacterData.prototype.insertData = function(offset, arg) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLCharacterData.prototype.deleteData = function(offset, count) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLCharacterData.prototype.replaceData = function(offset, count, arg) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLCharacterData.prototype.isEqualNode = function(node) {
|
|
if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
|
return false;
|
|
}
|
|
if (node.data !== this.data) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
|
|
return XMLCharacterData;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4407:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLCharacterData, XMLComment,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLCharacterData = __nccwpck_require__(7709);
|
|
|
|
module.exports = XMLComment = (function(superClass) {
|
|
extend(XMLComment, superClass);
|
|
|
|
function XMLComment(parent, text) {
|
|
XMLComment.__super__.constructor.call(this, parent);
|
|
if (text == null) {
|
|
throw new Error("Missing comment text. " + this.debugInfo());
|
|
}
|
|
this.name = "#comment";
|
|
this.type = NodeType.Comment;
|
|
this.value = this.stringify.comment(text);
|
|
}
|
|
|
|
XMLComment.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLComment.prototype.toString = function(options) {
|
|
return this.options.writer.comment(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLComment;
|
|
|
|
})(XMLCharacterData);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7465:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
|
|
|
|
XMLDOMErrorHandler = __nccwpck_require__(6744);
|
|
|
|
XMLDOMStringList = __nccwpck_require__(7028);
|
|
|
|
module.exports = XMLDOMConfiguration = (function() {
|
|
function XMLDOMConfiguration() {
|
|
var clonedSelf;
|
|
this.defaultParams = {
|
|
"canonical-form": false,
|
|
"cdata-sections": false,
|
|
"comments": false,
|
|
"datatype-normalization": false,
|
|
"element-content-whitespace": true,
|
|
"entities": true,
|
|
"error-handler": new XMLDOMErrorHandler(),
|
|
"infoset": true,
|
|
"validate-if-schema": false,
|
|
"namespaces": true,
|
|
"namespace-declarations": true,
|
|
"normalize-characters": false,
|
|
"schema-location": '',
|
|
"schema-type": '',
|
|
"split-cdata-sections": true,
|
|
"validate": false,
|
|
"well-formed": true
|
|
};
|
|
this.params = clonedSelf = Object.create(this.defaultParams);
|
|
}
|
|
|
|
Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
|
|
get: function() {
|
|
return new XMLDOMStringList(Object.keys(this.defaultParams));
|
|
}
|
|
});
|
|
|
|
XMLDOMConfiguration.prototype.getParameter = function(name) {
|
|
if (this.params.hasOwnProperty(name)) {
|
|
return this.params[name];
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
|
|
return true;
|
|
};
|
|
|
|
XMLDOMConfiguration.prototype.setParameter = function(name, value) {
|
|
if (value != null) {
|
|
return this.params[name] = value;
|
|
} else {
|
|
return delete this.params[name];
|
|
}
|
|
};
|
|
|
|
return XMLDOMConfiguration;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6744:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLDOMErrorHandler;
|
|
|
|
module.exports = XMLDOMErrorHandler = (function() {
|
|
function XMLDOMErrorHandler() {}
|
|
|
|
XMLDOMErrorHandler.prototype.handleError = function(error) {
|
|
throw new Error(error);
|
|
};
|
|
|
|
return XMLDOMErrorHandler;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8310:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLDOMImplementation;
|
|
|
|
module.exports = XMLDOMImplementation = (function() {
|
|
function XMLDOMImplementation() {}
|
|
|
|
XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
|
|
return true;
|
|
};
|
|
|
|
XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
XMLDOMImplementation.prototype.getFeature = function(feature, version) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
return XMLDOMImplementation;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7028:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLDOMStringList;
|
|
|
|
module.exports = XMLDOMStringList = (function() {
|
|
function XMLDOMStringList(arr) {
|
|
this.arr = arr || [];
|
|
}
|
|
|
|
Object.defineProperty(XMLDOMStringList.prototype, 'length', {
|
|
get: function() {
|
|
return this.arr.length;
|
|
}
|
|
});
|
|
|
|
XMLDOMStringList.prototype.item = function(index) {
|
|
return this.arr[index] || null;
|
|
};
|
|
|
|
XMLDOMStringList.prototype.contains = function(str) {
|
|
return this.arr.indexOf(str) !== -1;
|
|
};
|
|
|
|
return XMLDOMStringList;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1015:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDTDAttList, XMLNode,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDTDAttList = (function(superClass) {
|
|
extend(XMLDTDAttList, superClass);
|
|
|
|
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
|
XMLDTDAttList.__super__.constructor.call(this, parent);
|
|
if (elementName == null) {
|
|
throw new Error("Missing DTD element name. " + this.debugInfo());
|
|
}
|
|
if (attributeName == null) {
|
|
throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
|
|
}
|
|
if (!attributeType) {
|
|
throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
|
|
}
|
|
if (!defaultValueType) {
|
|
throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
|
|
}
|
|
if (defaultValueType.indexOf('#') !== 0) {
|
|
defaultValueType = '#' + defaultValueType;
|
|
}
|
|
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
|
|
throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
|
}
|
|
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
|
|
throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
|
}
|
|
this.elementName = this.stringify.name(elementName);
|
|
this.type = NodeType.AttributeDeclaration;
|
|
this.attributeName = this.stringify.name(attributeName);
|
|
this.attributeType = this.stringify.dtdAttType(attributeType);
|
|
if (defaultValue) {
|
|
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
|
|
}
|
|
this.defaultValueType = defaultValueType;
|
|
}
|
|
|
|
XMLDTDAttList.prototype.toString = function(options) {
|
|
return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLDTDAttList;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2421:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDTDElement, XMLNode,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDTDElement = (function(superClass) {
|
|
extend(XMLDTDElement, superClass);
|
|
|
|
function XMLDTDElement(parent, name, value) {
|
|
XMLDTDElement.__super__.constructor.call(this, parent);
|
|
if (name == null) {
|
|
throw new Error("Missing DTD element name. " + this.debugInfo());
|
|
}
|
|
if (!value) {
|
|
value = '(#PCDATA)';
|
|
}
|
|
if (Array.isArray(value)) {
|
|
value = '(' + value.join(',') + ')';
|
|
}
|
|
this.name = this.stringify.name(name);
|
|
this.type = NodeType.ElementDeclaration;
|
|
this.value = this.stringify.dtdElementValue(value);
|
|
}
|
|
|
|
XMLDTDElement.prototype.toString = function(options) {
|
|
return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLDTDElement;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 53:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDTDEntity, XMLNode, isObject,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
isObject = (__nccwpck_require__(8229).isObject);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDTDEntity = (function(superClass) {
|
|
extend(XMLDTDEntity, superClass);
|
|
|
|
function XMLDTDEntity(parent, pe, name, value) {
|
|
XMLDTDEntity.__super__.constructor.call(this, parent);
|
|
if (name == null) {
|
|
throw new Error("Missing DTD entity name. " + this.debugInfo(name));
|
|
}
|
|
if (value == null) {
|
|
throw new Error("Missing DTD entity value. " + this.debugInfo(name));
|
|
}
|
|
this.pe = !!pe;
|
|
this.name = this.stringify.name(name);
|
|
this.type = NodeType.EntityDeclaration;
|
|
if (!isObject(value)) {
|
|
this.value = this.stringify.dtdEntityValue(value);
|
|
this.internal = true;
|
|
} else {
|
|
if (!value.pubID && !value.sysID) {
|
|
throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
|
|
}
|
|
if (value.pubID && !value.sysID) {
|
|
throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
|
|
}
|
|
this.internal = false;
|
|
if (value.pubID != null) {
|
|
this.pubID = this.stringify.dtdPubID(value.pubID);
|
|
}
|
|
if (value.sysID != null) {
|
|
this.sysID = this.stringify.dtdSysID(value.sysID);
|
|
}
|
|
if (value.nData != null) {
|
|
this.nData = this.stringify.dtdNData(value.nData);
|
|
}
|
|
if (this.pe && this.nData) {
|
|
throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
|
|
}
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
|
|
get: function() {
|
|
return this.pubID;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
|
|
get: function() {
|
|
return this.sysID;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
|
|
get: function() {
|
|
return this.nData || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
XMLDTDEntity.prototype.toString = function(options) {
|
|
return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLDTDEntity;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2837:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDTDNotation, XMLNode,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDTDNotation = (function(superClass) {
|
|
extend(XMLDTDNotation, superClass);
|
|
|
|
function XMLDTDNotation(parent, name, value) {
|
|
XMLDTDNotation.__super__.constructor.call(this, parent);
|
|
if (name == null) {
|
|
throw new Error("Missing DTD notation name. " + this.debugInfo(name));
|
|
}
|
|
if (!value.pubID && !value.sysID) {
|
|
throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
|
|
}
|
|
this.name = this.stringify.name(name);
|
|
this.type = NodeType.NotationDeclaration;
|
|
if (value.pubID != null) {
|
|
this.pubID = this.stringify.dtdPubID(value.pubID);
|
|
}
|
|
if (value.sysID != null) {
|
|
this.sysID = this.stringify.dtdSysID(value.sysID);
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
|
|
get: function() {
|
|
return this.pubID;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
|
|
get: function() {
|
|
return this.sysID;
|
|
}
|
|
});
|
|
|
|
XMLDTDNotation.prototype.toString = function(options) {
|
|
return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLDTDNotation;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6364:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDeclaration, XMLNode, isObject,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
isObject = (__nccwpck_require__(8229).isObject);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDeclaration = (function(superClass) {
|
|
extend(XMLDeclaration, superClass);
|
|
|
|
function XMLDeclaration(parent, version, encoding, standalone) {
|
|
var ref;
|
|
XMLDeclaration.__super__.constructor.call(this, parent);
|
|
if (isObject(version)) {
|
|
ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
|
|
}
|
|
if (!version) {
|
|
version = '1.0';
|
|
}
|
|
this.type = NodeType.Declaration;
|
|
this.version = this.stringify.xmlVersion(version);
|
|
if (encoding != null) {
|
|
this.encoding = this.stringify.xmlEncoding(encoding);
|
|
}
|
|
if (standalone != null) {
|
|
this.standalone = this.stringify.xmlStandalone(standalone);
|
|
}
|
|
}
|
|
|
|
XMLDeclaration.prototype.toString = function(options) {
|
|
return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLDeclaration;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1801:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
isObject = (__nccwpck_require__(8229).isObject);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLDTDAttList = __nccwpck_require__(1015);
|
|
|
|
XMLDTDEntity = __nccwpck_require__(53);
|
|
|
|
XMLDTDElement = __nccwpck_require__(2421);
|
|
|
|
XMLDTDNotation = __nccwpck_require__(2837);
|
|
|
|
XMLNamedNodeMap = __nccwpck_require__(4361);
|
|
|
|
module.exports = XMLDocType = (function(superClass) {
|
|
extend(XMLDocType, superClass);
|
|
|
|
function XMLDocType(parent, pubID, sysID) {
|
|
var child, i, len, ref, ref1, ref2;
|
|
XMLDocType.__super__.constructor.call(this, parent);
|
|
this.type = NodeType.DocType;
|
|
if (parent.children) {
|
|
ref = parent.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
if (child.type === NodeType.Element) {
|
|
this.name = child.name;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.documentObject = parent;
|
|
if (isObject(pubID)) {
|
|
ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
|
|
}
|
|
if (sysID == null) {
|
|
ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
|
|
}
|
|
if (pubID != null) {
|
|
this.pubID = this.stringify.dtdPubID(pubID);
|
|
}
|
|
if (sysID != null) {
|
|
this.sysID = this.stringify.dtdSysID(sysID);
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(XMLDocType.prototype, 'entities', {
|
|
get: function() {
|
|
var child, i, len, nodes, ref;
|
|
nodes = {};
|
|
ref = this.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
if ((child.type === NodeType.EntityDeclaration) && !child.pe) {
|
|
nodes[child.name] = child;
|
|
}
|
|
}
|
|
return new XMLNamedNodeMap(nodes);
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocType.prototype, 'notations', {
|
|
get: function() {
|
|
var child, i, len, nodes, ref;
|
|
nodes = {};
|
|
ref = this.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
if (child.type === NodeType.NotationDeclaration) {
|
|
nodes[child.name] = child;
|
|
}
|
|
}
|
|
return new XMLNamedNodeMap(nodes);
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocType.prototype, 'publicId', {
|
|
get: function() {
|
|
return this.pubID;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocType.prototype, 'systemId', {
|
|
get: function() {
|
|
return this.sysID;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
|
|
get: function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
XMLDocType.prototype.element = function(name, value) {
|
|
var child;
|
|
child = new XMLDTDElement(this, name, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
|
var child;
|
|
child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLDocType.prototype.entity = function(name, value) {
|
|
var child;
|
|
child = new XMLDTDEntity(this, false, name, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLDocType.prototype.pEntity = function(name, value) {
|
|
var child;
|
|
child = new XMLDTDEntity(this, true, name, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLDocType.prototype.notation = function(name, value) {
|
|
var child;
|
|
child = new XMLDTDNotation(this, name, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLDocType.prototype.toString = function(options) {
|
|
return this.options.writer.docType(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLDocType.prototype.ele = function(name, value) {
|
|
return this.element(name, value);
|
|
};
|
|
|
|
XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
|
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
|
};
|
|
|
|
XMLDocType.prototype.ent = function(name, value) {
|
|
return this.entity(name, value);
|
|
};
|
|
|
|
XMLDocType.prototype.pent = function(name, value) {
|
|
return this.pEntity(name, value);
|
|
};
|
|
|
|
XMLDocType.prototype.not = function(name, value) {
|
|
return this.notation(name, value);
|
|
};
|
|
|
|
XMLDocType.prototype.up = function() {
|
|
return this.root() || this.documentObject;
|
|
};
|
|
|
|
XMLDocType.prototype.isEqualNode = function(node) {
|
|
if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
|
return false;
|
|
}
|
|
if (node.name !== this.name) {
|
|
return false;
|
|
}
|
|
if (node.publicId !== this.publicId) {
|
|
return false;
|
|
}
|
|
if (node.systemId !== this.systemId) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
|
|
return XMLDocType;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3730:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
isPlainObject = (__nccwpck_require__(8229).isPlainObject);
|
|
|
|
XMLDOMImplementation = __nccwpck_require__(8310);
|
|
|
|
XMLDOMConfiguration = __nccwpck_require__(7465);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLStringifier = __nccwpck_require__(8594);
|
|
|
|
XMLStringWriter = __nccwpck_require__(5913);
|
|
|
|
module.exports = XMLDocument = (function(superClass) {
|
|
extend(XMLDocument, superClass);
|
|
|
|
function XMLDocument(options) {
|
|
XMLDocument.__super__.constructor.call(this, null);
|
|
this.name = "#document";
|
|
this.type = NodeType.Document;
|
|
this.documentURI = null;
|
|
this.domConfig = new XMLDOMConfiguration();
|
|
options || (options = {});
|
|
if (!options.writer) {
|
|
options.writer = new XMLStringWriter();
|
|
}
|
|
this.options = options;
|
|
this.stringify = new XMLStringifier(options);
|
|
}
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'implementation', {
|
|
value: new XMLDOMImplementation()
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'doctype', {
|
|
get: function() {
|
|
var child, i, len, ref;
|
|
ref = this.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
if (child.type === NodeType.DocType) {
|
|
return child;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'documentElement', {
|
|
get: function() {
|
|
return this.rootObject || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
|
|
get: function() {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
|
|
get: function() {
|
|
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
|
return this.children[0].encoding;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
|
|
get: function() {
|
|
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
|
return this.children[0].standalone === 'yes';
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
|
|
get: function() {
|
|
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
|
return this.children[0].version;
|
|
} else {
|
|
return "1.0";
|
|
}
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'URL', {
|
|
get: function() {
|
|
return this.documentURI;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'origin', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'compatMode', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'characterSet', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLDocument.prototype, 'contentType', {
|
|
get: function() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
XMLDocument.prototype.end = function(writer) {
|
|
var writerOptions;
|
|
writerOptions = {};
|
|
if (!writer) {
|
|
writer = this.options.writer;
|
|
} else if (isPlainObject(writer)) {
|
|
writerOptions = writer;
|
|
writer = this.options.writer;
|
|
}
|
|
return writer.document(this, writer.filterOptions(writerOptions));
|
|
};
|
|
|
|
XMLDocument.prototype.toString = function(options) {
|
|
return this.options.writer.document(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLDocument.prototype.createElement = function(tagName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createDocumentFragment = function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createTextNode = function(data) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createComment = function(data) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createCDATASection = function(data) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createProcessingInstruction = function(target, data) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createAttribute = function(name) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createEntityReference = function(name) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.getElementsByTagName = function(tagname) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.importNode = function(importedNode, deep) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.getElementById = function(elementId) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.adoptNode = function(source) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.normalizeDocument = function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.getElementsByClassName = function(classNames) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createEvent = function(eventInterface) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createRange = function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
return XMLDocument;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7356:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref,
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLDocument = __nccwpck_require__(3730);
|
|
|
|
XMLElement = __nccwpck_require__(9437);
|
|
|
|
XMLCData = __nccwpck_require__(333);
|
|
|
|
XMLComment = __nccwpck_require__(4407);
|
|
|
|
XMLRaw = __nccwpck_require__(6329);
|
|
|
|
XMLText = __nccwpck_require__(1318);
|
|
|
|
XMLProcessingInstruction = __nccwpck_require__(6939);
|
|
|
|
XMLDeclaration = __nccwpck_require__(6364);
|
|
|
|
XMLDocType = __nccwpck_require__(1801);
|
|
|
|
XMLDTDAttList = __nccwpck_require__(1015);
|
|
|
|
XMLDTDEntity = __nccwpck_require__(53);
|
|
|
|
XMLDTDElement = __nccwpck_require__(2421);
|
|
|
|
XMLDTDNotation = __nccwpck_require__(2837);
|
|
|
|
XMLAttribute = __nccwpck_require__(8376);
|
|
|
|
XMLStringifier = __nccwpck_require__(8594);
|
|
|
|
XMLStringWriter = __nccwpck_require__(5913);
|
|
|
|
WriterState = __nccwpck_require__(9766);
|
|
|
|
module.exports = XMLDocumentCB = (function() {
|
|
function XMLDocumentCB(options, onData, onEnd) {
|
|
var writerOptions;
|
|
this.name = "?xml";
|
|
this.type = NodeType.Document;
|
|
options || (options = {});
|
|
writerOptions = {};
|
|
if (!options.writer) {
|
|
options.writer = new XMLStringWriter();
|
|
} else if (isPlainObject(options.writer)) {
|
|
writerOptions = options.writer;
|
|
options.writer = new XMLStringWriter();
|
|
}
|
|
this.options = options;
|
|
this.writer = options.writer;
|
|
this.writerOptions = this.writer.filterOptions(writerOptions);
|
|
this.stringify = new XMLStringifier(options);
|
|
this.onDataCallback = onData || function() {};
|
|
this.onEndCallback = onEnd || function() {};
|
|
this.currentNode = null;
|
|
this.currentLevel = -1;
|
|
this.openTags = {};
|
|
this.documentStarted = false;
|
|
this.documentCompleted = false;
|
|
this.root = null;
|
|
}
|
|
|
|
XMLDocumentCB.prototype.createChildNode = function(node) {
|
|
var att, attName, attributes, child, i, len, ref1, ref2;
|
|
switch (node.type) {
|
|
case NodeType.CData:
|
|
this.cdata(node.value);
|
|
break;
|
|
case NodeType.Comment:
|
|
this.comment(node.value);
|
|
break;
|
|
case NodeType.Element:
|
|
attributes = {};
|
|
ref1 = node.attribs;
|
|
for (attName in ref1) {
|
|
if (!hasProp.call(ref1, attName)) continue;
|
|
att = ref1[attName];
|
|
attributes[attName] = att.value;
|
|
}
|
|
this.node(node.name, attributes);
|
|
break;
|
|
case NodeType.Dummy:
|
|
this.dummy();
|
|
break;
|
|
case NodeType.Raw:
|
|
this.raw(node.value);
|
|
break;
|
|
case NodeType.Text:
|
|
this.text(node.value);
|
|
break;
|
|
case NodeType.ProcessingInstruction:
|
|
this.instruction(node.target, node.value);
|
|
break;
|
|
default:
|
|
throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
|
|
}
|
|
ref2 = node.children;
|
|
for (i = 0, len = ref2.length; i < len; i++) {
|
|
child = ref2[i];
|
|
this.createChildNode(child);
|
|
if (child.type === NodeType.Element) {
|
|
this.up();
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.dummy = function() {
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.node = function(name, attributes, text) {
|
|
var ref1;
|
|
if (name == null) {
|
|
throw new Error("Missing node name.");
|
|
}
|
|
if (this.root && this.currentLevel === -1) {
|
|
throw new Error("Document can only have one root node. " + this.debugInfo(name));
|
|
}
|
|
this.openCurrent();
|
|
name = getValue(name);
|
|
if (attributes == null) {
|
|
attributes = {};
|
|
}
|
|
attributes = getValue(attributes);
|
|
if (!isObject(attributes)) {
|
|
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
|
|
}
|
|
this.currentNode = new XMLElement(this, name, attributes);
|
|
this.currentNode.children = false;
|
|
this.currentLevel++;
|
|
this.openTags[this.currentLevel] = this.currentNode;
|
|
if (text != null) {
|
|
this.text(text);
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.element = function(name, attributes, text) {
|
|
var child, i, len, oldValidationFlag, ref1, root;
|
|
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
|
this.dtdElement.apply(this, arguments);
|
|
} else {
|
|
if (Array.isArray(name) || isObject(name) || isFunction(name)) {
|
|
oldValidationFlag = this.options.noValidation;
|
|
this.options.noValidation = true;
|
|
root = new XMLDocument(this.options).element('TEMP_ROOT');
|
|
root.element(name);
|
|
this.options.noValidation = oldValidationFlag;
|
|
ref1 = root.children;
|
|
for (i = 0, len = ref1.length; i < len; i++) {
|
|
child = ref1[i];
|
|
this.createChildNode(child);
|
|
if (child.type === NodeType.Element) {
|
|
this.up();
|
|
}
|
|
}
|
|
} else {
|
|
this.node(name, attributes, text);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.attribute = function(name, value) {
|
|
var attName, attValue;
|
|
if (!this.currentNode || this.currentNode.children) {
|
|
throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
|
|
}
|
|
if (name != null) {
|
|
name = getValue(name);
|
|
}
|
|
if (isObject(name)) {
|
|
for (attName in name) {
|
|
if (!hasProp.call(name, attName)) continue;
|
|
attValue = name[attName];
|
|
this.attribute(attName, attValue);
|
|
}
|
|
} else {
|
|
if (isFunction(value)) {
|
|
value = value.apply();
|
|
}
|
|
if (this.options.keepNullAttributes && (value == null)) {
|
|
this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
|
|
} else if (value != null) {
|
|
this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.text = function(value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLText(this, value);
|
|
this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.cdata = function(value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLCData(this, value);
|
|
this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.comment = function(value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLComment(this, value);
|
|
this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.raw = function(value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLRaw(this, value);
|
|
this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.instruction = function(target, value) {
|
|
var i, insTarget, insValue, len, node;
|
|
this.openCurrent();
|
|
if (target != null) {
|
|
target = getValue(target);
|
|
}
|
|
if (value != null) {
|
|
value = getValue(value);
|
|
}
|
|
if (Array.isArray(target)) {
|
|
for (i = 0, len = target.length; i < len; i++) {
|
|
insTarget = target[i];
|
|
this.instruction(insTarget);
|
|
}
|
|
} else if (isObject(target)) {
|
|
for (insTarget in target) {
|
|
if (!hasProp.call(target, insTarget)) continue;
|
|
insValue = target[insTarget];
|
|
this.instruction(insTarget, insValue);
|
|
}
|
|
} else {
|
|
if (isFunction(value)) {
|
|
value = value.apply();
|
|
}
|
|
node = new XMLProcessingInstruction(this, target, value);
|
|
this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
|
|
var node;
|
|
this.openCurrent();
|
|
if (this.documentStarted) {
|
|
throw new Error("declaration() must be the first node.");
|
|
}
|
|
node = new XMLDeclaration(this, version, encoding, standalone);
|
|
this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
|
|
this.openCurrent();
|
|
if (root == null) {
|
|
throw new Error("Missing root node name.");
|
|
}
|
|
if (this.root) {
|
|
throw new Error("dtd() must come before the root node.");
|
|
}
|
|
this.currentNode = new XMLDocType(this, pubID, sysID);
|
|
this.currentNode.rootNodeName = root;
|
|
this.currentNode.children = false;
|
|
this.currentLevel++;
|
|
this.openTags[this.currentLevel] = this.currentNode;
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.dtdElement = function(name, value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLDTDElement(this, name, value);
|
|
this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
|
this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.entity = function(name, value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLDTDEntity(this, false, name, value);
|
|
this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.pEntity = function(name, value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLDTDEntity(this, true, name, value);
|
|
this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.notation = function(name, value) {
|
|
var node;
|
|
this.openCurrent();
|
|
node = new XMLDTDNotation(this, name, value);
|
|
this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.up = function() {
|
|
if (this.currentLevel < 0) {
|
|
throw new Error("The document node has no parent.");
|
|
}
|
|
if (this.currentNode) {
|
|
if (this.currentNode.children) {
|
|
this.closeNode(this.currentNode);
|
|
} else {
|
|
this.openNode(this.currentNode);
|
|
}
|
|
this.currentNode = null;
|
|
} else {
|
|
this.closeNode(this.openTags[this.currentLevel]);
|
|
}
|
|
delete this.openTags[this.currentLevel];
|
|
this.currentLevel--;
|
|
return this;
|
|
};
|
|
|
|
XMLDocumentCB.prototype.end = function() {
|
|
while (this.currentLevel >= 0) {
|
|
this.up();
|
|
}
|
|
return this.onEnd();
|
|
};
|
|
|
|
XMLDocumentCB.prototype.openCurrent = function() {
|
|
if (this.currentNode) {
|
|
this.currentNode.children = true;
|
|
return this.openNode(this.currentNode);
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.openNode = function(node) {
|
|
var att, chunk, name, ref1;
|
|
if (!node.isOpen) {
|
|
if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
|
|
this.root = node;
|
|
}
|
|
chunk = '';
|
|
if (node.type === NodeType.Element) {
|
|
this.writerOptions.state = WriterState.OpenTag;
|
|
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
|
|
ref1 = node.attribs;
|
|
for (name in ref1) {
|
|
if (!hasProp.call(ref1, name)) continue;
|
|
att = ref1[name];
|
|
chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
|
|
}
|
|
chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
|
this.writerOptions.state = WriterState.InsideTag;
|
|
} else {
|
|
this.writerOptions.state = WriterState.OpenTag;
|
|
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
|
|
if (node.pubID && node.sysID) {
|
|
chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
|
} else if (node.sysID) {
|
|
chunk += ' SYSTEM "' + node.sysID + '"';
|
|
}
|
|
if (node.children) {
|
|
chunk += ' [';
|
|
this.writerOptions.state = WriterState.InsideTag;
|
|
} else {
|
|
this.writerOptions.state = WriterState.CloseTag;
|
|
chunk += '>';
|
|
}
|
|
chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
|
|
}
|
|
this.onData(chunk, this.currentLevel);
|
|
return node.isOpen = true;
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.closeNode = function(node) {
|
|
var chunk;
|
|
if (!node.isClosed) {
|
|
chunk = '';
|
|
this.writerOptions.state = WriterState.CloseTag;
|
|
if (node.type === NodeType.Element) {
|
|
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
|
} else {
|
|
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
|
}
|
|
this.writerOptions.state = WriterState.None;
|
|
this.onData(chunk, this.currentLevel);
|
|
return node.isClosed = true;
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.onData = function(chunk, level) {
|
|
this.documentStarted = true;
|
|
return this.onDataCallback(chunk, level + 1);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.onEnd = function() {
|
|
this.documentCompleted = true;
|
|
return this.onEndCallback();
|
|
};
|
|
|
|
XMLDocumentCB.prototype.debugInfo = function(name) {
|
|
if (name == null) {
|
|
return "";
|
|
} else {
|
|
return "node: <" + name + ">";
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.ele = function() {
|
|
return this.element.apply(this, arguments);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.nod = function(name, attributes, text) {
|
|
return this.node(name, attributes, text);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.txt = function(value) {
|
|
return this.text(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.dat = function(value) {
|
|
return this.cdata(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.com = function(value) {
|
|
return this.comment(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.ins = function(target, value) {
|
|
return this.instruction(target, value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
|
|
return this.declaration(version, encoding, standalone);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
|
|
return this.doctype(root, pubID, sysID);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.e = function(name, attributes, text) {
|
|
return this.element(name, attributes, text);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.n = function(name, attributes, text) {
|
|
return this.node(name, attributes, text);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.t = function(value) {
|
|
return this.text(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.d = function(value) {
|
|
return this.cdata(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.c = function(value) {
|
|
return this.comment(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.r = function(value) {
|
|
return this.raw(value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.i = function(target, value) {
|
|
return this.instruction(target, value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.att = function() {
|
|
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
|
return this.attList.apply(this, arguments);
|
|
} else {
|
|
return this.attribute.apply(this, arguments);
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.a = function() {
|
|
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
|
return this.attList.apply(this, arguments);
|
|
} else {
|
|
return this.attribute.apply(this, arguments);
|
|
}
|
|
};
|
|
|
|
XMLDocumentCB.prototype.ent = function(name, value) {
|
|
return this.entity(name, value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.pent = function(name, value) {
|
|
return this.pEntity(name, value);
|
|
};
|
|
|
|
XMLDocumentCB.prototype.not = function(name, value) {
|
|
return this.notation(name, value);
|
|
};
|
|
|
|
return XMLDocumentCB;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3590:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLDummy, XMLNode,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
module.exports = XMLDummy = (function(superClass) {
|
|
extend(XMLDummy, superClass);
|
|
|
|
function XMLDummy(parent) {
|
|
XMLDummy.__super__.constructor.call(this, parent);
|
|
this.type = NodeType.Dummy;
|
|
}
|
|
|
|
XMLDummy.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLDummy.prototype.toString = function(options) {
|
|
return '';
|
|
};
|
|
|
|
return XMLDummy;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9437:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLAttribute = __nccwpck_require__(8376);
|
|
|
|
XMLNamedNodeMap = __nccwpck_require__(4361);
|
|
|
|
module.exports = XMLElement = (function(superClass) {
|
|
extend(XMLElement, superClass);
|
|
|
|
function XMLElement(parent, name, attributes) {
|
|
var child, j, len, ref1;
|
|
XMLElement.__super__.constructor.call(this, parent);
|
|
if (name == null) {
|
|
throw new Error("Missing element name. " + this.debugInfo());
|
|
}
|
|
this.name = this.stringify.name(name);
|
|
this.type = NodeType.Element;
|
|
this.attribs = {};
|
|
this.schemaTypeInfo = null;
|
|
if (attributes != null) {
|
|
this.attribute(attributes);
|
|
}
|
|
if (parent.type === NodeType.Document) {
|
|
this.isRoot = true;
|
|
this.documentObject = parent;
|
|
parent.rootObject = this;
|
|
if (parent.children) {
|
|
ref1 = parent.children;
|
|
for (j = 0, len = ref1.length; j < len; j++) {
|
|
child = ref1[j];
|
|
if (child.type === NodeType.DocType) {
|
|
child.name = this.name;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'tagName', {
|
|
get: function() {
|
|
return this.name;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
|
|
get: function() {
|
|
return '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'prefix', {
|
|
get: function() {
|
|
return '';
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'localName', {
|
|
get: function() {
|
|
return this.name;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'id', {
|
|
get: function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'className', {
|
|
get: function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'classList', {
|
|
get: function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLElement.prototype, 'attributes', {
|
|
get: function() {
|
|
if (!this.attributeMap || !this.attributeMap.nodes) {
|
|
this.attributeMap = new XMLNamedNodeMap(this.attribs);
|
|
}
|
|
return this.attributeMap;
|
|
}
|
|
});
|
|
|
|
XMLElement.prototype.clone = function() {
|
|
var att, attName, clonedSelf, ref1;
|
|
clonedSelf = Object.create(this);
|
|
if (clonedSelf.isRoot) {
|
|
clonedSelf.documentObject = null;
|
|
}
|
|
clonedSelf.attribs = {};
|
|
ref1 = this.attribs;
|
|
for (attName in ref1) {
|
|
if (!hasProp.call(ref1, attName)) continue;
|
|
att = ref1[attName];
|
|
clonedSelf.attribs[attName] = att.clone();
|
|
}
|
|
clonedSelf.children = [];
|
|
this.children.forEach(function(child) {
|
|
var clonedChild;
|
|
clonedChild = child.clone();
|
|
clonedChild.parent = clonedSelf;
|
|
return clonedSelf.children.push(clonedChild);
|
|
});
|
|
return clonedSelf;
|
|
};
|
|
|
|
XMLElement.prototype.attribute = function(name, value) {
|
|
var attName, attValue;
|
|
if (name != null) {
|
|
name = getValue(name);
|
|
}
|
|
if (isObject(name)) {
|
|
for (attName in name) {
|
|
if (!hasProp.call(name, attName)) continue;
|
|
attValue = name[attName];
|
|
this.attribute(attName, attValue);
|
|
}
|
|
} else {
|
|
if (isFunction(value)) {
|
|
value = value.apply();
|
|
}
|
|
if (this.options.keepNullAttributes && (value == null)) {
|
|
this.attribs[name] = new XMLAttribute(this, name, "");
|
|
} else if (value != null) {
|
|
this.attribs[name] = new XMLAttribute(this, name, value);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLElement.prototype.removeAttribute = function(name) {
|
|
var attName, j, len;
|
|
if (name == null) {
|
|
throw new Error("Missing attribute name. " + this.debugInfo());
|
|
}
|
|
name = getValue(name);
|
|
if (Array.isArray(name)) {
|
|
for (j = 0, len = name.length; j < len; j++) {
|
|
attName = name[j];
|
|
delete this.attribs[attName];
|
|
}
|
|
} else {
|
|
delete this.attribs[name];
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLElement.prototype.toString = function(options) {
|
|
return this.options.writer.element(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLElement.prototype.att = function(name, value) {
|
|
return this.attribute(name, value);
|
|
};
|
|
|
|
XMLElement.prototype.a = function(name, value) {
|
|
return this.attribute(name, value);
|
|
};
|
|
|
|
XMLElement.prototype.getAttribute = function(name) {
|
|
if (this.attribs.hasOwnProperty(name)) {
|
|
return this.attribs[name].value;
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
XMLElement.prototype.setAttribute = function(name, value) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getAttributeNode = function(name) {
|
|
if (this.attribs.hasOwnProperty(name)) {
|
|
return this.attribs[name];
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
XMLElement.prototype.setAttributeNode = function(newAttr) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.removeAttributeNode = function(oldAttr) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getElementsByTagName = function(name) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.setAttributeNodeNS = function(newAttr) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.hasAttribute = function(name) {
|
|
return this.attribs.hasOwnProperty(name);
|
|
};
|
|
|
|
XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.setIdAttribute = function(name, isId) {
|
|
if (this.attribs.hasOwnProperty(name)) {
|
|
return this.attribs[name].isId;
|
|
} else {
|
|
return isId;
|
|
}
|
|
};
|
|
|
|
XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getElementsByTagName = function(tagname) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.getElementsByClassName = function(classNames) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLElement.prototype.isEqualNode = function(node) {
|
|
var i, j, ref1;
|
|
if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
|
return false;
|
|
}
|
|
if (node.namespaceURI !== this.namespaceURI) {
|
|
return false;
|
|
}
|
|
if (node.prefix !== this.prefix) {
|
|
return false;
|
|
}
|
|
if (node.localName !== this.localName) {
|
|
return false;
|
|
}
|
|
if (node.attribs.length !== this.attribs.length) {
|
|
return false;
|
|
}
|
|
for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
|
|
if (!this.attribs[i].isEqualNode(node.attribs[i])) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|
|
return XMLElement;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4361:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLNamedNodeMap;
|
|
|
|
module.exports = XMLNamedNodeMap = (function() {
|
|
function XMLNamedNodeMap(nodes) {
|
|
this.nodes = nodes;
|
|
}
|
|
|
|
Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
|
|
get: function() {
|
|
return Object.keys(this.nodes).length || 0;
|
|
}
|
|
});
|
|
|
|
XMLNamedNodeMap.prototype.clone = function() {
|
|
return this.nodes = null;
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.getNamedItem = function(name) {
|
|
return this.nodes[name];
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.setNamedItem = function(node) {
|
|
var oldNode;
|
|
oldNode = this.nodes[node.nodeName];
|
|
this.nodes[node.nodeName] = node;
|
|
return oldNode || null;
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.removeNamedItem = function(name) {
|
|
var oldNode;
|
|
oldNode = this.nodes[name];
|
|
delete this.nodes[name];
|
|
return oldNode || null;
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.item = function(index) {
|
|
return this.nodes[Object.keys(this.nodes)[index]] || null;
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.setNamedItemNS = function(node) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) {
|
|
throw new Error("This DOM method is not implemented.");
|
|
};
|
|
|
|
return XMLNamedNodeMap;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7608:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
ref1 = __nccwpck_require__(8229), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
|
|
|
XMLElement = null;
|
|
|
|
XMLCData = null;
|
|
|
|
XMLComment = null;
|
|
|
|
XMLDeclaration = null;
|
|
|
|
XMLDocType = null;
|
|
|
|
XMLRaw = null;
|
|
|
|
XMLText = null;
|
|
|
|
XMLProcessingInstruction = null;
|
|
|
|
XMLDummy = null;
|
|
|
|
NodeType = null;
|
|
|
|
XMLNodeList = null;
|
|
|
|
XMLNamedNodeMap = null;
|
|
|
|
DocumentPosition = null;
|
|
|
|
module.exports = XMLNode = (function() {
|
|
function XMLNode(parent1) {
|
|
this.parent = parent1;
|
|
if (this.parent) {
|
|
this.options = this.parent.options;
|
|
this.stringify = this.parent.stringify;
|
|
}
|
|
this.value = null;
|
|
this.children = [];
|
|
this.baseURI = null;
|
|
if (!XMLElement) {
|
|
XMLElement = __nccwpck_require__(9437);
|
|
XMLCData = __nccwpck_require__(333);
|
|
XMLComment = __nccwpck_require__(4407);
|
|
XMLDeclaration = __nccwpck_require__(6364);
|
|
XMLDocType = __nccwpck_require__(1801);
|
|
XMLRaw = __nccwpck_require__(6329);
|
|
XMLText = __nccwpck_require__(1318);
|
|
XMLProcessingInstruction = __nccwpck_require__(6939);
|
|
XMLDummy = __nccwpck_require__(3590);
|
|
NodeType = __nccwpck_require__(9267);
|
|
XMLNodeList = __nccwpck_require__(6768);
|
|
XMLNamedNodeMap = __nccwpck_require__(4361);
|
|
DocumentPosition = __nccwpck_require__(2839);
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
|
get: function() {
|
|
return this.name;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
|
get: function() {
|
|
return this.type;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
|
get: function() {
|
|
return this.value;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
|
get: function() {
|
|
return this.parent;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
|
get: function() {
|
|
if (!this.childNodeList || !this.childNodeList.nodes) {
|
|
this.childNodeList = new XMLNodeList(this.children);
|
|
}
|
|
return this.childNodeList;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
|
get: function() {
|
|
return this.children[0] || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
|
get: function() {
|
|
return this.children[this.children.length - 1] || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
|
get: function() {
|
|
var i;
|
|
i = this.parent.children.indexOf(this);
|
|
return this.parent.children[i - 1] || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
|
get: function() {
|
|
var i;
|
|
i = this.parent.children.indexOf(this);
|
|
return this.parent.children[i + 1] || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
|
get: function() {
|
|
return this.document() || null;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLNode.prototype, 'textContent', {
|
|
get: function() {
|
|
var child, j, len, ref2, str;
|
|
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
|
str = '';
|
|
ref2 = this.children;
|
|
for (j = 0, len = ref2.length; j < len; j++) {
|
|
child = ref2[j];
|
|
if (child.textContent) {
|
|
str += child.textContent;
|
|
}
|
|
}
|
|
return str;
|
|
} else {
|
|
return null;
|
|
}
|
|
},
|
|
set: function(value) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
XMLNode.prototype.setParent = function(parent) {
|
|
var child, j, len, ref2, results;
|
|
this.parent = parent;
|
|
if (parent) {
|
|
this.options = parent.options;
|
|
this.stringify = parent.stringify;
|
|
}
|
|
ref2 = this.children;
|
|
results = [];
|
|
for (j = 0, len = ref2.length; j < len; j++) {
|
|
child = ref2[j];
|
|
results.push(child.setParent(this));
|
|
}
|
|
return results;
|
|
};
|
|
|
|
XMLNode.prototype.element = function(name, attributes, text) {
|
|
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
|
lastChild = null;
|
|
if (attributes === null && (text == null)) {
|
|
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
|
}
|
|
if (attributes == null) {
|
|
attributes = {};
|
|
}
|
|
attributes = getValue(attributes);
|
|
if (!isObject(attributes)) {
|
|
ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
|
}
|
|
if (name != null) {
|
|
name = getValue(name);
|
|
}
|
|
if (Array.isArray(name)) {
|
|
for (j = 0, len = name.length; j < len; j++) {
|
|
item = name[j];
|
|
lastChild = this.element(item);
|
|
}
|
|
} else if (isFunction(name)) {
|
|
lastChild = this.element(name.apply());
|
|
} else if (isObject(name)) {
|
|
for (key in name) {
|
|
if (!hasProp.call(name, key)) continue;
|
|
val = name[key];
|
|
if (isFunction(val)) {
|
|
val = val.apply();
|
|
}
|
|
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
|
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
|
} else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
|
lastChild = this.dummy();
|
|
} else if (isObject(val) && isEmpty(val)) {
|
|
lastChild = this.element(key);
|
|
} else if (!this.options.keepNullNodes && (val == null)) {
|
|
lastChild = this.dummy();
|
|
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
|
for (k = 0, len1 = val.length; k < len1; k++) {
|
|
item = val[k];
|
|
childNode = {};
|
|
childNode[key] = item;
|
|
lastChild = this.element(childNode);
|
|
}
|
|
} else if (isObject(val)) {
|
|
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
|
lastChild = this.element(val);
|
|
} else {
|
|
lastChild = this.element(key);
|
|
lastChild.element(val);
|
|
}
|
|
} else {
|
|
lastChild = this.element(key, val);
|
|
}
|
|
}
|
|
} else if (!this.options.keepNullNodes && text === null) {
|
|
lastChild = this.dummy();
|
|
} else {
|
|
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
|
lastChild = this.text(text);
|
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
|
lastChild = this.cdata(text);
|
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
|
lastChild = this.comment(text);
|
|
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
|
lastChild = this.raw(text);
|
|
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
|
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
|
} else {
|
|
lastChild = this.node(name, attributes, text);
|
|
}
|
|
}
|
|
if (lastChild == null) {
|
|
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
|
}
|
|
return lastChild;
|
|
};
|
|
|
|
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
|
var child, i, newChild, refChild, removed;
|
|
if (name != null ? name.type : void 0) {
|
|
newChild = name;
|
|
refChild = attributes;
|
|
newChild.setParent(this);
|
|
if (refChild) {
|
|
i = children.indexOf(refChild);
|
|
removed = children.splice(i);
|
|
children.push(newChild);
|
|
Array.prototype.push.apply(children, removed);
|
|
} else {
|
|
children.push(newChild);
|
|
}
|
|
return newChild;
|
|
} else {
|
|
if (this.isRoot) {
|
|
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
|
}
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i);
|
|
child = this.parent.element(name, attributes, text);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return child;
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
|
var child, i, removed;
|
|
if (this.isRoot) {
|
|
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
|
}
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i + 1);
|
|
child = this.parent.element(name, attributes, text);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return child;
|
|
};
|
|
|
|
XMLNode.prototype.remove = function() {
|
|
var i, ref2;
|
|
if (this.isRoot) {
|
|
throw new Error("Cannot remove the root element. " + this.debugInfo());
|
|
}
|
|
i = this.parent.children.indexOf(this);
|
|
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
|
return this.parent;
|
|
};
|
|
|
|
XMLNode.prototype.node = function(name, attributes, text) {
|
|
var child, ref2;
|
|
if (name != null) {
|
|
name = getValue(name);
|
|
}
|
|
attributes || (attributes = {});
|
|
attributes = getValue(attributes);
|
|
if (!isObject(attributes)) {
|
|
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
|
}
|
|
child = new XMLElement(this, name, attributes);
|
|
if (text != null) {
|
|
child.text(text);
|
|
}
|
|
this.children.push(child);
|
|
return child;
|
|
};
|
|
|
|
XMLNode.prototype.text = function(value) {
|
|
var child;
|
|
if (isObject(value)) {
|
|
this.element(value);
|
|
}
|
|
child = new XMLText(this, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.cdata = function(value) {
|
|
var child;
|
|
child = new XMLCData(this, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.comment = function(value) {
|
|
var child;
|
|
child = new XMLComment(this, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.commentBefore = function(value) {
|
|
var child, i, removed;
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i);
|
|
child = this.parent.comment(value);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.commentAfter = function(value) {
|
|
var child, i, removed;
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i + 1);
|
|
child = this.parent.comment(value);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.raw = function(value) {
|
|
var child;
|
|
child = new XMLRaw(this, value);
|
|
this.children.push(child);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.dummy = function() {
|
|
var child;
|
|
child = new XMLDummy(this);
|
|
return child;
|
|
};
|
|
|
|
XMLNode.prototype.instruction = function(target, value) {
|
|
var insTarget, insValue, instruction, j, len;
|
|
if (target != null) {
|
|
target = getValue(target);
|
|
}
|
|
if (value != null) {
|
|
value = getValue(value);
|
|
}
|
|
if (Array.isArray(target)) {
|
|
for (j = 0, len = target.length; j < len; j++) {
|
|
insTarget = target[j];
|
|
this.instruction(insTarget);
|
|
}
|
|
} else if (isObject(target)) {
|
|
for (insTarget in target) {
|
|
if (!hasProp.call(target, insTarget)) continue;
|
|
insValue = target[insTarget];
|
|
this.instruction(insTarget, insValue);
|
|
}
|
|
} else {
|
|
if (isFunction(value)) {
|
|
value = value.apply();
|
|
}
|
|
instruction = new XMLProcessingInstruction(this, target, value);
|
|
this.children.push(instruction);
|
|
}
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.instructionBefore = function(target, value) {
|
|
var child, i, removed;
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i);
|
|
child = this.parent.instruction(target, value);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.instructionAfter = function(target, value) {
|
|
var child, i, removed;
|
|
i = this.parent.children.indexOf(this);
|
|
removed = this.parent.children.splice(i + 1);
|
|
child = this.parent.instruction(target, value);
|
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
|
var doc, xmldec;
|
|
doc = this.document();
|
|
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
|
if (doc.children.length === 0) {
|
|
doc.children.unshift(xmldec);
|
|
} else if (doc.children[0].type === NodeType.Declaration) {
|
|
doc.children[0] = xmldec;
|
|
} else {
|
|
doc.children.unshift(xmldec);
|
|
}
|
|
return doc.root() || doc;
|
|
};
|
|
|
|
XMLNode.prototype.dtd = function(pubID, sysID) {
|
|
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
|
doc = this.document();
|
|
doctype = new XMLDocType(doc, pubID, sysID);
|
|
ref2 = doc.children;
|
|
for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
|
child = ref2[i];
|
|
if (child.type === NodeType.DocType) {
|
|
doc.children[i] = doctype;
|
|
return doctype;
|
|
}
|
|
}
|
|
ref3 = doc.children;
|
|
for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
|
child = ref3[i];
|
|
if (child.isRoot) {
|
|
doc.children.splice(i, 0, doctype);
|
|
return doctype;
|
|
}
|
|
}
|
|
doc.children.push(doctype);
|
|
return doctype;
|
|
};
|
|
|
|
XMLNode.prototype.up = function() {
|
|
if (this.isRoot) {
|
|
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
|
}
|
|
return this.parent;
|
|
};
|
|
|
|
XMLNode.prototype.root = function() {
|
|
var node;
|
|
node = this;
|
|
while (node) {
|
|
if (node.type === NodeType.Document) {
|
|
return node.rootObject;
|
|
} else if (node.isRoot) {
|
|
return node;
|
|
} else {
|
|
node = node.parent;
|
|
}
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.document = function() {
|
|
var node;
|
|
node = this;
|
|
while (node) {
|
|
if (node.type === NodeType.Document) {
|
|
return node;
|
|
} else {
|
|
node = node.parent;
|
|
}
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.end = function(options) {
|
|
return this.document().end(options);
|
|
};
|
|
|
|
XMLNode.prototype.prev = function() {
|
|
var i;
|
|
i = this.parent.children.indexOf(this);
|
|
if (i < 1) {
|
|
throw new Error("Already at the first node. " + this.debugInfo());
|
|
}
|
|
return this.parent.children[i - 1];
|
|
};
|
|
|
|
XMLNode.prototype.next = function() {
|
|
var i;
|
|
i = this.parent.children.indexOf(this);
|
|
if (i === -1 || i === this.parent.children.length - 1) {
|
|
throw new Error("Already at the last node. " + this.debugInfo());
|
|
}
|
|
return this.parent.children[i + 1];
|
|
};
|
|
|
|
XMLNode.prototype.importDocument = function(doc) {
|
|
var clonedRoot;
|
|
clonedRoot = doc.root().clone();
|
|
clonedRoot.parent = this;
|
|
clonedRoot.isRoot = false;
|
|
this.children.push(clonedRoot);
|
|
return this;
|
|
};
|
|
|
|
XMLNode.prototype.debugInfo = function(name) {
|
|
var ref2, ref3;
|
|
name = name || this.name;
|
|
if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
|
return "";
|
|
} else if (name == null) {
|
|
return "parent: <" + this.parent.name + ">";
|
|
} else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
|
return "node: <" + name + ">";
|
|
} else {
|
|
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.ele = function(name, attributes, text) {
|
|
return this.element(name, attributes, text);
|
|
};
|
|
|
|
XMLNode.prototype.nod = function(name, attributes, text) {
|
|
return this.node(name, attributes, text);
|
|
};
|
|
|
|
XMLNode.prototype.txt = function(value) {
|
|
return this.text(value);
|
|
};
|
|
|
|
XMLNode.prototype.dat = function(value) {
|
|
return this.cdata(value);
|
|
};
|
|
|
|
XMLNode.prototype.com = function(value) {
|
|
return this.comment(value);
|
|
};
|
|
|
|
XMLNode.prototype.ins = function(target, value) {
|
|
return this.instruction(target, value);
|
|
};
|
|
|
|
XMLNode.prototype.doc = function() {
|
|
return this.document();
|
|
};
|
|
|
|
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
|
return this.declaration(version, encoding, standalone);
|
|
};
|
|
|
|
XMLNode.prototype.e = function(name, attributes, text) {
|
|
return this.element(name, attributes, text);
|
|
};
|
|
|
|
XMLNode.prototype.n = function(name, attributes, text) {
|
|
return this.node(name, attributes, text);
|
|
};
|
|
|
|
XMLNode.prototype.t = function(value) {
|
|
return this.text(value);
|
|
};
|
|
|
|
XMLNode.prototype.d = function(value) {
|
|
return this.cdata(value);
|
|
};
|
|
|
|
XMLNode.prototype.c = function(value) {
|
|
return this.comment(value);
|
|
};
|
|
|
|
XMLNode.prototype.r = function(value) {
|
|
return this.raw(value);
|
|
};
|
|
|
|
XMLNode.prototype.i = function(target, value) {
|
|
return this.instruction(target, value);
|
|
};
|
|
|
|
XMLNode.prototype.u = function() {
|
|
return this.up();
|
|
};
|
|
|
|
XMLNode.prototype.importXMLBuilder = function(doc) {
|
|
return this.importDocument(doc);
|
|
};
|
|
|
|
XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.removeChild = function(oldChild) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.appendChild = function(newChild) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.hasChildNodes = function() {
|
|
return this.children.length !== 0;
|
|
};
|
|
|
|
XMLNode.prototype.cloneNode = function(deep) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.normalize = function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.isSupported = function(feature, version) {
|
|
return true;
|
|
};
|
|
|
|
XMLNode.prototype.hasAttributes = function() {
|
|
return this.attribs.length !== 0;
|
|
};
|
|
|
|
XMLNode.prototype.compareDocumentPosition = function(other) {
|
|
var ref, res;
|
|
ref = this;
|
|
if (ref === other) {
|
|
return 0;
|
|
} else if (this.document() !== other.document()) {
|
|
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
|
if (Math.random() < 0.5) {
|
|
res |= DocumentPosition.Preceding;
|
|
} else {
|
|
res |= DocumentPosition.Following;
|
|
}
|
|
return res;
|
|
} else if (ref.isAncestor(other)) {
|
|
return DocumentPosition.Contains | DocumentPosition.Preceding;
|
|
} else if (ref.isDescendant(other)) {
|
|
return DocumentPosition.Contains | DocumentPosition.Following;
|
|
} else if (ref.isPreceding(other)) {
|
|
return DocumentPosition.Preceding;
|
|
} else {
|
|
return DocumentPosition.Following;
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.isSameNode = function(other) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.isEqualNode = function(node) {
|
|
var i, j, ref2;
|
|
if (node.nodeType !== this.nodeType) {
|
|
return false;
|
|
}
|
|
if (node.children.length !== this.children.length) {
|
|
return false;
|
|
}
|
|
for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
|
if (!this.children[i].isEqualNode(node.children[i])) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|
|
XMLNode.prototype.getFeature = function(feature, version) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.setUserData = function(key, data, handler) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.getUserData = function(key) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLNode.prototype.contains = function(other) {
|
|
if (!other) {
|
|
return false;
|
|
}
|
|
return other === this || this.isDescendant(other);
|
|
};
|
|
|
|
XMLNode.prototype.isDescendant = function(node) {
|
|
var child, isDescendantChild, j, len, ref2;
|
|
ref2 = this.children;
|
|
for (j = 0, len = ref2.length; j < len; j++) {
|
|
child = ref2[j];
|
|
if (node === child) {
|
|
return true;
|
|
}
|
|
isDescendantChild = child.isDescendant(node);
|
|
if (isDescendantChild) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
|
|
XMLNode.prototype.isAncestor = function(node) {
|
|
return node.isDescendant(this);
|
|
};
|
|
|
|
XMLNode.prototype.isPreceding = function(node) {
|
|
var nodePos, thisPos;
|
|
nodePos = this.treePosition(node);
|
|
thisPos = this.treePosition(this);
|
|
if (nodePos === -1 || thisPos === -1) {
|
|
return false;
|
|
} else {
|
|
return nodePos < thisPos;
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.isFollowing = function(node) {
|
|
var nodePos, thisPos;
|
|
nodePos = this.treePosition(node);
|
|
thisPos = this.treePosition(this);
|
|
if (nodePos === -1 || thisPos === -1) {
|
|
return false;
|
|
} else {
|
|
return nodePos > thisPos;
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.treePosition = function(node) {
|
|
var found, pos;
|
|
pos = 0;
|
|
found = false;
|
|
this.foreachTreeNode(this.document(), function(childNode) {
|
|
pos++;
|
|
if (!found && childNode === node) {
|
|
return found = true;
|
|
}
|
|
});
|
|
if (found) {
|
|
return pos;
|
|
} else {
|
|
return -1;
|
|
}
|
|
};
|
|
|
|
XMLNode.prototype.foreachTreeNode = function(node, func) {
|
|
var child, j, len, ref2, res;
|
|
node || (node = this.document());
|
|
ref2 = node.children;
|
|
for (j = 0, len = ref2.length; j < len; j++) {
|
|
child = ref2[j];
|
|
if (res = func(child)) {
|
|
return res;
|
|
} else {
|
|
res = this.foreachTreeNode(child, func);
|
|
if (res) {
|
|
return res;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
return XMLNode;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6768:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLNodeList;
|
|
|
|
module.exports = XMLNodeList = (function() {
|
|
function XMLNodeList(nodes) {
|
|
this.nodes = nodes;
|
|
}
|
|
|
|
Object.defineProperty(XMLNodeList.prototype, 'length', {
|
|
get: function() {
|
|
return this.nodes.length || 0;
|
|
}
|
|
});
|
|
|
|
XMLNodeList.prototype.clone = function() {
|
|
return this.nodes = null;
|
|
};
|
|
|
|
XMLNodeList.prototype.item = function(index) {
|
|
return this.nodes[index] || null;
|
|
};
|
|
|
|
return XMLNodeList;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6939:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLCharacterData, XMLProcessingInstruction,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLCharacterData = __nccwpck_require__(7709);
|
|
|
|
module.exports = XMLProcessingInstruction = (function(superClass) {
|
|
extend(XMLProcessingInstruction, superClass);
|
|
|
|
function XMLProcessingInstruction(parent, target, value) {
|
|
XMLProcessingInstruction.__super__.constructor.call(this, parent);
|
|
if (target == null) {
|
|
throw new Error("Missing instruction target. " + this.debugInfo());
|
|
}
|
|
this.type = NodeType.ProcessingInstruction;
|
|
this.target = this.stringify.insTarget(target);
|
|
this.name = this.target;
|
|
if (value) {
|
|
this.value = this.stringify.insValue(value);
|
|
}
|
|
}
|
|
|
|
XMLProcessingInstruction.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLProcessingInstruction.prototype.toString = function(options) {
|
|
return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLProcessingInstruction.prototype.isEqualNode = function(node) {
|
|
if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
|
return false;
|
|
}
|
|
if (node.target !== this.target) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
|
|
return XMLProcessingInstruction;
|
|
|
|
})(XMLCharacterData);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6329:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLNode, XMLRaw,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLNode = __nccwpck_require__(7608);
|
|
|
|
module.exports = XMLRaw = (function(superClass) {
|
|
extend(XMLRaw, superClass);
|
|
|
|
function XMLRaw(parent, text) {
|
|
XMLRaw.__super__.constructor.call(this, parent);
|
|
if (text == null) {
|
|
throw new Error("Missing raw text. " + this.debugInfo());
|
|
}
|
|
this.type = NodeType.Raw;
|
|
this.value = this.stringify.raw(text);
|
|
}
|
|
|
|
XMLRaw.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLRaw.prototype.toString = function(options) {
|
|
return this.options.writer.raw(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
return XMLRaw;
|
|
|
|
})(XMLNode);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8601:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, WriterState, XMLStreamWriter, XMLWriterBase,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLWriterBase = __nccwpck_require__(6752);
|
|
|
|
WriterState = __nccwpck_require__(9766);
|
|
|
|
module.exports = XMLStreamWriter = (function(superClass) {
|
|
extend(XMLStreamWriter, superClass);
|
|
|
|
function XMLStreamWriter(stream, options) {
|
|
this.stream = stream;
|
|
XMLStreamWriter.__super__.constructor.call(this, options);
|
|
}
|
|
|
|
XMLStreamWriter.prototype.endline = function(node, options, level) {
|
|
if (node.isLastRootNode && options.state === WriterState.CloseTag) {
|
|
return '';
|
|
} else {
|
|
return XMLStreamWriter.__super__.endline.call(this, node, options, level);
|
|
}
|
|
};
|
|
|
|
XMLStreamWriter.prototype.document = function(doc, options) {
|
|
var child, i, j, k, len, len1, ref, ref1, results;
|
|
ref = doc.children;
|
|
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
|
child = ref[i];
|
|
child.isLastRootNode = i === doc.children.length - 1;
|
|
}
|
|
options = this.filterOptions(options);
|
|
ref1 = doc.children;
|
|
results = [];
|
|
for (k = 0, len1 = ref1.length; k < len1; k++) {
|
|
child = ref1[k];
|
|
results.push(this.writeChildNode(child, options, 0));
|
|
}
|
|
return results;
|
|
};
|
|
|
|
XMLStreamWriter.prototype.attribute = function(att, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.cdata = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.comment = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.declaration = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.docType = function(node, options, level) {
|
|
var child, j, len, ref;
|
|
level || (level = 0);
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
this.stream.write(this.indent(node, options, level));
|
|
this.stream.write('<!DOCTYPE ' + node.root().name);
|
|
if (node.pubID && node.sysID) {
|
|
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
|
|
} else if (node.sysID) {
|
|
this.stream.write(' SYSTEM "' + node.sysID + '"');
|
|
}
|
|
if (node.children.length > 0) {
|
|
this.stream.write(' [');
|
|
this.stream.write(this.endline(node, options, level));
|
|
options.state = WriterState.InsideTag;
|
|
ref = node.children;
|
|
for (j = 0, len = ref.length; j < len; j++) {
|
|
child = ref[j];
|
|
this.writeChildNode(child, options, level + 1);
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write(']');
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write(options.spaceBeforeSlash + '>');
|
|
this.stream.write(this.endline(node, options, level));
|
|
options.state = WriterState.None;
|
|
return this.closeNode(node, options, level);
|
|
};
|
|
|
|
XMLStreamWriter.prototype.element = function(node, options, level) {
|
|
var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
|
|
level || (level = 0);
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
this.stream.write(this.indent(node, options, level) + '<' + node.name);
|
|
ref = node.attribs;
|
|
for (name in ref) {
|
|
if (!hasProp.call(ref, name)) continue;
|
|
att = ref[name];
|
|
this.attribute(att, options, level);
|
|
}
|
|
childNodeCount = node.children.length;
|
|
firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
|
if (childNodeCount === 0 || node.children.every(function(e) {
|
|
return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
|
})) {
|
|
if (options.allowEmpty) {
|
|
this.stream.write('>');
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write('</' + node.name + '>');
|
|
} else {
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write(options.spaceBeforeSlash + '/>');
|
|
}
|
|
} else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
|
|
this.stream.write('>');
|
|
options.state = WriterState.InsideTag;
|
|
options.suppressPrettyCount++;
|
|
prettySuppressed = true;
|
|
this.writeChildNode(firstChildNode, options, level + 1);
|
|
options.suppressPrettyCount--;
|
|
prettySuppressed = false;
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write('</' + node.name + '>');
|
|
} else {
|
|
this.stream.write('>' + this.endline(node, options, level));
|
|
options.state = WriterState.InsideTag;
|
|
ref1 = node.children;
|
|
for (j = 0, len = ref1.length; j < len; j++) {
|
|
child = ref1[j];
|
|
this.writeChildNode(child, options, level + 1);
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
|
|
}
|
|
this.stream.write(this.endline(node, options, level));
|
|
options.state = WriterState.None;
|
|
return this.closeNode(node, options, level);
|
|
};
|
|
|
|
XMLStreamWriter.prototype.processingInstruction = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.raw = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.text = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.dtdAttList = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.dtdElement = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.dtdEntity = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
|
|
};
|
|
|
|
XMLStreamWriter.prototype.dtdNotation = function(node, options, level) {
|
|
return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
|
|
};
|
|
|
|
return XMLStreamWriter;
|
|
|
|
})(XMLWriterBase);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5913:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLStringWriter, XMLWriterBase,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
XMLWriterBase = __nccwpck_require__(6752);
|
|
|
|
module.exports = XMLStringWriter = (function(superClass) {
|
|
extend(XMLStringWriter, superClass);
|
|
|
|
function XMLStringWriter(options) {
|
|
XMLStringWriter.__super__.constructor.call(this, options);
|
|
}
|
|
|
|
XMLStringWriter.prototype.document = function(doc, options) {
|
|
var child, i, len, r, ref;
|
|
options = this.filterOptions(options);
|
|
r = '';
|
|
ref = doc.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
r += this.writeChildNode(child, options, 0);
|
|
}
|
|
if (options.pretty && r.slice(-options.newline.length) === options.newline) {
|
|
r = r.slice(0, -options.newline.length);
|
|
}
|
|
return r;
|
|
};
|
|
|
|
return XMLStringWriter;
|
|
|
|
})(XMLWriterBase);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8594:
|
|
/***/ (function(module) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var XMLStringifier,
|
|
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
module.exports = XMLStringifier = (function() {
|
|
function XMLStringifier(options) {
|
|
this.assertLegalName = bind(this.assertLegalName, this);
|
|
this.assertLegalChar = bind(this.assertLegalChar, this);
|
|
var key, ref, value;
|
|
options || (options = {});
|
|
this.options = options;
|
|
if (!this.options.version) {
|
|
this.options.version = '1.0';
|
|
}
|
|
ref = options.stringify || {};
|
|
for (key in ref) {
|
|
if (!hasProp.call(ref, key)) continue;
|
|
value = ref[key];
|
|
this[key] = value;
|
|
}
|
|
}
|
|
|
|
XMLStringifier.prototype.name = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalName('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.text = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar(this.textEscape('' + val || ''));
|
|
};
|
|
|
|
XMLStringifier.prototype.cdata = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
val = '' + val || '';
|
|
val = val.replace(']]>', ']]]]><![CDATA[>');
|
|
return this.assertLegalChar(val);
|
|
};
|
|
|
|
XMLStringifier.prototype.comment = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
val = '' + val || '';
|
|
if (val.match(/--/)) {
|
|
throw new Error("Comment text cannot contain double-hypen: " + val);
|
|
}
|
|
return this.assertLegalChar(val);
|
|
};
|
|
|
|
XMLStringifier.prototype.raw = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return '' + val || '';
|
|
};
|
|
|
|
XMLStringifier.prototype.attValue = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar(this.attEscape(val = '' + val || ''));
|
|
};
|
|
|
|
XMLStringifier.prototype.insTarget = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.insValue = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
val = '' + val || '';
|
|
if (val.match(/\?>/)) {
|
|
throw new Error("Invalid processing instruction value: " + val);
|
|
}
|
|
return this.assertLegalChar(val);
|
|
};
|
|
|
|
XMLStringifier.prototype.xmlVersion = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
val = '' + val || '';
|
|
if (!val.match(/1\.[0-9]+/)) {
|
|
throw new Error("Invalid version number: " + val);
|
|
}
|
|
return val;
|
|
};
|
|
|
|
XMLStringifier.prototype.xmlEncoding = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
val = '' + val || '';
|
|
if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
|
|
throw new Error("Invalid encoding: " + val);
|
|
}
|
|
return this.assertLegalChar(val);
|
|
};
|
|
|
|
XMLStringifier.prototype.xmlStandalone = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
if (val) {
|
|
return "yes";
|
|
} else {
|
|
return "no";
|
|
}
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdPubID = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdSysID = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdElementValue = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdAttType = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdAttDefault = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdEntityValue = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.dtdNData = function(val) {
|
|
if (this.options.noValidation) {
|
|
return val;
|
|
}
|
|
return this.assertLegalChar('' + val || '');
|
|
};
|
|
|
|
XMLStringifier.prototype.convertAttKey = '@';
|
|
|
|
XMLStringifier.prototype.convertPIKey = '?';
|
|
|
|
XMLStringifier.prototype.convertTextKey = '#text';
|
|
|
|
XMLStringifier.prototype.convertCDataKey = '#cdata';
|
|
|
|
XMLStringifier.prototype.convertCommentKey = '#comment';
|
|
|
|
XMLStringifier.prototype.convertRawKey = '#raw';
|
|
|
|
XMLStringifier.prototype.assertLegalChar = function(str) {
|
|
var regex, res;
|
|
if (this.options.noValidation) {
|
|
return str;
|
|
}
|
|
regex = '';
|
|
if (this.options.version === '1.0') {
|
|
regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
if (res = str.match(regex)) {
|
|
throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
|
}
|
|
} else if (this.options.version === '1.1') {
|
|
regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
if (res = str.match(regex)) {
|
|
throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
|
}
|
|
}
|
|
return str;
|
|
};
|
|
|
|
XMLStringifier.prototype.assertLegalName = function(str) {
|
|
var regex;
|
|
if (this.options.noValidation) {
|
|
return str;
|
|
}
|
|
this.assertLegalChar(str);
|
|
regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
|
|
if (!str.match(regex)) {
|
|
throw new Error("Invalid character in name");
|
|
}
|
|
return str;
|
|
};
|
|
|
|
XMLStringifier.prototype.textEscape = function(str) {
|
|
var ampregex;
|
|
if (this.options.noValidation) {
|
|
return str;
|
|
}
|
|
ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
|
return str.replace(ampregex, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
');
|
|
};
|
|
|
|
XMLStringifier.prototype.attEscape = function(str) {
|
|
var ampregex;
|
|
if (this.options.noValidation) {
|
|
return str;
|
|
}
|
|
ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
|
return str.replace(ampregex, '&').replace(/</g, '<').replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
');
|
|
};
|
|
|
|
return XMLStringifier;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1318:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, XMLCharacterData, XMLText,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLCharacterData = __nccwpck_require__(7709);
|
|
|
|
module.exports = XMLText = (function(superClass) {
|
|
extend(XMLText, superClass);
|
|
|
|
function XMLText(parent, text) {
|
|
XMLText.__super__.constructor.call(this, parent);
|
|
if (text == null) {
|
|
throw new Error("Missing element text. " + this.debugInfo());
|
|
}
|
|
this.name = "#text";
|
|
this.type = NodeType.Text;
|
|
this.value = this.stringify.text(text);
|
|
}
|
|
|
|
Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
|
|
get: function() {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(XMLText.prototype, 'wholeText', {
|
|
get: function() {
|
|
var next, prev, str;
|
|
str = '';
|
|
prev = this.previousSibling;
|
|
while (prev) {
|
|
str = prev.data + str;
|
|
prev = prev.previousSibling;
|
|
}
|
|
str += this.data;
|
|
next = this.nextSibling;
|
|
while (next) {
|
|
str = str + next.data;
|
|
next = next.nextSibling;
|
|
}
|
|
return str;
|
|
}
|
|
});
|
|
|
|
XMLText.prototype.clone = function() {
|
|
return Object.create(this);
|
|
};
|
|
|
|
XMLText.prototype.toString = function(options) {
|
|
return this.options.writer.text(this, this.options.writer.filterOptions(options));
|
|
};
|
|
|
|
XMLText.prototype.splitText = function(offset) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
XMLText.prototype.replaceWholeText = function(content) {
|
|
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
|
};
|
|
|
|
return XMLText;
|
|
|
|
})(XMLCharacterData);
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6752:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign,
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
assign = (__nccwpck_require__(8229).assign);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
XMLDeclaration = __nccwpck_require__(6364);
|
|
|
|
XMLDocType = __nccwpck_require__(1801);
|
|
|
|
XMLCData = __nccwpck_require__(333);
|
|
|
|
XMLComment = __nccwpck_require__(4407);
|
|
|
|
XMLElement = __nccwpck_require__(9437);
|
|
|
|
XMLRaw = __nccwpck_require__(6329);
|
|
|
|
XMLText = __nccwpck_require__(1318);
|
|
|
|
XMLProcessingInstruction = __nccwpck_require__(6939);
|
|
|
|
XMLDummy = __nccwpck_require__(3590);
|
|
|
|
XMLDTDAttList = __nccwpck_require__(1015);
|
|
|
|
XMLDTDElement = __nccwpck_require__(2421);
|
|
|
|
XMLDTDEntity = __nccwpck_require__(53);
|
|
|
|
XMLDTDNotation = __nccwpck_require__(2837);
|
|
|
|
WriterState = __nccwpck_require__(9766);
|
|
|
|
module.exports = XMLWriterBase = (function() {
|
|
function XMLWriterBase(options) {
|
|
var key, ref, value;
|
|
options || (options = {});
|
|
this.options = options;
|
|
ref = options.writer || {};
|
|
for (key in ref) {
|
|
if (!hasProp.call(ref, key)) continue;
|
|
value = ref[key];
|
|
this["_" + key] = this[key];
|
|
this[key] = value;
|
|
}
|
|
}
|
|
|
|
XMLWriterBase.prototype.filterOptions = function(options) {
|
|
var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
|
options || (options = {});
|
|
options = assign({}, this.options, options);
|
|
filteredOptions = {
|
|
writer: this
|
|
};
|
|
filteredOptions.pretty = options.pretty || false;
|
|
filteredOptions.allowEmpty = options.allowEmpty || false;
|
|
filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
|
|
filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
|
|
filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
|
|
filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
|
|
filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
|
|
if (filteredOptions.spaceBeforeSlash === true) {
|
|
filteredOptions.spaceBeforeSlash = ' ';
|
|
}
|
|
filteredOptions.suppressPrettyCount = 0;
|
|
filteredOptions.user = {};
|
|
filteredOptions.state = WriterState.None;
|
|
return filteredOptions;
|
|
};
|
|
|
|
XMLWriterBase.prototype.indent = function(node, options, level) {
|
|
var indentLevel;
|
|
if (!options.pretty || options.suppressPrettyCount) {
|
|
return '';
|
|
} else if (options.pretty) {
|
|
indentLevel = (level || 0) + options.offset + 1;
|
|
if (indentLevel > 0) {
|
|
return new Array(indentLevel).join(options.indent);
|
|
}
|
|
}
|
|
return '';
|
|
};
|
|
|
|
XMLWriterBase.prototype.endline = function(node, options, level) {
|
|
if (!options.pretty || options.suppressPrettyCount) {
|
|
return '';
|
|
} else {
|
|
return options.newline;
|
|
}
|
|
};
|
|
|
|
XMLWriterBase.prototype.attribute = function(att, options, level) {
|
|
var r;
|
|
this.openAttribute(att, options, level);
|
|
r = ' ' + att.name + '="' + att.value + '"';
|
|
this.closeAttribute(att, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.cdata = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<![CDATA[';
|
|
options.state = WriterState.InsideTag;
|
|
r += node.value;
|
|
options.state = WriterState.CloseTag;
|
|
r += ']]>' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.comment = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<!-- ';
|
|
options.state = WriterState.InsideTag;
|
|
r += node.value;
|
|
options.state = WriterState.CloseTag;
|
|
r += ' -->' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.declaration = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<?xml';
|
|
options.state = WriterState.InsideTag;
|
|
r += ' version="' + node.version + '"';
|
|
if (node.encoding != null) {
|
|
r += ' encoding="' + node.encoding + '"';
|
|
}
|
|
if (node.standalone != null) {
|
|
r += ' standalone="' + node.standalone + '"';
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '?>';
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.docType = function(node, options, level) {
|
|
var child, i, len, r, ref;
|
|
level || (level = 0);
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level);
|
|
r += '<!DOCTYPE ' + node.root().name;
|
|
if (node.pubID && node.sysID) {
|
|
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
|
} else if (node.sysID) {
|
|
r += ' SYSTEM "' + node.sysID + '"';
|
|
}
|
|
if (node.children.length > 0) {
|
|
r += ' [';
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.InsideTag;
|
|
ref = node.children;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
child = ref[i];
|
|
r += this.writeChildNode(child, options, level + 1);
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += ']';
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '>';
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.element = function(node, options, level) {
|
|
var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
|
|
level || (level = 0);
|
|
prettySuppressed = false;
|
|
r = '';
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r += this.indent(node, options, level) + '<' + node.name;
|
|
ref = node.attribs;
|
|
for (name in ref) {
|
|
if (!hasProp.call(ref, name)) continue;
|
|
att = ref[name];
|
|
r += this.attribute(att, options, level);
|
|
}
|
|
childNodeCount = node.children.length;
|
|
firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
|
if (childNodeCount === 0 || node.children.every(function(e) {
|
|
return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
|
})) {
|
|
if (options.allowEmpty) {
|
|
r += '>';
|
|
options.state = WriterState.CloseTag;
|
|
r += '</' + node.name + '>' + this.endline(node, options, level);
|
|
} else {
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
|
|
}
|
|
} else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
|
|
r += '>';
|
|
options.state = WriterState.InsideTag;
|
|
options.suppressPrettyCount++;
|
|
prettySuppressed = true;
|
|
r += this.writeChildNode(firstChildNode, options, level + 1);
|
|
options.suppressPrettyCount--;
|
|
prettySuppressed = false;
|
|
options.state = WriterState.CloseTag;
|
|
r += '</' + node.name + '>' + this.endline(node, options, level);
|
|
} else {
|
|
if (options.dontPrettyTextNodes) {
|
|
ref1 = node.children;
|
|
for (i = 0, len = ref1.length; i < len; i++) {
|
|
child = ref1[i];
|
|
if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) {
|
|
options.suppressPrettyCount++;
|
|
prettySuppressed = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
r += '>' + this.endline(node, options, level);
|
|
options.state = WriterState.InsideTag;
|
|
ref2 = node.children;
|
|
for (j = 0, len1 = ref2.length; j < len1; j++) {
|
|
child = ref2[j];
|
|
r += this.writeChildNode(child, options, level + 1);
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += this.indent(node, options, level) + '</' + node.name + '>';
|
|
if (prettySuppressed) {
|
|
options.suppressPrettyCount--;
|
|
}
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
}
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.writeChildNode = function(node, options, level) {
|
|
switch (node.type) {
|
|
case NodeType.CData:
|
|
return this.cdata(node, options, level);
|
|
case NodeType.Comment:
|
|
return this.comment(node, options, level);
|
|
case NodeType.Element:
|
|
return this.element(node, options, level);
|
|
case NodeType.Raw:
|
|
return this.raw(node, options, level);
|
|
case NodeType.Text:
|
|
return this.text(node, options, level);
|
|
case NodeType.ProcessingInstruction:
|
|
return this.processingInstruction(node, options, level);
|
|
case NodeType.Dummy:
|
|
return '';
|
|
case NodeType.Declaration:
|
|
return this.declaration(node, options, level);
|
|
case NodeType.DocType:
|
|
return this.docType(node, options, level);
|
|
case NodeType.AttributeDeclaration:
|
|
return this.dtdAttList(node, options, level);
|
|
case NodeType.ElementDeclaration:
|
|
return this.dtdElement(node, options, level);
|
|
case NodeType.EntityDeclaration:
|
|
return this.dtdEntity(node, options, level);
|
|
case NodeType.NotationDeclaration:
|
|
return this.dtdNotation(node, options, level);
|
|
default:
|
|
throw new Error("Unknown XML node type: " + node.constructor.name);
|
|
}
|
|
};
|
|
|
|
XMLWriterBase.prototype.processingInstruction = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<?';
|
|
options.state = WriterState.InsideTag;
|
|
r += node.target;
|
|
if (node.value) {
|
|
r += ' ' + node.value;
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '?>';
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.raw = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level);
|
|
options.state = WriterState.InsideTag;
|
|
r += node.value;
|
|
options.state = WriterState.CloseTag;
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.text = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level);
|
|
options.state = WriterState.InsideTag;
|
|
r += node.value;
|
|
options.state = WriterState.CloseTag;
|
|
r += this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.dtdAttList = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<!ATTLIST';
|
|
options.state = WriterState.InsideTag;
|
|
r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
|
|
if (node.defaultValueType !== '#DEFAULT') {
|
|
r += ' ' + node.defaultValueType;
|
|
}
|
|
if (node.defaultValue) {
|
|
r += ' "' + node.defaultValue + '"';
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.dtdElement = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<!ELEMENT';
|
|
options.state = WriterState.InsideTag;
|
|
r += ' ' + node.name + ' ' + node.value;
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.dtdEntity = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<!ENTITY';
|
|
options.state = WriterState.InsideTag;
|
|
if (node.pe) {
|
|
r += ' %';
|
|
}
|
|
r += ' ' + node.name;
|
|
if (node.value) {
|
|
r += ' "' + node.value + '"';
|
|
} else {
|
|
if (node.pubID && node.sysID) {
|
|
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
|
} else if (node.sysID) {
|
|
r += ' SYSTEM "' + node.sysID + '"';
|
|
}
|
|
if (node.nData) {
|
|
r += ' NDATA ' + node.nData;
|
|
}
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.dtdNotation = function(node, options, level) {
|
|
var r;
|
|
this.openNode(node, options, level);
|
|
options.state = WriterState.OpenTag;
|
|
r = this.indent(node, options, level) + '<!NOTATION';
|
|
options.state = WriterState.InsideTag;
|
|
r += ' ' + node.name;
|
|
if (node.pubID && node.sysID) {
|
|
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
|
} else if (node.pubID) {
|
|
r += ' PUBLIC "' + node.pubID + '"';
|
|
} else if (node.sysID) {
|
|
r += ' SYSTEM "' + node.sysID + '"';
|
|
}
|
|
options.state = WriterState.CloseTag;
|
|
r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
|
options.state = WriterState.None;
|
|
this.closeNode(node, options, level);
|
|
return r;
|
|
};
|
|
|
|
XMLWriterBase.prototype.openNode = function(node, options, level) {};
|
|
|
|
XMLWriterBase.prototype.closeNode = function(node, options, level) {};
|
|
|
|
XMLWriterBase.prototype.openAttribute = function(att, options, level) {};
|
|
|
|
XMLWriterBase.prototype.closeAttribute = function(att, options, level) {};
|
|
|
|
return XMLWriterBase;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2958:
|
|
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
|
|
|
|
// Generated by CoffeeScript 1.12.7
|
|
(function() {
|
|
var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
|
|
|
|
ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction;
|
|
|
|
XMLDOMImplementation = __nccwpck_require__(8310);
|
|
|
|
XMLDocument = __nccwpck_require__(3730);
|
|
|
|
XMLDocumentCB = __nccwpck_require__(7356);
|
|
|
|
XMLStringWriter = __nccwpck_require__(5913);
|
|
|
|
XMLStreamWriter = __nccwpck_require__(8601);
|
|
|
|
NodeType = __nccwpck_require__(9267);
|
|
|
|
WriterState = __nccwpck_require__(9766);
|
|
|
|
module.exports.create = function(name, xmldec, doctype, options) {
|
|
var doc, root;
|
|
if (name == null) {
|
|
throw new Error("Root element needs a name.");
|
|
}
|
|
options = assign({}, xmldec, doctype, options);
|
|
doc = new XMLDocument(options);
|
|
root = doc.element(name);
|
|
if (!options.headless) {
|
|
doc.declaration(options);
|
|
if ((options.pubID != null) || (options.sysID != null)) {
|
|
doc.dtd(options);
|
|
}
|
|
}
|
|
return root;
|
|
};
|
|
|
|
module.exports.begin = function(options, onData, onEnd) {
|
|
var ref1;
|
|
if (isFunction(options)) {
|
|
ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
|
|
options = {};
|
|
}
|
|
if (onData) {
|
|
return new XMLDocumentCB(options, onData, onEnd);
|
|
} else {
|
|
return new XMLDocument(options);
|
|
}
|
|
};
|
|
|
|
module.exports.stringWriter = function(options) {
|
|
return new XMLStringWriter(options);
|
|
};
|
|
|
|
module.exports.streamWriter = function(stream, options) {
|
|
return new XMLStreamWriter(stream, options);
|
|
};
|
|
|
|
module.exports.implementation = new XMLDOMImplementation();
|
|
|
|
module.exports.nodeType = NodeType;
|
|
|
|
module.exports.writerState = WriterState;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9042:
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
|
|
var Inputs;
|
|
(function (Inputs) {
|
|
Inputs["Key"] = "key";
|
|
Inputs["Path"] = "path";
|
|
Inputs["RestoreKeys"] = "restore-keys";
|
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
|
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
|
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
|
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
|
var Outputs;
|
|
(function (Outputs) {
|
|
Outputs["CacheHit"] = "cache-hit";
|
|
Outputs["CachePrimaryKey"] = "cache-primary-key";
|
|
Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action
|
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
|
var State;
|
|
(function (State) {
|
|
State["CachePrimaryKey"] = "CACHE_KEY";
|
|
State["CacheMatchedKey"] = "CACHE_RESULT";
|
|
})(State = exports.State || (exports.State = {}));
|
|
var Events;
|
|
(function (Events) {
|
|
Events["Key"] = "GITHUB_EVENT_NAME";
|
|
Events["Push"] = "push";
|
|
Events["PullRequest"] = "pull_request";
|
|
})(Events = exports.Events || (exports.Events = {}));
|
|
exports.RefKey = "GITHUB_REF";
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6589:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.saveRun = exports.saveOnlyRun = exports.saveImpl = void 0;
|
|
const cache = __importStar(__nccwpck_require__(5628));
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
const constants_1 = __nccwpck_require__(9042);
|
|
const stateProvider_1 = __nccwpck_require__(1527);
|
|
const utils = __importStar(__nccwpck_require__(6850));
|
|
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
|
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
|
// throw an uncaught exception. Instead of failing this action, just warn.
|
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
|
function saveImpl(stateProvider) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
let cacheId = -1;
|
|
try {
|
|
if (!utils.isCacheFeatureAvailable()) {
|
|
return;
|
|
}
|
|
if (!utils.isValidEvent()) {
|
|
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
|
|
return;
|
|
}
|
|
// If restore has stored a primary key in state, reuse that
|
|
// Else re-evaluate from inputs
|
|
const primaryKey = stateProvider.getState(constants_1.State.CachePrimaryKey) ||
|
|
core.getInput(constants_1.Inputs.Key);
|
|
if (!primaryKey) {
|
|
utils.logWarning(`Key is not specified.`);
|
|
return;
|
|
}
|
|
// If matched restore key is same as primary key, then do not save cache
|
|
// NO-OP in case of SaveOnly action
|
|
const restoredKey = stateProvider.getCacheState();
|
|
if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
|
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
|
return;
|
|
}
|
|
const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
|
|
required: true
|
|
});
|
|
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
|
|
cacheId = yield cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive);
|
|
if (cacheId != -1) {
|
|
core.info(`Cache saved with key: ${primaryKey}`);
|
|
}
|
|
}
|
|
catch (error) {
|
|
utils.logWarning(error.message);
|
|
}
|
|
return cacheId;
|
|
});
|
|
}
|
|
exports.saveImpl = saveImpl;
|
|
function saveOnlyRun(earlyExit) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
try {
|
|
const cacheId = yield saveImpl(new stateProvider_1.NullStateProvider());
|
|
if (cacheId === -1) {
|
|
core.warning(`Cache save failed.`);
|
|
}
|
|
}
|
|
catch (err) {
|
|
console.error(err);
|
|
if (earlyExit) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
// node will stay alive if any promises are not resolved,
|
|
// which is a possibility if HTTP requests are dangling
|
|
// due to retries or timeouts. We know that if we got here
|
|
// that all promises that we care about have successfully
|
|
// resolved, so simply exit with success.
|
|
if (earlyExit) {
|
|
process.exit(0);
|
|
}
|
|
});
|
|
}
|
|
exports.saveOnlyRun = saveOnlyRun;
|
|
function saveRun(earlyExit) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
try {
|
|
yield saveImpl(new stateProvider_1.StateProvider());
|
|
}
|
|
catch (err) {
|
|
console.error(err);
|
|
if (earlyExit) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
// node will stay alive if any promises are not resolved,
|
|
// which is a possibility if HTTP requests are dangling
|
|
// due to retries or timeouts. We know that if we got here
|
|
// that all promises that we care about have successfully
|
|
// resolved, so simply exit with success.
|
|
if (earlyExit) {
|
|
process.exit(0);
|
|
}
|
|
});
|
|
}
|
|
exports.saveRun = saveRun;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1527:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.NullStateProvider = exports.StateProvider = void 0;
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
const constants_1 = __nccwpck_require__(9042);
|
|
class StateProviderBase {
|
|
constructor() {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
this.setState = (key, value) => { };
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
this.getState = (key) => "";
|
|
}
|
|
getCacheState() {
|
|
const cacheKey = this.getState(constants_1.State.CacheMatchedKey);
|
|
if (cacheKey) {
|
|
core.debug(`Cache state/key: ${cacheKey}`);
|
|
return cacheKey;
|
|
}
|
|
return undefined;
|
|
}
|
|
}
|
|
class StateProvider extends StateProviderBase {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.setState = core.saveState;
|
|
this.getState = core.getState;
|
|
}
|
|
}
|
|
exports.StateProvider = StateProvider;
|
|
class NullStateProvider extends StateProviderBase {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.stateToOutputMap = new Map([
|
|
[constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey],
|
|
[constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey]
|
|
]);
|
|
this.setState = (key, value) => {
|
|
core.setOutput(this.stateToOutputMap.get(key), value);
|
|
};
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
this.getState = (key) => "";
|
|
}
|
|
}
|
|
exports.NullStateProvider = NullStateProvider;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6850:
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
exports.isCacheFeatureAvailable = exports.getInputAsBool = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0;
|
|
const cache = __importStar(__nccwpck_require__(5628));
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
const constants_1 = __nccwpck_require__(9042);
|
|
function isGhes() {
|
|
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
|
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
|
}
|
|
exports.isGhes = isGhes;
|
|
function isExactKeyMatch(key, cacheKey) {
|
|
return !!(cacheKey &&
|
|
cacheKey.localeCompare(key, undefined, {
|
|
sensitivity: "accent"
|
|
}) === 0);
|
|
}
|
|
exports.isExactKeyMatch = isExactKeyMatch;
|
|
function logWarning(message) {
|
|
const warningPrefix = "[warning]";
|
|
core.info(`${warningPrefix}${message}`);
|
|
}
|
|
exports.logWarning = logWarning;
|
|
// Cache token authorized for all events that are tied to a ref
|
|
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
|
|
function isValidEvent() {
|
|
return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
|
|
}
|
|
exports.isValidEvent = isValidEvent;
|
|
function getInputAsArray(name, options) {
|
|
return core
|
|
.getInput(name, options)
|
|
.split("\n")
|
|
.map(s => s.replace(/^!\s+/, "!").trim())
|
|
.filter(x => x !== "");
|
|
}
|
|
exports.getInputAsArray = getInputAsArray;
|
|
function getInputAsInt(name, options) {
|
|
const value = parseInt(core.getInput(name, options));
|
|
if (isNaN(value) || value < 0) {
|
|
return undefined;
|
|
}
|
|
return value;
|
|
}
|
|
exports.getInputAsInt = getInputAsInt;
|
|
function getInputAsBool(name, options) {
|
|
const result = core.getInput(name, options);
|
|
return result.toLowerCase() === "true";
|
|
}
|
|
exports.getInputAsBool = getInputAsBool;
|
|
function isCacheFeatureAvailable() {
|
|
if (cache.isFeatureAvailable()) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9491:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("assert");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4300:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("buffer");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2081:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("child_process");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6113:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("crypto");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2361:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("events");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7147:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("fs");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3685:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("http");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5687:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("https");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1808:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("net");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2037:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("os");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1017:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("path");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2781:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("stream");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1576:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("string_decoder");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9512:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("timers");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4404:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("tls");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3837:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = require("util");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7579:
|
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
|
|
"use strict";
|
|
// ESM COMPAT FLAG
|
|
__nccwpck_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__nccwpck_require__.d(__webpack_exports__, {
|
|
"default": () => (/* binding */ yn)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/yn/lenient.js
|
|
const YES_MATCH_SCORE_THRESHOLD = 2;
|
|
const NO_MATCH_SCORE_THRESHOLD = 1.25;
|
|
|
|
const yMatch = new Map([
|
|
[5, 0.25],
|
|
[6, 0.25],
|
|
[7, 0.25],
|
|
['t', 0.75],
|
|
['y', 1],
|
|
['u', 0.75],
|
|
['g', 0.25],
|
|
['h', 0.25],
|
|
['j', 0.25],
|
|
]);
|
|
|
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
const eMatch = new Map([
|
|
[2, 0.25],
|
|
[3, 0.25],
|
|
[4, 0.25],
|
|
['w', 0.75],
|
|
['e', 1],
|
|
['r', 0.75],
|
|
['s', 0.25],
|
|
['d', 0.25],
|
|
['f', 0.25],
|
|
]);
|
|
|
|
const sMatch = new Map([
|
|
['q', 0.25],
|
|
['w', 0.25],
|
|
['e', 0.25],
|
|
['a', 0.75],
|
|
['s', 1],
|
|
['d', 0.75],
|
|
['z', 0.25],
|
|
['x', 0.25],
|
|
['c', 0.25],
|
|
]);
|
|
|
|
const nMatch = new Map([
|
|
['h', 0.25],
|
|
['j', 0.25],
|
|
['k', 0.25],
|
|
['b', 0.75],
|
|
['n', 1],
|
|
['m', 0.75],
|
|
]);
|
|
|
|
const oMatch = new Map([
|
|
[9, 0.25],
|
|
[0, 0.25],
|
|
['i', 0.75],
|
|
['o', 1],
|
|
['p', 0.75],
|
|
['k', 0.25],
|
|
['l', 0.25],
|
|
]);
|
|
|
|
function getYesMatchScore(value) {
|
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
const [y, e, s] = value;
|
|
let score = 0;
|
|
|
|
if (yMatch.has(y)) {
|
|
score += yMatch.get(y);
|
|
}
|
|
|
|
if (eMatch.has(e)) {
|
|
score += eMatch.get(e);
|
|
}
|
|
|
|
if (sMatch.has(s)) {
|
|
score += sMatch.get(s);
|
|
}
|
|
|
|
return score;
|
|
}
|
|
|
|
function getNoMatchScore(value) {
|
|
const [n, o] = value;
|
|
let score = 0;
|
|
|
|
if (nMatch.has(n)) {
|
|
score += nMatch.get(n);
|
|
}
|
|
|
|
if (oMatch.has(o)) {
|
|
score += oMatch.get(o);
|
|
}
|
|
|
|
return score;
|
|
}
|
|
|
|
function lenient_lenient(input, default_) {
|
|
if (getYesMatchScore(input) >= YES_MATCH_SCORE_THRESHOLD) {
|
|
return true;
|
|
}
|
|
|
|
if (getNoMatchScore(input) >= NO_MATCH_SCORE_THRESHOLD) {
|
|
return false;
|
|
}
|
|
|
|
return default_;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/yn/index.js
|
|
|
|
|
|
function yn(value, {
|
|
lenient = false,
|
|
default: default_,
|
|
} = {}) {
|
|
value = String(value).trim();
|
|
|
|
if (default_ !== undefined && typeof default_ !== 'boolean') {
|
|
throw new TypeError(`Expected the \`default\` option to be of type \`boolean\`, got \`${typeof default_}\``);
|
|
}
|
|
|
|
if (/^(?:y|yes|true|1|on)$/i.test(value)) {
|
|
return true;
|
|
}
|
|
|
|
if (/^(?:n|no|false|0|off)$/i.test(value)) {
|
|
return false;
|
|
}
|
|
|
|
if (lenient === true) {
|
|
return lenient_lenient(value, default_);
|
|
}
|
|
|
|
return default_;
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3765:
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/3gpp-ims+xml":{"source":"iana","compressible":true},"application/3gpphal+json":{"source":"iana","compressible":true},"application/3gpphalforms+json":{"source":"iana","compressible":true},"application/a2l":{"source":"iana"},"application/ace+cbor":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/activity+json":{"source":"iana","compressible":true},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana","compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana","compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/alto-updatestreamcontrol+json":{"source":"iana","compressible":true},"application/alto-updatestreamparams+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/at+jwt":{"source":"iana"},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana","compressible":true,"extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana","compressible":true,"extensions":["atomdeleted"]},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","compressible":true,"extensions":["atomsvc"]},"application/atsc-dwd+xml":{"source":"iana","compressible":true,"extensions":["dwd"]},"application/atsc-dynamic-event-message":{"source":"iana"},"application/atsc-held+xml":{"source":"iana","compressible":true,"extensions":["held"]},"application/atsc-rdt+json":{"source":"iana","compressible":true},"application/atsc-rsat+xml":{"source":"iana","compressible":true,"extensions":["rsat"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana","compressible":true},"application/bacnet-xdd+zip":{"source":"iana","compressible":false},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/calendar+json":{"source":"iana","compressible":true},"application/calendar+xml":{"source":"iana","compressible":true,"extensions":["xcs"]},"application/call-completion":{"source":"iana"},"application/cals-1840":{"source":"iana"},"application/captive+json":{"source":"iana","compressible":true},"application/cbor":{"source":"iana"},"application/cbor-seq":{"source":"iana"},"application/cccex":{"source":"iana"},"application/ccmp+xml":{"source":"iana","compressible":true},"application/ccxml+xml":{"source":"iana","compressible":true,"extensions":["ccxml"]},"application/cdfx+xml":{"source":"iana","compressible":true,"extensions":["cdfx"]},"application/cdmi-capability":{"source":"iana","extensions":["cdmia"]},"application/cdmi-container":{"source":"iana","extensions":["cdmic"]},"application/cdmi-domain":{"source":"iana","extensions":["cdmid"]},"application/cdmi-object":{"source":"iana","extensions":["cdmio"]},"application/cdmi-queue":{"source":"iana","extensions":["cdmiq"]},"application/cdni":{"source":"iana"},"application/cea":{"source":"iana"},"application/cea-2018+xml":{"source":"iana","compressible":true},"application/cellml+xml":{"source":"iana","compressible":true},"application/cfw":{"source":"iana"},"application/city+json":{"source":"iana","compressible":true},"application/clr":{"source":"iana"},"application/clue+xml":{"source":"iana","compressible":true},"application/clue_info+xml":{"source":"iana","compressible":true},"application/cms":{"source":"iana"},"application/cnrp+xml":{"source":"iana","compressible":true},"application/coap-group+json":{"source":"iana","compressible":true},"application/coap-payload":{"source":"iana"},"application/commonground":{"source":"iana"},"application/conference-info+xml":{"source":"iana","compressible":true},"application/cose":{"source":"iana"},"application/cose-key":{"source":"iana"},"application/cose-key-set":{"source":"iana"},"application/cpl+xml":{"source":"iana","compressible":true,"extensions":["cpl"]},"application/csrattrs":{"source":"iana"},"application/csta+xml":{"source":"iana","compressible":true},"application/cstadata+xml":{"source":"iana","compressible":true},"application/csvm+json":{"source":"iana","compressible":true},"application/cu-seeme":{"source":"apache","extensions":["cu"]},"application/cwt":{"source":"iana"},"application/cybercash":{"source":"iana"},"application/dart":{"compressible":true},"application/dash+xml":{"source":"iana","compressible":true,"extensions":["mpd"]},"application/dash-patch+xml":{"source":"iana","compressible":true,"extensions":["mpp"]},"application/dashdelta":{"source":"iana"},"application/davmount+xml":{"source":"iana","compressible":true,"extensions":["davmount"]},"application/dca-rft":{"source":"iana"},"application/dcd":{"source":"iana"},"application/dec-dx":{"source":"iana"},"application/dialog-info+xml":{"source":"iana","compressible":true},"application/dicom":{"source":"iana"},"application/dicom+json":{"source":"iana","compressible":true},"application/dicom+xml":{"source":"iana","compressible":true},"application/dii":{"source":"iana"},"application/dit":{"source":"iana"},"application/dns":{"source":"iana"},"application/dns+json":{"source":"iana","compressible":true},"application/dns-message":{"source":"iana"},"application/docbook+xml":{"source":"apache","compressible":true,"extensions":["dbk"]},"application/dots+cbor":{"source":"iana"},"application/dskpp+xml":{"source":"iana","compressible":true},"application/dssc+der":{"source":"iana","extensions":["dssc"]},"application/dssc+xml":{"source":"iana","compressible":true,"extensions":["xdssc"]},"application/dvcs":{"source":"iana"},"application/ecmascript":{"source":"iana","compressible":true,"extensions":["es","ecma"]},"application/edi-consent":{"source":"iana"},"application/edi-x12":{"source":"iana","compressible":false},"application/edifact":{"source":"iana","compressible":false},"application/efi":{"source":"iana"},"application/elm+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/elm+xml":{"source":"iana","compressible":true},"application/emergencycalldata.cap+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/emergencycalldata.comment+xml":{"source":"iana","compressible":true},"application/emergencycalldata.control+xml":{"source":"iana","compressible":true},"application/emergencycalldata.deviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.ecall.msd":{"source":"iana"},"application/emergencycalldata.providerinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.serviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.subscriberinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.veds+xml":{"source":"iana","compressible":true},"application/emma+xml":{"source":"iana","compressible":true,"extensions":["emma"]},"application/emotionml+xml":{"source":"iana","compressible":true,"extensions":["emotionml"]},"application/encaprtp":{"source":"iana"},"application/epp+xml":{"source":"iana","compressible":true},"application/epub+zip":{"source":"iana","compressible":false,"extensions":["epub"]},"application/eshop":{"source":"iana"},"application/exi":{"source":"iana","extensions":["exi"]},"application/expect-ct-report+json":{"source":"iana","compressible":true},"application/express":{"source":"iana","extensions":["exp"]},"application/fastinfoset":{"source":"iana"},"application/fastsoap":{"source":"iana"},"application/fdt+xml":{"source":"iana","compressible":true,"extensions":["fdt"]},"application/fhir+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/fhir+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/fido.trusted-apps+json":{"compressible":true},"application/fits":{"source":"iana"},"application/flexfec":{"source":"iana"},"application/font-sfnt":{"source":"iana"},"application/font-tdpfr":{"source":"iana","extensions":["pfr"]},"application/font-woff":{"source":"iana","compressible":false},"application/framework-attributes+xml":{"source":"iana","compressible":true},"application/geo+json":{"source":"iana","compressible":true,"extensions":["geojson"]},"application/geo+json-seq":{"source":"iana"},"application/geopackage+sqlite3":{"source":"iana"},"application/geoxacml+xml":{"source":"iana","compressible":true},"application/gltf-buffer":{"source":"iana"},"application/gml+xml":{"source":"iana","compressible":true,"extensions":["gml"]},"application/gpx+xml":{"source":"apache","compressible":true,"extensions":["gpx"]},"application/gxf":{"source":"apache","extensions":["gxf"]},"application/gzip":{"source":"iana","compressible":false,"extensions":["gz"]},"application/h224":{"source":"iana"},"application/held+xml":{"source":"iana","compressible":true},"application/hjson":{"extensions":["hjson"]},"application/http":{"source":"iana"},"application/hyperstudio":{"source":"iana","extensions":["stk"]},"application/ibe-key-request+xml":{"source":"iana","compressible":true},"application/ibe-pkg-reply+xml":{"source":"iana","compressible":true},"application/ibe-pp-data":{"source":"iana"},"application/iges":{"source":"iana"},"application/im-iscomposing+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/index":{"source":"iana"},"application/index.cmd":{"source":"iana"},"application/index.obj":{"source":"iana"},"application/index.response":{"source":"iana"},"application/index.vnd":{"source":"iana"},"application/inkml+xml":{"source":"iana","compressible":true,"extensions":["ink","inkml"]},"application/iotp":{"source":"iana"},"application/ipfix":{"source":"iana","extensions":["ipfix"]},"application/ipp":{"source":"iana"},"application/isup":{"source":"iana"},"application/its+xml":{"source":"iana","compressible":true,"extensions":["its"]},"application/java-archive":{"source":"apache","compressible":false,"extensions":["jar","war","ear"]},"application/java-serialized-object":{"source":"apache","compressible":false,"extensions":["ser"]},"application/java-vm":{"source":"apache","compressible":false,"extensions":["class"]},"application/javascript":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["js","mjs"]},"application/jf2feed+json":{"source":"iana","compressible":true},"application/jose":{"source":"iana"},"application/jose+json":{"source":"iana","compressible":true},"application/jrd+json":{"source":"iana","compressible":true},"application/jscalendar+json":{"source":"iana","compressible":true},"application/json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["json","map"]},"application/json-patch+json":{"source":"iana","compressible":true},"application/json-seq":{"source":"iana"},"application/json5":{"extensions":["json5"]},"application/jsonml+json":{"source":"apache","compressible":true,"extensions":["jsonml"]},"application/jwk+json":{"source":"iana","compressible":true},"application/jwk-set+json":{"source":"iana","compressible":true},"application/jwt":{"source":"iana"},"application/kpml-request+xml":{"source":"iana","compressible":true},"application/kpml-response+xml":{"source":"iana","compressible":true},"application/ld+json":{"source":"iana","compressible":true,"extensions":["jsonld"]},"application/lgr+xml":{"source":"iana","compressible":true,"extensions":["lgr"]},"application/link-format":{"source":"iana"},"application/load-control+xml":{"source":"iana","compressible":true},"application/lost+xml":{"source":"iana","compressible":true,"extensions":["lostxml"]},"application/lostsync+xml":{"source":"iana","compressible":true},"application/lpf+zip":{"source":"iana","compressible":false},"application/lxf":{"source":"iana"},"application/mac-binhex40":{"source":"iana","extensions":["hqx"]},"application/mac-compactpro":{"source":"apache","extensions":["cpt"]},"application/macwriteii":{"source":"iana"},"application/mads+xml":{"source":"iana","compressible":true,"extensions":["mads"]},"application/manifest+json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["webmanifest"]},"application/marc":{"source":"iana","extensions":["mrc"]},"application/marcxml+xml":{"source":"iana","compressible":true,"extensions":["mrcx"]},"application/mathematica":{"source":"iana","extensions":["ma","nb","mb"]},"application/mathml+xml":{"source":"iana","compressible":true,"extensions":["mathml"]},"application/mathml-content+xml":{"source":"iana","compressible":true},"application/mathml-presentation+xml":{"source":"iana","compressible":true},"application/mbms-associated-procedure-description+xml":{"source":"iana","compressible":true},"application/mbms-deregister+xml":{"source":"iana","compressible":true},"application/mbms-envelope+xml":{"source":"iana","compressible":true},"application/mbms-msk+xml":{"source":"iana","compressible":true},"application/mbms-msk-response+xml":{"source":"iana","compressible":true},"application/mbms-protection-description+xml":{"source":"iana","compressible":true},"application/mbms-reception-report+xml":{"source":"iana","compressible":true},"application/mbms-register+xml":{"source":"iana","compressible":true},"application/mbms-register-response+xml":{"source":"iana","compressible":true},"application/mbms-schedule+xml":{"source":"iana","compressible":true},"application/mbms-user-service-description+xml":{"source":"iana","compressible":true},"application/mbox":{"source":"iana","extensions":["mbox"]},"application/media-policy-dataset+xml":{"source":"iana","compressible":true,"extensions":["mpf"]},"application/media_control+xml":{"source":"iana","compressible":true},"application/mediaservercontrol+xml":{"source":"iana","compressible":true,"extensions":["mscml"]},"application/merge-patch+json":{"source":"iana","compressible":true},"application/metalink+xml":{"source":"apache","compressible":true,"extensions":["metalink"]},"application/metalink4+xml":{"source":"iana","compressible":true,"extensions":["meta4"]},"application/mets+xml":{"source":"iana","compressible":true,"extensions":["mets"]},"application/mf4":{"source":"iana"},"application/mikey":{"source":"iana"},"application/mipc":{"source":"iana"},"application/missing-blocks+cbor-seq":{"source":"iana"},"application/mmt-aei+xml":{"source":"iana","compressible":true,"extensions":["maei"]},"application/mmt-usd+xml":{"source":"iana","compressible":true,"extensions":["musd"]},"application/mods+xml":{"source":"iana","compressible":true,"extensions":["mods"]},"application/moss-keys":{"source":"iana"},"application/moss-signature":{"source":"iana"},"application/mosskey-data":{"source":"iana"},"application/mosskey-request":{"source":"iana"},"application/mp21":{"source":"iana","extensions":["m21","mp21"]},"application/mp4":{"source":"iana","extensions":["mp4s","m4p"]},"application/mpeg4-generic":{"source":"iana"},"application/mpeg4-iod":{"source":"iana"},"application/mpeg4-iod-xmt":{"source":"iana"},"application/mrb-consumer+xml":{"source":"iana","compressible":true},"application/mrb-publish+xml":{"source":"iana","compressible":true},"application/msc-ivr+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msc-mixer+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msword":{"source":"iana","compressible":false,"extensions":["doc","dot"]},"application/mud+json":{"source":"iana","compressible":true},"application/multipart-core":{"source":"iana"},"application/mxf":{"source":"iana","extensions":["mxf"]},"application/n-quads":{"source":"iana","extensions":["nq"]},"application/n-triples":{"source":"iana","extensions":["nt"]},"application/nasdata":{"source":"iana"},"application/news-checkgroups":{"source":"iana","charset":"US-ASCII"},"application/news-groupinfo":{"source":"iana","charset":"US-ASCII"},"application/news-transmission":{"source":"iana"},"application/nlsml+xml":{"source":"iana","compressible":true},"application/node":{"source":"iana","extensions":["cjs"]},"application/nss":{"source":"iana"},"application/oauth-authz-req+jwt":{"source":"iana"},"application/oblivious-dns-message":{"source":"iana"},"application/ocsp-request":{"source":"iana"},"application/ocsp-response":{"source":"iana"},"application/octet-stream":{"source":"iana","compressible":false,"extensions":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{"source":"iana","extensions":["oda"]},"application/odm+xml":{"source":"iana","compressible":true},"application/odx":{"source":"iana"},"application/oebps-package+xml":{"source":"iana","compressible":true,"extensions":["opf"]},"application/ogg":{"source":"iana","compressible":false,"extensions":["ogx"]},"application/omdoc+xml":{"source":"apache","compressible":true,"extensions":["omdoc"]},"application/onenote":{"source":"apache","extensions":["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{"source":"iana","compressible":true},"application/oscore":{"source":"iana"},"application/oxps":{"source":"iana","extensions":["oxps"]},"application/p21":{"source":"iana"},"application/p21+zip":{"source":"iana","compressible":false},"application/p2p-overlay+xml":{"source":"iana","compressible":true,"extensions":["relo"]},"application/parityfec":{"source":"iana"},"application/passport":{"source":"iana"},"application/patch-ops-error+xml":{"source":"iana","compressible":true,"extensions":["xer"]},"application/pdf":{"source":"iana","compressible":false,"extensions":["pdf"]},"application/pdx":{"source":"iana"},"application/pem-certificate-chain":{"source":"iana"},"application/pgp-encrypted":{"source":"iana","compressible":false,"extensions":["pgp"]},"application/pgp-keys":{"source":"iana","extensions":["asc"]},"application/pgp-signature":{"source":"iana","extensions":["asc","sig"]},"application/pics-rules":{"source":"apache","extensions":["prf"]},"application/pidf+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pidf-diff+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pkcs10":{"source":"iana","extensions":["p10"]},"application/pkcs12":{"source":"iana"},"application/pkcs7-mime":{"source":"iana","extensions":["p7m","p7c"]},"application/pkcs7-signature":{"source":"iana","extensions":["p7s"]},"application/pkcs8":{"source":"iana","extensions":["p8"]},"application/pkcs8-encrypted":{"source":"iana"},"application/pkix-attr-cert":{"source":"iana","extensions":["ac"]},"application/pkix-cert":{"source":"iana","extensions":["cer"]},"application/pkix-crl":{"source":"iana","extensions":["crl"]},"application/pkix-pkipath":{"source":"iana","extensions":["pkipath"]},"application/pkixcmp":{"source":"iana","extensions":["pki"]},"application/pls+xml":{"source":"iana","compressible":true,"extensions":["pls"]},"application/poc-settings+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/postscript":{"source":"iana","compressible":true,"extensions":["ai","eps","ps"]},"application/ppsp-tracker+json":{"source":"iana","compressible":true},"application/problem+json":{"source":"iana","compressible":true},"application/problem+xml":{"source":"iana","compressible":true},"application/provenance+xml":{"source":"iana","compressible":true,"extensions":["provx"]},"application/prs.alvestrand.titrax-sheet":{"source":"iana"},"application/prs.cww":{"source":"iana","extensions":["cww"]},"application/prs.cyn":{"source":"iana","charset":"7-BIT"},"application/prs.hpub+zip":{"source":"iana","compressible":false},"application/prs.nprend":{"source":"iana"},"application/prs.plucker":{"source":"iana"},"application/prs.rdf-xml-crypt":{"source":"iana"},"application/prs.xsf+xml":{"source":"iana","compressible":true},"application/pskc+xml":{"source":"iana","compressible":true,"extensions":["pskcxml"]},"application/pvd+json":{"source":"iana","compressible":true},"application/qsig":{"source":"iana"},"application/raml+yaml":{"compressible":true,"extensions":["raml"]},"application/raptorfec":{"source":"iana"},"application/rdap+json":{"source":"iana","compressible":true},"application/rdf+xml":{"source":"iana","compressible":true,"extensions":["rdf","owl"]},"application/reginfo+xml":{"source":"iana","compressible":true,"extensions":["rif"]},"application/relax-ng-compact-syntax":{"source":"iana","extensions":["rnc"]},"application/remote-printing":{"source":"iana"},"application/reputon+json":{"source":"iana","compressible":true},"application/resource-lists+xml":{"source":"iana","compressible":true,"extensions":["rl"]},"application/resource-lists-diff+xml":{"source":"iana","compressible":true,"extensions":["rld"]},"application/rfc+xml":{"source":"iana","compressible":true},"application/riscos":{"source":"iana"},"application/rlmi+xml":{"source":"iana","compressible":true},"application/rls-services+xml":{"source":"iana","compressible":true,"extensions":["rs"]},"application/route-apd+xml":{"source":"iana","compressible":true,"extensions":["rapd"]},"application/route-s-tsid+xml":{"source":"iana","compressible":true,"extensions":["sls"]},"application/route-usd+xml":{"source":"iana","compressible":true,"extensions":["rusd"]},"application/rpki-ghostbusters":{"source":"iana","extensions":["gbr"]},"application/rpki-manifest":{"source":"iana","extensions":["mft"]},"application/rpki-publication":{"source":"iana"},"application/rpki-roa":{"source":"iana","extensions":["roa"]},"application/rpki-updown":{"source":"iana"},"application/rsd+xml":{"source":"apache","compressible":true,"extensions":["rsd"]},"application/rss+xml":{"source":"apache","compressible":true,"extensions":["rss"]},"application/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"application/rtploopback":{"source":"iana"},"application/rtx":{"source":"iana"},"application/samlassertion+xml":{"source":"iana","compressible":true},"application/samlmetadata+xml":{"source":"iana","compressible":true},"application/sarif+json":{"source":"iana","compressible":true},"application/sarif-external-properties+json":{"source":"iana","compressible":true},"application/sbe":{"source":"iana"},"application/sbml+xml":{"source":"iana","compressible":true,"extensions":["sbml"]},"application/scaip+xml":{"source":"iana","compressible":true},"application/scim+json":{"source":"iana","compressible":true},"application/scvp-cv-request":{"source":"iana","extensions":["scq"]},"application/scvp-cv-response":{"source":"iana","extensions":["scs"]},"application/scvp-vp-request":{"source":"iana","extensions":["spq"]},"application/scvp-vp-response":{"source":"iana","extensions":["spp"]},"application/sdp":{"source":"iana","extensions":["sdp"]},"application/secevent+jwt":{"source":"iana"},"application/senml+cbor":{"source":"iana"},"application/senml+json":{"source":"iana","compressible":true},"application/senml+xml":{"source":"iana","compressible":true,"extensions":["senmlx"]},"application/senml-etch+cbor":{"source":"iana"},"application/senml-etch+json":{"source":"iana","compressible":true},"application/senml-exi":{"source":"iana"},"application/sensml+cbor":{"source":"iana"},"application/sensml+json":{"source":"iana","compressible":true},"application/sensml+xml":{"source":"iana","compressible":true,"extensions":["sensmlx"]},"application/sensml-exi":{"source":"iana"},"application/sep+xml":{"source":"iana","compressible":true},"application/sep-exi":{"source":"iana"},"application/session-info":{"source":"iana"},"application/set-payment":{"source":"iana"},"application/set-payment-initiation":{"source":"iana","extensions":["setpay"]},"application/set-registration":{"source":"iana"},"application/set-registration-initiation":{"source":"iana","extensions":["setreg"]},"application/sgml":{"source":"iana"},"application/sgml-open-catalog":{"source":"iana"},"application/shf+xml":{"source":"iana","compressible":true,"extensions":["shf"]},"application/sieve":{"source":"iana","extensions":["siv","sieve"]},"application/simple-filter+xml":{"source":"iana","compressible":true},"application/simple-message-summary":{"source":"iana"},"application/simplesymbolcontainer":{"source":"iana"},"application/sipc":{"source":"iana"},"application/slate":{"source":"iana"},"application/smil":{"source":"iana"},"application/smil+xml":{"source":"iana","compressible":true,"extensions":["smi","smil"]},"application/smpte336m":{"source":"iana"},"application/soap+fastinfoset":{"source":"iana"},"application/soap+xml":{"source":"iana","compressible":true},"application/sparql-query":{"source":"iana","extensions":["rq"]},"application/sparql-results+xml":{"source":"iana","compressible":true,"extensions":["srx"]},"application/spdx+json":{"source":"iana","compressible":true},"application/spirits-event+xml":{"source":"iana","compressible":true},"application/sql":{"source":"iana"},"application/srgs":{"source":"iana","extensions":["gram"]},"application/srgs+xml":{"source":"iana","compressible":true,"extensions":["grxml"]},"application/sru+xml":{"source":"iana","compressible":true,"extensions":["sru"]},"application/ssdl+xml":{"source":"apache","compressible":true,"extensions":["ssdl"]},"application/ssml+xml":{"source":"iana","compressible":true,"extensions":["ssml"]},"application/stix+json":{"source":"iana","compressible":true},"application/swid+xml":{"source":"iana","compressible":true,"extensions":["swidtag"]},"application/tamp-apex-update":{"source":"iana"},"application/tamp-apex-update-confirm":{"source":"iana"},"application/tamp-community-update":{"source":"iana"},"application/tamp-community-update-confirm":{"source":"iana"},"application/tamp-error":{"source":"iana"},"application/tamp-sequence-adjust":{"source":"iana"},"application/tamp-sequence-adjust-confirm":{"source":"iana"},"application/tamp-status-query":{"source":"iana"},"application/tamp-status-response":{"source":"iana"},"application/tamp-update":{"source":"iana"},"application/tamp-update-confirm":{"source":"iana"},"application/tar":{"compressible":true},"application/taxii+json":{"source":"iana","compressible":true},"application/td+json":{"source":"iana","compressible":true},"application/tei+xml":{"source":"iana","compressible":true,"extensions":["tei","teicorpus"]},"application/tetra_isi":{"source":"iana"},"application/thraud+xml":{"source":"iana","compressible":true,"extensions":["tfi"]},"application/timestamp-query":{"source":"iana"},"application/timestamp-reply":{"source":"iana"},"application/timestamped-data":{"source":"iana","extensions":["tsd"]},"application/tlsrpt+gzip":{"source":"iana"},"application/tlsrpt+json":{"source":"iana","compressible":true},"application/tnauthlist":{"source":"iana"},"application/token-introspection+jwt":{"source":"iana"},"application/toml":{"compressible":true,"extensions":["toml"]},"application/trickle-ice-sdpfrag":{"source":"iana"},"application/trig":{"source":"iana","extensions":["trig"]},"application/ttml+xml":{"source":"iana","compressible":true,"extensions":["ttml"]},"application/tve-trigger":{"source":"iana"},"application/tzif":{"source":"iana"},"application/tzif-leap":{"source":"iana"},"application/ubjson":{"compressible":false,"extensions":["ubj"]},"application/ulpfec":{"source":"iana"},"application/urc-grpsheet+xml":{"source":"iana","compressible":true},"application/urc-ressheet+xml":{"source":"iana","compressible":true,"extensions":["rsheet"]},"application/urc-targetdesc+xml":{"source":"iana","compressible":true,"extensions":["td"]},"application/urc-uisocketdesc+xml":{"source":"iana","compressible":true},"application/vcard+json":{"source":"iana","compressible":true},"application/vcard+xml":{"source":"iana","compressible":true},"application/vemmi":{"source":"iana"},"application/vividence.scriptfile":{"source":"apache"},"application/vnd.1000minds.decision-model+xml":{"source":"iana","compressible":true,"extensions":["1km"]},"application/vnd.3gpp-prose+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-prose-pc3ch+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-v2x-local-service-information":{"source":"iana"},"application/vnd.3gpp.5gnas":{"source":"iana"},"application/vnd.3gpp.access-transfer-events+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.bsf+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gmop+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gtpc":{"source":"iana"},"application/vnd.3gpp.interworking-data":{"source":"iana"},"application/vnd.3gpp.lpp":{"source":"iana"},"application/vnd.3gpp.mc-signalling-ear":{"source":"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-payload":{"source":"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-signalling":{"source":"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-floor-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-signed+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-init-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-transmission-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mid-call+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ngap":{"source":"iana"},"application/vnd.3gpp.pfcp":{"source":"iana"},"application/vnd.3gpp.pic-bw-large":{"source":"iana","extensions":["plb"]},"application/vnd.3gpp.pic-bw-small":{"source":"iana","extensions":["psb"]},"application/vnd.3gpp.pic-bw-var":{"source":"iana","extensions":["pvb"]},"application/vnd.3gpp.s1ap":{"source":"iana"},"application/vnd.3gpp.sms":{"source":"iana"},"application/vnd.3gpp.sms+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-ext+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.state-and-event-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ussd+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.bcmcsinfo+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.sms":{"source":"iana"},"application/vnd.3gpp2.tcap":{"source":"iana","extensions":["tcap"]},"application/vnd.3lightssoftware.imagescal":{"source":"iana"},"application/vnd.3m.post-it-notes":{"source":"iana","extensions":["pwn"]},"application/vnd.accpac.simply.aso":{"source":"iana","extensions":["aso"]},"application/vnd.accpac.simply.imp":{"source":"iana","extensions":["imp"]},"application/vnd.acucobol":{"source":"iana","extensions":["acu"]},"application/vnd.acucorp":{"source":"iana","extensions":["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{"source":"apache","compressible":false,"extensions":["air"]},"application/vnd.adobe.flash.movie":{"source":"iana"},"application/vnd.adobe.formscentral.fcdt":{"source":"iana","extensions":["fcdt"]},"application/vnd.adobe.fxp":{"source":"iana","extensions":["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{"source":"iana"},"application/vnd.adobe.xdp+xml":{"source":"iana","compressible":true,"extensions":["xdp"]},"application/vnd.adobe.xfdf":{"source":"iana","extensions":["xfdf"]},"application/vnd.aether.imp":{"source":"iana"},"application/vnd.afpc.afplinedata":{"source":"iana"},"application/vnd.afpc.afplinedata-pagedef":{"source":"iana"},"application/vnd.afpc.cmoca-cmresource":{"source":"iana"},"application/vnd.afpc.foca-charset":{"source":"iana"},"application/vnd.afpc.foca-codedfont":{"source":"iana"},"application/vnd.afpc.foca-codepage":{"source":"iana"},"application/vnd.afpc.modca":{"source":"iana"},"application/vnd.afpc.modca-cmtable":{"source":"iana"},"application/vnd.afpc.modca-formdef":{"source":"iana"},"application/vnd.afpc.modca-mediummap":{"source":"iana"},"application/vnd.afpc.modca-objectcontainer":{"source":"iana"},"application/vnd.afpc.modca-overlay":{"source":"iana"},"application/vnd.afpc.modca-pagesegment":{"source":"iana"},"application/vnd.age":{"source":"iana","extensions":["age"]},"application/vnd.ah-barcode":{"source":"iana"},"application/vnd.ahead.space":{"source":"iana","extensions":["ahead"]},"application/vnd.airzip.filesecure.azf":{"source":"iana","extensions":["azf"]},"application/vnd.airzip.filesecure.azs":{"source":"iana","extensions":["azs"]},"application/vnd.amadeus+json":{"source":"iana","compressible":true},"application/vnd.amazon.ebook":{"source":"apache","extensions":["azw"]},"application/vnd.amazon.mobi8-ebook":{"source":"iana"},"application/vnd.americandynamics.acc":{"source":"iana","extensions":["acc"]},"application/vnd.amiga.ami":{"source":"iana","extensions":["ami"]},"application/vnd.amundsen.maze+xml":{"source":"iana","compressible":true},"application/vnd.android.ota":{"source":"iana"},"application/vnd.android.package-archive":{"source":"apache","compressible":false,"extensions":["apk"]},"application/vnd.anki":{"source":"iana"},"application/vnd.anser-web-certificate-issue-initiation":{"source":"iana","extensions":["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{"source":"apache","extensions":["fti"]},"application/vnd.antix.game-component":{"source":"iana","extensions":["atx"]},"application/vnd.apache.arrow.file":{"source":"iana"},"application/vnd.apache.arrow.stream":{"source":"iana"},"application/vnd.apache.thrift.binary":{"source":"iana"},"application/vnd.apache.thrift.compact":{"source":"iana"},"application/vnd.apache.thrift.json":{"source":"iana"},"application/vnd.api+json":{"source":"iana","compressible":true},"application/vnd.aplextor.warrp+json":{"source":"iana","compressible":true},"application/vnd.apothekende.reservation+json":{"source":"iana","compressible":true},"application/vnd.apple.installer+xml":{"source":"iana","compressible":true,"extensions":["mpkg"]},"application/vnd.apple.keynote":{"source":"iana","extensions":["key"]},"application/vnd.apple.mpegurl":{"source":"iana","extensions":["m3u8"]},"application/vnd.apple.numbers":{"source":"iana","extensions":["numbers"]},"application/vnd.apple.pages":{"source":"iana","extensions":["pages"]},"application/vnd.apple.pkpass":{"compressible":false,"extensions":["pkpass"]},"application/vnd.arastra.swi":{"source":"iana"},"application/vnd.aristanetworks.swi":{"source":"iana","extensions":["swi"]},"application/vnd.artisan+json":{"source":"iana","compressible":true},"application/vnd.artsquare":{"source":"iana"},"application/vnd.astraea-software.iota":{"source":"iana","extensions":["iota"]},"application/vnd.audiograph":{"source":"iana","extensions":["aep"]},"application/vnd.autopackage":{"source":"iana"},"application/vnd.avalon+json":{"source":"iana","compressible":true},"application/vnd.avistar+xml":{"source":"iana","compressible":true},"application/vnd.balsamiq.bmml+xml":{"source":"iana","compressible":true,"extensions":["bmml"]},"application/vnd.balsamiq.bmpr":{"source":"iana"},"application/vnd.banana-accounting":{"source":"iana"},"application/vnd.bbf.usp.error":{"source":"iana"},"application/vnd.bbf.usp.msg":{"source":"iana"},"application/vnd.bbf.usp.msg+json":{"source":"iana","compressible":true},"application/vnd.bekitzur-stech+json":{"source":"iana","compressible":true},"application/vnd.bint.med-content":{"source":"iana"},"application/vnd.biopax.rdf+xml":{"source":"iana","compressible":true},"application/vnd.blink-idb-value-wrapper":{"source":"iana"},"application/vnd.blueice.multipass":{"source":"iana","extensions":["mpm"]},"application/vnd.bluetooth.ep.oob":{"source":"iana"},"application/vnd.bluetooth.le.oob":{"source":"iana"},"application/vnd.bmi":{"source":"iana","extensions":["bmi"]},"application/vnd.bpf":{"source":"iana"},"application/vnd.bpf3":{"source":"iana"},"application/vnd.businessobjects":{"source":"iana","extensions":["rep"]},"application/vnd.byu.uapi+json":{"source":"iana","compressible":true},"application/vnd.cab-jscript":{"source":"iana"},"application/vnd.canon-cpdl":{"source":"iana"},"application/vnd.canon-lips":{"source":"iana"},"application/vnd.capasystems-pg+json":{"source":"iana","compressible":true},"application/vnd.cendio.thinlinc.clientconf":{"source":"iana"},"application/vnd.century-systems.tcp_stream":{"source":"iana"},"application/vnd.chemdraw+xml":{"source":"iana","compressible":true,"extensions":["cdxml"]},"application/vnd.chess-pgn":{"source":"iana"},"application/vnd.chipnuts.karaoke-mmd":{"source":"iana","extensions":["mmd"]},"application/vnd.ciedi":{"source":"iana"},"application/vnd.cinderella":{"source":"iana","extensions":["cdy"]},"application/vnd.cirpack.isdn-ext":{"source":"iana"},"application/vnd.citationstyles.style+xml":{"source":"iana","compressible":true,"extensions":["csl"]},"application/vnd.claymore":{"source":"iana","extensions":["cla"]},"application/vnd.cloanto.rp9":{"source":"iana","extensions":["rp9"]},"application/vnd.clonk.c4group":{"source":"iana","extensions":["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{"source":"iana","extensions":["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{"source":"iana","extensions":["c11amz"]},"application/vnd.coffeescript":{"source":"iana"},"application/vnd.collabio.xodocuments.document":{"source":"iana"},"application/vnd.collabio.xodocuments.document-template":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation-template":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{"source":"iana"},"application/vnd.collection+json":{"source":"iana","compressible":true},"application/vnd.collection.doc+json":{"source":"iana","compressible":true},"application/vnd.collection.next+json":{"source":"iana","compressible":true},"application/vnd.comicbook+zip":{"source":"iana","compressible":false},"application/vnd.comicbook-rar":{"source":"iana"},"application/vnd.commerce-battelle":{"source":"iana"},"application/vnd.commonspace":{"source":"iana","extensions":["csp"]},"application/vnd.contact.cmsg":{"source":"iana","extensions":["cdbcmsg"]},"application/vnd.coreos.ignition+json":{"source":"iana","compressible":true},"application/vnd.cosmocaller":{"source":"iana","extensions":["cmc"]},"application/vnd.crick.clicker":{"source":"iana","extensions":["clkx"]},"application/vnd.crick.clicker.keyboard":{"source":"iana","extensions":["clkk"]},"application/vnd.crick.clicker.palette":{"source":"iana","extensions":["clkp"]},"application/vnd.crick.clicker.template":{"source":"iana","extensions":["clkt"]},"application/vnd.crick.clicker.wordbank":{"source":"iana","extensions":["clkw"]},"application/vnd.criticaltools.wbs+xml":{"source":"iana","compressible":true,"extensions":["wbs"]},"application/vnd.cryptii.pipe+json":{"source":"iana","compressible":true},"application/vnd.crypto-shade-file":{"source":"iana"},"application/vnd.cryptomator.encrypted":{"source":"iana"},"application/vnd.cryptomator.vault":{"source":"iana"},"application/vnd.ctc-posml":{"source":"iana","extensions":["pml"]},"application/vnd.ctct.ws+xml":{"source":"iana","compressible":true},"application/vnd.cups-pdf":{"source":"iana"},"application/vnd.cups-postscript":{"source":"iana"},"application/vnd.cups-ppd":{"source":"iana","extensions":["ppd"]},"application/vnd.cups-raster":{"source":"iana"},"application/vnd.cups-raw":{"source":"iana"},"application/vnd.curl":{"source":"iana"},"application/vnd.curl.car":{"source":"apache","extensions":["car"]},"application/vnd.curl.pcurl":{"source":"apache","extensions":["pcurl"]},"application/vnd.cyan.dean.root+xml":{"source":"iana","compressible":true},"application/vnd.cybank":{"source":"iana"},"application/vnd.cyclonedx+json":{"source":"iana","compressible":true},"application/vnd.cyclonedx+xml":{"source":"iana","compressible":true},"application/vnd.d2l.coursepackage1p0+zip":{"source":"iana","compressible":false},"application/vnd.d3m-dataset":{"source":"iana"},"application/vnd.d3m-problem":{"source":"iana"},"application/vnd.dart":{"source":"iana","compressible":true,"extensions":["dart"]},"application/vnd.data-vision.rdz":{"source":"iana","extensions":["rdz"]},"application/vnd.datapackage+json":{"source":"iana","compressible":true},"application/vnd.dataresource+json":{"source":"iana","compressible":true},"application/vnd.dbf":{"source":"iana","extensions":["dbf"]},"application/vnd.debian.binary-package":{"source":"iana"},"application/vnd.dece.data":{"source":"iana","extensions":["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{"source":"iana","compressible":true,"extensions":["uvt","uvvt"]},"application/vnd.dece.unspecified":{"source":"iana","extensions":["uvx","uvvx"]},"application/vnd.dece.zip":{"source":"iana","extensions":["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{"source":"iana","extensions":["fe_launch"]},"application/vnd.desmume.movie":{"source":"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{"source":"iana"},"application/vnd.dm.delegation+xml":{"source":"iana","compressible":true},"application/vnd.dna":{"source":"iana","extensions":["dna"]},"application/vnd.document+json":{"source":"iana","compressible":true},"application/vnd.dolby.mlp":{"source":"apache","extensions":["mlp"]},"application/vnd.dolby.mobile.1":{"source":"iana"},"application/vnd.dolby.mobile.2":{"source":"iana"},"application/vnd.doremir.scorecloud-binary-document":{"source":"iana"},"application/vnd.dpgraph":{"source":"iana","extensions":["dpg"]},"application/vnd.dreamfactory":{"source":"iana","extensions":["dfac"]},"application/vnd.drive+json":{"source":"iana","compressible":true},"application/vnd.ds-keypoint":{"source":"apache","extensions":["kpxx"]},"application/vnd.dtg.local":{"source":"iana"},"application/vnd.dtg.local.flash":{"source":"iana"},"application/vnd.dtg.local.html":{"source":"iana"},"application/vnd.dvb.ait":{"source":"iana","extensions":["ait"]},"application/vnd.dvb.dvbisl+xml":{"source":"iana","compressible":true},"application/vnd.dvb.dvbj":{"source":"iana"},"application/vnd.dvb.esgcontainer":{"source":"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess2":{"source":"iana"},"application/vnd.dvb.ipdcesgpdd":{"source":"iana"},"application/vnd.dvb.ipdcroaming":{"source":"iana"},"application/vnd.dvb.iptv.alfec-base":{"source":"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{"source":"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-container+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-generic+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-msglist+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-request+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-response+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-init+xml":{"source":"iana","compressible":true},"application/vnd.dvb.pfr":{"source":"iana"},"application/vnd.dvb.service":{"source":"iana","extensions":["svc"]},"application/vnd.dxr":{"source":"iana"},"application/vnd.dynageo":{"source":"iana","extensions":["geo"]},"application/vnd.dzr":{"source":"iana"},"application/vnd.easykaraoke.cdgdownload":{"source":"iana"},"application/vnd.ecdis-update":{"source":"iana"},"application/vnd.ecip.rlp":{"source":"iana"},"application/vnd.eclipse.ditto+json":{"source":"iana","compressible":true},"application/vnd.ecowin.chart":{"source":"iana","extensions":["mag"]},"application/vnd.ecowin.filerequest":{"source":"iana"},"application/vnd.ecowin.fileupdate":{"source":"iana"},"application/vnd.ecowin.series":{"source":"iana"},"application/vnd.ecowin.seriesrequest":{"source":"iana"},"application/vnd.ecowin.seriesupdate":{"source":"iana"},"application/vnd.efi.img":{"source":"iana"},"application/vnd.efi.iso":{"source":"iana"},"application/vnd.emclient.accessrequest+xml":{"source":"iana","compressible":true},"application/vnd.enliven":{"source":"iana","extensions":["nml"]},"application/vnd.enphase.envoy":{"source":"iana"},"application/vnd.eprints.data+xml":{"source":"iana","compressible":true},"application/vnd.epson.esf":{"source":"iana","extensions":["esf"]},"application/vnd.epson.msf":{"source":"iana","extensions":["msf"]},"application/vnd.epson.quickanime":{"source":"iana","extensions":["qam"]},"application/vnd.epson.salt":{"source":"iana","extensions":["slt"]},"application/vnd.epson.ssf":{"source":"iana","extensions":["ssf"]},"application/vnd.ericsson.quickcall":{"source":"iana"},"application/vnd.espass-espass+zip":{"source":"iana","compressible":false},"application/vnd.eszigno3+xml":{"source":"iana","compressible":true,"extensions":["es3","et3"]},"application/vnd.etsi.aoc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.asic-e+zip":{"source":"iana","compressible":false},"application/vnd.etsi.asic-s+zip":{"source":"iana","compressible":false},"application/vnd.etsi.cug+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvcommand+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-bc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-cod+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-npvr+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvservice+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsync+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvueprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mcid+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mheg5":{"source":"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{"source":"iana","compressible":true},"application/vnd.etsi.pstn+xml":{"source":"iana","compressible":true},"application/vnd.etsi.sci+xml":{"source":"iana","compressible":true},"application/vnd.etsi.simservs+xml":{"source":"iana","compressible":true},"application/vnd.etsi.timestamp-token":{"source":"iana"},"application/vnd.etsi.tsl+xml":{"source":"iana","compressible":true},"application/vnd.etsi.tsl.der":{"source":"iana"},"application/vnd.eu.kasparian.car+json":{"source":"iana","compressible":true},"application/vnd.eudora.data":{"source":"iana"},"application/vnd.evolv.ecig.profile":{"source":"iana"},"application/vnd.evolv.ecig.settings":{"source":"iana"},"application/vnd.evolv.ecig.theme":{"source":"iana"},"application/vnd.exstream-empower+zip":{"source":"iana","compressible":false},"application/vnd.exstream-package":{"source":"iana"},"application/vnd.ezpix-album":{"source":"iana","extensions":["ez2"]},"application/vnd.ezpix-package":{"source":"iana","extensions":["ez3"]},"application/vnd.f-secure.mobile":{"source":"iana"},"application/vnd.familysearch.gedcom+zip":{"source":"iana","compressible":false},"application/vnd.fastcopy-disk-image":{"source":"iana"},"application/vnd.fdf":{"source":"iana","extensions":["fdf"]},"application/vnd.fdsn.mseed":{"source":"iana","extensions":["mseed"]},"application/vnd.fdsn.seed":{"source":"iana","extensions":["seed","dataless"]},"application/vnd.ffsns":{"source":"iana"},"application/vnd.ficlab.flb+zip":{"source":"iana","compressible":false},"application/vnd.filmit.zfc":{"source":"iana"},"application/vnd.fints":{"source":"iana"},"application/vnd.firemonkeys.cloudcell":{"source":"iana"},"application/vnd.flographit":{"source":"iana","extensions":["gph"]},"application/vnd.fluxtime.clip":{"source":"iana","extensions":["ftc"]},"application/vnd.font-fontforge-sfd":{"source":"iana"},"application/vnd.framemaker":{"source":"iana","extensions":["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{"source":"iana","extensions":["fnc"]},"application/vnd.frogans.ltf":{"source":"iana","extensions":["ltf"]},"application/vnd.fsc.weblaunch":{"source":"iana","extensions":["fsc"]},"application/vnd.fujifilm.fb.docuworks":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.container":{"source":"iana"},"application/vnd.fujifilm.fb.jfi+xml":{"source":"iana","compressible":true},"application/vnd.fujitsu.oasys":{"source":"iana","extensions":["oas"]},"application/vnd.fujitsu.oasys2":{"source":"iana","extensions":["oa2"]},"application/vnd.fujitsu.oasys3":{"source":"iana","extensions":["oa3"]},"application/vnd.fujitsu.oasysgp":{"source":"iana","extensions":["fg5"]},"application/vnd.fujitsu.oasysprs":{"source":"iana","extensions":["bh2"]},"application/vnd.fujixerox.art-ex":{"source":"iana"},"application/vnd.fujixerox.art4":{"source":"iana"},"application/vnd.fujixerox.ddd":{"source":"iana","extensions":["ddd"]},"application/vnd.fujixerox.docuworks":{"source":"iana","extensions":["xdw"]},"application/vnd.fujixerox.docuworks.binder":{"source":"iana","extensions":["xbd"]},"application/vnd.fujixerox.docuworks.container":{"source":"iana"},"application/vnd.fujixerox.hbpl":{"source":"iana"},"application/vnd.fut-misnet":{"source":"iana"},"application/vnd.futoin+cbor":{"source":"iana"},"application/vnd.futoin+json":{"source":"iana","compressible":true},"application/vnd.fuzzysheet":{"source":"iana","extensions":["fzs"]},"application/vnd.genomatix.tuxedo":{"source":"iana","extensions":["txd"]},"application/vnd.gentics.grd+json":{"source":"iana","compressible":true},"application/vnd.geo+json":{"source":"iana","compressible":true},"application/vnd.geocube+xml":{"source":"iana","compressible":true},"application/vnd.geogebra.file":{"source":"iana","extensions":["ggb"]},"application/vnd.geogebra.slides":{"source":"iana"},"application/vnd.geogebra.tool":{"source":"iana","extensions":["ggt"]},"application/vnd.geometry-explorer":{"source":"iana","extensions":["gex","gre"]},"application/vnd.geonext":{"source":"iana","extensions":["gxt"]},"application/vnd.geoplan":{"source":"iana","extensions":["g2w"]},"application/vnd.geospace":{"source":"iana","extensions":["g3w"]},"application/vnd.gerber":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt-response":{"source":"iana"},"application/vnd.gmx":{"source":"iana","extensions":["gmx"]},"application/vnd.google-apps.document":{"compressible":false,"extensions":["gdoc"]},"application/vnd.google-apps.presentation":{"compressible":false,"extensions":["gslides"]},"application/vnd.google-apps.spreadsheet":{"compressible":false,"extensions":["gsheet"]},"application/vnd.google-earth.kml+xml":{"source":"iana","compressible":true,"extensions":["kml"]},"application/vnd.google-earth.kmz":{"source":"iana","compressible":false,"extensions":["kmz"]},"application/vnd.gov.sk.e-form+xml":{"source":"iana","compressible":true},"application/vnd.gov.sk.e-form+zip":{"source":"iana","compressible":false},"application/vnd.gov.sk.xmldatacontainer+xml":{"source":"iana","compressible":true},"application/vnd.grafeq":{"source":"iana","extensions":["gqf","gqs"]},"application/vnd.gridmp":{"source":"iana"},"application/vnd.groove-account":{"source":"iana","extensions":["gac"]},"application/vnd.groove-help":{"source":"iana","extensions":["ghf"]},"application/vnd.groove-identity-message":{"source":"iana","extensions":["gim"]},"application/vnd.groove-injector":{"source":"iana","extensions":["grv"]},"application/vnd.groove-tool-message":{"source":"iana","extensions":["gtm"]},"application/vnd.groove-tool-template":{"source":"iana","extensions":["tpl"]},"application/vnd.groove-vcard":{"source":"iana","extensions":["vcg"]},"application/vnd.hal+json":{"source":"iana","compressible":true},"application/vnd.hal+xml":{"source":"iana","compressible":true,"extensions":["hal"]},"application/vnd.handheld-entertainment+xml":{"source":"iana","compressible":true,"extensions":["zmm"]},"application/vnd.hbci":{"source":"iana","extensions":["hbci"]},"application/vnd.hc+json":{"source":"iana","compressible":true},"application/vnd.hcl-bireports":{"source":"iana"},"application/vnd.hdt":{"source":"iana"},"application/vnd.heroku+json":{"source":"iana","compressible":true},"application/vnd.hhe.lesson-player":{"source":"iana","extensions":["les"]},"application/vnd.hl7cda+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.hl7v2+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.hp-hpgl":{"source":"iana","extensions":["hpgl"]},"application/vnd.hp-hpid":{"source":"iana","extensions":["hpid"]},"application/vnd.hp-hps":{"source":"iana","extensions":["hps"]},"application/vnd.hp-jlyt":{"source":"iana","extensions":["jlt"]},"application/vnd.hp-pcl":{"source":"iana","extensions":["pcl"]},"application/vnd.hp-pclxl":{"source":"iana","extensions":["pclxl"]},"application/vnd.httphone":{"source":"iana"},"application/vnd.hydrostatix.sof-data":{"source":"iana","extensions":["sfd-hdstx"]},"application/vnd.hyper+json":{"source":"iana","compressible":true},"application/vnd.hyper-item+json":{"source":"iana","compressible":true},"application/vnd.hyperdrive+json":{"source":"iana","compressible":true},"application/vnd.hzn-3d-crossword":{"source":"iana"},"application/vnd.ibm.afplinedata":{"source":"iana"},"application/vnd.ibm.electronic-media":{"source":"iana"},"application/vnd.ibm.minipay":{"source":"iana","extensions":["mpy"]},"application/vnd.ibm.modcap":{"source":"iana","extensions":["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{"source":"iana","extensions":["irm"]},"application/vnd.ibm.secure-container":{"source":"iana","extensions":["sc"]},"application/vnd.iccprofile":{"source":"iana","extensions":["icc","icm"]},"application/vnd.ieee.1905":{"source":"iana"},"application/vnd.igloader":{"source":"iana","extensions":["igl"]},"application/vnd.imagemeter.folder+zip":{"source":"iana","compressible":false},"application/vnd.imagemeter.image+zip":{"source":"iana","compressible":false},"application/vnd.immervision-ivp":{"source":"iana","extensions":["ivp"]},"application/vnd.immervision-ivu":{"source":"iana","extensions":["ivu"]},"application/vnd.ims.imsccv1p1":{"source":"iana"},"application/vnd.ims.imsccv1p2":{"source":"iana"},"application/vnd.ims.imsccv1p3":{"source":"iana"},"application/vnd.ims.lis.v2.result+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy.id+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings.simple+json":{"source":"iana","compressible":true},"application/vnd.informedcontrol.rms+xml":{"source":"iana","compressible":true},"application/vnd.informix-visionary":{"source":"iana"},"application/vnd.infotech.project":{"source":"iana"},"application/vnd.infotech.project+xml":{"source":"iana","compressible":true},"application/vnd.innopath.wamp.notification":{"source":"iana"},"application/vnd.insors.igm":{"source":"iana","extensions":["igm"]},"application/vnd.intercon.formnet":{"source":"iana","extensions":["xpw","xpx"]},"application/vnd.intergeo":{"source":"iana","extensions":["i2g"]},"application/vnd.intertrust.digibox":{"source":"iana"},"application/vnd.intertrust.nncp":{"source":"iana"},"application/vnd.intu.qbo":{"source":"iana","extensions":["qbo"]},"application/vnd.intu.qfx":{"source":"iana","extensions":["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.conceptitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.knowledgeitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsmessage+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.packageitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.planningitem+xml":{"source":"iana","compressible":true},"application/vnd.ipunplugged.rcprofile":{"source":"iana","extensions":["rcprofile"]},"application/vnd.irepository.package+xml":{"source":"iana","compressible":true,"extensions":["irp"]},"application/vnd.is-xpr":{"source":"iana","extensions":["xpr"]},"application/vnd.isac.fcs":{"source":"iana","extensions":["fcs"]},"application/vnd.iso11783-10+zip":{"source":"iana","compressible":false},"application/vnd.jam":{"source":"iana","extensions":["jam"]},"application/vnd.japannet-directory-service":{"source":"iana"},"application/vnd.japannet-jpnstore-wakeup":{"source":"iana"},"application/vnd.japannet-payment-wakeup":{"source":"iana"},"application/vnd.japannet-registration":{"source":"iana"},"application/vnd.japannet-registration-wakeup":{"source":"iana"},"application/vnd.japannet-setstore-wakeup":{"source":"iana"},"application/vnd.japannet-verification":{"source":"iana"},"application/vnd.japannet-verification-wakeup":{"source":"iana"},"application/vnd.jcp.javame.midlet-rms":{"source":"iana","extensions":["rms"]},"application/vnd.jisp":{"source":"iana","extensions":["jisp"]},"application/vnd.joost.joda-archive":{"source":"iana","extensions":["joda"]},"application/vnd.jsk.isdn-ngn":{"source":"iana"},"application/vnd.kahootz":{"source":"iana","extensions":["ktz","ktr"]},"application/vnd.kde.karbon":{"source":"iana","extensions":["karbon"]},"application/vnd.kde.kchart":{"source":"iana","extensions":["chrt"]},"application/vnd.kde.kformula":{"source":"iana","extensions":["kfo"]},"application/vnd.kde.kivio":{"source":"iana","extensions":["flw"]},"application/vnd.kde.kontour":{"source":"iana","extensions":["kon"]},"application/vnd.kde.kpresenter":{"source":"iana","extensions":["kpr","kpt"]},"application/vnd.kde.kspread":{"source":"iana","extensions":["ksp"]},"application/vnd.kde.kword":{"source":"iana","extensions":["kwd","kwt"]},"application/vnd.kenameaapp":{"source":"iana","extensions":["htke"]},"application/vnd.kidspiration":{"source":"iana","extensions":["kia"]},"application/vnd.kinar":{"source":"iana","extensions":["kne","knp"]},"application/vnd.koan":{"source":"iana","extensions":["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{"source":"iana","extensions":["sse"]},"application/vnd.las":{"source":"iana"},"application/vnd.las.las+json":{"source":"iana","compressible":true},"application/vnd.las.las+xml":{"source":"iana","compressible":true,"extensions":["lasxml"]},"application/vnd.laszip":{"source":"iana"},"application/vnd.leap+json":{"source":"iana","compressible":true},"application/vnd.liberty-request+xml":{"source":"iana","compressible":true},"application/vnd.llamagraphics.life-balance.desktop":{"source":"iana","extensions":["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{"source":"iana","compressible":true,"extensions":["lbe"]},"application/vnd.logipipe.circuit+zip":{"source":"iana","compressible":false},"application/vnd.loom":{"source":"iana"},"application/vnd.lotus-1-2-3":{"source":"iana","extensions":["123"]},"application/vnd.lotus-approach":{"source":"iana","extensions":["apr"]},"application/vnd.lotus-freelance":{"source":"iana","extensions":["pre"]},"application/vnd.lotus-notes":{"source":"iana","extensions":["nsf"]},"application/vnd.lotus-organizer":{"source":"iana","extensions":["org"]},"application/vnd.lotus-screencam":{"source":"iana","extensions":["scm"]},"application/vnd.lotus-wordpro":{"source":"iana","extensions":["lwp"]},"application/vnd.macports.portpkg":{"source":"iana","extensions":["portpkg"]},"application/vnd.mapbox-vector-tile":{"source":"iana","extensions":["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.conftoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.license+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.mdcf":{"source":"iana"},"application/vnd.mason+json":{"source":"iana","compressible":true},"application/vnd.maxar.archive.3tz+zip":{"source":"iana","compressible":false},"application/vnd.maxmind.maxmind-db":{"source":"iana"},"application/vnd.mcd":{"source":"iana","extensions":["mcd"]},"application/vnd.medcalcdata":{"source":"iana","extensions":["mc1"]},"application/vnd.mediastation.cdkey":{"source":"iana","extensions":["cdkey"]},"application/vnd.meridian-slingshot":{"source":"iana"},"application/vnd.mfer":{"source":"iana","extensions":["mwf"]},"application/vnd.mfmp":{"source":"iana","extensions":["mfm"]},"application/vnd.micro+json":{"source":"iana","compressible":true},"application/vnd.micrografx.flo":{"source":"iana","extensions":["flo"]},"application/vnd.micrografx.igx":{"source":"iana","extensions":["igx"]},"application/vnd.microsoft.portable-executable":{"source":"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{"source":"iana"},"application/vnd.miele+json":{"source":"iana","compressible":true},"application/vnd.mif":{"source":"iana","extensions":["mif"]},"application/vnd.minisoft-hp3000-save":{"source":"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{"source":"iana"},"application/vnd.mobius.daf":{"source":"iana","extensions":["daf"]},"application/vnd.mobius.dis":{"source":"iana","extensions":["dis"]},"application/vnd.mobius.mbk":{"source":"iana","extensions":["mbk"]},"application/vnd.mobius.mqy":{"source":"iana","extensions":["mqy"]},"application/vnd.mobius.msl":{"source":"iana","extensions":["msl"]},"application/vnd.mobius.plc":{"source":"iana","extensions":["plc"]},"application/vnd.mobius.txf":{"source":"iana","extensions":["txf"]},"application/vnd.mophun.application":{"source":"iana","extensions":["mpn"]},"application/vnd.mophun.certificate":{"source":"iana","extensions":["mpc"]},"application/vnd.motorola.flexsuite":{"source":"iana"},"application/vnd.motorola.flexsuite.adsi":{"source":"iana"},"application/vnd.motorola.flexsuite.fis":{"source":"iana"},"application/vnd.motorola.flexsuite.gotap":{"source":"iana"},"application/vnd.motorola.flexsuite.kmr":{"source":"iana"},"application/vnd.motorola.flexsuite.ttc":{"source":"iana"},"application/vnd.motorola.flexsuite.wem":{"source":"iana"},"application/vnd.motorola.iprm":{"source":"iana"},"application/vnd.mozilla.xul+xml":{"source":"iana","compressible":true,"extensions":["xul"]},"application/vnd.ms-3mfdocument":{"source":"iana"},"application/vnd.ms-artgalry":{"source":"iana","extensions":["cil"]},"application/vnd.ms-asf":{"source":"iana"},"application/vnd.ms-cab-compressed":{"source":"iana","extensions":["cab"]},"application/vnd.ms-color.iccprofile":{"source":"apache"},"application/vnd.ms-excel":{"source":"iana","compressible":false,"extensions":["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{"source":"iana","extensions":["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{"source":"iana","extensions":["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{"source":"iana","extensions":["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{"source":"iana","extensions":["xltm"]},"application/vnd.ms-fontobject":{"source":"iana","compressible":true,"extensions":["eot"]},"application/vnd.ms-htmlhelp":{"source":"iana","extensions":["chm"]},"application/vnd.ms-ims":{"source":"iana","extensions":["ims"]},"application/vnd.ms-lrm":{"source":"iana","extensions":["lrm"]},"application/vnd.ms-office.activex+xml":{"source":"iana","compressible":true},"application/vnd.ms-officetheme":{"source":"iana","extensions":["thmx"]},"application/vnd.ms-opentype":{"source":"apache","compressible":true},"application/vnd.ms-outlook":{"compressible":false,"extensions":["msg"]},"application/vnd.ms-package.obfuscated-opentype":{"source":"apache"},"application/vnd.ms-pki.seccat":{"source":"apache","extensions":["cat"]},"application/vnd.ms-pki.stl":{"source":"apache","extensions":["stl"]},"application/vnd.ms-playready.initiator+xml":{"source":"iana","compressible":true},"application/vnd.ms-powerpoint":{"source":"iana","compressible":false,"extensions":["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{"source":"iana","extensions":["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{"source":"iana","extensions":["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{"source":"iana","extensions":["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{"source":"iana","extensions":["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{"source":"iana","extensions":["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{"source":"iana","compressible":true},"application/vnd.ms-printing.printticket+xml":{"source":"apache","compressible":true},"application/vnd.ms-printschematicket+xml":{"source":"iana","compressible":true},"application/vnd.ms-project":{"source":"iana","extensions":["mpp","mpt"]},"application/vnd.ms-tnef":{"source":"iana"},"application/vnd.ms-windows.devicepairing":{"source":"iana"},"application/vnd.ms-windows.nwprinting.oob":{"source":"iana"},"application/vnd.ms-windows.printerpairing":{"source":"iana"},"application/vnd.ms-windows.wsd.oob":{"source":"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.lic-resp":{"source":"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.meter-resp":{"source":"iana"},"application/vnd.ms-word.document.macroenabled.12":{"source":"iana","extensions":["docm"]},"application/vnd.ms-word.template.macroenabled.12":{"source":"iana","extensions":["dotm"]},"application/vnd.ms-works":{"source":"iana","extensions":["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{"source":"iana","extensions":["wpl"]},"application/vnd.ms-xpsdocument":{"source":"iana","compressible":false,"extensions":["xps"]},"application/vnd.msa-disk-image":{"source":"iana"},"application/vnd.mseq":{"source":"iana","extensions":["mseq"]},"application/vnd.msign":{"source":"iana"},"application/vnd.multiad.creator":{"source":"iana"},"application/vnd.multiad.creator.cif":{"source":"iana"},"application/vnd.music-niff":{"source":"iana"},"application/vnd.musician":{"source":"iana","extensions":["mus"]},"application/vnd.muvee.style":{"source":"iana","extensions":["msty"]},"application/vnd.mynfc":{"source":"iana","extensions":["taglet"]},"application/vnd.nacamar.ybrid+json":{"source":"iana","compressible":true},"application/vnd.ncd.control":{"source":"iana"},"application/vnd.ncd.reference":{"source":"iana"},"application/vnd.nearst.inv+json":{"source":"iana","compressible":true},"application/vnd.nebumind.line":{"source":"iana"},"application/vnd.nervana":{"source":"iana"},"application/vnd.netfpx":{"source":"iana"},"application/vnd.neurolanguage.nlu":{"source":"iana","extensions":["nlu"]},"application/vnd.nimn":{"source":"iana"},"application/vnd.nintendo.nitro.rom":{"source":"iana"},"application/vnd.nintendo.snes.rom":{"source":"iana"},"application/vnd.nitf":{"source":"iana","extensions":["ntf","nitf"]},"application/vnd.noblenet-directory":{"source":"iana","extensions":["nnd"]},"application/vnd.noblenet-sealer":{"source":"iana","extensions":["nns"]},"application/vnd.noblenet-web":{"source":"iana","extensions":["nnw"]},"application/vnd.nokia.catalogs":{"source":"iana"},"application/vnd.nokia.conml+wbxml":{"source":"iana"},"application/vnd.nokia.conml+xml":{"source":"iana","compressible":true},"application/vnd.nokia.iptv.config+xml":{"source":"iana","compressible":true},"application/vnd.nokia.isds-radio-presets":{"source":"iana"},"application/vnd.nokia.landmark+wbxml":{"source":"iana"},"application/vnd.nokia.landmark+xml":{"source":"iana","compressible":true},"application/vnd.nokia.landmarkcollection+xml":{"source":"iana","compressible":true},"application/vnd.nokia.n-gage.ac+xml":{"source":"iana","compressible":true,"extensions":["ac"]},"application/vnd.nokia.n-gage.data":{"source":"iana","extensions":["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{"source":"iana","extensions":["n-gage"]},"application/vnd.nokia.ncd":{"source":"iana"},"application/vnd.nokia.pcd+wbxml":{"source":"iana"},"application/vnd.nokia.pcd+xml":{"source":"iana","compressible":true},"application/vnd.nokia.radio-preset":{"source":"iana","extensions":["rpst"]},"application/vnd.nokia.radio-presets":{"source":"iana","extensions":["rpss"]},"application/vnd.novadigm.edm":{"source":"iana","extensions":["edm"]},"application/vnd.novadigm.edx":{"source":"iana","extensions":["edx"]},"application/vnd.novadigm.ext":{"source":"iana","extensions":["ext"]},"application/vnd.ntt-local.content-share":{"source":"iana"},"application/vnd.ntt-local.file-transfer":{"source":"iana"},"application/vnd.ntt-local.ogw_remote-access":{"source":"iana"},"application/vnd.ntt-local.sip-ta_remote":{"source":"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{"source":"iana"},"application/vnd.oasis.opendocument.chart":{"source":"iana","extensions":["odc"]},"application/vnd.oasis.opendocument.chart-template":{"source":"iana","extensions":["otc"]},"application/vnd.oasis.opendocument.database":{"source":"iana","extensions":["odb"]},"application/vnd.oasis.opendocument.formula":{"source":"iana","extensions":["odf"]},"application/vnd.oasis.opendocument.formula-template":{"source":"iana","extensions":["odft"]},"application/vnd.oasis.opendocument.graphics":{"source":"iana","compressible":false,"extensions":["odg"]},"application/vnd.oasis.opendocument.graphics-template":{"source":"iana","extensions":["otg"]},"application/vnd.oasis.opendocument.image":{"source":"iana","extensions":["odi"]},"application/vnd.oasis.opendocument.image-template":{"source":"iana","extensions":["oti"]},"application/vnd.oasis.opendocument.presentation":{"source":"iana","compressible":false,"extensions":["odp"]},"application/vnd.oasis.opendocument.presentation-template":{"source":"iana","extensions":["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{"source":"iana","compressible":false,"extensions":["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{"source":"iana","extensions":["ots"]},"application/vnd.oasis.opendocument.text":{"source":"iana","compressible":false,"extensions":["odt"]},"application/vnd.oasis.opendocument.text-master":{"source":"iana","extensions":["odm"]},"application/vnd.oasis.opendocument.text-template":{"source":"iana","extensions":["ott"]},"application/vnd.oasis.opendocument.text-web":{"source":"iana","extensions":["oth"]},"application/vnd.obn":{"source":"iana"},"application/vnd.ocf+cbor":{"source":"iana"},"application/vnd.oci.image.manifest.v1+json":{"source":"iana","compressible":true},"application/vnd.oftn.l10n+json":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessdownload+xml":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessstreaming+xml":{"source":"iana","compressible":true},"application/vnd.oipf.cspg-hexbinary":{"source":"iana"},"application/vnd.oipf.dae.svg+xml":{"source":"iana","compressible":true},"application/vnd.oipf.dae.xhtml+xml":{"source":"iana","compressible":true},"application/vnd.oipf.mippvcontrolmessage+xml":{"source":"iana","compressible":true},"application/vnd.oipf.pae.gem":{"source":"iana"},"application/vnd.oipf.spdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.oipf.spdlist+xml":{"source":"iana","compressible":true},"application/vnd.oipf.ueprofile+xml":{"source":"iana","compressible":true},"application/vnd.oipf.userprofile+xml":{"source":"iana","compressible":true},"application/vnd.olpc-sugar":{"source":"iana","extensions":["xo"]},"application/vnd.oma-scws-config":{"source":"iana"},"application/vnd.oma-scws-http-request":{"source":"iana"},"application/vnd.oma-scws-http-response":{"source":"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.drm-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.imd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.ltkm":{"source":"iana"},"application/vnd.oma.bcast.notification+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.provisioningtrigger":{"source":"iana"},"application/vnd.oma.bcast.sgboot":{"source":"iana"},"application/vnd.oma.bcast.sgdd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sgdu":{"source":"iana"},"application/vnd.oma.bcast.simple-symbol-container":{"source":"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sprov+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.stkm":{"source":"iana"},"application/vnd.oma.cab-address-book+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-feature-handler+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-pcc+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-subs-invite+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-user-prefs+xml":{"source":"iana","compressible":true},"application/vnd.oma.dcd":{"source":"iana"},"application/vnd.oma.dcdc":{"source":"iana"},"application/vnd.oma.dd2+xml":{"source":"iana","compressible":true,"extensions":["dd2"]},"application/vnd.oma.drm.risd+xml":{"source":"iana","compressible":true},"application/vnd.oma.group-usage-list+xml":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+cbor":{"source":"iana"},"application/vnd.oma.lwm2m+json":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+tlv":{"source":"iana"},"application/vnd.oma.pal+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.detailed-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.final-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.groups+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.invocation-descriptor+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.optimized-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.push":{"source":"iana"},"application/vnd.oma.scidm.messages+xml":{"source":"iana","compressible":true},"application/vnd.oma.xcap-directory+xml":{"source":"iana","compressible":true},"application/vnd.omads-email+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-file+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-folder+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omaloc-supl-init":{"source":"iana"},"application/vnd.onepager":{"source":"iana"},"application/vnd.onepagertamp":{"source":"iana"},"application/vnd.onepagertamx":{"source":"iana"},"application/vnd.onepagertat":{"source":"iana"},"application/vnd.onepagertatp":{"source":"iana"},"application/vnd.onepagertatx":{"source":"iana"},"application/vnd.openblox.game+xml":{"source":"iana","compressible":true,"extensions":["obgx"]},"application/vnd.openblox.game-binary":{"source":"iana"},"application/vnd.openeye.oeb":{"source":"iana"},"application/vnd.openofficeorg.extension":{"source":"apache","extensions":["oxt"]},"application/vnd.openstreetmap.data+xml":{"source":"iana","compressible":true,"extensions":["osm"]},"application/vnd.opentimestamps.ots":{"source":"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawing+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{"source":"iana","compressible":false,"extensions":["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slide":{"source":"iana","extensions":["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{"source":"iana","extensions":["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.template":{"source":"iana","extensions":["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"source":"iana","compressible":false,"extensions":["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{"source":"iana","extensions":["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.theme+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.vmldrawing":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"source":"iana","compressible":false,"extensions":["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{"source":"iana","extensions":["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.core-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.relationships+xml":{"source":"iana","compressible":true},"application/vnd.oracle.resource+json":{"source":"iana","compressible":true},"application/vnd.orange.indata":{"source":"iana"},"application/vnd.osa.netdeploy":{"source":"iana"},"application/vnd.osgeo.mapguide.package":{"source":"iana","extensions":["mgp"]},"application/vnd.osgi.bundle":{"source":"iana"},"application/vnd.osgi.dp":{"source":"iana","extensions":["dp"]},"application/vnd.osgi.subsystem":{"source":"iana","extensions":["esa"]},"application/vnd.otps.ct-kip+xml":{"source":"iana","compressible":true},"application/vnd.oxli.countgraph":{"source":"iana"},"application/vnd.pagerduty+json":{"source":"iana","compressible":true},"application/vnd.palm":{"source":"iana","extensions":["pdb","pqa","oprc"]},"application/vnd.panoply":{"source":"iana"},"application/vnd.paos.xml":{"source":"iana"},"application/vnd.patentdive":{"source":"iana"},"application/vnd.patientecommsdoc":{"source":"iana"},"application/vnd.pawaafile":{"source":"iana","extensions":["paw"]},"application/vnd.pcos":{"source":"iana"},"application/vnd.pg.format":{"source":"iana","extensions":["str"]},"application/vnd.pg.osasli":{"source":"iana","extensions":["ei6"]},"application/vnd.piaccess.application-licence":{"source":"iana"},"application/vnd.picsel":{"source":"iana","extensions":["efif"]},"application/vnd.pmi.widget":{"source":"iana","extensions":["wg"]},"application/vnd.poc.group-advertisement+xml":{"source":"iana","compressible":true},"application/vnd.pocketlearn":{"source":"iana","extensions":["plf"]},"application/vnd.powerbuilder6":{"source":"iana","extensions":["pbd"]},"application/vnd.powerbuilder6-s":{"source":"iana"},"application/vnd.powerbuilder7":{"source":"iana"},"application/vnd.powerbuilder7-s":{"source":"iana"},"application/vnd.powerbuilder75":{"source":"iana"},"application/vnd.powerbuilder75-s":{"source":"iana"},"application/vnd.preminet":{"source":"iana"},"application/vnd.previewsystems.box":{"source":"iana","extensions":["box"]},"application/vnd.proteus.magazine":{"source":"iana","extensions":["mgz"]},"application/vnd.psfs":{"source":"iana"},"application/vnd.publishare-delta-tree":{"source":"iana","extensions":["qps"]},"application/vnd.pvi.ptid1":{"source":"iana","extensions":["ptid"]},"application/vnd.pwg-multiplexed":{"source":"iana"},"application/vnd.pwg-xhtml-print+xml":{"source":"iana","compressible":true},"application/vnd.qualcomm.brew-app-res":{"source":"iana"},"application/vnd.quarantainenet":{"source":"iana"},"application/vnd.quark.quarkxpress":{"source":"iana","extensions":["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{"source":"iana"},"application/vnd.radisys.moml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conn+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-stream+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-base+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-detect+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-group+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-speech+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-transform+xml":{"source":"iana","compressible":true},"application/vnd.rainstor.data":{"source":"iana"},"application/vnd.rapid":{"source":"iana"},"application/vnd.rar":{"source":"iana","extensions":["rar"]},"application/vnd.realvnc.bed":{"source":"iana","extensions":["bed"]},"application/vnd.recordare.musicxml":{"source":"iana","extensions":["mxl"]},"application/vnd.recordare.musicxml+xml":{"source":"iana","compressible":true,"extensions":["musicxml"]},"application/vnd.renlearn.rlprint":{"source":"iana"},"application/vnd.resilient.logic":{"source":"iana"},"application/vnd.restful+json":{"source":"iana","compressible":true},"application/vnd.rig.cryptonote":{"source":"iana","extensions":["cryptonote"]},"application/vnd.rim.cod":{"source":"apache","extensions":["cod"]},"application/vnd.rn-realmedia":{"source":"apache","extensions":["rm"]},"application/vnd.rn-realmedia-vbr":{"source":"apache","extensions":["rmvb"]},"application/vnd.route66.link66+xml":{"source":"iana","compressible":true,"extensions":["link66"]},"application/vnd.rs-274x":{"source":"iana"},"application/vnd.ruckus.download":{"source":"iana"},"application/vnd.s3sms":{"source":"iana"},"application/vnd.sailingtracker.track":{"source":"iana","extensions":["st"]},"application/vnd.sar":{"source":"iana"},"application/vnd.sbm.cid":{"source":"iana"},"application/vnd.sbm.mid2":{"source":"iana"},"application/vnd.scribus":{"source":"iana"},"application/vnd.sealed.3df":{"source":"iana"},"application/vnd.sealed.csf":{"source":"iana"},"application/vnd.sealed.doc":{"source":"iana"},"application/vnd.sealed.eml":{"source":"iana"},"application/vnd.sealed.mht":{"source":"iana"},"application/vnd.sealed.net":{"source":"iana"},"application/vnd.sealed.ppt":{"source":"iana"},"application/vnd.sealed.tiff":{"source":"iana"},"application/vnd.sealed.xls":{"source":"iana"},"application/vnd.sealedmedia.softseal.html":{"source":"iana"},"application/vnd.sealedmedia.softseal.pdf":{"source":"iana"},"application/vnd.seemail":{"source":"iana","extensions":["see"]},"application/vnd.seis+json":{"source":"iana","compressible":true},"application/vnd.sema":{"source":"iana","extensions":["sema"]},"application/vnd.semd":{"source":"iana","extensions":["semd"]},"application/vnd.semf":{"source":"iana","extensions":["semf"]},"application/vnd.shade-save-file":{"source":"iana"},"application/vnd.shana.informed.formdata":{"source":"iana","extensions":["ifm"]},"application/vnd.shana.informed.formtemplate":{"source":"iana","extensions":["itp"]},"application/vnd.shana.informed.interchange":{"source":"iana","extensions":["iif"]},"application/vnd.shana.informed.package":{"source":"iana","extensions":["ipk"]},"application/vnd.shootproof+json":{"source":"iana","compressible":true},"application/vnd.shopkick+json":{"source":"iana","compressible":true},"application/vnd.shp":{"source":"iana"},"application/vnd.shx":{"source":"iana"},"application/vnd.sigrok.session":{"source":"iana"},"application/vnd.simtech-mindmapper":{"source":"iana","extensions":["twd","twds"]},"application/vnd.siren+json":{"source":"iana","compressible":true},"application/vnd.smaf":{"source":"iana","extensions":["mmf"]},"application/vnd.smart.notebook":{"source":"iana"},"application/vnd.smart.teacher":{"source":"iana","extensions":["teacher"]},"application/vnd.snesdev-page-table":{"source":"iana"},"application/vnd.software602.filler.form+xml":{"source":"iana","compressible":true,"extensions":["fo"]},"application/vnd.software602.filler.form-xml-zip":{"source":"iana"},"application/vnd.solent.sdkm+xml":{"source":"iana","compressible":true,"extensions":["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{"source":"iana","extensions":["dxp"]},"application/vnd.spotfire.sfs":{"source":"iana","extensions":["sfs"]},"application/vnd.sqlite3":{"source":"iana"},"application/vnd.sss-cod":{"source":"iana"},"application/vnd.sss-dtf":{"source":"iana"},"application/vnd.sss-ntf":{"source":"iana"},"application/vnd.stardivision.calc":{"source":"apache","extensions":["sdc"]},"application/vnd.stardivision.draw":{"source":"apache","extensions":["sda"]},"application/vnd.stardivision.impress":{"source":"apache","extensions":["sdd"]},"application/vnd.stardivision.math":{"source":"apache","extensions":["smf"]},"application/vnd.stardivision.writer":{"source":"apache","extensions":["sdw","vor"]},"application/vnd.stardivision.writer-global":{"source":"apache","extensions":["sgl"]},"application/vnd.stepmania.package":{"source":"iana","extensions":["smzip"]},"application/vnd.stepmania.stepchart":{"source":"iana","extensions":["sm"]},"application/vnd.street-stream":{"source":"iana"},"application/vnd.sun.wadl+xml":{"source":"iana","compressible":true,"extensions":["wadl"]},"application/vnd.sun.xml.calc":{"source":"apache","extensions":["sxc"]},"application/vnd.sun.xml.calc.template":{"source":"apache","extensions":["stc"]},"application/vnd.sun.xml.draw":{"source":"apache","extensions":["sxd"]},"application/vnd.sun.xml.draw.template":{"source":"apache","extensions":["std"]},"application/vnd.sun.xml.impress":{"source":"apache","extensions":["sxi"]},"application/vnd.sun.xml.impress.template":{"source":"apache","extensions":["sti"]},"application/vnd.sun.xml.math":{"source":"apache","extensions":["sxm"]},"application/vnd.sun.xml.writer":{"source":"apache","extensions":["sxw"]},"application/vnd.sun.xml.writer.global":{"source":"apache","extensions":["sxg"]},"application/vnd.sun.xml.writer.template":{"source":"apache","extensions":["stw"]},"application/vnd.sus-calendar":{"source":"iana","extensions":["sus","susp"]},"application/vnd.svd":{"source":"iana","extensions":["svd"]},"application/vnd.swiftview-ics":{"source":"iana"},"application/vnd.sycle+xml":{"source":"iana","compressible":true},"application/vnd.syft+json":{"source":"iana","compressible":true},"application/vnd.symbian.install":{"source":"apache","extensions":["sis","sisx"]},"application/vnd.syncml+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xsm"]},"application/vnd.syncml.dm+wbxml":{"source":"iana","charset":"UTF-8","extensions":["bdm"]},"application/vnd.syncml.dm+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xdm"]},"application/vnd.syncml.dm.notification":{"source":"iana"},"application/vnd.syncml.dmddf+wbxml":{"source":"iana"},"application/vnd.syncml.dmddf+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{"source":"iana"},"application/vnd.syncml.dmtnds+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.syncml.ds.notification":{"source":"iana"},"application/vnd.tableschema+json":{"source":"iana","compressible":true},"application/vnd.tao.intent-module-archive":{"source":"iana","extensions":["tao"]},"application/vnd.tcpdump.pcap":{"source":"iana","extensions":["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{"source":"iana","compressible":true},"application/vnd.tmd.mediaflex.api+xml":{"source":"iana","compressible":true},"application/vnd.tml":{"source":"iana"},"application/vnd.tmobile-livetv":{"source":"iana","extensions":["tmo"]},"application/vnd.tri.onesource":{"source":"iana"},"application/vnd.trid.tpt":{"source":"iana","extensions":["tpt"]},"application/vnd.triscape.mxs":{"source":"iana","extensions":["mxs"]},"application/vnd.trueapp":{"source":"iana","extensions":["tra"]},"application/vnd.truedoc":{"source":"iana"},"application/vnd.ubisoft.webplayer":{"source":"iana"},"application/vnd.ufdl":{"source":"iana","extensions":["ufd","ufdl"]},"application/vnd.uiq.theme":{"source":"iana","extensions":["utz"]},"application/vnd.umajin":{"source":"iana","extensions":["umj"]},"application/vnd.unity":{"source":"iana","extensions":["unityweb"]},"application/vnd.uoml+xml":{"source":"iana","compressible":true,"extensions":["uoml"]},"application/vnd.uplanet.alert":{"source":"iana"},"application/vnd.uplanet.alert-wbxml":{"source":"iana"},"application/vnd.uplanet.bearer-choice":{"source":"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{"source":"iana"},"application/vnd.uplanet.cacheop":{"source":"iana"},"application/vnd.uplanet.cacheop-wbxml":{"source":"iana"},"application/vnd.uplanet.channel":{"source":"iana"},"application/vnd.uplanet.channel-wbxml":{"source":"iana"},"application/vnd.uplanet.list":{"source":"iana"},"application/vnd.uplanet.list-wbxml":{"source":"iana"},"application/vnd.uplanet.listcmd":{"source":"iana"},"application/vnd.uplanet.listcmd-wbxml":{"source":"iana"},"application/vnd.uplanet.signal":{"source":"iana"},"application/vnd.uri-map":{"source":"iana"},"application/vnd.valve.source.material":{"source":"iana"},"application/vnd.vcx":{"source":"iana","extensions":["vcx"]},"application/vnd.vd-study":{"source":"iana"},"application/vnd.vectorworks":{"source":"iana"},"application/vnd.vel+json":{"source":"iana","compressible":true},"application/vnd.verimatrix.vcas":{"source":"iana"},"application/vnd.veritone.aion+json":{"source":"iana","compressible":true},"application/vnd.veryant.thin":{"source":"iana"},"application/vnd.ves.encrypted":{"source":"iana"},"application/vnd.vidsoft.vidconference":{"source":"iana"},"application/vnd.visio":{"source":"iana","extensions":["vsd","vst","vss","vsw"]},"application/vnd.visionary":{"source":"iana","extensions":["vis"]},"application/vnd.vividence.scriptfile":{"source":"iana"},"application/vnd.vsf":{"source":"iana","extensions":["vsf"]},"application/vnd.wap.sic":{"source":"iana"},"application/vnd.wap.slc":{"source":"iana"},"application/vnd.wap.wbxml":{"source":"iana","charset":"UTF-8","extensions":["wbxml"]},"application/vnd.wap.wmlc":{"source":"iana","extensions":["wmlc"]},"application/vnd.wap.wmlscriptc":{"source":"iana","extensions":["wmlsc"]},"application/vnd.webturbo":{"source":"iana","extensions":["wtb"]},"application/vnd.wfa.dpp":{"source":"iana"},"application/vnd.wfa.p2p":{"source":"iana"},"application/vnd.wfa.wsc":{"source":"iana"},"application/vnd.windows.devicepairing":{"source":"iana"},"application/vnd.wmc":{"source":"iana"},"application/vnd.wmf.bootstrap":{"source":"iana"},"application/vnd.wolfram.mathematica":{"source":"iana"},"application/vnd.wolfram.mathematica.package":{"source":"iana"},"application/vnd.wolfram.player":{"source":"iana","extensions":["nbp"]},"application/vnd.wordperfect":{"source":"iana","extensions":["wpd"]},"application/vnd.wqd":{"source":"iana","extensions":["wqd"]},"application/vnd.wrq-hp3000-labelled":{"source":"iana"},"application/vnd.wt.stf":{"source":"iana","extensions":["stf"]},"application/vnd.wv.csp+wbxml":{"source":"iana"},"application/vnd.wv.csp+xml":{"source":"iana","compressible":true},"application/vnd.wv.ssp+xml":{"source":"iana","compressible":true},"application/vnd.xacml+json":{"source":"iana","compressible":true},"application/vnd.xara":{"source":"iana","extensions":["xar"]},"application/vnd.xfdl":{"source":"iana","extensions":["xfdl"]},"application/vnd.xfdl.webform":{"source":"iana"},"application/vnd.xmi+xml":{"source":"iana","compressible":true},"application/vnd.xmpie.cpkg":{"source":"iana"},"application/vnd.xmpie.dpkg":{"source":"iana"},"application/vnd.xmpie.plan":{"source":"iana"},"application/vnd.xmpie.ppkg":{"source":"iana"},"application/vnd.xmpie.xlim":{"source":"iana"},"application/vnd.yamaha.hv-dic":{"source":"iana","extensions":["hvd"]},"application/vnd.yamaha.hv-script":{"source":"iana","extensions":["hvs"]},"application/vnd.yamaha.hv-voice":{"source":"iana","extensions":["hvp"]},"application/vnd.yamaha.openscoreformat":{"source":"iana","extensions":["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{"source":"iana","compressible":true,"extensions":["osfpvg"]},"application/vnd.yamaha.remote-setup":{"source":"iana"},"application/vnd.yamaha.smaf-audio":{"source":"iana","extensions":["saf"]},"application/vnd.yamaha.smaf-phrase":{"source":"iana","extensions":["spf"]},"application/vnd.yamaha.through-ngn":{"source":"iana"},"application/vnd.yamaha.tunnel-udpencap":{"source":"iana"},"application/vnd.yaoweme":{"source":"iana"},"application/vnd.yellowriver-custom-menu":{"source":"iana","extensions":["cmp"]},"application/vnd.youtube.yt":{"source":"iana"},"application/vnd.zul":{"source":"iana","extensions":["zir","zirz"]},"application/vnd.zzazz.deck+xml":{"source":"iana","compressible":true,"extensions":["zaz"]},"application/voicexml+xml":{"source":"iana","compressible":true,"extensions":["vxml"]},"application/voucher-cms+json":{"source":"iana","compressible":true},"application/vq-rtcpxr":{"source":"iana"},"application/wasm":{"source":"iana","compressible":true,"extensions":["wasm"]},"application/watcherinfo+xml":{"source":"iana","compressible":true,"extensions":["wif"]},"application/webpush-options+json":{"source":"iana","compressible":true},"application/whoispp-query":{"source":"iana"},"application/whoispp-response":{"source":"iana"},"application/widget":{"source":"iana","extensions":["wgt"]},"application/winhlp":{"source":"apache","extensions":["hlp"]},"application/wita":{"source":"iana"},"application/wordperfect5.1":{"source":"iana"},"application/wsdl+xml":{"source":"iana","compressible":true,"extensions":["wsdl"]},"application/wspolicy+xml":{"source":"iana","compressible":true,"extensions":["wspolicy"]},"application/x-7z-compressed":{"source":"apache","compressible":false,"extensions":["7z"]},"application/x-abiword":{"source":"apache","extensions":["abw"]},"application/x-ace-compressed":{"source":"apache","extensions":["ace"]},"application/x-amf":{"source":"apache"},"application/x-apple-diskimage":{"source":"apache","extensions":["dmg"]},"application/x-arj":{"compressible":false,"extensions":["arj"]},"application/x-authorware-bin":{"source":"apache","extensions":["aab","x32","u32","vox"]},"application/x-authorware-map":{"source":"apache","extensions":["aam"]},"application/x-authorware-seg":{"source":"apache","extensions":["aas"]},"application/x-bcpio":{"source":"apache","extensions":["bcpio"]},"application/x-bdoc":{"compressible":false,"extensions":["bdoc"]},"application/x-bittorrent":{"source":"apache","extensions":["torrent"]},"application/x-blorb":{"source":"apache","extensions":["blb","blorb"]},"application/x-bzip":{"source":"apache","compressible":false,"extensions":["bz"]},"application/x-bzip2":{"source":"apache","compressible":false,"extensions":["bz2","boz"]},"application/x-cbr":{"source":"apache","extensions":["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{"source":"apache","extensions":["vcd"]},"application/x-cfs-compressed":{"source":"apache","extensions":["cfs"]},"application/x-chat":{"source":"apache","extensions":["chat"]},"application/x-chess-pgn":{"source":"apache","extensions":["pgn"]},"application/x-chrome-extension":{"extensions":["crx"]},"application/x-cocoa":{"source":"nginx","extensions":["cco"]},"application/x-compress":{"source":"apache"},"application/x-conference":{"source":"apache","extensions":["nsc"]},"application/x-cpio":{"source":"apache","extensions":["cpio"]},"application/x-csh":{"source":"apache","extensions":["csh"]},"application/x-deb":{"compressible":false},"application/x-debian-package":{"source":"apache","extensions":["deb","udeb"]},"application/x-dgc-compressed":{"source":"apache","extensions":["dgc"]},"application/x-director":{"source":"apache","extensions":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{"source":"apache","extensions":["wad"]},"application/x-dtbncx+xml":{"source":"apache","compressible":true,"extensions":["ncx"]},"application/x-dtbook+xml":{"source":"apache","compressible":true,"extensions":["dtb"]},"application/x-dtbresource+xml":{"source":"apache","compressible":true,"extensions":["res"]},"application/x-dvi":{"source":"apache","compressible":false,"extensions":["dvi"]},"application/x-envoy":{"source":"apache","extensions":["evy"]},"application/x-eva":{"source":"apache","extensions":["eva"]},"application/x-font-bdf":{"source":"apache","extensions":["bdf"]},"application/x-font-dos":{"source":"apache"},"application/x-font-framemaker":{"source":"apache"},"application/x-font-ghostscript":{"source":"apache","extensions":["gsf"]},"application/x-font-libgrx":{"source":"apache"},"application/x-font-linux-psf":{"source":"apache","extensions":["psf"]},"application/x-font-pcf":{"source":"apache","extensions":["pcf"]},"application/x-font-snf":{"source":"apache","extensions":["snf"]},"application/x-font-speedo":{"source":"apache"},"application/x-font-sunos-news":{"source":"apache"},"application/x-font-type1":{"source":"apache","extensions":["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{"source":"apache"},"application/x-freearc":{"source":"apache","extensions":["arc"]},"application/x-futuresplash":{"source":"apache","extensions":["spl"]},"application/x-gca-compressed":{"source":"apache","extensions":["gca"]},"application/x-glulx":{"source":"apache","extensions":["ulx"]},"application/x-gnumeric":{"source":"apache","extensions":["gnumeric"]},"application/x-gramps-xml":{"source":"apache","extensions":["gramps"]},"application/x-gtar":{"source":"apache","extensions":["gtar"]},"application/x-gzip":{"source":"apache"},"application/x-hdf":{"source":"apache","extensions":["hdf"]},"application/x-httpd-php":{"compressible":true,"extensions":["php"]},"application/x-install-instructions":{"source":"apache","extensions":["install"]},"application/x-iso9660-image":{"source":"apache","extensions":["iso"]},"application/x-iwork-keynote-sffkey":{"extensions":["key"]},"application/x-iwork-numbers-sffnumbers":{"extensions":["numbers"]},"application/x-iwork-pages-sffpages":{"extensions":["pages"]},"application/x-java-archive-diff":{"source":"nginx","extensions":["jardiff"]},"application/x-java-jnlp-file":{"source":"apache","compressible":false,"extensions":["jnlp"]},"application/x-javascript":{"compressible":true},"application/x-keepass2":{"extensions":["kdbx"]},"application/x-latex":{"source":"apache","compressible":false,"extensions":["latex"]},"application/x-lua-bytecode":{"extensions":["luac"]},"application/x-lzh-compressed":{"source":"apache","extensions":["lzh","lha"]},"application/x-makeself":{"source":"nginx","extensions":["run"]},"application/x-mie":{"source":"apache","extensions":["mie"]},"application/x-mobipocket-ebook":{"source":"apache","extensions":["prc","mobi"]},"application/x-mpegurl":{"compressible":false},"application/x-ms-application":{"source":"apache","extensions":["application"]},"application/x-ms-shortcut":{"source":"apache","extensions":["lnk"]},"application/x-ms-wmd":{"source":"apache","extensions":["wmd"]},"application/x-ms-wmz":{"source":"apache","extensions":["wmz"]},"application/x-ms-xbap":{"source":"apache","extensions":["xbap"]},"application/x-msaccess":{"source":"apache","extensions":["mdb"]},"application/x-msbinder":{"source":"apache","extensions":["obd"]},"application/x-mscardfile":{"source":"apache","extensions":["crd"]},"application/x-msclip":{"source":"apache","extensions":["clp"]},"application/x-msdos-program":{"extensions":["exe"]},"application/x-msdownload":{"source":"apache","extensions":["exe","dll","com","bat","msi"]},"application/x-msmediaview":{"source":"apache","extensions":["mvb","m13","m14"]},"application/x-msmetafile":{"source":"apache","extensions":["wmf","wmz","emf","emz"]},"application/x-msmoney":{"source":"apache","extensions":["mny"]},"application/x-mspublisher":{"source":"apache","extensions":["pub"]},"application/x-msschedule":{"source":"apache","extensions":["scd"]},"application/x-msterminal":{"source":"apache","extensions":["trm"]},"application/x-mswrite":{"source":"apache","extensions":["wri"]},"application/x-netcdf":{"source":"apache","extensions":["nc","cdf"]},"application/x-ns-proxy-autoconfig":{"compressible":true,"extensions":["pac"]},"application/x-nzb":{"source":"apache","extensions":["nzb"]},"application/x-perl":{"source":"nginx","extensions":["pl","pm"]},"application/x-pilot":{"source":"nginx","extensions":["prc","pdb"]},"application/x-pkcs12":{"source":"apache","compressible":false,"extensions":["p12","pfx"]},"application/x-pkcs7-certificates":{"source":"apache","extensions":["p7b","spc"]},"application/x-pkcs7-certreqresp":{"source":"apache","extensions":["p7r"]},"application/x-pki-message":{"source":"iana"},"application/x-rar-compressed":{"source":"apache","compressible":false,"extensions":["rar"]},"application/x-redhat-package-manager":{"source":"nginx","extensions":["rpm"]},"application/x-research-info-systems":{"source":"apache","extensions":["ris"]},"application/x-sea":{"source":"nginx","extensions":["sea"]},"application/x-sh":{"source":"apache","compressible":true,"extensions":["sh"]},"application/x-shar":{"source":"apache","extensions":["shar"]},"application/x-shockwave-flash":{"source":"apache","compressible":false,"extensions":["swf"]},"application/x-silverlight-app":{"source":"apache","extensions":["xap"]},"application/x-sql":{"source":"apache","extensions":["sql"]},"application/x-stuffit":{"source":"apache","compressible":false,"extensions":["sit"]},"application/x-stuffitx":{"source":"apache","extensions":["sitx"]},"application/x-subrip":{"source":"apache","extensions":["srt"]},"application/x-sv4cpio":{"source":"apache","extensions":["sv4cpio"]},"application/x-sv4crc":{"source":"apache","extensions":["sv4crc"]},"application/x-t3vm-image":{"source":"apache","extensions":["t3"]},"application/x-tads":{"source":"apache","extensions":["gam"]},"application/x-tar":{"source":"apache","compressible":true,"extensions":["tar"]},"application/x-tcl":{"source":"apache","extensions":["tcl","tk"]},"application/x-tex":{"source":"apache","extensions":["tex"]},"application/x-tex-tfm":{"source":"apache","extensions":["tfm"]},"application/x-texinfo":{"source":"apache","extensions":["texinfo","texi"]},"application/x-tgif":{"source":"apache","extensions":["obj"]},"application/x-ustar":{"source":"apache","extensions":["ustar"]},"application/x-virtualbox-hdd":{"compressible":true,"extensions":["hdd"]},"application/x-virtualbox-ova":{"compressible":true,"extensions":["ova"]},"application/x-virtualbox-ovf":{"compressible":true,"extensions":["ovf"]},"application/x-virtualbox-vbox":{"compressible":true,"extensions":["vbox"]},"application/x-virtualbox-vbox-extpack":{"compressible":false,"extensions":["vbox-extpack"]},"application/x-virtualbox-vdi":{"compressible":true,"extensions":["vdi"]},"application/x-virtualbox-vhd":{"compressible":true,"extensions":["vhd"]},"application/x-virtualbox-vmdk":{"compressible":true,"extensions":["vmdk"]},"application/x-wais-source":{"source":"apache","extensions":["src"]},"application/x-web-app-manifest+json":{"compressible":true,"extensions":["webapp"]},"application/x-www-form-urlencoded":{"source":"iana","compressible":true},"application/x-x509-ca-cert":{"source":"iana","extensions":["der","crt","pem"]},"application/x-x509-ca-ra-cert":{"source":"iana"},"application/x-x509-next-ca-cert":{"source":"iana"},"application/x-xfig":{"source":"apache","extensions":["fig"]},"application/x-xliff+xml":{"source":"apache","compressible":true,"extensions":["xlf"]},"application/x-xpinstall":{"source":"apache","compressible":false,"extensions":["xpi"]},"application/x-xz":{"source":"apache","extensions":["xz"]},"application/x-zmachine":{"source":"apache","extensions":["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{"source":"iana"},"application/xacml+xml":{"source":"iana","compressible":true},"application/xaml+xml":{"source":"apache","compressible":true,"extensions":["xaml"]},"application/xcap-att+xml":{"source":"iana","compressible":true,"extensions":["xav"]},"application/xcap-caps+xml":{"source":"iana","compressible":true,"extensions":["xca"]},"application/xcap-diff+xml":{"source":"iana","compressible":true,"extensions":["xdf"]},"application/xcap-el+xml":{"source":"iana","compressible":true,"extensions":["xel"]},"application/xcap-error+xml":{"source":"iana","compressible":true},"application/xcap-ns+xml":{"source":"iana","compressible":true,"extensions":["xns"]},"application/xcon-conference-info+xml":{"source":"iana","compressible":true},"application/xcon-conference-info-diff+xml":{"source":"iana","compressible":true},"application/xenc+xml":{"source":"iana","compressible":true,"extensions":["xenc"]},"application/xhtml+xml":{"source":"iana","compressible":true,"extensions":["xhtml","xht"]},"application/xhtml-voice+xml":{"source":"apache","compressible":true},"application/xliff+xml":{"source":"iana","compressible":true,"extensions":["xlf"]},"application/xml":{"source":"iana","compressible":true,"extensions":["xml","xsl","xsd","rng"]},"application/xml-dtd":{"source":"iana","compressible":true,"extensions":["dtd"]},"application/xml-external-parsed-entity":{"source":"iana"},"application/xml-patch+xml":{"source":"iana","compressible":true},"application/xmpp+xml":{"source":"iana","compressible":true},"application/xop+xml":{"source":"iana","compressible":true,"extensions":["xop"]},"application/xproc+xml":{"source":"apache","compressible":true,"extensions":["xpl"]},"application/xslt+xml":{"source":"iana","compressible":true,"extensions":["xsl","xslt"]},"application/xspf+xml":{"source":"apache","compressible":true,"extensions":["xspf"]},"application/xv+xml":{"source":"iana","compressible":true,"extensions":["mxml","xhvml","xvml","xvm"]},"application/yang":{"source":"iana","extensions":["yang"]},"application/yang-data+json":{"source":"iana","compressible":true},"application/yang-data+xml":{"source":"iana","compressible":true},"application/yang-patch+json":{"source":"iana","compressible":true},"application/yang-patch+xml":{"source":"iana","compressible":true},"application/yin+xml":{"source":"iana","compressible":true,"extensions":["yin"]},"application/zip":{"source":"iana","compressible":false,"extensions":["zip"]},"application/zlib":{"source":"iana"},"application/zstd":{"source":"iana"},"audio/1d-interleaved-parityfec":{"source":"iana"},"audio/32kadpcm":{"source":"iana"},"audio/3gpp":{"source":"iana","compressible":false,"extensions":["3gpp"]},"audio/3gpp2":{"source":"iana"},"audio/aac":{"source":"iana"},"audio/ac3":{"source":"iana"},"audio/adpcm":{"source":"apache","extensions":["adp"]},"audio/amr":{"source":"iana","extensions":["amr"]},"audio/amr-wb":{"source":"iana"},"audio/amr-wb+":{"source":"iana"},"audio/aptx":{"source":"iana"},"audio/asc":{"source":"iana"},"audio/atrac-advanced-lossless":{"source":"iana"},"audio/atrac-x":{"source":"iana"},"audio/atrac3":{"source":"iana"},"audio/basic":{"source":"iana","compressible":false,"extensions":["au","snd"]},"audio/bv16":{"source":"iana"},"audio/bv32":{"source":"iana"},"audio/clearmode":{"source":"iana"},"audio/cn":{"source":"iana"},"audio/dat12":{"source":"iana"},"audio/dls":{"source":"iana"},"audio/dsr-es201108":{"source":"iana"},"audio/dsr-es202050":{"source":"iana"},"audio/dsr-es202211":{"source":"iana"},"audio/dsr-es202212":{"source":"iana"},"audio/dv":{"source":"iana"},"audio/dvi4":{"source":"iana"},"audio/eac3":{"source":"iana"},"audio/encaprtp":{"source":"iana"},"audio/evrc":{"source":"iana"},"audio/evrc-qcp":{"source":"iana"},"audio/evrc0":{"source":"iana"},"audio/evrc1":{"source":"iana"},"audio/evrcb":{"source":"iana"},"audio/evrcb0":{"source":"iana"},"audio/evrcb1":{"source":"iana"},"audio/evrcnw":{"source":"iana"},"audio/evrcnw0":{"source":"iana"},"audio/evrcnw1":{"source":"iana"},"audio/evrcwb":{"source":"iana"},"audio/evrcwb0":{"source":"iana"},"audio/evrcwb1":{"source":"iana"},"audio/evs":{"source":"iana"},"audio/flexfec":{"source":"iana"},"audio/fwdred":{"source":"iana"},"audio/g711-0":{"source":"iana"},"audio/g719":{"source":"iana"},"audio/g722":{"source":"iana"},"audio/g7221":{"source":"iana"},"audio/g723":{"source":"iana"},"audio/g726-16":{"source":"iana"},"audio/g726-24":{"source":"iana"},"audio/g726-32":{"source":"iana"},"audio/g726-40":{"source":"iana"},"audio/g728":{"source":"iana"},"audio/g729":{"source":"iana"},"audio/g7291":{"source":"iana"},"audio/g729d":{"source":"iana"},"audio/g729e":{"source":"iana"},"audio/gsm":{"source":"iana"},"audio/gsm-efr":{"source":"iana"},"audio/gsm-hr-08":{"source":"iana"},"audio/ilbc":{"source":"iana"},"audio/ip-mr_v2.5":{"source":"iana"},"audio/isac":{"source":"apache"},"audio/l16":{"source":"iana"},"audio/l20":{"source":"iana"},"audio/l24":{"source":"iana","compressible":false},"audio/l8":{"source":"iana"},"audio/lpc":{"source":"iana"},"audio/melp":{"source":"iana"},"audio/melp1200":{"source":"iana"},"audio/melp2400":{"source":"iana"},"audio/melp600":{"source":"iana"},"audio/mhas":{"source":"iana"},"audio/midi":{"source":"apache","extensions":["mid","midi","kar","rmi"]},"audio/mobile-xmf":{"source":"iana","extensions":["mxmf"]},"audio/mp3":{"compressible":false,"extensions":["mp3"]},"audio/mp4":{"source":"iana","compressible":false,"extensions":["m4a","mp4a"]},"audio/mp4a-latm":{"source":"iana"},"audio/mpa":{"source":"iana"},"audio/mpa-robust":{"source":"iana"},"audio/mpeg":{"source":"iana","compressible":false,"extensions":["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{"source":"iana"},"audio/musepack":{"source":"apache"},"audio/ogg":{"source":"iana","compressible":false,"extensions":["oga","ogg","spx","opus"]},"audio/opus":{"source":"iana"},"audio/parityfec":{"source":"iana"},"audio/pcma":{"source":"iana"},"audio/pcma-wb":{"source":"iana"},"audio/pcmu":{"source":"iana"},"audio/pcmu-wb":{"source":"iana"},"audio/prs.sid":{"source":"iana"},"audio/qcelp":{"source":"iana"},"audio/raptorfec":{"source":"iana"},"audio/red":{"source":"iana"},"audio/rtp-enc-aescm128":{"source":"iana"},"audio/rtp-midi":{"source":"iana"},"audio/rtploopback":{"source":"iana"},"audio/rtx":{"source":"iana"},"audio/s3m":{"source":"apache","extensions":["s3m"]},"audio/scip":{"source":"iana"},"audio/silk":{"source":"apache","extensions":["sil"]},"audio/smv":{"source":"iana"},"audio/smv-qcp":{"source":"iana"},"audio/smv0":{"source":"iana"},"audio/sofa":{"source":"iana"},"audio/sp-midi":{"source":"iana"},"audio/speex":{"source":"iana"},"audio/t140c":{"source":"iana"},"audio/t38":{"source":"iana"},"audio/telephone-event":{"source":"iana"},"audio/tetra_acelp":{"source":"iana"},"audio/tetra_acelp_bb":{"source":"iana"},"audio/tone":{"source":"iana"},"audio/tsvcis":{"source":"iana"},"audio/uemclip":{"source":"iana"},"audio/ulpfec":{"source":"iana"},"audio/usac":{"source":"iana"},"audio/vdvi":{"source":"iana"},"audio/vmr-wb":{"source":"iana"},"audio/vnd.3gpp.iufp":{"source":"iana"},"audio/vnd.4sb":{"source":"iana"},"audio/vnd.audiokoz":{"source":"iana"},"audio/vnd.celp":{"source":"iana"},"audio/vnd.cisco.nse":{"source":"iana"},"audio/vnd.cmles.radio-events":{"source":"iana"},"audio/vnd.cns.anp1":{"source":"iana"},"audio/vnd.cns.inf1":{"source":"iana"},"audio/vnd.dece.audio":{"source":"iana","extensions":["uva","uvva"]},"audio/vnd.digital-winds":{"source":"iana","extensions":["eol"]},"audio/vnd.dlna.adts":{"source":"iana"},"audio/vnd.dolby.heaac.1":{"source":"iana"},"audio/vnd.dolby.heaac.2":{"source":"iana"},"audio/vnd.dolby.mlp":{"source":"iana"},"audio/vnd.dolby.mps":{"source":"iana"},"audio/vnd.dolby.pl2":{"source":"iana"},"audio/vnd.dolby.pl2x":{"source":"iana"},"audio/vnd.dolby.pl2z":{"source":"iana"},"audio/vnd.dolby.pulse.1":{"source":"iana"},"audio/vnd.dra":{"source":"iana","extensions":["dra"]},"audio/vnd.dts":{"source":"iana","extensions":["dts"]},"audio/vnd.dts.hd":{"source":"iana","extensions":["dtshd"]},"audio/vnd.dts.uhd":{"source":"iana"},"audio/vnd.dvb.file":{"source":"iana"},"audio/vnd.everad.plj":{"source":"iana"},"audio/vnd.hns.audio":{"source":"iana"},"audio/vnd.lucent.voice":{"source":"iana","extensions":["lvp"]},"audio/vnd.ms-playready.media.pya":{"source":"iana","extensions":["pya"]},"audio/vnd.nokia.mobile-xmf":{"source":"iana"},"audio/vnd.nortel.vbk":{"source":"iana"},"audio/vnd.nuera.ecelp4800":{"source":"iana","extensions":["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{"source":"iana","extensions":["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{"source":"iana","extensions":["ecelp9600"]},"audio/vnd.octel.sbc":{"source":"iana"},"audio/vnd.presonus.multitrack":{"source":"iana"},"audio/vnd.qcelp":{"source":"iana"},"audio/vnd.rhetorex.32kadpcm":{"source":"iana"},"audio/vnd.rip":{"source":"iana","extensions":["rip"]},"audio/vnd.rn-realaudio":{"compressible":false},"audio/vnd.sealedmedia.softseal.mpeg":{"source":"iana"},"audio/vnd.vmx.cvsd":{"source":"iana"},"audio/vnd.wave":{"compressible":false},"audio/vorbis":{"source":"iana","compressible":false},"audio/vorbis-config":{"source":"iana"},"audio/wav":{"compressible":false,"extensions":["wav"]},"audio/wave":{"compressible":false,"extensions":["wav"]},"audio/webm":{"source":"apache","compressible":false,"extensions":["weba"]},"audio/x-aac":{"source":"apache","compressible":false,"extensions":["aac"]},"audio/x-aiff":{"source":"apache","extensions":["aif","aiff","aifc"]},"audio/x-caf":{"source":"apache","compressible":false,"extensions":["caf"]},"audio/x-flac":{"source":"apache","extensions":["flac"]},"audio/x-m4a":{"source":"nginx","extensions":["m4a"]},"audio/x-matroska":{"source":"apache","extensions":["mka"]},"audio/x-mpegurl":{"source":"apache","extensions":["m3u"]},"audio/x-ms-wax":{"source":"apache","extensions":["wax"]},"audio/x-ms-wma":{"source":"apache","extensions":["wma"]},"audio/x-pn-realaudio":{"source":"apache","extensions":["ram","ra"]},"audio/x-pn-realaudio-plugin":{"source":"apache","extensions":["rmp"]},"audio/x-realaudio":{"source":"nginx","extensions":["ra"]},"audio/x-tta":{"source":"apache"},"audio/x-wav":{"source":"apache","extensions":["wav"]},"audio/xm":{"source":"apache","extensions":["xm"]},"chemical/x-cdx":{"source":"apache","extensions":["cdx"]},"chemical/x-cif":{"source":"apache","extensions":["cif"]},"chemical/x-cmdf":{"source":"apache","extensions":["cmdf"]},"chemical/x-cml":{"source":"apache","extensions":["cml"]},"chemical/x-csml":{"source":"apache","extensions":["csml"]},"chemical/x-pdb":{"source":"apache"},"chemical/x-xyz":{"source":"apache","extensions":["xyz"]},"font/collection":{"source":"iana","extensions":["ttc"]},"font/otf":{"source":"iana","compressible":true,"extensions":["otf"]},"font/sfnt":{"source":"iana"},"font/ttf":{"source":"iana","compressible":true,"extensions":["ttf"]},"font/woff":{"source":"iana","extensions":["woff"]},"font/woff2":{"source":"iana","extensions":["woff2"]},"image/aces":{"source":"iana","extensions":["exr"]},"image/apng":{"compressible":false,"extensions":["apng"]},"image/avci":{"source":"iana","extensions":["avci"]},"image/avcs":{"source":"iana","extensions":["avcs"]},"image/avif":{"source":"iana","compressible":false,"extensions":["avif"]},"image/bmp":{"source":"iana","compressible":true,"extensions":["bmp"]},"image/cgm":{"source":"iana","extensions":["cgm"]},"image/dicom-rle":{"source":"iana","extensions":["drle"]},"image/emf":{"source":"iana","extensions":["emf"]},"image/fits":{"source":"iana","extensions":["fits"]},"image/g3fax":{"source":"iana","extensions":["g3"]},"image/gif":{"source":"iana","compressible":false,"extensions":["gif"]},"image/heic":{"source":"iana","extensions":["heic"]},"image/heic-sequence":{"source":"iana","extensions":["heics"]},"image/heif":{"source":"iana","extensions":["heif"]},"image/heif-sequence":{"source":"iana","extensions":["heifs"]},"image/hej2k":{"source":"iana","extensions":["hej2"]},"image/hsj2":{"source":"iana","extensions":["hsj2"]},"image/ief":{"source":"iana","extensions":["ief"]},"image/jls":{"source":"iana","extensions":["jls"]},"image/jp2":{"source":"iana","compressible":false,"extensions":["jp2","jpg2"]},"image/jpeg":{"source":"iana","compressible":false,"extensions":["jpeg","jpg","jpe"]},"image/jph":{"source":"iana","extensions":["jph"]},"image/jphc":{"source":"iana","extensions":["jhc"]},"image/jpm":{"source":"iana","compressible":false,"extensions":["jpm"]},"image/jpx":{"source":"iana","compressible":false,"extensions":["jpx","jpf"]},"image/jxr":{"source":"iana","extensions":["jxr"]},"image/jxra":{"source":"iana","extensions":["jxra"]},"image/jxrs":{"source":"iana","extensions":["jxrs"]},"image/jxs":{"source":"iana","extensions":["jxs"]},"image/jxsc":{"source":"iana","extensions":["jxsc"]},"image/jxsi":{"source":"iana","extensions":["jxsi"]},"image/jxss":{"source":"iana","extensions":["jxss"]},"image/ktx":{"source":"iana","extensions":["ktx"]},"image/ktx2":{"source":"iana","extensions":["ktx2"]},"image/naplps":{"source":"iana"},"image/pjpeg":{"compressible":false},"image/png":{"source":"iana","compressible":false,"extensions":["png"]},"image/prs.btif":{"source":"iana","extensions":["btif"]},"image/prs.pti":{"source":"iana","extensions":["pti"]},"image/pwg-raster":{"source":"iana"},"image/sgi":{"source":"apache","extensions":["sgi"]},"image/svg+xml":{"source":"iana","compressible":true,"extensions":["svg","svgz"]},"image/t38":{"source":"iana","extensions":["t38"]},"image/tiff":{"source":"iana","compressible":false,"extensions":["tif","tiff"]},"image/tiff-fx":{"source":"iana","extensions":["tfx"]},"image/vnd.adobe.photoshop":{"source":"iana","compressible":true,"extensions":["psd"]},"image/vnd.airzip.accelerator.azv":{"source":"iana","extensions":["azv"]},"image/vnd.cns.inf2":{"source":"iana"},"image/vnd.dece.graphic":{"source":"iana","extensions":["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{"source":"iana","extensions":["djvu","djv"]},"image/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"image/vnd.dwg":{"source":"iana","extensions":["dwg"]},"image/vnd.dxf":{"source":"iana","extensions":["dxf"]},"image/vnd.fastbidsheet":{"source":"iana","extensions":["fbs"]},"image/vnd.fpx":{"source":"iana","extensions":["fpx"]},"image/vnd.fst":{"source":"iana","extensions":["fst"]},"image/vnd.fujixerox.edmics-mmr":{"source":"iana","extensions":["mmr"]},"image/vnd.fujixerox.edmics-rlc":{"source":"iana","extensions":["rlc"]},"image/vnd.globalgraphics.pgb":{"source":"iana"},"image/vnd.microsoft.icon":{"source":"iana","compressible":true,"extensions":["ico"]},"image/vnd.mix":{"source":"iana"},"image/vnd.mozilla.apng":{"source":"iana"},"image/vnd.ms-dds":{"compressible":true,"extensions":["dds"]},"image/vnd.ms-modi":{"source":"iana","extensions":["mdi"]},"image/vnd.ms-photo":{"source":"apache","extensions":["wdp"]},"image/vnd.net-fpx":{"source":"iana","extensions":["npx"]},"image/vnd.pco.b16":{"source":"iana","extensions":["b16"]},"image/vnd.radiance":{"source":"iana"},"image/vnd.sealed.png":{"source":"iana"},"image/vnd.sealedmedia.softseal.gif":{"source":"iana"},"image/vnd.sealedmedia.softseal.jpg":{"source":"iana"},"image/vnd.svf":{"source":"iana"},"image/vnd.tencent.tap":{"source":"iana","extensions":["tap"]},"image/vnd.valve.source.texture":{"source":"iana","extensions":["vtf"]},"image/vnd.wap.wbmp":{"source":"iana","extensions":["wbmp"]},"image/vnd.xiff":{"source":"iana","extensions":["xif"]},"image/vnd.zbrush.pcx":{"source":"iana","extensions":["pcx"]},"image/webp":{"source":"apache","extensions":["webp"]},"image/wmf":{"source":"iana","extensions":["wmf"]},"image/x-3ds":{"source":"apache","extensions":["3ds"]},"image/x-cmu-raster":{"source":"apache","extensions":["ras"]},"image/x-cmx":{"source":"apache","extensions":["cmx"]},"image/x-freehand":{"source":"apache","extensions":["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{"source":"apache","compressible":true,"extensions":["ico"]},"image/x-jng":{"source":"nginx","extensions":["jng"]},"image/x-mrsid-image":{"source":"apache","extensions":["sid"]},"image/x-ms-bmp":{"source":"nginx","compressible":true,"extensions":["bmp"]},"image/x-pcx":{"source":"apache","extensions":["pcx"]},"image/x-pict":{"source":"apache","extensions":["pic","pct"]},"image/x-portable-anymap":{"source":"apache","extensions":["pnm"]},"image/x-portable-bitmap":{"source":"apache","extensions":["pbm"]},"image/x-portable-graymap":{"source":"apache","extensions":["pgm"]},"image/x-portable-pixmap":{"source":"apache","extensions":["ppm"]},"image/x-rgb":{"source":"apache","extensions":["rgb"]},"image/x-tga":{"source":"apache","extensions":["tga"]},"image/x-xbitmap":{"source":"apache","extensions":["xbm"]},"image/x-xcf":{"compressible":false},"image/x-xpixmap":{"source":"apache","extensions":["xpm"]},"image/x-xwindowdump":{"source":"apache","extensions":["xwd"]},"message/cpim":{"source":"iana"},"message/delivery-status":{"source":"iana"},"message/disposition-notification":{"source":"iana","extensions":["disposition-notification"]},"message/external-body":{"source":"iana"},"message/feedback-report":{"source":"iana"},"message/global":{"source":"iana","extensions":["u8msg"]},"message/global-delivery-status":{"source":"iana","extensions":["u8dsn"]},"message/global-disposition-notification":{"source":"iana","extensions":["u8mdn"]},"message/global-headers":{"source":"iana","extensions":["u8hdr"]},"message/http":{"source":"iana","compressible":false},"message/imdn+xml":{"source":"iana","compressible":true},"message/news":{"source":"iana"},"message/partial":{"source":"iana","compressible":false},"message/rfc822":{"source":"iana","compressible":true,"extensions":["eml","mime"]},"message/s-http":{"source":"iana"},"message/sip":{"source":"iana"},"message/sipfrag":{"source":"iana"},"message/tracking-status":{"source":"iana"},"message/vnd.si.simp":{"source":"iana"},"message/vnd.wfa.wsc":{"source":"iana","extensions":["wsc"]},"model/3mf":{"source":"iana","extensions":["3mf"]},"model/e57":{"source":"iana"},"model/gltf+json":{"source":"iana","compressible":true,"extensions":["gltf"]},"model/gltf-binary":{"source":"iana","compressible":true,"extensions":["glb"]},"model/iges":{"source":"iana","compressible":false,"extensions":["igs","iges"]},"model/mesh":{"source":"iana","compressible":false,"extensions":["msh","mesh","silo"]},"model/mtl":{"source":"iana","extensions":["mtl"]},"model/obj":{"source":"iana","extensions":["obj"]},"model/step":{"source":"iana"},"model/step+xml":{"source":"iana","compressible":true,"extensions":["stpx"]},"model/step+zip":{"source":"iana","compressible":false,"extensions":["stpz"]},"model/step-xml+zip":{"source":"iana","compressible":false,"extensions":["stpxz"]},"model/stl":{"source":"iana","extensions":["stl"]},"model/vnd.collada+xml":{"source":"iana","compressible":true,"extensions":["dae"]},"model/vnd.dwf":{"source":"iana","extensions":["dwf"]},"model/vnd.flatland.3dml":{"source":"iana"},"model/vnd.gdl":{"source":"iana","extensions":["gdl"]},"model/vnd.gs-gdl":{"source":"apache"},"model/vnd.gs.gdl":{"source":"iana"},"model/vnd.gtw":{"source":"iana","extensions":["gtw"]},"model/vnd.moml+xml":{"source":"iana","compressible":true},"model/vnd.mts":{"source":"iana","extensions":["mts"]},"model/vnd.opengex":{"source":"iana","extensions":["ogex"]},"model/vnd.parasolid.transmit.binary":{"source":"iana","extensions":["x_b"]},"model/vnd.parasolid.transmit.text":{"source":"iana","extensions":["x_t"]},"model/vnd.pytha.pyox":{"source":"iana"},"model/vnd.rosette.annotated-data-model":{"source":"iana"},"model/vnd.sap.vds":{"source":"iana","extensions":["vds"]},"model/vnd.usdz+zip":{"source":"iana","compressible":false,"extensions":["usdz"]},"model/vnd.valve.source.compiled-map":{"source":"iana","extensions":["bsp"]},"model/vnd.vtu":{"source":"iana","extensions":["vtu"]},"model/vrml":{"source":"iana","compressible":false,"extensions":["wrl","vrml"]},"model/x3d+binary":{"source":"apache","compressible":false,"extensions":["x3db","x3dbz"]},"model/x3d+fastinfoset":{"source":"iana","extensions":["x3db"]},"model/x3d+vrml":{"source":"apache","compressible":false,"extensions":["x3dv","x3dvz"]},"model/x3d+xml":{"source":"iana","compressible":true,"extensions":["x3d","x3dz"]},"model/x3d-vrml":{"source":"iana","extensions":["x3dv"]},"multipart/alternative":{"source":"iana","compressible":false},"multipart/appledouble":{"source":"iana"},"multipart/byteranges":{"source":"iana"},"multipart/digest":{"source":"iana"},"multipart/encrypted":{"source":"iana","compressible":false},"multipart/form-data":{"source":"iana","compressible":false},"multipart/header-set":{"source":"iana"},"multipart/mixed":{"source":"iana"},"multipart/multilingual":{"source":"iana"},"multipart/parallel":{"source":"iana"},"multipart/related":{"source":"iana","compressible":false},"multipart/report":{"source":"iana"},"multipart/signed":{"source":"iana","compressible":false},"multipart/vnd.bint.med-plus":{"source":"iana"},"multipart/voice-message":{"source":"iana"},"multipart/x-mixed-replace":{"source":"iana"},"text/1d-interleaved-parityfec":{"source":"iana"},"text/cache-manifest":{"source":"iana","compressible":true,"extensions":["appcache","manifest"]},"text/calendar":{"source":"iana","extensions":["ics","ifb"]},"text/calender":{"compressible":true},"text/cmd":{"compressible":true},"text/coffeescript":{"extensions":["coffee","litcoffee"]},"text/cql":{"source":"iana"},"text/cql-expression":{"source":"iana"},"text/cql-identifier":{"source":"iana"},"text/css":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["css"]},"text/csv":{"source":"iana","compressible":true,"extensions":["csv"]},"text/csv-schema":{"source":"iana"},"text/directory":{"source":"iana"},"text/dns":{"source":"iana"},"text/ecmascript":{"source":"iana"},"text/encaprtp":{"source":"iana"},"text/enriched":{"source":"iana"},"text/fhirpath":{"source":"iana"},"text/flexfec":{"source":"iana"},"text/fwdred":{"source":"iana"},"text/gff3":{"source":"iana"},"text/grammar-ref-list":{"source":"iana"},"text/html":{"source":"iana","compressible":true,"extensions":["html","htm","shtml"]},"text/jade":{"extensions":["jade"]},"text/javascript":{"source":"iana","compressible":true},"text/jcr-cnd":{"source":"iana"},"text/jsx":{"compressible":true,"extensions":["jsx"]},"text/less":{"compressible":true,"extensions":["less"]},"text/markdown":{"source":"iana","compressible":true,"extensions":["markdown","md"]},"text/mathml":{"source":"nginx","extensions":["mml"]},"text/mdx":{"compressible":true,"extensions":["mdx"]},"text/mizar":{"source":"iana"},"text/n3":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["n3"]},"text/parameters":{"source":"iana","charset":"UTF-8"},"text/parityfec":{"source":"iana"},"text/plain":{"source":"iana","compressible":true,"extensions":["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{"source":"iana","charset":"UTF-8"},"text/prs.fallenstein.rst":{"source":"iana"},"text/prs.lines.tag":{"source":"iana","extensions":["dsc"]},"text/prs.prop.logic":{"source":"iana"},"text/raptorfec":{"source":"iana"},"text/red":{"source":"iana"},"text/rfc822-headers":{"source":"iana"},"text/richtext":{"source":"iana","compressible":true,"extensions":["rtx"]},"text/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"text/rtp-enc-aescm128":{"source":"iana"},"text/rtploopback":{"source":"iana"},"text/rtx":{"source":"iana"},"text/sgml":{"source":"iana","extensions":["sgml","sgm"]},"text/shaclc":{"source":"iana"},"text/shex":{"source":"iana","extensions":["shex"]},"text/slim":{"extensions":["slim","slm"]},"text/spdx":{"source":"iana","extensions":["spdx"]},"text/strings":{"source":"iana"},"text/stylus":{"extensions":["stylus","styl"]},"text/t140":{"source":"iana"},"text/tab-separated-values":{"source":"iana","compressible":true,"extensions":["tsv"]},"text/troff":{"source":"iana","extensions":["t","tr","roff","man","me","ms"]},"text/turtle":{"source":"iana","charset":"UTF-8","extensions":["ttl"]},"text/ulpfec":{"source":"iana"},"text/uri-list":{"source":"iana","compressible":true,"extensions":["uri","uris","urls"]},"text/vcard":{"source":"iana","compressible":true,"extensions":["vcard"]},"text/vnd.a":{"source":"iana"},"text/vnd.abc":{"source":"iana"},"text/vnd.ascii-art":{"source":"iana"},"text/vnd.curl":{"source":"iana","extensions":["curl"]},"text/vnd.curl.dcurl":{"source":"apache","extensions":["dcurl"]},"text/vnd.curl.mcurl":{"source":"apache","extensions":["mcurl"]},"text/vnd.curl.scurl":{"source":"apache","extensions":["scurl"]},"text/vnd.debian.copyright":{"source":"iana","charset":"UTF-8"},"text/vnd.dmclientscript":{"source":"iana"},"text/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"text/vnd.esmertec.theme-descriptor":{"source":"iana","charset":"UTF-8"},"text/vnd.familysearch.gedcom":{"source":"iana","extensions":["ged"]},"text/vnd.ficlab.flt":{"source":"iana"},"text/vnd.fly":{"source":"iana","extensions":["fly"]},"text/vnd.fmi.flexstor":{"source":"iana","extensions":["flx"]},"text/vnd.gml":{"source":"iana"},"text/vnd.graphviz":{"source":"iana","extensions":["gv"]},"text/vnd.hans":{"source":"iana"},"text/vnd.hgl":{"source":"iana"},"text/vnd.in3d.3dml":{"source":"iana","extensions":["3dml"]},"text/vnd.in3d.spot":{"source":"iana","extensions":["spot"]},"text/vnd.iptc.newsml":{"source":"iana"},"text/vnd.iptc.nitf":{"source":"iana"},"text/vnd.latex-z":{"source":"iana"},"text/vnd.motorola.reflex":{"source":"iana"},"text/vnd.ms-mediapackage":{"source":"iana"},"text/vnd.net2phone.commcenter.command":{"source":"iana"},"text/vnd.radisys.msml-basic-layout":{"source":"iana"},"text/vnd.senx.warpscript":{"source":"iana"},"text/vnd.si.uricatalogue":{"source":"iana"},"text/vnd.sosi":{"source":"iana"},"text/vnd.sun.j2me.app-descriptor":{"source":"iana","charset":"UTF-8","extensions":["jad"]},"text/vnd.trolltech.linguist":{"source":"iana","charset":"UTF-8"},"text/vnd.wap.si":{"source":"iana"},"text/vnd.wap.sl":{"source":"iana"},"text/vnd.wap.wml":{"source":"iana","extensions":["wml"]},"text/vnd.wap.wmlscript":{"source":"iana","extensions":["wmls"]},"text/vtt":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["vtt"]},"text/x-asm":{"source":"apache","extensions":["s","asm"]},"text/x-c":{"source":"apache","extensions":["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{"source":"nginx","extensions":["htc"]},"text/x-fortran":{"source":"apache","extensions":["f","for","f77","f90"]},"text/x-gwt-rpc":{"compressible":true},"text/x-handlebars-template":{"extensions":["hbs"]},"text/x-java-source":{"source":"apache","extensions":["java"]},"text/x-jquery-tmpl":{"compressible":true},"text/x-lua":{"extensions":["lua"]},"text/x-markdown":{"compressible":true,"extensions":["mkd"]},"text/x-nfo":{"source":"apache","extensions":["nfo"]},"text/x-opml":{"source":"apache","extensions":["opml"]},"text/x-org":{"compressible":true,"extensions":["org"]},"text/x-pascal":{"source":"apache","extensions":["p","pas"]},"text/x-processing":{"compressible":true,"extensions":["pde"]},"text/x-sass":{"extensions":["sass"]},"text/x-scss":{"extensions":["scss"]},"text/x-setext":{"source":"apache","extensions":["etx"]},"text/x-sfv":{"source":"apache","extensions":["sfv"]},"text/x-suse-ymp":{"compressible":true,"extensions":["ymp"]},"text/x-uuencode":{"source":"apache","extensions":["uu"]},"text/x-vcalendar":{"source":"apache","extensions":["vcs"]},"text/x-vcard":{"source":"apache","extensions":["vcf"]},"text/xml":{"source":"iana","compressible":true,"extensions":["xml"]},"text/xml-external-parsed-entity":{"source":"iana"},"text/yaml":{"compressible":true,"extensions":["yaml","yml"]},"video/1d-interleaved-parityfec":{"source":"iana"},"video/3gpp":{"source":"iana","extensions":["3gp","3gpp"]},"video/3gpp-tt":{"source":"iana"},"video/3gpp2":{"source":"iana","extensions":["3g2"]},"video/av1":{"source":"iana"},"video/bmpeg":{"source":"iana"},"video/bt656":{"source":"iana"},"video/celb":{"source":"iana"},"video/dv":{"source":"iana"},"video/encaprtp":{"source":"iana"},"video/ffv1":{"source":"iana"},"video/flexfec":{"source":"iana"},"video/h261":{"source":"iana","extensions":["h261"]},"video/h263":{"source":"iana","extensions":["h263"]},"video/h263-1998":{"source":"iana"},"video/h263-2000":{"source":"iana"},"video/h264":{"source":"iana","extensions":["h264"]},"video/h264-rcdo":{"source":"iana"},"video/h264-svc":{"source":"iana"},"video/h265":{"source":"iana"},"video/iso.segment":{"source":"iana","extensions":["m4s"]},"video/jpeg":{"source":"iana","extensions":["jpgv"]},"video/jpeg2000":{"source":"iana"},"video/jpm":{"source":"apache","extensions":["jpm","jpgm"]},"video/jxsv":{"source":"iana"},"video/mj2":{"source":"iana","extensions":["mj2","mjp2"]},"video/mp1s":{"source":"iana"},"video/mp2p":{"source":"iana"},"video/mp2t":{"source":"iana","extensions":["ts"]},"video/mp4":{"source":"iana","compressible":false,"extensions":["mp4","mp4v","mpg4"]},"video/mp4v-es":{"source":"iana"},"video/mpeg":{"source":"iana","compressible":false,"extensions":["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{"source":"iana"},"video/mpv":{"source":"iana"},"video/nv":{"source":"iana"},"video/ogg":{"source":"iana","compressible":false,"extensions":["ogv"]},"video/parityfec":{"source":"iana"},"video/pointer":{"source":"iana"},"video/quicktime":{"source":"iana","compressible":false,"extensions":["qt","mov"]},"video/raptorfec":{"source":"iana"},"video/raw":{"source":"iana"},"video/rtp-enc-aescm128":{"source":"iana"},"video/rtploopback":{"source":"iana"},"video/rtx":{"source":"iana"},"video/scip":{"source":"iana"},"video/smpte291":{"source":"iana"},"video/smpte292m":{"source":"iana"},"video/ulpfec":{"source":"iana"},"video/vc1":{"source":"iana"},"video/vc2":{"source":"iana"},"video/vnd.cctv":{"source":"iana"},"video/vnd.dece.hd":{"source":"iana","extensions":["uvh","uvvh"]},"video/vnd.dece.mobile":{"source":"iana","extensions":["uvm","uvvm"]},"video/vnd.dece.mp4":{"source":"iana"},"video/vnd.dece.pd":{"source":"iana","extensions":["uvp","uvvp"]},"video/vnd.dece.sd":{"source":"iana","extensions":["uvs","uvvs"]},"video/vnd.dece.video":{"source":"iana","extensions":["uvv","uvvv"]},"video/vnd.directv.mpeg":{"source":"iana"},"video/vnd.directv.mpeg-tts":{"source":"iana"},"video/vnd.dlna.mpeg-tts":{"source":"iana"},"video/vnd.dvb.file":{"source":"iana","extensions":["dvb"]},"video/vnd.fvt":{"source":"iana","extensions":["fvt"]},"video/vnd.hns.video":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.ttsavc":{"source":"iana"},"video/vnd.iptvforum.ttsmpeg2":{"source":"iana"},"video/vnd.motorola.video":{"source":"iana"},"video/vnd.motorola.videop":{"source":"iana"},"video/vnd.mpegurl":{"source":"iana","extensions":["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{"source":"iana","extensions":["pyv"]},"video/vnd.nokia.interleaved-multimedia":{"source":"iana"},"video/vnd.nokia.mp4vr":{"source":"iana"},"video/vnd.nokia.videovoip":{"source":"iana"},"video/vnd.objectvideo":{"source":"iana"},"video/vnd.radgamettools.bink":{"source":"iana"},"video/vnd.radgamettools.smacker":{"source":"iana"},"video/vnd.sealed.mpeg1":{"source":"iana"},"video/vnd.sealed.mpeg4":{"source":"iana"},"video/vnd.sealed.swf":{"source":"iana"},"video/vnd.sealedmedia.softseal.mov":{"source":"iana"},"video/vnd.uvvu.mp4":{"source":"iana","extensions":["uvu","uvvu"]},"video/vnd.vivo":{"source":"iana","extensions":["viv"]},"video/vnd.youtube.yt":{"source":"iana"},"video/vp8":{"source":"iana"},"video/vp9":{"source":"iana"},"video/webm":{"source":"apache","compressible":false,"extensions":["webm"]},"video/x-f4v":{"source":"apache","extensions":["f4v"]},"video/x-fli":{"source":"apache","extensions":["fli"]},"video/x-flv":{"source":"apache","compressible":false,"extensions":["flv"]},"video/x-m4v":{"source":"apache","extensions":["m4v"]},"video/x-matroska":{"source":"apache","compressible":false,"extensions":["mkv","mk3d","mks"]},"video/x-mng":{"source":"apache","extensions":["mng"]},"video/x-ms-asf":{"source":"apache","extensions":["asf","asx"]},"video/x-ms-vob":{"source":"apache","extensions":["vob"]},"video/x-ms-wm":{"source":"apache","extensions":["wm"]},"video/x-ms-wmv":{"source":"apache","compressible":false,"extensions":["wmv"]},"video/x-ms-wmx":{"source":"apache","extensions":["wmx"]},"video/x-ms-wvx":{"source":"apache","extensions":["wvx"]},"video/x-msvideo":{"source":"apache","extensions":["avi"]},"video/x-sgi-movie":{"source":"apache","extensions":["movie"]},"video/x-smv":{"source":"apache","extensions":["smv"]},"x-conference/x-cooltalk":{"source":"apache","extensions":["ice"]},"x-shader/x-fragment":{"compressible":true},"x-shader/x-vertex":{"compressible":true}}');
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __nccwpck_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ id: moduleId,
|
|
/******/ loaded: false,
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ var threw = true;
|
|
/******/ try {
|
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
|
|
/******/ threw = false;
|
|
/******/ } finally {
|
|
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
/******/ }
|
|
/******/
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.loaded = true;
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/define property getters */
|
|
/******/ (() => {
|
|
/******/ // define getter functions for harmony exports
|
|
/******/ __nccwpck_require__.d = (exports, definition) => {
|
|
/******/ for(var key in definition) {
|
|
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __nccwpck_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/node module decorator */
|
|
/******/ (() => {
|
|
/******/ __nccwpck_require__.nmd = (module) => {
|
|
/******/ module.paths = [];
|
|
/******/ if (!module.children) module.children = [];
|
|
/******/ return module;
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/compat */
|
|
/******/
|
|
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
/******/
|
|
/************************************************************************/
|
|
var __webpack_exports__ = {};
|
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
(() => {
|
|
"use strict";
|
|
var exports = __webpack_exports__;
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
const saveImpl_1 = __nccwpck_require__(6589);
|
|
(0, saveImpl_1.saveRun)(true);
|
|
|
|
})();
|
|
|
|
module.exports = __webpack_exports__;
|
|
/******/ })()
|
|
; |