new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ConnectableObservable.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/ConnectableObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C;;;;;;GAMG;AACH,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAgBtC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAAE,SAAS,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAfpF,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IAC7C,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAChC,SAAS,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAAQ;IAElD;;;;;;;;;;OAUG;gBACgB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAY,cAAc,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAepF,SAAS,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC;IAQlC,SAAS,CAAC,SAAS;IAOnB;;;OAGG;IACH,OAAO,IAAI,YAAY;IA+BvB;;;OAGG;IACH,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;CAG1B"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('events').EventEmitter;
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[10010] = (function(){ var d = "ˇˇ\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.materialize = void 0;
|
||||
var Notification_1 = require("../Notification");
|
||||
var lift_1 = require("../util/lift");
|
||||
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
||||
function materialize() {
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
||||
subscriber.next(Notification_1.Notification.createNext(value));
|
||||
}, function () {
|
||||
subscriber.next(Notification_1.Notification.createComplete());
|
||||
subscriber.complete();
|
||||
}, function (err) {
|
||||
subscriber.next(Notification_1.Notification.createError(err));
|
||||
subscriber.complete();
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.materialize = materialize;
|
||||
//# sourceMappingURL=materialize.js.map
|
||||
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
var protocols = require("protocols");
|
||||
|
||||
/**
|
||||
* isSsh
|
||||
* Checks if an input value is a ssh url or not.
|
||||
*
|
||||
* @name isSsh
|
||||
* @function
|
||||
* @param {String|Array} input The input url or an array of protocols.
|
||||
* @return {Boolean} `true` if the input is a ssh url, `false` otherwise.
|
||||
*/
|
||||
function isSsh(input) {
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
return input.indexOf("ssh") !== -1 || input.indexOf("rsync") !== -1;
|
||||
}
|
||||
|
||||
if (typeof input !== "string") {
|
||||
return false;
|
||||
}
|
||||
|
||||
var prots = protocols(input);
|
||||
input = input.substring(input.indexOf("://") + 3);
|
||||
if (isSsh(prots)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO This probably could be improved :)
|
||||
var urlPortPattern = new RegExp('\.([a-zA-Z\\d]+):(\\d+)\/');
|
||||
return !input.match(urlPortPattern) && input.indexOf("@") < input.indexOf(":");
|
||||
}
|
||||
|
||||
module.exports = isSsh;
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
Flatten the type output to improve type hints shown in editors.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Simplify} from 'type-fest';
|
||||
|
||||
type PositionProps = {
|
||||
top: number;
|
||||
left: number;
|
||||
};
|
||||
|
||||
type SizeProps = {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
||||
type Props = Simplify<PositionProps & SizeProps>;
|
||||
```
|
||||
|
||||
@category Utilities
|
||||
*/
|
||||
export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]};
|
||||
@@ -0,0 +1,215 @@
|
||||
"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());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const net_1 = __importDefault(require("net"));
|
||||
const tls_1 = __importDefault(require("tls"));
|
||||
const once_1 = __importDefault(require("@tootallnate/once"));
|
||||
const crypto_1 = __importDefault(require("crypto"));
|
||||
const get_uri_1 = __importDefault(require("get-uri"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const raw_body_1 = __importDefault(require("raw-body"));
|
||||
const url_1 = require("url");
|
||||
const http_proxy_agent_1 = require("http-proxy-agent");
|
||||
const https_proxy_agent_1 = require("https-proxy-agent");
|
||||
const socks_proxy_agent_1 = require("socks-proxy-agent");
|
||||
const pac_resolver_1 = __importDefault(require("pac-resolver"));
|
||||
const agent_base_1 = require("agent-base");
|
||||
const debug = debug_1.default('pac-proxy-agent');
|
||||
/**
|
||||
* The `PacProxyAgent` class.
|
||||
*
|
||||
* A few different "protocol" modes are supported (supported protocols are
|
||||
* backed by the `get-uri` module):
|
||||
*
|
||||
* - "pac+data", "data" - refers to an embedded "data:" URI
|
||||
* - "pac+file", "file" - refers to a local file
|
||||
* - "pac+ftp", "ftp" - refers to a file located on an FTP server
|
||||
* - "pac+http", "http" - refers to an HTTP endpoint
|
||||
* - "pac+https", "https" - refers to an HTTPS endpoint
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
class PacProxyAgent extends agent_base_1.Agent {
|
||||
constructor(uri, opts = {}) {
|
||||
super(opts);
|
||||
this.clearResolverPromise = () => {
|
||||
this.resolverPromise = undefined;
|
||||
};
|
||||
debug('Creating PacProxyAgent with URI %o and options %o', uri, opts);
|
||||
// Strip the "pac+" prefix
|
||||
this.uri = uri.replace(/^pac\+/i, '');
|
||||
this.opts = Object.assign({}, opts);
|
||||
this.cache = undefined;
|
||||
this.resolver = undefined;
|
||||
this.resolverHash = '';
|
||||
this.resolverPromise = undefined;
|
||||
// For `PacResolver`
|
||||
if (!this.opts.filename) {
|
||||
this.opts.filename = uri;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Loads the PAC proxy file from the source if necessary, and returns
|
||||
* a generated `FindProxyForURL()` resolver function to use.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
getResolver() {
|
||||
if (!this.resolverPromise) {
|
||||
this.resolverPromise = this.loadResolver();
|
||||
this.resolverPromise.then(this.clearResolverPromise, this.clearResolverPromise);
|
||||
}
|
||||
return this.resolverPromise;
|
||||
}
|
||||
loadResolver() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
// (Re)load the contents of the PAC file URI
|
||||
const code = yield this.loadPacFile();
|
||||
// Create a sha1 hash of the JS code
|
||||
const hash = crypto_1.default
|
||||
.createHash('sha1')
|
||||
.update(code)
|
||||
.digest('hex');
|
||||
if (this.resolver && this.resolverHash === hash) {
|
||||
debug('Same sha1 hash for code - contents have not changed, reusing previous proxy resolver');
|
||||
return this.resolver;
|
||||
}
|
||||
// Cache the resolver
|
||||
debug('Creating new proxy resolver instance');
|
||||
this.resolver = pac_resolver_1.default(code, this.opts);
|
||||
// Store that sha1 hash for future comparison purposes
|
||||
this.resolverHash = hash;
|
||||
return this.resolver;
|
||||
}
|
||||
catch (err) {
|
||||
if (this.resolver && err.code === 'ENOTMODIFIED') {
|
||||
debug('Got ENOTMODIFIED response, reusing previous proxy resolver');
|
||||
return this.resolver;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Loads the contents of the PAC proxy file.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
loadPacFile() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
debug('Loading PAC file: %o', this.uri);
|
||||
const rs = yield get_uri_1.default(this.uri, { cache: this.cache });
|
||||
debug('Got `Readable` instance for URI');
|
||||
this.cache = rs;
|
||||
const buf = yield raw_body_1.default(rs);
|
||||
debug('Read %o byte PAC file from URI', buf.length);
|
||||
return buf.toString('utf8');
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Called when the node-core HTTP client library is creating a new HTTP request.
|
||||
*
|
||||
* @api protected
|
||||
*/
|
||||
callback(req, opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { secureEndpoint } = opts;
|
||||
// First, get a generated `FindProxyForURL()` function,
|
||||
// either cached or retrieved from the source
|
||||
const resolver = yield this.getResolver();
|
||||
// Calculate the `url` parameter
|
||||
const defaultPort = secureEndpoint ? 443 : 80;
|
||||
let path = req.path;
|
||||
let search = null;
|
||||
const firstQuestion = path.indexOf('?');
|
||||
if (firstQuestion !== -1) {
|
||||
search = path.substring(firstQuestion);
|
||||
path = path.substring(0, firstQuestion);
|
||||
}
|
||||
const urlOpts = Object.assign(Object.assign({}, opts), { protocol: secureEndpoint ? 'https:' : 'http:', pathname: path, search,
|
||||
// need to use `hostname` instead of `host` otherwise `port` is ignored
|
||||
hostname: opts.host, host: null, href: null,
|
||||
// set `port` to null when it is the protocol default port (80 / 443)
|
||||
port: defaultPort === opts.port ? null : opts.port });
|
||||
const url = url_1.format(urlOpts);
|
||||
debug('url: %o', url);
|
||||
let result = yield resolver(url);
|
||||
// Default to "DIRECT" if a falsey value was returned (or nothing)
|
||||
if (!result) {
|
||||
result = 'DIRECT';
|
||||
}
|
||||
const proxies = String(result)
|
||||
.trim()
|
||||
.split(/\s*;\s*/g)
|
||||
.filter(Boolean);
|
||||
if (this.opts.fallbackToDirect && !proxies.includes('DIRECT')) {
|
||||
proxies.push('DIRECT');
|
||||
}
|
||||
for (const proxy of proxies) {
|
||||
let agent = null;
|
||||
let socket = null;
|
||||
const [type, target] = proxy.split(/\s+/);
|
||||
debug('Attempting to use proxy: %o', proxy);
|
||||
if (type === 'DIRECT') {
|
||||
// Direct connection to the destination endpoint
|
||||
socket = secureEndpoint ? tls_1.default.connect(opts) : net_1.default.connect(opts);
|
||||
}
|
||||
else if (type === 'SOCKS' || type === 'SOCKS5') {
|
||||
// Use a SOCKSv5h proxy
|
||||
agent = new socks_proxy_agent_1.SocksProxyAgent(`socks://${target}`);
|
||||
}
|
||||
else if (type === 'SOCKS4') {
|
||||
// Use a SOCKSv4a proxy
|
||||
agent = new socks_proxy_agent_1.SocksProxyAgent(`socks4a://${target}`);
|
||||
}
|
||||
else if (type === 'PROXY' ||
|
||||
type === 'HTTP' ||
|
||||
type === 'HTTPS') {
|
||||
// Use an HTTP or HTTPS proxy
|
||||
// http://dev.chromium.org/developers/design-documents/secure-web-proxy
|
||||
const proxyURL = `${type === 'HTTPS' ? 'https' : 'http'}://${target}`;
|
||||
const proxyOpts = Object.assign(Object.assign({}, this.opts), url_1.parse(proxyURL));
|
||||
if (secureEndpoint) {
|
||||
agent = new https_proxy_agent_1.HttpsProxyAgent(proxyOpts);
|
||||
}
|
||||
else {
|
||||
agent = new http_proxy_agent_1.HttpProxyAgent(proxyOpts);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (socket) {
|
||||
// "DIRECT" connection, wait for connection confirmation
|
||||
yield once_1.default(socket, 'connect');
|
||||
req.emit('proxy', { proxy, socket });
|
||||
return socket;
|
||||
}
|
||||
if (agent) {
|
||||
const s = yield agent.callback(req, opts);
|
||||
req.emit('proxy', { proxy, socket: s });
|
||||
return s;
|
||||
}
|
||||
throw new Error(`Could not determine proxy type for: ${proxy}`);
|
||||
}
|
||||
catch (err) {
|
||||
debug('Got error for proxy %o: %o', proxy, err);
|
||||
req.emit('proxy', { proxy, error: err });
|
||||
}
|
||||
}
|
||||
throw new Error(`Failed to establish a socket connection to proxies: ${JSON.stringify(proxies)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = PacProxyAgent;
|
||||
//# sourceMappingURL=agent.js.map
|
||||
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function every(array, predicate) {
|
||||
for (var i = 0; i < array.length; i += 1) {
|
||||
if (!predicate(array[i], i, array)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApiError = void 0;
|
||||
class ApiError extends Error {
|
||||
constructor(response, message) {
|
||||
super(message);
|
||||
this.url = response.url;
|
||||
this.status = response.status;
|
||||
this.statusText = response.statusText;
|
||||
this.body = response.body;
|
||||
}
|
||||
}
|
||||
exports.ApiError = ApiError;
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"path-type","version":"4.0.0","files":{"license":{"checkedAt":1678883669272,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"package.json":{"checkedAt":1678883673371,"integrity":"sha512-MGG+S0LEfOU6cupshaoN7TCPhKxLzXM0z2xvzbTRJg3n2Pciw64alZJX2bvi0BDEuqk6SJ9fNh25+xrQuOymlA==","mode":420,"size":714},"index.js":{"checkedAt":1678883673371,"integrity":"sha512-ybPgHToJQJN9OXkDxCxjwYFTqh0foWCmN8rtL3ONcNvlA7jX5xQquz9j6AlCCrHT6hZ/fnpvgiwpUxhP+Nk09A==","mode":420,"size":1176},"index.d.ts":{"checkedAt":1678883673371,"integrity":"sha512-YIaXzHzUOx9yVG0KLCxwCx5a3i+9sBnPHnVh+rlErdEkHjPN71fn9zblBx94mTjZMuhsWsrf7W49T+u2yBSb3g==","mode":420,"size":1296},"readme.md":{"checkedAt":1678883673371,"integrity":"sha512-xGprIZ7MY0TZAZGGKjbpkTZWs84Fqd/gkWy0FYSMQQiMk5P6qijuR4PymvAc41kw1YXcIJOWosXJsus+TUae1g==","mode":420,"size":1112}}}
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TimeInterval = exports.timeInterval = void 0;
|
||||
var async_1 = require("../scheduler/async");
|
||||
var lift_1 = require("../util/lift");
|
||||
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
||||
function timeInterval(scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
var last = scheduler.now();
|
||||
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
||||
var now = scheduler.now();
|
||||
var interval = now - last;
|
||||
last = now;
|
||||
subscriber.next(new TimeInterval(value, interval));
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.timeInterval = timeInterval;
|
||||
var TimeInterval = (function () {
|
||||
function TimeInterval(value, interval) {
|
||||
this.value = value;
|
||||
this.interval = interval;
|
||||
}
|
||||
return TimeInterval;
|
||||
}());
|
||||
exports.TimeInterval = TimeInterval;
|
||||
//# sourceMappingURL=timeInterval.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"is-boolean-object","version":"1.1.2","files":{".eslintignore":{"checkedAt":1678883671537,"integrity":"sha512-VLhEcqup3IHXtZJPt07ZYoA9JNRjy1jhU/NU41Yw4E8mEyea/z+6bw5hL3lhCO09pji9E0BH2Q3aDXdc3i9zBg==","mode":420,"size":10},".nycrc":{"checkedAt":1678883671619,"integrity":"sha512-aLxN7EM7vuJGE3vcz8CsQow+RuaR3thZWTHupkykz/8WOXUd8ayX5goRxPe3MCnZ0VVDkuEk8UBkk3NodRfMOg==","mode":420,"size":159},"LICENSE":{"checkedAt":1678883671601,"integrity":"sha512-CWRd82wre8E2D9wfNTwrOCxhLsdU7obtQTc4poEGt1uTk93MEI2QW01sXILetqMRgoYp4EIKQZNHNCQrALOFjw==","mode":420,"size":1082},".editorconfig":{"checkedAt":1678883671770,"integrity":"sha512-YawvVmCRII368W4uV526wIIaoNa5Z79175k6E15G/tb58q6H4yNY7Ets5vW0hdoO063Yb+2YoXw2K+vwzCyBhA==","mode":420,"size":353},"test/index.js":{"checkedAt":1678883671770,"integrity":"sha512-lsb4GuNxKruzxKRfD8XDQOpFwFLZolU8CnQcUiTFCn7c+2kGQuzSWcD5rGPL+rQl6oS+8D0FoDzn0r6MVaPV4Q==","mode":420,"size":1628},"package.json":{"checkedAt":1678883671770,"integrity":"sha512-tu+o/vY6+ZKZXWDLO9COozMTgCzmdutTAYBUN5DtA89U1nE1RHH1fjOVisANSx95u9+Q3vHTtnYlyYp85IGhdA==","mode":420,"size":2279},"index.js":{"checkedAt":1678883671770,"integrity":"sha512-zfMG9kaJGgdeUmT1/rbXMOqjvzdFoL++4THxlzxidgTu3pVtYVvzteMZY4aEjYWN57SdTXpzxDL97JKDDSfgJg==","mode":420,"size":697},".eslintrc":{"checkedAt":1678883671770,"integrity":"sha512-8AIsGkUCDjzroYiaDfj/qNjeQTdfUe3k0+6lsBYmPtOSQ1+uAVwDcayNzXaEJjgy3xGlrTSCPIW1d/ujOXkWVg==","mode":420,"size":282},"README.md":{"checkedAt":1678883671772,"integrity":"sha512-fo2wBWPxyQApNjdNK58MLITzQ0rVNPVKveLQdeApySbJrNzZZ9ATP9rMbjalGf+DeDr5FsyoUBpNarGhfyC8Eg==","mode":420,"size":2221},"CHANGELOG.md":{"checkedAt":1678883671772,"integrity":"sha512-tApEwGLtRIKnE1wwCe43V/hvPyVEFJ3qdnNQcDUy/mgfkr7ck7bvouY4GmlAtVaVaJ33L7OC5qb5vZ8nPtVDcQ==","mode":420,"size":12821},".github/FUNDING.yml":{"checkedAt":1678883671772,"integrity":"sha512-P8j1tDuN92XRtEQYL3nFxruTutPKi7+Sa9GcpDNvqoYLgLcGaCTkMplYR16/RbAwrJxe7IlFedqE7WUZDwY3Rw==","mode":420,"size":588}}}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import type { ErrnoException } from '../types';
|
||||
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
|
||||
export declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
||||
export interface FileSystemAdapter {
|
||||
lstat: StatAsynchronousMethod;
|
||||
stat: StatAsynchronousMethod;
|
||||
lstatSync: StatSynchronousMethod;
|
||||
statSync: StatSynchronousMethod;
|
||||
}
|
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, coerce = require("./coerce");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
var coerced = coerce(value);
|
||||
if (coerced !== null) return coerced;
|
||||
var options = arguments[1];
|
||||
var errorMessage =
|
||||
options && options.name
|
||||
? "Expected an integer for %n, received %v"
|
||||
: "%v is not an integer";
|
||||
return resolveException(value, errorMessage, options);
|
||||
};
|
||||
@@ -0,0 +1,107 @@
|
||||
# is-extglob [](https://www.npmjs.com/package/is-extglob) [](https://npmjs.org/package/is-extglob) [](https://travis-ci.org/jonschlinkert/is-extglob)
|
||||
|
||||
> Returns true if a string has an extglob.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-extglob
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isExtglob = require('is-extglob');
|
||||
```
|
||||
|
||||
**True**
|
||||
|
||||
```js
|
||||
isExtglob('?(abc)');
|
||||
isExtglob('@(abc)');
|
||||
isExtglob('!(abc)');
|
||||
isExtglob('*(abc)');
|
||||
isExtglob('+(abc)');
|
||||
```
|
||||
|
||||
**False**
|
||||
|
||||
Escaped extglobs:
|
||||
|
||||
```js
|
||||
isExtglob('\\?(abc)');
|
||||
isExtglob('\\@(abc)');
|
||||
isExtglob('\\!(abc)');
|
||||
isExtglob('\\*(abc)');
|
||||
isExtglob('\\+(abc)');
|
||||
```
|
||||
|
||||
Everything else...
|
||||
|
||||
```js
|
||||
isExtglob('foo.js');
|
||||
isExtglob('!foo.js');
|
||||
isExtglob('*.js');
|
||||
isExtglob('**/abc.js');
|
||||
isExtglob('abc/*.js');
|
||||
isExtglob('abc/(aaa|bbb).js');
|
||||
isExtglob('abc/[a-z].js');
|
||||
isExtglob('abc/{a,b}.js');
|
||||
isExtglob('abc/?.js');
|
||||
isExtglob('abc.js');
|
||||
isExtglob('abc/def/ghi.js');
|
||||
```
|
||||
|
||||
## History
|
||||
|
||||
**v2.0**
|
||||
|
||||
Adds support for escaping. Escaped exglobs no longer return true.
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.")
|
||||
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
|
||||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
|
||||
|
||||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
||||
|
||||
```sh
|
||||
$ npm install -g verb verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm install -d && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.00307,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.00307,"48":0.00614,"49":0,"50":0,"51":0,"52":0.00307,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00307,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.0215,"89":0,"90":0,"91":0.01843,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00307,"100":0.00307,"101":0,"102":0.00307,"103":0,"104":0,"105":0.01843,"106":0.00307,"107":0.01228,"108":0.00307,"109":0.41459,"110":0.3071,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00307,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.01228,"39":0,"40":0.00921,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00614,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0.00307,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00307,"66":0,"67":0,"68":0.00307,"69":0.00307,"70":0,"71":0,"72":0.00921,"73":0.00307,"74":0.00921,"75":0.00614,"76":0,"77":0,"78":0,"79":0.0737,"80":0.00307,"81":0.04914,"83":0.00307,"84":0.01536,"85":0,"86":0.00307,"87":0.0952,"88":0.0215,"89":0.0215,"90":0,"91":0.00307,"92":0,"93":0,"94":0,"95":0.02457,"96":0,"97":0,"98":0.00307,"99":0.00307,"100":0.00307,"101":0.00307,"102":0.03071,"103":0.05221,"104":0.14434,"105":0.00307,"106":0.0215,"107":0.01228,"108":0.15048,"109":2.84989,"110":1.53243,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.02764,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.1382,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0.02457,"62":0,"63":0.01843,"64":0.00921,"65":0,"66":0.06142,"67":0.22111,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0.00921,"80":0.00921,"81":0,"82":0,"83":0,"84":0,"85":0.00614,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.03071,"94":0.05835,"95":0.13205,"9.5-9.6":0,"10.0-10.1":0,"10.5":0.00307,"10.6":0.00307,"11.1":0,"11.5":0,"11.6":0,"12.1":0.00921},B:{"12":0.00921,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.01843,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00614,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00921,"101":0,"102":0,"103":0,"104":0.00307,"105":0,"106":0,"107":0.00307,"108":0.01228,"109":0.42994,"110":0.66334},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.00921,"14.1":0.0215,"15.1":0,"15.2-15.3":0,"15.4":0.00307,"15.5":0.00921,"15.6":0.02764,"16.0":0,"16.1":0.00921,"16.2":0.01228,"16.3":0.01536,"16.4":0},G:{"8":0.00298,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.04177,"6.0-6.1":0,"7.0-7.1":0.12831,"8.1-8.4":0.02387,"9.0-9.2":0.00298,"9.3":0.09101,"10.0-10.2":0,"10.3":0.02835,"11.0-11.2":0.03133,"11.3-11.4":0.00149,"12.0-12.1":0.22379,"12.2-12.5":3.74928,"13.0-13.1":0,"13.2":0,"13.3":0.00597,"13.4-13.7":0.08206,"14.0-14.4":0.27452,"14.5-14.8":0.25811,"15.0-15.1":0.22976,"15.2-15.3":0.92352,"15.4":0.30734,"15.5":0.49085,"15.6":0.82505,"16.0":0.58335,"16.1":1.59192,"16.2":1.30994,"16.3":1.37857,"16.4":0.00746},P:{"4":0.43263,"20":0.98887,"5.0-5.4":0,"6.2-6.4":0.0103,"7.2-7.4":0.74165,"8.2":0,"9.2":0.0309,"10.1":0,"11.1-11.2":0.0412,"12.0":0.0206,"13.0":0.08241,"14.0":0.0206,"15.0":0.18541,"16.0":0.57684,"17.0":0.0721,"18.0":0.12361,"19.0":1.28759},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00904,"4.4":0,"4.4.3-4.4.4":0.25207},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00307,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.03465,_:"3.0-3.1"},J:{"7":0,"10":0.02079},O:{"0":0.11779},H:{"0":2.40749},L:{"0":67.71982},R:{_:"0"},M:{"0":0.63747},Q:{"13.1":0.00693}};
|
||||
@@ -0,0 +1,20 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J D E CC","8":"F A"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K EC FC"},D:{"1":"3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v J D E F A B C K L G M N","33":"0 1 2 O w g x y z"},E:{"1":"D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC","33":"J"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C PC QC RC SC qB AC TC rB"},G:{"1":"E XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC","33":"WC"},H:{"2":"oC"},I:{"1":"f tC uC","2":"tB pC qC rC","8":"I sC BC"},J:{"1":"A","2":"D"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"B","8":"A"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Mutation Observer"};
|
||||
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isSurrogatePair;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
||||
|
||||
function isSurrogatePair(str) {
|
||||
(0, _assertString.default)(str);
|
||||
return surrogatePair.test(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,386 @@
|
||||
import process from 'node:process';
|
||||
import chalk from 'chalk';
|
||||
import cliCursor from 'cli-cursor';
|
||||
import cliSpinners from 'cli-spinners';
|
||||
import logSymbols from 'log-symbols';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import wcwidth from 'wcwidth';
|
||||
import isInteractive from 'is-interactive';
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
import {StdinDiscarder} from './utilities.js';
|
||||
|
||||
let stdinDiscarder;
|
||||
|
||||
class Ora {
|
||||
#linesToClear = 0;
|
||||
#isDiscardingStdin = false;
|
||||
#lineCount = 0;
|
||||
#frameIndex = 0;
|
||||
#options;
|
||||
#spinner;
|
||||
#stream;
|
||||
#id;
|
||||
#initialInterval;
|
||||
#isEnabled;
|
||||
#isSilent;
|
||||
#indent;
|
||||
#text;
|
||||
#prefixText;
|
||||
|
||||
color;
|
||||
|
||||
constructor(options) {
|
||||
if (!stdinDiscarder) {
|
||||
stdinDiscarder = new StdinDiscarder();
|
||||
}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options,
|
||||
};
|
||||
}
|
||||
|
||||
this.#options = {
|
||||
color: 'cyan',
|
||||
stream: process.stderr,
|
||||
discardStdin: true,
|
||||
hideCursor: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
// Public
|
||||
this.color = this.#options.color;
|
||||
|
||||
// It's important that these use the public setters.
|
||||
this.spinner = this.#options.spinner;
|
||||
|
||||
this.#initialInterval = this.#options.interval;
|
||||
this.#stream = this.#options.stream;
|
||||
this.#isEnabled = typeof this.#options.isEnabled === 'boolean' ? this.#options.isEnabled : isInteractive({stream: this.#stream});
|
||||
this.#isSilent = typeof this.#options.isSilent === 'boolean' ? this.#options.isSilent : false;
|
||||
|
||||
// Set *after* `this.#stream`.
|
||||
// It's important that these use the public setters.
|
||||
this.text = this.#options.text;
|
||||
this.prefixText = this.#options.prefixText;
|
||||
this.indent = this.#options.indent;
|
||||
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
this._stream = this.#stream;
|
||||
this._isEnabled = this.#isEnabled;
|
||||
|
||||
Object.defineProperty(this, '_linesToClear', {
|
||||
get() {
|
||||
return this.#linesToClear;
|
||||
},
|
||||
set(newValue) {
|
||||
this.#linesToClear = newValue;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_frameIndex', {
|
||||
get() {
|
||||
return this.#frameIndex;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_lineCount', {
|
||||
get() {
|
||||
return this.#lineCount;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get indent() {
|
||||
return this.#indent;
|
||||
}
|
||||
|
||||
set indent(indent = 0) {
|
||||
if (!(indent >= 0 && Number.isInteger(indent))) {
|
||||
throw new Error('The `indent` option must be an integer from 0 and up');
|
||||
}
|
||||
|
||||
this.#indent = indent;
|
||||
this.updateLineCount();
|
||||
}
|
||||
|
||||
get interval() {
|
||||
return this.#initialInterval || this.#spinner.interval || 100;
|
||||
}
|
||||
|
||||
get spinner() {
|
||||
return this.#spinner;
|
||||
}
|
||||
|
||||
set spinner(spinner) {
|
||||
this.#frameIndex = 0;
|
||||
this.#initialInterval = undefined;
|
||||
|
||||
if (typeof spinner === 'object') {
|
||||
if (spinner.frames === undefined) {
|
||||
throw new Error('The given spinner must have a `frames` property');
|
||||
}
|
||||
|
||||
this.#spinner = spinner;
|
||||
} else if (!isUnicodeSupported()) {
|
||||
this.#spinner = cliSpinners.line;
|
||||
} else if (spinner === undefined) {
|
||||
// Set default spinner
|
||||
this.#spinner = cliSpinners.dots;
|
||||
} else if (spinner !== 'default' && cliSpinners[spinner]) {
|
||||
this.#spinner = cliSpinners[spinner];
|
||||
} else {
|
||||
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
|
||||
}
|
||||
}
|
||||
|
||||
get text() {
|
||||
return this.#text;
|
||||
}
|
||||
|
||||
set text(value) {
|
||||
this.#text = value || '';
|
||||
this.updateLineCount();
|
||||
}
|
||||
|
||||
get prefixText() {
|
||||
return this.#prefixText;
|
||||
}
|
||||
|
||||
set prefixText(value) {
|
||||
this.#prefixText = value || '';
|
||||
this.updateLineCount();
|
||||
}
|
||||
|
||||
get isSpinning() {
|
||||
return this.#id !== undefined;
|
||||
}
|
||||
|
||||
// TODO: Use private methods when targeting Node.js 14.
|
||||
getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {
|
||||
if (typeof prefixText === 'string' && prefixText !== '') {
|
||||
return prefixText + postfix;
|
||||
}
|
||||
|
||||
if (typeof prefixText === 'function') {
|
||||
return prefixText() + postfix;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
updateLineCount() {
|
||||
const columns = this.#stream.columns || 80;
|
||||
const fullPrefixText = this.getFullPrefixText(this.#prefixText, '-');
|
||||
|
||||
this.#lineCount = 0;
|
||||
for (const line of stripAnsi(' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text).split('\n')) {
|
||||
this.#lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
|
||||
}
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return this.#isEnabled && !this.#isSilent;
|
||||
}
|
||||
|
||||
set isEnabled(value) {
|
||||
if (typeof value !== 'boolean') {
|
||||
throw new TypeError('The `isEnabled` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isEnabled = value;
|
||||
}
|
||||
|
||||
get isSilent() {
|
||||
return this.#isSilent;
|
||||
}
|
||||
|
||||
set isSilent(value) {
|
||||
if (typeof value !== 'boolean') {
|
||||
throw new TypeError('The `isSilent` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isSilent = value;
|
||||
}
|
||||
|
||||
frame() {
|
||||
const {frames} = this.#spinner;
|
||||
let frame = frames[this.#frameIndex];
|
||||
|
||||
if (this.color) {
|
||||
frame = chalk[this.color](frame);
|
||||
}
|
||||
|
||||
this.#frameIndex = ++this.#frameIndex % frames.length;
|
||||
const fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';
|
||||
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
|
||||
|
||||
return fullPrefixText + frame + fullText;
|
||||
}
|
||||
|
||||
clear() {
|
||||
if (!this.#isEnabled || !this.#stream.isTTY) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.#stream.cursorTo(0);
|
||||
|
||||
for (let index = 0; index < this.#linesToClear; index++) {
|
||||
if (index > 0) {
|
||||
this.#stream.moveCursor(0, -1);
|
||||
}
|
||||
|
||||
this.#stream.clearLine(1);
|
||||
}
|
||||
|
||||
if (this.#indent || this.lastIndent !== this.#indent) {
|
||||
this.#stream.cursorTo(this.#indent);
|
||||
}
|
||||
|
||||
this.lastIndent = this.#indent;
|
||||
this.#linesToClear = 0;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.clear();
|
||||
this.#stream.write(this.frame());
|
||||
this.#linesToClear = this.#lineCount;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
start(text) {
|
||||
if (text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (!this.#isEnabled) {
|
||||
if (this.text) {
|
||||
this.#stream.write(`- ${this.text}\n`);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.isSpinning) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.hide(this.#stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY) {
|
||||
this.#isDiscardingStdin = true;
|
||||
stdinDiscarder.start();
|
||||
}
|
||||
|
||||
this.render();
|
||||
this.#id = setInterval(this.render.bind(this), this.interval);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (!this.#isEnabled) {
|
||||
return this;
|
||||
}
|
||||
|
||||
clearInterval(this.#id);
|
||||
this.#id = undefined;
|
||||
this.#frameIndex = 0;
|
||||
this.clear();
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.show(this.#stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {
|
||||
stdinDiscarder.stop();
|
||||
this.#isDiscardingStdin = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
succeed(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.success, text});
|
||||
}
|
||||
|
||||
fail(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.error, text});
|
||||
}
|
||||
|
||||
warn(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.warning, text});
|
||||
}
|
||||
|
||||
info(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.info, text});
|
||||
}
|
||||
|
||||
stopAndPersist(options = {}) {
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
const prefixText = options.prefixText || this.#prefixText;
|
||||
const text = options.text || this.text;
|
||||
const fullText = (typeof text === 'string') ? ' ' + text : '';
|
||||
|
||||
this.stop();
|
||||
this.#stream.write(`${this.getFullPrefixText(prefixText, ' ')}${options.symbol || ' '}${fullText}\n`);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export default function ora(options) {
|
||||
return new Ora(options);
|
||||
}
|
||||
|
||||
export async function oraPromise(action, options) {
|
||||
const actionIsFunction = typeof action === 'function';
|
||||
const actionIsPromise = typeof action.then === 'function';
|
||||
|
||||
if (!actionIsFunction && !actionIsPromise) {
|
||||
throw new TypeError('Parameter `action` must be a Function or a Promise');
|
||||
}
|
||||
|
||||
const {successText, failText} = typeof options === 'object'
|
||||
? options
|
||||
: {successText: undefined, failText: undefined};
|
||||
|
||||
const spinner = ora(options).start();
|
||||
|
||||
try {
|
||||
const promise = actionIsFunction ? action(spinner) : action;
|
||||
const result = await promise;
|
||||
|
||||
spinner.succeed(
|
||||
successText === undefined
|
||||
? undefined
|
||||
: (typeof successText === 'string' ? successText : successText(result)),
|
||||
);
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
spinner.fail(
|
||||
failText === undefined
|
||||
? undefined
|
||||
: (typeof failText === 'string' ? failText : failText(error)),
|
||||
);
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PartitionNumberPattern = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var FormatNumericToString_1 = require("./FormatNumericToString");
|
||||
var _262_1 = require("../262");
|
||||
var ComputeExponent_1 = require("./ComputeExponent");
|
||||
var format_to_parts_1 = (0, tslib_1.__importDefault)(require("./format_to_parts"));
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-formatnumberstring
|
||||
*/
|
||||
function PartitionNumberPattern(numberFormat, x, _a) {
|
||||
var _b;
|
||||
var getInternalSlots = _a.getInternalSlots;
|
||||
var internalSlots = getInternalSlots(numberFormat);
|
||||
var pl = internalSlots.pl, dataLocaleData = internalSlots.dataLocaleData, numberingSystem = internalSlots.numberingSystem;
|
||||
var symbols = dataLocaleData.numbers.symbols[numberingSystem] ||
|
||||
dataLocaleData.numbers.symbols[dataLocaleData.numbers.nu[0]];
|
||||
var magnitude = 0;
|
||||
var exponent = 0;
|
||||
var n;
|
||||
if (isNaN(x)) {
|
||||
n = symbols.nan;
|
||||
}
|
||||
else if (!isFinite(x)) {
|
||||
n = symbols.infinity;
|
||||
}
|
||||
else {
|
||||
if (internalSlots.style === 'percent') {
|
||||
x *= 100;
|
||||
}
|
||||
;
|
||||
_b = (0, ComputeExponent_1.ComputeExponent)(numberFormat, x, {
|
||||
getInternalSlots: getInternalSlots,
|
||||
}), exponent = _b[0], magnitude = _b[1];
|
||||
// Preserve more precision by doing multiplication when exponent is negative.
|
||||
x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
|
||||
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(internalSlots, x);
|
||||
n = formatNumberResult.formattedString;
|
||||
x = formatNumberResult.roundedNumber;
|
||||
}
|
||||
// Based on https://tc39.es/ecma402/#sec-getnumberformatpattern
|
||||
// We need to do this before `x` is rounded.
|
||||
var sign;
|
||||
var signDisplay = internalSlots.signDisplay;
|
||||
switch (signDisplay) {
|
||||
case 'never':
|
||||
sign = 0;
|
||||
break;
|
||||
case 'auto':
|
||||
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
|
||||
sign = 0;
|
||||
}
|
||||
else {
|
||||
sign = -1;
|
||||
}
|
||||
break;
|
||||
case 'always':
|
||||
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
|
||||
sign = 1;
|
||||
}
|
||||
else {
|
||||
sign = -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// x === 0 -> x is 0 or x is -0
|
||||
if (x === 0 || isNaN(x)) {
|
||||
sign = 0;
|
||||
}
|
||||
else if (x > 0) {
|
||||
sign = 1;
|
||||
}
|
||||
else {
|
||||
sign = -1;
|
||||
}
|
||||
}
|
||||
return (0, format_to_parts_1.default)({ roundedNumber: x, formattedString: n, exponent: exponent, magnitude: magnitude, sign: sign }, internalSlots.dataLocaleData, pl, internalSlots);
|
||||
}
|
||||
exports.PartitionNumberPattern = PartitionNumberPattern;
|
||||
@@ -0,0 +1,5 @@
|
||||
var a = require('a');
|
||||
|
||||
function *gen() {
|
||||
yield require('b');
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = 'A';
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"windowWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/windowWhen.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AAErC,qCAAuC;AACvC,2DAAgE;AAChE,qDAAoD;AA8CpD,SAAgB,UAAU,CAAI,eAA2C;IACvE,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,MAAyB,CAAC;QAC9B,IAAI,iBAA8C,CAAC;QAMnD,IAAM,WAAW,GAAG,UAAC,GAAQ;YAC3B,MAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;QAQF,IAAM,UAAU,GAAG;YAGjB,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,WAAW,EAAE,CAAC;YAGjC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE,CAAC;YAGnB,MAAM,GAAG,IAAI,iBAAO,EAAK,CAAC;YAC1B,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;YAGvC,IAAI,eAAgC,CAAC;YACrC,IAAI;gBACF,eAAe,GAAG,qBAAS,CAAC,eAAe,EAAE,CAAC,CAAC;aAChD;YAAC,OAAO,GAAG,EAAE;gBACZ,WAAW,CAAC,GAAG,CAAC,CAAC;gBACjB,OAAO;aACR;YAMD,eAAe,CAAC,SAAS,CAAC,CAAC,iBAAiB,GAAG,6CAAwB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7H,CAAC,CAAC;QAGF,UAAU,EAAE,CAAC;QAGb,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK,IAAK,OAAA,MAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAnB,CAAmB,EAC9B;YAEE,MAAO,CAAC,QAAQ,EAAE,CAAC;YACnB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,EACD,WAAW,EACX;YAGE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,WAAW,EAAE,CAAC;YACjC,MAAM,GAAG,IAAK,CAAC;QACjB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAvED,gCAuEC"}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function switchMap(project, resultSelector) {
|
||||
return operate(function (source, subscriber) {
|
||||
var innerSubscriber = null;
|
||||
var index = 0;
|
||||
var isComplete = false;
|
||||
var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
||||
var innerIndex = 0;
|
||||
var outerIndex = index++;
|
||||
innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
|
||||
innerSubscriber = null;
|
||||
checkComplete();
|
||||
})));
|
||||
}, function () {
|
||||
isComplete = true;
|
||||
checkComplete();
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=switchMap.js.map
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isMagnetURI;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var magnetURIComponent = /(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i;
|
||||
|
||||
function isMagnetURI(url) {
|
||||
(0, _assertString.default)(url);
|
||||
|
||||
if (url.indexOf('magnet:?') !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return magnetURIComponent.test(url);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scheduleIterable.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduled/scheduleIterable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,iBAgD/E"}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
|
||||
module.exports = isObject;
|
||||
@@ -0,0 +1,50 @@
|
||||
declare namespace detectIndent {
|
||||
interface Indent {
|
||||
/**
|
||||
Type of indentation. Is `undefined` if no indentation is detected.
|
||||
*/
|
||||
type: 'tab' | 'space' | undefined;
|
||||
|
||||
/**
|
||||
Amount of indentation, for example `2`.
|
||||
*/
|
||||
amount: number;
|
||||
|
||||
/**
|
||||
Actual indentation.
|
||||
*/
|
||||
indent: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Detect the indentation of code.
|
||||
|
||||
@param string - A string of any kind of text.
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import detectIndent = require('detect-indent');
|
||||
|
||||
// {
|
||||
// "ilove": "pizza"
|
||||
// }
|
||||
const file = fs.readFileSync('foo.json', 'utf8');
|
||||
|
||||
// Tries to detect the indentation and falls back to a default if it can't
|
||||
const indent = detectIndent(file).indent || ' ';
|
||||
|
||||
const json = JSON.parse(file);
|
||||
|
||||
json.ilove = 'unicorns';
|
||||
|
||||
fs.writeFileSync('foo.json', JSON.stringify(json, null, indent));
|
||||
// {
|
||||
// "ilove": "unicorns"
|
||||
// }
|
||||
```
|
||||
*/
|
||||
declare function detectIndent(string: string): detectIndent.Indent;
|
||||
|
||||
export = detectIndent;
|
||||
@@ -0,0 +1,124 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBound = require('call-bind/callBound');
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
||||
var $Map = GetIntrinsic('%Map%', true);
|
||||
|
||||
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
||||
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
||||
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
||||
var $mapGet = callBound('Map.prototype.get', true);
|
||||
var $mapSet = callBound('Map.prototype.set', true);
|
||||
var $mapHas = callBound('Map.prototype.has', true);
|
||||
|
||||
/*
|
||||
* This function traverses the list returning the node corresponding to the
|
||||
* given key.
|
||||
*
|
||||
* That node is also moved to the head of the list, so that if it's accessed
|
||||
* again we don't need to traverse the whole list. By doing so, all the recently
|
||||
* used nodes can be accessed relatively quickly.
|
||||
*/
|
||||
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
||||
for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
|
||||
if (curr.key === key) {
|
||||
prev.next = curr.next;
|
||||
curr.next = list.next;
|
||||
list.next = curr; // eslint-disable-line no-param-reassign
|
||||
return curr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var listGet = function (objects, key) {
|
||||
var node = listGetNode(objects, key);
|
||||
return node && node.value;
|
||||
};
|
||||
var listSet = function (objects, key, value) {
|
||||
var node = listGetNode(objects, key);
|
||||
if (node) {
|
||||
node.value = value;
|
||||
} else {
|
||||
// Prepend the new node to the beginning of the list
|
||||
objects.next = { // eslint-disable-line no-param-reassign
|
||||
key: key,
|
||||
next: objects.next,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
};
|
||||
var listHas = function (objects, key) {
|
||||
return !!listGetNode(objects, key);
|
||||
};
|
||||
|
||||
module.exports = function getSideChannel() {
|
||||
var $wm;
|
||||
var $m;
|
||||
var $o;
|
||||
var channel = {
|
||||
assert: function (key) {
|
||||
if (!channel.has(key)) {
|
||||
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
||||
}
|
||||
},
|
||||
get: function (key) { // eslint-disable-line consistent-return
|
||||
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
||||
if ($wm) {
|
||||
return $weakMapGet($wm, key);
|
||||
}
|
||||
} else if ($Map) {
|
||||
if ($m) {
|
||||
return $mapGet($m, key);
|
||||
}
|
||||
} else {
|
||||
if ($o) { // eslint-disable-line no-lonely-if
|
||||
return listGet($o, key);
|
||||
}
|
||||
}
|
||||
},
|
||||
has: function (key) {
|
||||
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
||||
if ($wm) {
|
||||
return $weakMapHas($wm, key);
|
||||
}
|
||||
} else if ($Map) {
|
||||
if ($m) {
|
||||
return $mapHas($m, key);
|
||||
}
|
||||
} else {
|
||||
if ($o) { // eslint-disable-line no-lonely-if
|
||||
return listHas($o, key);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
set: function (key, value) {
|
||||
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
||||
if (!$wm) {
|
||||
$wm = new $WeakMap();
|
||||
}
|
||||
$weakMapSet($wm, key, value);
|
||||
} else if ($Map) {
|
||||
if (!$m) {
|
||||
$m = new $Map();
|
||||
}
|
||||
$mapSet($m, key, value);
|
||||
} else {
|
||||
if (!$o) {
|
||||
/*
|
||||
* Initialize the linked list as an empty node, so that we don't have
|
||||
* to special-case handling of the first node: we can always refer to
|
||||
* it as (previous node).next, instead of something like (list).head
|
||||
*/
|
||||
$o = { key: {}, next: null };
|
||||
}
|
||||
listSet($o, key, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
return channel;
|
||||
};
|
||||
@@ -0,0 +1,276 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/parserMgr.js</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../../index.html">All files</a> / <a href="index.html">csv2json/libs/core</a> parserMgr.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/34</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/14</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/34</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">//implementation
|
||||
var registeredParsers = <span class="cstat-no" title="statement not covered" >[];</span>
|
||||
var Parser = <span class="cstat-no" title="statement not covered" >require("./parser.js");</span>
|
||||
var defaultParser = <span class="cstat-no" title="statement not covered" >require("./defaultParsers");</span>
|
||||
|
||||
function <span class="fstat-no" title="function not covered" >registerParser </span>(parser) {
|
||||
<span class="cstat-no" title="statement not covered" > if (parser instanceof Parser && registeredParsers.indexOf(parser) === -1) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > registeredParsers.push(parser); </span>// TODO indexOf doesn't work with object references
|
||||
}
|
||||
}
|
||||
|
||||
function <span class="fstat-no" title="function not covered" >getParser(</span>columnTitle, param) {
|
||||
var inst, parser;
|
||||
function <span class="fstat-no" title="function not covered" >getParserByName(</span>parserName) {
|
||||
var parser;
|
||||
<span class="cstat-no" title="statement not covered" > registeredParsers.forEach(<span class="fstat-no" title="function not covered" >fu</span>nction(p){</span>
|
||||
<span class="cstat-no" title="statement not covered" > if (p.getName() === parserName){</span>
|
||||
<span class="cstat-no" title="statement not covered" > parser = p;</span>
|
||||
}
|
||||
});
|
||||
<span class="cstat-no" title="statement not covered" > if (parser) {</span>
|
||||
var inst = <span class="cstat-no" title="statement not covered" >parser.clone();</span>
|
||||
<span class="cstat-no" title="statement not covered" > return inst;</span>
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" > return new Parser(); </span>//TODO remove new
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" > columnTitle = columnTitle ? columnTitle : '';</span>
|
||||
<span class="cstat-no" title="statement not covered" > registeredParsers.forEach(<span class="fstat-no" title="function not covered" >fu</span>nction(p) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > if (p.test(columnTitle)) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > parser=p;</span>
|
||||
}
|
||||
});
|
||||
<span class="cstat-no" title="statement not covered" > if (parser) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > inst = parser.clone();</span>
|
||||
<span class="cstat-no" title="statement not covered" > inst.head = columnTitle;</span>
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > inst = getParserByName("json", columnTitle);</span>
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" > inst.setParam(param);</span>
|
||||
<span class="cstat-no" title="statement not covered" > inst.initHead(columnTitle);</span>
|
||||
<span class="cstat-no" title="statement not covered" > return inst;</span>
|
||||
}
|
||||
|
||||
function <span class="fstat-no" title="function not covered" >addParser(</span>name, regExp, parseFunc) {
|
||||
var parser = <span class="cstat-no" title="statement not covered" >new Parser(name, regExp, parseFunc,false);</span> //TODO remove new
|
||||
<span class="cstat-no" title="statement not covered" > registerParser(parser);</span>
|
||||
}
|
||||
|
||||
function <span class="fstat-no" title="function not covered" >addSafeParser(</span>parserPath) {
|
||||
//TODO impl
|
||||
}
|
||||
|
||||
function <span class="fstat-no" title="function not covered" >initParsers(</span>row, param) {
|
||||
var parsers = <span class="cstat-no" title="statement not covered" >[];</span>
|
||||
<span class="cstat-no" title="statement not covered" > row.forEach(<span class="fstat-no" title="function not covered" >fu</span>nction (columnTitle) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > parsers.push(getParser(columnTitle, param));</span>
|
||||
});
|
||||
<span class="cstat-no" title="statement not covered" > return parsers;</span>
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" >defaultParser.forEach(<span class="fstat-no" title="function not covered" >fu</span>nction (parserCfg){</span>
|
||||
//TODO refactor this
|
||||
<span class="cstat-no" title="statement not covered" > addParser(parserCfg.name, parserCfg.regExp, parserCfg.parserFunc, parserCfg.processSafe);</span>
|
||||
});
|
||||
|
||||
//module interfaces
|
||||
<span class="cstat-no" title="statement not covered" >module.exports.addParser = addParser;</span>
|
||||
<span class="cstat-no" title="statement not covered" >module.exports.initParsers = initParsers;</span>
|
||||
<span class="cstat-no" title="statement not covered" >module.exports.getParser = getParser;</span>
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../../sorter.js"></script>
|
||||
<script src="../../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00443,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00443,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00443,"100":0,"101":0,"102":0.00443,"103":0,"104":0,"105":0.00443,"106":0,"107":0.02656,"108":0.00885,"109":0.70389,"110":0.54009,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.00443,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0.00443,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.01771,"75":0,"76":0,"77":0,"78":0,"79":0.00443,"80":0,"81":0.02656,"83":0.00885,"84":0,"85":0,"86":0,"87":0.00443,"88":0,"89":0.00443,"90":0,"91":0,"92":0,"93":0.01328,"94":0.00885,"95":0,"96":0.01328,"97":0.00443,"98":0.00443,"99":0.02214,"100":0.00443,"101":0.00443,"102":0.00443,"103":0.01328,"104":0.00443,"105":0.01771,"106":0.01771,"107":0.06641,"108":0.17265,"109":7.54804,"110":4.49783,"111":0,"112":0.00443,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0.00443,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00443,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.01328,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.0487,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0.00885,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.30104,"91":0,"92":0,"93":0.00443,"94":0.10625,"95":0.07526,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0.00443,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0.00443,"15":0,"16":0,"17":0.00443,"18":0.01328,"79":0,"80":0,"81":0.00443,"83":0,"84":0.00443,"85":0,"86":0,"87":0,"88":0,"89":0.00443,"90":0.00443,"91":0,"92":0.00885,"93":0,"94":0,"95":0,"96":0.00443,"97":0,"98":0,"99":0,"100":0.00443,"101":0,"102":0,"103":0.00443,"104":0,"105":0.00443,"106":0,"107":0.00443,"108":0.03542,"109":0.50025,"110":0.87655},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00443,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.00443,"14.1":0.01328,"15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0.00443,"15.6":0.03099,"16.0":0,"16.1":0.01771,"16.2":0.01771,"16.3":0.01328,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.03216,"10.0-10.2":0,"10.3":2.14206,"11.0-11.2":0.00419,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0.17617,"13.0-13.1":0.0014,"13.2":0,"13.3":0.00419,"13.4-13.7":0.06572,"14.0-14.4":0.73546,"14.5-14.8":0.12444,"15.0-15.1":0.44463,"15.2-15.3":0.13143,"15.4":0.12444,"15.5":0.96197,"15.6":0.783,"16.0":0.75363,"16.1":1.64429,"16.2":1.9491,"16.3":3.01314,"16.4":0.00699},P:{"4":0.06154,"20":0.91279,"5.0-5.4":0.02051,"6.2-6.4":0.02051,"7.2-7.4":0.53331,"8.2":0,"9.2":0.01026,"10.1":0,"11.1-11.2":0.21538,"12.0":0,"13.0":0.0923,"14.0":2.42043,"15.0":0.05128,"16.0":0.10256,"17.0":0.03077,"18.0":0.1641,"19.0":1.97942},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.03048,"4.4":0,"4.4.3-4.4.4":0.02822},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00443,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0.04458},O:{"0":1.44898},H:{"0":0.87057},L:{"0":57.53448},R:{_:"0"},M:{"0":0.15604},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"race.js","sourceRoot":"","sources":["../../../../src/internal/observable/race.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AA6C3E,MAAM,UAAU,IAAI;IAAI,iBAAyD;SAAzD,UAAyD,EAAzD,qBAAyD,EAAzD,IAAyD;QAAzD,4BAAyD;;IAC/E,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAElC,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAI,QAAQ,CAAC,OAA+B,CAAC,CAAC,CAAC;AAC3I,CAAC;AAOD,MAAM,UAAU,QAAQ,CAAI,OAA6B;IACvD,OAAO,UAAC,UAAyB;QAC/B,IAAI,aAAa,GAAmB,EAAE,CAAC;gCAM9B,CAAC;YACR,aAAa,CAAC,IAAI,CAChB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAuB,CAAC,CAAC,SAAS,CACnD,wBAAwB,CAAC,UAAU,EAAE,UAAC,KAAK;gBACzC,IAAI,aAAa,EAAE;oBAGjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBAC7C,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;qBAC3C;oBACD,aAAa,GAAG,IAAK,CAAC;iBACvB;gBACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC,CAAC,CACH,CACF,CAAC;;QAfJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE;oBAArE,CAAC;SAgBT;IACH,CAAC,CAAC;AACJ,CAAC"}
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace pathKey {
|
||||
interface Options {
|
||||
/**
|
||||
Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
|
||||
*/
|
||||
readonly env?: {[key: string]: string | undefined};
|
||||
|
||||
/**
|
||||
Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
|
||||
*/
|
||||
readonly platform?: NodeJS.Platform;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pathKey: {
|
||||
/**
|
||||
Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
|
||||
|
||||
@example
|
||||
```
|
||||
import pathKey = require('path-key');
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
*/
|
||||
(options?: pathKey.Options): string;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function pathKey(options?: pathKey.Options): string;
|
||||
// export = pathKey;
|
||||
default: typeof pathKey;
|
||||
};
|
||||
|
||||
export = pathKey;
|
||||
@@ -0,0 +1,29 @@
|
||||
export function isStream(stream) {
|
||||
return stream !== null
|
||||
&& typeof stream === 'object'
|
||||
&& typeof stream.pipe === 'function';
|
||||
}
|
||||
|
||||
export function isWritableStream(stream) {
|
||||
return isStream(stream)
|
||||
&& stream.writable !== false
|
||||
&& typeof stream._write === 'function'
|
||||
&& typeof stream._writableState === 'object';
|
||||
}
|
||||
|
||||
export function isReadableStream(stream) {
|
||||
return isStream(stream)
|
||||
&& stream.readable !== false
|
||||
&& typeof stream._read === 'function'
|
||||
&& typeof stream._readableState === 'object';
|
||||
}
|
||||
|
||||
export function isDuplexStream(stream) {
|
||||
return isWritableStream(stream)
|
||||
&& isReadableStream(stream);
|
||||
}
|
||||
|
||||
export function isTransformStream(stream) {
|
||||
return isDuplexStream(stream)
|
||||
&& typeof stream._transform === 'function';
|
||||
}
|
||||
@@ -0,0 +1,603 @@
|
||||
'use strict'
|
||||
|
||||
let Declaration = require('./declaration')
|
||||
let tokenizer = require('./tokenize')
|
||||
let Comment = require('./comment')
|
||||
let AtRule = require('./at-rule')
|
||||
let Root = require('./root')
|
||||
let Rule = require('./rule')
|
||||
|
||||
const SAFE_COMMENT_NEIGHBOR = {
|
||||
empty: true,
|
||||
space: true
|
||||
}
|
||||
|
||||
function findLastWithPosition(tokens) {
|
||||
for (let i = tokens.length - 1; i >= 0; i--) {
|
||||
let token = tokens[i]
|
||||
let pos = token[3] || token[2]
|
||||
if (pos) return pos
|
||||
}
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(input) {
|
||||
this.input = input
|
||||
|
||||
this.root = new Root()
|
||||
this.current = this.root
|
||||
this.spaces = ''
|
||||
this.semicolon = false
|
||||
this.customProperty = false
|
||||
|
||||
this.createTokenizer()
|
||||
this.root.source = { input, start: { offset: 0, line: 1, column: 1 } }
|
||||
}
|
||||
|
||||
createTokenizer() {
|
||||
this.tokenizer = tokenizer(this.input)
|
||||
}
|
||||
|
||||
parse() {
|
||||
let token
|
||||
while (!this.tokenizer.endOfFile()) {
|
||||
token = this.tokenizer.nextToken()
|
||||
|
||||
switch (token[0]) {
|
||||
case 'space':
|
||||
this.spaces += token[1]
|
||||
break
|
||||
|
||||
case ';':
|
||||
this.freeSemicolon(token)
|
||||
break
|
||||
|
||||
case '}':
|
||||
this.end(token)
|
||||
break
|
||||
|
||||
case 'comment':
|
||||
this.comment(token)
|
||||
break
|
||||
|
||||
case 'at-word':
|
||||
this.atrule(token)
|
||||
break
|
||||
|
||||
case '{':
|
||||
this.emptyRule(token)
|
||||
break
|
||||
|
||||
default:
|
||||
this.other(token)
|
||||
break
|
||||
}
|
||||
}
|
||||
this.endFile()
|
||||
}
|
||||
|
||||
comment(token) {
|
||||
let node = new Comment()
|
||||
this.init(node, token[2])
|
||||
node.source.end = this.getPosition(token[3] || token[2])
|
||||
|
||||
let text = token[1].slice(2, -2)
|
||||
if (/^\s*$/.test(text)) {
|
||||
node.text = ''
|
||||
node.raws.left = text
|
||||
node.raws.right = ''
|
||||
} else {
|
||||
let match = text.match(/^(\s*)([^]*\S)(\s*)$/)
|
||||
node.text = match[2]
|
||||
node.raws.left = match[1]
|
||||
node.raws.right = match[3]
|
||||
}
|
||||
}
|
||||
|
||||
emptyRule(token) {
|
||||
let node = new Rule()
|
||||
this.init(node, token[2])
|
||||
node.selector = ''
|
||||
node.raws.between = ''
|
||||
this.current = node
|
||||
}
|
||||
|
||||
other(start) {
|
||||
let end = false
|
||||
let type = null
|
||||
let colon = false
|
||||
let bracket = null
|
||||
let brackets = []
|
||||
let customProperty = start[1].startsWith('--')
|
||||
|
||||
let tokens = []
|
||||
let token = start
|
||||
while (token) {
|
||||
type = token[0]
|
||||
tokens.push(token)
|
||||
|
||||
if (type === '(' || type === '[') {
|
||||
if (!bracket) bracket = token
|
||||
brackets.push(type === '(' ? ')' : ']')
|
||||
} else if (customProperty && colon && type === '{') {
|
||||
if (!bracket) bracket = token
|
||||
brackets.push('}')
|
||||
} else if (brackets.length === 0) {
|
||||
if (type === ';') {
|
||||
if (colon) {
|
||||
this.decl(tokens, customProperty)
|
||||
return
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else if (type === '{') {
|
||||
this.rule(tokens)
|
||||
return
|
||||
} else if (type === '}') {
|
||||
this.tokenizer.back(tokens.pop())
|
||||
end = true
|
||||
break
|
||||
} else if (type === ':') {
|
||||
colon = true
|
||||
}
|
||||
} else if (type === brackets[brackets.length - 1]) {
|
||||
brackets.pop()
|
||||
if (brackets.length === 0) bracket = null
|
||||
}
|
||||
|
||||
token = this.tokenizer.nextToken()
|
||||
}
|
||||
|
||||
if (this.tokenizer.endOfFile()) end = true
|
||||
if (brackets.length > 0) this.unclosedBracket(bracket)
|
||||
|
||||
if (end && colon) {
|
||||
if (!customProperty) {
|
||||
while (tokens.length) {
|
||||
token = tokens[tokens.length - 1][0]
|
||||
if (token !== 'space' && token !== 'comment') break
|
||||
this.tokenizer.back(tokens.pop())
|
||||
}
|
||||
}
|
||||
this.decl(tokens, customProperty)
|
||||
} else {
|
||||
this.unknownWord(tokens)
|
||||
}
|
||||
}
|
||||
|
||||
rule(tokens) {
|
||||
tokens.pop()
|
||||
|
||||
let node = new Rule()
|
||||
this.init(node, tokens[0][2])
|
||||
|
||||
node.raws.between = this.spacesAndCommentsFromEnd(tokens)
|
||||
this.raw(node, 'selector', tokens)
|
||||
this.current = node
|
||||
}
|
||||
|
||||
decl(tokens, customProperty) {
|
||||
let node = new Declaration()
|
||||
this.init(node, tokens[0][2])
|
||||
|
||||
let last = tokens[tokens.length - 1]
|
||||
if (last[0] === ';') {
|
||||
this.semicolon = true
|
||||
tokens.pop()
|
||||
}
|
||||
|
||||
node.source.end = this.getPosition(
|
||||
last[3] || last[2] || findLastWithPosition(tokens)
|
||||
)
|
||||
|
||||
while (tokens[0][0] !== 'word') {
|
||||
if (tokens.length === 1) this.unknownWord(tokens)
|
||||
node.raws.before += tokens.shift()[1]
|
||||
}
|
||||
node.source.start = this.getPosition(tokens[0][2])
|
||||
|
||||
node.prop = ''
|
||||
while (tokens.length) {
|
||||
let type = tokens[0][0]
|
||||
if (type === ':' || type === 'space' || type === 'comment') {
|
||||
break
|
||||
}
|
||||
node.prop += tokens.shift()[1]
|
||||
}
|
||||
|
||||
node.raws.between = ''
|
||||
|
||||
let token
|
||||
while (tokens.length) {
|
||||
token = tokens.shift()
|
||||
|
||||
if (token[0] === ':') {
|
||||
node.raws.between += token[1]
|
||||
break
|
||||
} else {
|
||||
if (token[0] === 'word' && /\w/.test(token[1])) {
|
||||
this.unknownWord([token])
|
||||
}
|
||||
node.raws.between += token[1]
|
||||
}
|
||||
}
|
||||
|
||||
if (node.prop[0] === '_' || node.prop[0] === '*') {
|
||||
node.raws.before += node.prop[0]
|
||||
node.prop = node.prop.slice(1)
|
||||
}
|
||||
|
||||
let firstSpaces = []
|
||||
let next
|
||||
while (tokens.length) {
|
||||
next = tokens[0][0]
|
||||
if (next !== 'space' && next !== 'comment') break
|
||||
firstSpaces.push(tokens.shift())
|
||||
}
|
||||
|
||||
this.precheckMissedSemicolon(tokens)
|
||||
|
||||
for (let i = tokens.length - 1; i >= 0; i--) {
|
||||
token = tokens[i]
|
||||
if (token[1].toLowerCase() === '!important') {
|
||||
node.important = true
|
||||
let string = this.stringFrom(tokens, i)
|
||||
string = this.spacesFromEnd(tokens) + string
|
||||
if (string !== ' !important') node.raws.important = string
|
||||
break
|
||||
} else if (token[1].toLowerCase() === 'important') {
|
||||
let cache = tokens.slice(0)
|
||||
let str = ''
|
||||
for (let j = i; j > 0; j--) {
|
||||
let type = cache[j][0]
|
||||
if (str.trim().indexOf('!') === 0 && type !== 'space') {
|
||||
break
|
||||
}
|
||||
str = cache.pop()[1] + str
|
||||
}
|
||||
if (str.trim().indexOf('!') === 0) {
|
||||
node.important = true
|
||||
node.raws.important = str
|
||||
tokens = cache
|
||||
}
|
||||
}
|
||||
|
||||
if (token[0] !== 'space' && token[0] !== 'comment') {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment')
|
||||
|
||||
if (hasWord) {
|
||||
node.raws.between += firstSpaces.map(i => i[1]).join('')
|
||||
firstSpaces = []
|
||||
}
|
||||
this.raw(node, 'value', firstSpaces.concat(tokens), customProperty)
|
||||
|
||||
if (node.value.includes(':') && !customProperty) {
|
||||
this.checkMissedSemicolon(tokens)
|
||||
}
|
||||
}
|
||||
|
||||
atrule(token) {
|
||||
let node = new AtRule()
|
||||
node.name = token[1].slice(1)
|
||||
if (node.name === '') {
|
||||
this.unnamedAtrule(node, token)
|
||||
}
|
||||
this.init(node, token[2])
|
||||
|
||||
let type
|
||||
let prev
|
||||
let shift
|
||||
let last = false
|
||||
let open = false
|
||||
let params = []
|
||||
let brackets = []
|
||||
|
||||
while (!this.tokenizer.endOfFile()) {
|
||||
token = this.tokenizer.nextToken()
|
||||
type = token[0]
|
||||
|
||||
if (type === '(' || type === '[') {
|
||||
brackets.push(type === '(' ? ')' : ']')
|
||||
} else if (type === '{' && brackets.length > 0) {
|
||||
brackets.push('}')
|
||||
} else if (type === brackets[brackets.length - 1]) {
|
||||
brackets.pop()
|
||||
}
|
||||
|
||||
if (brackets.length === 0) {
|
||||
if (type === ';') {
|
||||
node.source.end = this.getPosition(token[2])
|
||||
this.semicolon = true
|
||||
break
|
||||
} else if (type === '{') {
|
||||
open = true
|
||||
break
|
||||
} else if (type === '}') {
|
||||
if (params.length > 0) {
|
||||
shift = params.length - 1
|
||||
prev = params[shift]
|
||||
while (prev && prev[0] === 'space') {
|
||||
prev = params[--shift]
|
||||
}
|
||||
if (prev) {
|
||||
node.source.end = this.getPosition(prev[3] || prev[2])
|
||||
}
|
||||
}
|
||||
this.end(token)
|
||||
break
|
||||
} else {
|
||||
params.push(token)
|
||||
}
|
||||
} else {
|
||||
params.push(token)
|
||||
}
|
||||
|
||||
if (this.tokenizer.endOfFile()) {
|
||||
last = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
node.raws.between = this.spacesAndCommentsFromEnd(params)
|
||||
if (params.length) {
|
||||
node.raws.afterName = this.spacesAndCommentsFromStart(params)
|
||||
this.raw(node, 'params', params)
|
||||
if (last) {
|
||||
token = params[params.length - 1]
|
||||
node.source.end = this.getPosition(token[3] || token[2])
|
||||
this.spaces = node.raws.between
|
||||
node.raws.between = ''
|
||||
}
|
||||
} else {
|
||||
node.raws.afterName = ''
|
||||
node.params = ''
|
||||
}
|
||||
|
||||
if (open) {
|
||||
node.nodes = []
|
||||
this.current = node
|
||||
}
|
||||
}
|
||||
|
||||
end(token) {
|
||||
if (this.current.nodes && this.current.nodes.length) {
|
||||
this.current.raws.semicolon = this.semicolon
|
||||
}
|
||||
this.semicolon = false
|
||||
|
||||
this.current.raws.after = (this.current.raws.after || '') + this.spaces
|
||||
this.spaces = ''
|
||||
|
||||
if (this.current.parent) {
|
||||
this.current.source.end = this.getPosition(token[2])
|
||||
this.current = this.current.parent
|
||||
} else {
|
||||
this.unexpectedClose(token)
|
||||
}
|
||||
}
|
||||
|
||||
endFile() {
|
||||
if (this.current.parent) this.unclosedBlock()
|
||||
if (this.current.nodes && this.current.nodes.length) {
|
||||
this.current.raws.semicolon = this.semicolon
|
||||
}
|
||||
this.current.raws.after = (this.current.raws.after || '') + this.spaces
|
||||
}
|
||||
|
||||
freeSemicolon(token) {
|
||||
this.spaces += token[1]
|
||||
if (this.current.nodes) {
|
||||
let prev = this.current.nodes[this.current.nodes.length - 1]
|
||||
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
|
||||
prev.raws.ownSemicolon = this.spaces
|
||||
this.spaces = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
getPosition(offset) {
|
||||
let pos = this.input.fromOffset(offset)
|
||||
return {
|
||||
offset,
|
||||
line: pos.line,
|
||||
column: pos.col
|
||||
}
|
||||
}
|
||||
|
||||
init(node, offset) {
|
||||
this.current.push(node)
|
||||
node.source = {
|
||||
start: this.getPosition(offset),
|
||||
input: this.input
|
||||
}
|
||||
node.raws.before = this.spaces
|
||||
this.spaces = ''
|
||||
if (node.type !== 'comment') this.semicolon = false
|
||||
}
|
||||
|
||||
raw(node, prop, tokens, customProperty) {
|
||||
let token, type
|
||||
let length = tokens.length
|
||||
let value = ''
|
||||
let clean = true
|
||||
let next, prev
|
||||
|
||||
for (let i = 0; i < length; i += 1) {
|
||||
token = tokens[i]
|
||||
type = token[0]
|
||||
if (type === 'space' && i === length - 1 && !customProperty) {
|
||||
clean = false
|
||||
} else if (type === 'comment') {
|
||||
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
|
||||
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
|
||||
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
|
||||
if (value.slice(-1) === ',') {
|
||||
clean = false
|
||||
} else {
|
||||
value += token[1]
|
||||
}
|
||||
} else {
|
||||
clean = false
|
||||
}
|
||||
} else {
|
||||
value += token[1]
|
||||
}
|
||||
}
|
||||
if (!clean) {
|
||||
let raw = tokens.reduce((all, i) => all + i[1], '')
|
||||
node.raws[prop] = { value, raw }
|
||||
}
|
||||
node[prop] = value
|
||||
}
|
||||
|
||||
spacesAndCommentsFromEnd(tokens) {
|
||||
let lastTokenType
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
lastTokenType = tokens[tokens.length - 1][0]
|
||||
if (lastTokenType !== 'space' && lastTokenType !== 'comment') break
|
||||
spaces = tokens.pop()[1] + spaces
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
spacesAndCommentsFromStart(tokens) {
|
||||
let next
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
next = tokens[0][0]
|
||||
if (next !== 'space' && next !== 'comment') break
|
||||
spaces += tokens.shift()[1]
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
spacesFromEnd(tokens) {
|
||||
let lastTokenType
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
lastTokenType = tokens[tokens.length - 1][0]
|
||||
if (lastTokenType !== 'space') break
|
||||
spaces = tokens.pop()[1] + spaces
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
stringFrom(tokens, from) {
|
||||
let result = ''
|
||||
for (let i = from; i < tokens.length; i++) {
|
||||
result += tokens[i][1]
|
||||
}
|
||||
tokens.splice(from, tokens.length - from)
|
||||
return result
|
||||
}
|
||||
|
||||
colon(tokens) {
|
||||
let brackets = 0
|
||||
let token, type, prev
|
||||
for (let [i, element] of tokens.entries()) {
|
||||
token = element
|
||||
type = token[0]
|
||||
|
||||
if (type === '(') {
|
||||
brackets += 1
|
||||
}
|
||||
if (type === ')') {
|
||||
brackets -= 1
|
||||
}
|
||||
if (brackets === 0 && type === ':') {
|
||||
if (!prev) {
|
||||
this.doubleColon(token)
|
||||
} else if (prev[0] === 'word' && prev[1] === 'progid') {
|
||||
continue
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
prev = token
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Errors
|
||||
|
||||
unclosedBracket(bracket) {
|
||||
throw this.input.error(
|
||||
'Unclosed bracket',
|
||||
{ offset: bracket[2] },
|
||||
{ offset: bracket[2] + 1 }
|
||||
)
|
||||
}
|
||||
|
||||
unknownWord(tokens) {
|
||||
throw this.input.error(
|
||||
'Unknown word',
|
||||
{ offset: tokens[0][2] },
|
||||
{ offset: tokens[0][2] + tokens[0][1].length }
|
||||
)
|
||||
}
|
||||
|
||||
unexpectedClose(token) {
|
||||
throw this.input.error(
|
||||
'Unexpected }',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + 1 }
|
||||
)
|
||||
}
|
||||
|
||||
unclosedBlock() {
|
||||
let pos = this.current.source.start
|
||||
throw this.input.error('Unclosed block', pos.line, pos.column)
|
||||
}
|
||||
|
||||
doubleColon(token) {
|
||||
throw this.input.error(
|
||||
'Double colon',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + token[1].length }
|
||||
)
|
||||
}
|
||||
|
||||
unnamedAtrule(node, token) {
|
||||
throw this.input.error(
|
||||
'At-rule without name',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + token[1].length }
|
||||
)
|
||||
}
|
||||
|
||||
precheckMissedSemicolon(/* tokens */) {
|
||||
// Hook for Safe Parser
|
||||
}
|
||||
|
||||
checkMissedSemicolon(tokens) {
|
||||
let colon = this.colon(tokens)
|
||||
if (colon === false) return
|
||||
|
||||
let founded = 0
|
||||
let token
|
||||
for (let j = colon - 1; j >= 0; j--) {
|
||||
token = tokens[j]
|
||||
if (token[0] !== 'space') {
|
||||
founded += 1
|
||||
if (founded === 2) break
|
||||
}
|
||||
}
|
||||
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
|
||||
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
|
||||
// And because we need it after that one we do +1 to get the next one.
|
||||
throw this.input.error(
|
||||
'Missed semicolon',
|
||||
token[0] === 'word' ? token[3] + 1 : token[2]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Parser
|
||||
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var inspect = require('object-inspect');
|
||||
var is = require('object-is');
|
||||
var forEach = require('for-each');
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasBigInts = require('has-bigints')();
|
||||
|
||||
var unboxPrimitive = require('..');
|
||||
|
||||
var debug = function (v, m) { return inspect(v) + ' ' + m; };
|
||||
|
||||
test('primitives', function (t) {
|
||||
var primitives = [
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'foo',
|
||||
42,
|
||||
NaN,
|
||||
Infinity,
|
||||
0
|
||||
];
|
||||
if (hasSymbols) {
|
||||
primitives.push(Symbol(), Symbol.iterator, Symbol('f'));
|
||||
}
|
||||
if (hasBigInts) {
|
||||
primitives.push(BigInt(42), BigInt(0));
|
||||
}
|
||||
forEach(primitives, function (primitive) {
|
||||
var obj = Object(primitive);
|
||||
t.ok(
|
||||
is(unboxPrimitive(obj), primitive),
|
||||
debug(obj, 'unboxes to ' + inspect(primitive))
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('objects', function (t) {
|
||||
var objects = [
|
||||
{},
|
||||
[],
|
||||
function () {},
|
||||
/a/g,
|
||||
new Date()
|
||||
];
|
||||
forEach(objects, function (object) {
|
||||
t['throws'](
|
||||
function () { unboxPrimitive(object); },
|
||||
TypeError,
|
||||
debug(object, 'is not a primitive')
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,72 @@
|
||||
import { QueueAction } from './QueueAction';
|
||||
import { QueueScheduler } from './QueueScheduler';
|
||||
|
||||
/**
|
||||
*
|
||||
* Queue Scheduler
|
||||
*
|
||||
* <span class="informal">Put every next task on a queue, instead of executing it immediately</span>
|
||||
*
|
||||
* `queue` scheduler, when used with delay, behaves the same as {@link asyncScheduler} scheduler.
|
||||
*
|
||||
* When used without delay, it schedules given task synchronously - executes it right when
|
||||
* it is scheduled. However when called recursively, that is when inside the scheduled task,
|
||||
* another task is scheduled with queue scheduler, instead of executing immediately as well,
|
||||
* that task will be put on a queue and wait for current one to finish.
|
||||
*
|
||||
* This means that when you execute task with `queue` scheduler, you are sure it will end
|
||||
* before any other task scheduled with that scheduler will start.
|
||||
*
|
||||
* ## Examples
|
||||
* Schedule recursively first, then do something
|
||||
* ```ts
|
||||
* import { queueScheduler } from 'rxjs';
|
||||
*
|
||||
* queueScheduler.schedule(() => {
|
||||
* queueScheduler.schedule(() => console.log('second')); // will not happen now, but will be put on a queue
|
||||
*
|
||||
* console.log('first');
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // "first"
|
||||
* // "second"
|
||||
* ```
|
||||
*
|
||||
* Reschedule itself recursively
|
||||
* ```ts
|
||||
* import { queueScheduler } from 'rxjs';
|
||||
*
|
||||
* queueScheduler.schedule(function(state) {
|
||||
* if (state !== 0) {
|
||||
* console.log('before', state);
|
||||
* this.schedule(state - 1); // `this` references currently executing Action,
|
||||
* // which we reschedule with new state
|
||||
* console.log('after', state);
|
||||
* }
|
||||
* }, 0, 3);
|
||||
*
|
||||
* // In scheduler that runs recursively, you would expect:
|
||||
* // "before", 3
|
||||
* // "before", 2
|
||||
* // "before", 1
|
||||
* // "after", 1
|
||||
* // "after", 2
|
||||
* // "after", 3
|
||||
*
|
||||
* // But with queue it logs:
|
||||
* // "before", 3
|
||||
* // "after", 3
|
||||
* // "before", 2
|
||||
* // "after", 2
|
||||
* // "before", 1
|
||||
* // "after", 1
|
||||
* ```
|
||||
*/
|
||||
|
||||
export const queueScheduler = new QueueScheduler(QueueAction);
|
||||
|
||||
/**
|
||||
* @deprecated Renamed to {@link queueScheduler}. Will be removed in v8.
|
||||
*/
|
||||
export const queue = queueScheduler;
|
||||
@@ -0,0 +1 @@
|
||||
export * from './ca-file'
|
||||
@@ -0,0 +1,3 @@
|
||||
import Request from '../core/index.js';
|
||||
import { type CancelableRequest } from './types.js';
|
||||
export default function asPromise<T>(firstRequest?: Request): CancelableRequest<T>;
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
||||
* CJS and ESM environments.
|
||||
*
|
||||
* @license
|
||||
* Copyright (c) 2016, Contributors
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
var _a, _b, _c;
|
||||
import { format } from 'util';
|
||||
import { normalize, resolve } from 'path';
|
||||
import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
|
||||
import { YargsParser } from './yargs-parser.js';
|
||||
import { readFileSync } from 'fs';
|
||||
// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
|
||||
// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
|
||||
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
|
||||
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
||||
: 12;
|
||||
const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
||||
if (nodeVersion) {
|
||||
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
||||
if (major < minNodeVersion) {
|
||||
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
||||
}
|
||||
}
|
||||
// Creates a yargs-parser instance using Node.js standard libraries:
|
||||
const env = process ? process.env : {};
|
||||
const parser = new YargsParser({
|
||||
cwd: process.cwd,
|
||||
env: () => {
|
||||
return env;
|
||||
},
|
||||
format,
|
||||
normalize,
|
||||
resolve,
|
||||
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
||||
// we can exercise all the lines below:
|
||||
require: (path) => {
|
||||
if (typeof require !== 'undefined') {
|
||||
return require(path);
|
||||
}
|
||||
else if (path.match(/\.json$/)) {
|
||||
// Addresses: https://github.com/yargs/yargs/issues/2040
|
||||
return JSON.parse(readFileSync(path, 'utf8'));
|
||||
}
|
||||
else {
|
||||
throw Error('only .json config files are supported in ESM');
|
||||
}
|
||||
}
|
||||
});
|
||||
const yargsParser = function Parser(args, opts) {
|
||||
const result = parser.parse(args.slice(), opts);
|
||||
return result.argv;
|
||||
};
|
||||
yargsParser.detailed = function (args, opts) {
|
||||
return parser.parse(args.slice(), opts);
|
||||
};
|
||||
yargsParser.camelCase = camelCase;
|
||||
yargsParser.decamelize = decamelize;
|
||||
yargsParser.looksLikeNumber = looksLikeNumber;
|
||||
export default yargsParser;
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"max-params": [2, 3],
|
||||
"new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
|
||||
"no-magic-numbers": 0,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bufferCount.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/bufferCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAM,GAAG,IAAW,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CA+DnH"}
|
||||
@@ -0,0 +1,86 @@
|
||||
import {Buffer} from 'node:buffer';
|
||||
import {Readable as ReadableStream} from 'node:stream';
|
||||
|
||||
export type Options = {
|
||||
/**
|
||||
The HTTP response status code.
|
||||
*/
|
||||
readonly statusCode: number;
|
||||
|
||||
/**
|
||||
The HTTP headers object.
|
||||
|
||||
Keys are in lowercase.
|
||||
*/
|
||||
readonly headers: Record<string, string>;
|
||||
|
||||
/**
|
||||
The response body.
|
||||
|
||||
The contents will be streamable but is also exposed directly as `response.body`.
|
||||
*/
|
||||
readonly body: Buffer;
|
||||
|
||||
/**
|
||||
The request URL string.
|
||||
*/
|
||||
readonly url: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
|
||||
|
||||
@example
|
||||
```
|
||||
import Response from 'responselike';
|
||||
|
||||
const response = new Response({
|
||||
statusCode: 200,
|
||||
headers: {
|
||||
foo: 'bar'
|
||||
},
|
||||
body: Buffer.from('Hi!'),
|
||||
url: 'https://example.com'
|
||||
});
|
||||
|
||||
response.statusCode;
|
||||
// 200
|
||||
|
||||
response.headers;
|
||||
// {foo: 'bar'}
|
||||
|
||||
response.body;
|
||||
// <Buffer 48 69 21>
|
||||
|
||||
response.url;
|
||||
// 'https://example.com'
|
||||
|
||||
response.pipe(process.stdout);
|
||||
// 'Hi!'
|
||||
```
|
||||
*/
|
||||
export default class Response extends ReadableStream {
|
||||
/**
|
||||
The HTTP response status code.
|
||||
*/
|
||||
readonly statusCode: number;
|
||||
|
||||
/**
|
||||
The HTTP headers.
|
||||
|
||||
Keys will be automatically lowercased.
|
||||
*/
|
||||
readonly headers: Record<string, string>;
|
||||
|
||||
/**
|
||||
The response body.
|
||||
*/
|
||||
readonly body: Buffer;
|
||||
|
||||
/**
|
||||
The request URL string.
|
||||
*/
|
||||
readonly url: string;
|
||||
|
||||
constructor(options?: Options);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
# get-intrinsic <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Get and robustly cache all JS language-level intrinsics at first require time.
|
||||
|
||||
See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var assert = require('assert');
|
||||
|
||||
// static methods
|
||||
assert.equal(GetIntrinsic('%Math.pow%'), Math.pow);
|
||||
assert.equal(Math.pow(2, 3), 8);
|
||||
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
|
||||
delete Math.pow;
|
||||
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
|
||||
|
||||
// instance methods
|
||||
var arr = [1];
|
||||
assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push);
|
||||
assert.deepEqual(arr, [1]);
|
||||
|
||||
arr.push(2);
|
||||
assert.deepEqual(arr, [1, 2]);
|
||||
|
||||
GetIntrinsic('%Array.prototype.push%').call(arr, 3);
|
||||
assert.deepEqual(arr, [1, 2, 3]);
|
||||
|
||||
delete Array.prototype.push;
|
||||
GetIntrinsic('%Array.prototype.push%').call(arr, 4);
|
||||
assert.deepEqual(arr, [1, 2, 3, 4]);
|
||||
|
||||
// missing features
|
||||
delete JSON.parse; // to simulate a real intrinsic that is missing in the environment
|
||||
assert.throws(() => GetIntrinsic('%JSON.parse%'));
|
||||
assert.equal(undefined, GetIntrinsic('%JSON.parse%', true));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
## Security
|
||||
|
||||
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||
|
||||
[package-url]: https://npmjs.org/package/get-intrinsic
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/get-intrinsic.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/get-intrinsic
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/get-intrinsic/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic
|
||||
[actions-url]: https://github.com/ljharb/get-intrinsic/actions
|
||||
@@ -0,0 +1,9 @@
|
||||
var freeGlobal = require('./_freeGlobal');
|
||||
|
||||
/** 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')();
|
||||
|
||||
module.exports = root;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapOneOrManyArgs.js","sourceRoot":"","sources":["../../../../src/internal/util/mapOneOrManyArgs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAE1B,SAAS,WAAW,CAAO,EAA2B,EAAE,IAAW;IAC/D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAMD,MAAM,UAAU,gBAAgB,CAAO,EAA2B;IAC9D,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;AAC7C,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').tryEach;
|
||||
@@ -0,0 +1,29 @@
|
||||
var test = require('tape');
|
||||
var path = require('path');
|
||||
var resolve = require('../');
|
||||
|
||||
test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = 'C:\\a\\b\\c\\d';
|
||||
|
||||
resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
t.equal(!!err, true);
|
||||
});
|
||||
});
|
||||
|
||||
test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var opts = {
|
||||
basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
|
||||
preserveSymlinks: false
|
||||
};
|
||||
|
||||
var module = './dotdot/abc';
|
||||
|
||||
resolve(module, opts, function (err, res) {
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
t.equal(res, undefined);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,138 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/CSVError.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> CSVError.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">88.24% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>15/17</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">66.67% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">87.5% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>14/16</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var util = require("util");
|
||||
export default class CSVError extends Error{
|
||||
static column_mismatched(index:number, extra?:string){
|
||||
return new CSVError("column_mismatched", index, extra);
|
||||
}
|
||||
static unclosed_quote(index:number, extra?:string){
|
||||
return new CSVError("unclosed_quote", index, extra);
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > static fromArray(</span>arr:any[]){
|
||||
<span class="cstat-no" title="statement not covered" > return new CSVError(arr[0],arr[1],arr[2]);</span>
|
||||
}
|
||||
constructor(
|
||||
public err:string,
|
||||
public line:number,
|
||||
public extra?: string
|
||||
){
|
||||
super("Error: " + err + ". JSON Line number: " + line + (extra ? " near: " + extra : ""))<span class="branch-1 cbranch-no" title="branch not covered" >;</span>
|
||||
this.name="CSV Parse Error";
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > toString(){</span>
|
||||
<span class="cstat-no" title="statement not covered" > return JSON.stringify([this.err, this.line, this.extra]); </span>
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
||||
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
||||
function invariant(condition, message, Err) {
|
||||
if (Err === void 0) { Err = Error; }
|
||||
if (!condition) {
|
||||
throw new Err(message);
|
||||
}
|
||||
}
|
||||
exports.invariant = invariant;
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
export interface ProxyResponse {
|
||||
statusCode: number;
|
||||
buffered: Buffer;
|
||||
}
|
||||
export default function parseProxyResponse(socket: Readable): Promise<ProxyResponse>;
|
||||
@@ -0,0 +1,38 @@
|
||||
import { AnimationFrameScheduler } from './AnimationFrameScheduler';
|
||||
/**
|
||||
*
|
||||
* Animation Frame Scheduler
|
||||
*
|
||||
* <span class="informal">Perform task when `window.requestAnimationFrame` would fire</span>
|
||||
*
|
||||
* When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler
|
||||
* behaviour.
|
||||
*
|
||||
* Without delay, `animationFrame` scheduler can be used to create smooth browser animations.
|
||||
* It makes sure scheduled task will happen just before next browser content repaint,
|
||||
* thus performing animations as efficiently as possible.
|
||||
*
|
||||
* ## Example
|
||||
* Schedule div height animation
|
||||
* ```ts
|
||||
* // html: <div style="background: #0ff;"></div>
|
||||
* import { animationFrameScheduler } from 'rxjs';
|
||||
*
|
||||
* const div = document.querySelector('div');
|
||||
*
|
||||
* animationFrameScheduler.schedule(function(height) {
|
||||
* div.style.height = height + "px";
|
||||
*
|
||||
* this.schedule(height + 1); // `this` references currently executing Action,
|
||||
* // which we reschedule with new state
|
||||
* }, 0, 0);
|
||||
*
|
||||
* // You will see a div element growing in height
|
||||
* ```
|
||||
*/
|
||||
export declare const animationFrameScheduler: AnimationFrameScheduler;
|
||||
/**
|
||||
* @deprecated Renamed to {@link animationFrameScheduler}. Will be removed in v8.
|
||||
*/
|
||||
export declare const animationFrame: AnimationFrameScheduler;
|
||||
//# sourceMappingURL=animationFrame.d.ts.map
|
||||
@@ -0,0 +1,29 @@
|
||||
import { getXHRResponse } from './getXHRResponse';
|
||||
var AjaxResponse = (function () {
|
||||
function AjaxResponse(originalEvent, xhr, request, type) {
|
||||
if (type === void 0) { type = 'download_load'; }
|
||||
this.originalEvent = originalEvent;
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.type = type;
|
||||
var status = xhr.status, responseType = xhr.responseType;
|
||||
this.status = status !== null && status !== void 0 ? status : 0;
|
||||
this.responseType = responseType !== null && responseType !== void 0 ? responseType : '';
|
||||
var allHeaders = xhr.getAllResponseHeaders();
|
||||
this.responseHeaders = allHeaders
|
||||
?
|
||||
allHeaders.split('\n').reduce(function (headers, line) {
|
||||
var index = line.indexOf(': ');
|
||||
headers[line.slice(0, index)] = line.slice(index + 2);
|
||||
return headers;
|
||||
}, {})
|
||||
: {};
|
||||
this.response = getXHRResponse(xhr);
|
||||
var loaded = originalEvent.loaded, total = originalEvent.total;
|
||||
this.loaded = loaded;
|
||||
this.total = total;
|
||||
}
|
||||
return AjaxResponse;
|
||||
}());
|
||||
export { AjaxResponse };
|
||||
//# sourceMappingURL=AjaxResponse.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Context } from 'preact';
|
||||
import { Config } from '../config';
|
||||
/**
|
||||
* This is a hack to get the current global config from Preact context.
|
||||
* My assumption is that we only need one global context which is the ConfigContext
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
export default function getConfig(context: {
|
||||
[key: string]: Context<any>;
|
||||
}): Config;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('tap', require('../tap'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var value = require("./valid-value")
|
||||
, objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
module.exports = function (obj) {
|
||||
var i;
|
||||
value(obj);
|
||||
for (i in obj) {
|
||||
// Jslint: ignore
|
||||
if (objPropertyIsEnumerable.call(obj, i)) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('stops parsing on the first non-option when stopEarly is set', function (t) {
|
||||
var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
|
||||
stopEarly: true,
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
aaa: 'bbb',
|
||||
_: ['ccc', '--ddd'],
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 KARASZI István
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,196 @@
|
||||
// Generated by LiveScript 1.4.0
|
||||
(function(){
|
||||
var identifierRegex, tokenRegex;
|
||||
identifierRegex = /[\$\w]+/;
|
||||
function peek(tokens){
|
||||
var token;
|
||||
token = tokens[0];
|
||||
if (token == null) {
|
||||
throw new Error('Unexpected end of input.');
|
||||
}
|
||||
return token;
|
||||
}
|
||||
function consumeIdent(tokens){
|
||||
var token;
|
||||
token = peek(tokens);
|
||||
if (!identifierRegex.test(token)) {
|
||||
throw new Error("Expected text, got '" + token + "' instead.");
|
||||
}
|
||||
return tokens.shift();
|
||||
}
|
||||
function consumeOp(tokens, op){
|
||||
var token;
|
||||
token = peek(tokens);
|
||||
if (token !== op) {
|
||||
throw new Error("Expected '" + op + "', got '" + token + "' instead.");
|
||||
}
|
||||
return tokens.shift();
|
||||
}
|
||||
function maybeConsumeOp(tokens, op){
|
||||
var token;
|
||||
token = tokens[0];
|
||||
if (token === op) {
|
||||
return tokens.shift();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function consumeArray(tokens){
|
||||
var types;
|
||||
consumeOp(tokens, '[');
|
||||
if (peek(tokens) === ']') {
|
||||
throw new Error("Must specify type of Array - eg. [Type], got [] instead.");
|
||||
}
|
||||
types = consumeTypes(tokens);
|
||||
consumeOp(tokens, ']');
|
||||
return {
|
||||
structure: 'array',
|
||||
of: types
|
||||
};
|
||||
}
|
||||
function consumeTuple(tokens){
|
||||
var components;
|
||||
components = [];
|
||||
consumeOp(tokens, '(');
|
||||
if (peek(tokens) === ')') {
|
||||
throw new Error("Tuple must be of at least length 1 - eg. (Type), got () instead.");
|
||||
}
|
||||
for (;;) {
|
||||
components.push(consumeTypes(tokens));
|
||||
maybeConsumeOp(tokens, ',');
|
||||
if (')' === peek(tokens)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
consumeOp(tokens, ')');
|
||||
return {
|
||||
structure: 'tuple',
|
||||
of: components
|
||||
};
|
||||
}
|
||||
function consumeFields(tokens){
|
||||
var fields, subset, ref$, key, types;
|
||||
fields = {};
|
||||
consumeOp(tokens, '{');
|
||||
subset = false;
|
||||
for (;;) {
|
||||
if (maybeConsumeOp(tokens, '...')) {
|
||||
subset = true;
|
||||
break;
|
||||
}
|
||||
ref$ = consumeField(tokens), key = ref$[0], types = ref$[1];
|
||||
fields[key] = types;
|
||||
maybeConsumeOp(tokens, ',');
|
||||
if ('}' === peek(tokens)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
consumeOp(tokens, '}');
|
||||
return {
|
||||
structure: 'fields',
|
||||
of: fields,
|
||||
subset: subset
|
||||
};
|
||||
}
|
||||
function consumeField(tokens){
|
||||
var key, types;
|
||||
key = consumeIdent(tokens);
|
||||
consumeOp(tokens, ':');
|
||||
types = consumeTypes(tokens);
|
||||
return [key, types];
|
||||
}
|
||||
function maybeConsumeStructure(tokens){
|
||||
switch (tokens[0]) {
|
||||
case '[':
|
||||
return consumeArray(tokens);
|
||||
case '(':
|
||||
return consumeTuple(tokens);
|
||||
case '{':
|
||||
return consumeFields(tokens);
|
||||
}
|
||||
}
|
||||
function consumeType(tokens){
|
||||
var token, wildcard, type, structure;
|
||||
token = peek(tokens);
|
||||
wildcard = token === '*';
|
||||
if (wildcard || identifierRegex.test(token)) {
|
||||
type = wildcard
|
||||
? consumeOp(tokens, '*')
|
||||
: consumeIdent(tokens);
|
||||
structure = maybeConsumeStructure(tokens);
|
||||
if (structure) {
|
||||
return structure.type = type, structure;
|
||||
} else {
|
||||
return {
|
||||
type: type
|
||||
};
|
||||
}
|
||||
} else {
|
||||
structure = maybeConsumeStructure(tokens);
|
||||
if (!structure) {
|
||||
throw new Error("Unexpected character: " + token);
|
||||
}
|
||||
return structure;
|
||||
}
|
||||
}
|
||||
function consumeTypes(tokens){
|
||||
var lookahead, types, typesSoFar, typeObj, type;
|
||||
if ('::' === peek(tokens)) {
|
||||
throw new Error("No comment before comment separator '::' found.");
|
||||
}
|
||||
lookahead = tokens[1];
|
||||
if (lookahead != null && lookahead === '::') {
|
||||
tokens.shift();
|
||||
tokens.shift();
|
||||
}
|
||||
types = [];
|
||||
typesSoFar = {};
|
||||
if ('Maybe' === peek(tokens)) {
|
||||
tokens.shift();
|
||||
types = [
|
||||
{
|
||||
type: 'Undefined'
|
||||
}, {
|
||||
type: 'Null'
|
||||
}
|
||||
];
|
||||
typesSoFar = {
|
||||
Undefined: true,
|
||||
Null: true
|
||||
};
|
||||
}
|
||||
for (;;) {
|
||||
typeObj = consumeType(tokens), type = typeObj.type;
|
||||
if (!typesSoFar[type]) {
|
||||
types.push(typeObj);
|
||||
}
|
||||
typesSoFar[type] = true;
|
||||
if (!maybeConsumeOp(tokens, '|')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
tokenRegex = RegExp('\\.\\.\\.|::|->|' + identifierRegex.source + '|\\S', 'g');
|
||||
module.exports = function(input){
|
||||
var tokens, e;
|
||||
if (!input.length) {
|
||||
throw new Error('No type specified.');
|
||||
}
|
||||
tokens = input.match(tokenRegex) || [];
|
||||
if (in$('->', tokens)) {
|
||||
throw new Error("Function types are not supported.\ To validate that something is a function, you may use 'Function'.");
|
||||
}
|
||||
try {
|
||||
return consumeTypes(tokens);
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
throw new Error(e.message + " - Remaining tokens: " + JSON.stringify(tokens) + " - Initial input: '" + input + "'");
|
||||
}
|
||||
};
|
||||
function in$(x, xs){
|
||||
var i = -1, l = xs.length >>> 0;
|
||||
while (++i < l) if (x === xs[i]) return true;
|
||||
return false;
|
||||
}
|
||||
}).call(this);
|
||||
@@ -0,0 +1,31 @@
|
||||
import { EndpointOptions } from "./EndpointOptions";
|
||||
import { OctokitResponse } from "./OctokitResponse";
|
||||
import { RequestInterface } from "./RequestInterface";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Route } from "./Route";
|
||||
/**
|
||||
* Interface to implement complex authentication strategies for Octokit.
|
||||
* An object Implementing the AuthInterface can directly be passed as the
|
||||
* `auth` option in the Octokit constructor.
|
||||
*
|
||||
* For the official implementations of the most common authentication
|
||||
* strategies, see https://github.com/octokit/auth.js
|
||||
*/
|
||||
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
|
||||
(...args: AuthOptions): Promise<Authentication>;
|
||||
hook: {
|
||||
/**
|
||||
* Sends a request using the passed `request` instance
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
|
||||
/**
|
||||
* Sends a request using the passed `request` instance
|
||||
*
|
||||
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.00327,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00653,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00327,"79":0,"80":0,"81":0,"82":0.00327,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.02614,"93":0,"94":0.00327,"95":0,"96":0,"97":0,"98":0.00327,"99":0,"100":0,"101":0,"102":0.01307,"103":0,"104":0.00327,"105":0,"106":0,"107":0.00653,"108":0.06207,"109":0.3365,"110":0.23522,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.00653,"35":0,"36":0,"37":0,"38":0.00653,"39":0,"40":0.00327,"41":0,"42":0,"43":0.00327,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00327,"50":0.00327,"51":0,"52":0,"53":0.00327,"54":0,"55":0.00327,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00327,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00327,"79":0.05881,"80":0.00653,"81":0.0392,"83":0.0098,"84":0,"85":0,"86":0.00327,"87":0.01634,"88":0.0098,"89":0,"90":0,"91":0.0196,"92":0.04247,"93":0.00327,"94":0.00327,"95":0.00327,"96":0.00327,"97":0.02287,"98":0.00327,"99":0.02287,"100":0.0392,"101":0.0098,"102":0.01307,"103":0.0294,"104":0.01307,"105":0.0098,"106":0.0196,"107":0.02287,"108":0.17642,"109":4.04455,"110":2.6136,"111":0.00327,"112":0.00327,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.01634,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0.00327,"64":0,"65":0,"66":0.01634,"67":0.05227,"68":0,"69":0,"70":0,"71":0.00327,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0.00327,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.0098,"94":0.12741,"95":0.10128,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00327,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00653,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00327,"104":0,"105":0.00327,"106":0.00327,"107":0.02287,"108":0.01307,"109":0.42471,"110":0.6142},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00327,"13":0.00327,"14":0.01634,"15":0.00327,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00653,"13.1":0.01634,"14.1":0.04574,"15.1":0.00327,"15.2-15.3":0.01307,"15.4":0.01307,"15.5":0.03267,"15.6":0.11108,"16.0":0.01634,"16.1":0.07514,"16.2":0.12415,"16.3":0.14048,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0.00239,"4.2-4.3":0,"5.0-5.1":0.01077,"6.0-6.1":0,"7.0-7.1":0.03111,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.08376,"10.0-10.2":0.00359,"10.3":0.06103,"11.0-11.2":0.00359,"11.3-11.4":0.0012,"12.0-12.1":0.01077,"12.2-12.5":0.40325,"13.0-13.1":0.0012,"13.2":0.00359,"13.3":0.00957,"13.4-13.7":0.0359,"14.0-14.4":0.09453,"14.5-14.8":0.33026,"15.0-15.1":0.06462,"15.2-15.3":0.17829,"15.4":0.11966,"15.5":0.21658,"15.6":0.86513,"16.0":1.1906,"16.1":2.43145,"16.2":2.71145,"16.3":2.29265,"16.4":0.01316},P:{"4":0.23468,"20":1.96926,"5.0-5.4":0.0102,"6.2-6.4":0,"7.2-7.4":0.21427,"8.2":0,"9.2":0.0102,"10.1":0.0102,"11.1-11.2":0.06122,"12.0":0.03061,"13.0":0.06122,"14.0":0.06122,"15.0":0.02041,"16.0":0.2959,"17.0":0.12244,"18.0":0.14285,"19.0":3.36712},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00359,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.07889},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.01307,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.53864},H:{"0":0.55457},L:{"0":67.88912},R:{_:"0"},M:{"0":0.39051},Q:{"13.1":0}};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, coerceToNaturalNumber = require("../../natural-number/coerce");
|
||||
|
||||
describe("natural-number/coerce", function () {
|
||||
it("Should coerce float to integer", function () {
|
||||
assert.equal(coerceToNaturalNumber(123.123), 123);
|
||||
assert.equal(coerceToNaturalNumber(123.823), 123);
|
||||
});
|
||||
it("Should coerce string", function () { assert.equal(coerceToNaturalNumber("12.123"), 12); });
|
||||
it("Should coerce booleans", function () { assert.equal(coerceToNaturalNumber(true), 1); });
|
||||
it("Should coerce number objects", function () {
|
||||
assert.equal(coerceToNaturalNumber(new Number(343)), 343);
|
||||
});
|
||||
it("Should coerce objects", function () {
|
||||
assert.equal(coerceToNaturalNumber({ valueOf: function () { return 23; } }), 23);
|
||||
});
|
||||
it("Should coerce number beyond Number.MAX_SAFE_INTEGER", function () {
|
||||
assert.equal(coerceToNaturalNumber(9007199254740992), 9007199254740992);
|
||||
});
|
||||
|
||||
it("Should reject negative number", function () {
|
||||
assert.equal(coerceToNaturalNumber(-1), null);
|
||||
});
|
||||
it("Should reject infinite number", function () {
|
||||
assert.equal(coerceToNaturalNumber(Infinity), null);
|
||||
});
|
||||
it("Should reject NaN", function () { assert.equal(coerceToNaturalNumber(NaN), null); });
|
||||
|
||||
if (typeof Object.create === "function") {
|
||||
it("Should not coerce objects with no number representation", function () {
|
||||
assert.equal(coerceToNaturalNumber(Object.create(null)), null);
|
||||
});
|
||||
}
|
||||
|
||||
it("Should not coerce null", function () { assert.equal(coerceToNaturalNumber(null), null); });
|
||||
it("Should not coerce undefined", function () {
|
||||
assert.equal(coerceToNaturalNumber(undefined), null);
|
||||
});
|
||||
|
||||
if (typeof Symbol === "function") {
|
||||
it("Should not coerce symbols", function () {
|
||||
assert.equal(coerceToNaturalNumber(Symbol("foo")), null);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user