new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.S_UNICODE_REGEX = void 0;
|
||||
// @generated from regex-gen.ts
|
||||
exports.S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
|
||||
@@ -0,0 +1,164 @@
|
||||
// Based on https://github.com/bramstein/url-template, licensed under BSD
|
||||
// TODO: create separate package.
|
||||
//
|
||||
// Copyright (c) 2012-2014, Bram Stein
|
||||
// All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. The name of the author may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
/* istanbul ignore file */
|
||||
function encodeReserved(str) {
|
||||
return str
|
||||
.split(/(%[0-9A-Fa-f]{2})/g)
|
||||
.map(function (part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value =
|
||||
operator === "+" || operator === "#"
|
||||
? encodeReserved(value)
|
||||
: encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
}
|
||||
else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" ||
|
||||
typeof value === "number" ||
|
||||
typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
|
||||
}
|
||||
else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
tmp.push(encodeValue(operator, value));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
}
|
||||
else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
}
|
||||
else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
}
|
||||
else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template),
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function (variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
}
|
||||
else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
}
|
||||
else {
|
||||
return values.join(",");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import { request, RequestOptions, ClientRequest, ServerResponse } from 'node:http';
|
||||
import { URL } from 'node:url';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { Store } from 'keyv';
|
||||
import ResponseLike from 'responselike';
|
||||
import { CachePolicyObject } from 'http-cache-semantics';
|
||||
export type RequestFn = typeof request;
|
||||
export type RequestFunction = typeof request;
|
||||
export type CacheResponse = ServerResponse | typeof ResponseLike;
|
||||
export type CacheableRequestFunction = (options: CacheableOptions, cb?: (response: CacheResponse) => void) => Emitter;
|
||||
export type CacheableOptions = Options & RequestOptions | string | URL;
|
||||
export type StorageAdapter = Store<any>;
|
||||
export interface Options {
|
||||
/**
|
||||
* If the cache should be used. Setting this to `false` will completely bypass the cache for the current request.
|
||||
* @default true
|
||||
*/
|
||||
cache?: boolean | undefined;
|
||||
/**
|
||||
* If set to `true` once a cached resource has expired it is deleted and will have to be re-requested.
|
||||
*
|
||||
* If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated
|
||||
* on the next request with `If-None-Match`/`If-Modified-Since` headers.
|
||||
* @default false
|
||||
*/
|
||||
strictTtl?: boolean | undefined;
|
||||
/**
|
||||
* Limits TTL. The `number` represents milliseconds.
|
||||
* @default undefined
|
||||
*/
|
||||
maxTtl?: number | undefined;
|
||||
/**
|
||||
* When set to `true`, if the DB connection fails we will automatically fallback to a network request.
|
||||
* DB errors will still be emitted to notify you of the problem even though the request callback may succeed.
|
||||
* @default false
|
||||
*/
|
||||
automaticFailover?: boolean | undefined;
|
||||
/**
|
||||
* Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a
|
||||
* new request and override the cache instead.
|
||||
* @default false
|
||||
*/
|
||||
forceRefresh?: boolean | undefined;
|
||||
remoteAddress?: boolean | undefined;
|
||||
url?: string | undefined;
|
||||
headers?: Record<string, string | string[] | undefined>;
|
||||
body?: Buffer;
|
||||
}
|
||||
export interface CacheValue extends Record<string, any> {
|
||||
url: string;
|
||||
statusCode: number;
|
||||
body: Buffer | string;
|
||||
cachePolicy: CachePolicyObject;
|
||||
}
|
||||
export interface Emitter extends EventEmitter {
|
||||
addListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
addListener(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
addListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
on(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
on(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
on(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
once(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
once(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
once(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
prependListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
prependListener(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
prependListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
prependOnceListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
prependOnceListener(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
prependOnceListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
removeListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
removeListener(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
removeListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
off(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
off(event: 'response', listener: (response: CacheResponse) => void): this;
|
||||
off(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
removeAllListeners(event?: 'request' | 'response' | 'error'): this;
|
||||
listeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
||||
listeners(event: 'response'): Array<(response: CacheResponse) => void>;
|
||||
listeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
||||
rawListeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
||||
rawListeners(event: 'response'): Array<(response: CacheResponse) => void>;
|
||||
rawListeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
||||
emit(event: 'request', request: ClientRequest): boolean;
|
||||
emit(event: 'response', response: CacheResponse): boolean;
|
||||
emit(event: 'error', error: RequestError | CacheError): boolean;
|
||||
eventNames(): Array<'request' | 'response' | 'error'>;
|
||||
listenerCount(type: 'request' | 'response' | 'error'): number;
|
||||
}
|
||||
export declare class RequestError extends Error {
|
||||
constructor(error: Error);
|
||||
}
|
||||
export declare class CacheError extends Error {
|
||||
constructor(error: Error);
|
||||
}
|
||||
export interface UrlOption {
|
||||
path: string;
|
||||
pathname?: string;
|
||||
search?: string;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
@@ -0,0 +1,7 @@
|
||||
export default function dlv(obj, key, def, p, undef) {
|
||||
key = key.split ? key.split('.') : key;
|
||||
for (p = 0; p < key.length; p++) {
|
||||
obj = obj ? obj[key[p]] : undef;
|
||||
}
|
||||
return obj === undef ? def : obj;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
var baseForRight = require('./_baseForRight'),
|
||||
keys = require('./keys');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forOwnRight` without support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseForOwnRight(object, iteratee) {
|
||||
return object && baseForRight(object, iteratee, keys);
|
||||
}
|
||||
|
||||
module.exports = baseForOwnRight;
|
||||
@@ -0,0 +1,59 @@
|
||||
import { YError } from '../yerror.js';
|
||||
let previouslyVisitedConfigs = [];
|
||||
let shim;
|
||||
export function applyExtends(config, cwd, mergeExtends, _shim) {
|
||||
shim = _shim;
|
||||
let defaultConfig = {};
|
||||
if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
|
||||
if (typeof config.extends !== 'string')
|
||||
return defaultConfig;
|
||||
const isPath = /\.json|\..*rc$/.test(config.extends);
|
||||
let pathToDefault = null;
|
||||
if (!isPath) {
|
||||
try {
|
||||
pathToDefault = require.resolve(config.extends);
|
||||
}
|
||||
catch (_err) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
|
||||
}
|
||||
checkForCircularExtends(pathToDefault);
|
||||
previouslyVisitedConfigs.push(pathToDefault);
|
||||
defaultConfig = isPath
|
||||
? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
|
||||
: require(config.extends);
|
||||
delete config.extends;
|
||||
defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
|
||||
}
|
||||
previouslyVisitedConfigs = [];
|
||||
return mergeExtends
|
||||
? mergeDeep(defaultConfig, config)
|
||||
: Object.assign({}, defaultConfig, config);
|
||||
}
|
||||
function checkForCircularExtends(cfgPath) {
|
||||
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
||||
throw new YError(`Circular extended configurations: '${cfgPath}'.`);
|
||||
}
|
||||
}
|
||||
function getPathToDefaultConfig(cwd, pathToExtend) {
|
||||
return shim.path.resolve(cwd, pathToExtend);
|
||||
}
|
||||
function mergeDeep(config1, config2) {
|
||||
const target = {};
|
||||
function isObject(obj) {
|
||||
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
||||
}
|
||||
Object.assign(target, config1);
|
||||
for (const key of Object.keys(config2)) {
|
||||
if (isObject(config2[key]) && isObject(target[key])) {
|
||||
target[key] = mergeDeep(config1[key], config2[key]);
|
||||
}
|
||||
else {
|
||||
target[key] = config2[key];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
# cli-boxes
|
||||
|
||||
> Boxes for use in the terminal
|
||||
|
||||
The list of boxes is just a [JSON file](boxes.json) and can be used anywhere.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install cli-boxes
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const cliBoxes = require('cli-boxes');
|
||||
|
||||
console.log(cliBoxes.single);
|
||||
/*
|
||||
{
|
||||
topLeft: '┌',
|
||||
top: '─',
|
||||
topRight: '┐',
|
||||
right: '│',
|
||||
bottomRight: '┘',
|
||||
bottom: '─',
|
||||
bottomLeft: '└',
|
||||
left: '│'
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cliBoxes
|
||||
|
||||
#### `single`
|
||||
|
||||
```
|
||||
┌────┐
|
||||
│ │
|
||||
└────┘
|
||||
```
|
||||
|
||||
#### `double`
|
||||
|
||||
```
|
||||
╔════╗
|
||||
║ ║
|
||||
╚════╝
|
||||
```
|
||||
|
||||
#### `round`
|
||||
|
||||
```
|
||||
╭────╮
|
||||
│ │
|
||||
╰────╯
|
||||
```
|
||||
|
||||
#### `bold`
|
||||
|
||||
```
|
||||
┏━━━━┓
|
||||
┃ ┃
|
||||
┗━━━━┛
|
||||
```
|
||||
|
||||
#### `singleDouble`
|
||||
|
||||
```
|
||||
╓────╖
|
||||
║ ║
|
||||
╙────╜
|
||||
```
|
||||
|
||||
#### `doubleSingle`
|
||||
|
||||
```
|
||||
╒════╕
|
||||
│ │
|
||||
╘════╛
|
||||
```
|
||||
|
||||
#### `classic`
|
||||
|
||||
```
|
||||
+----+
|
||||
| |
|
||||
+----+
|
||||
```
|
||||
|
||||
#### `arrow`
|
||||
|
||||
```
|
||||
↘↓↓↓↓↙
|
||||
→ ←
|
||||
↗↑↑↑↑↖
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [boxen](https://github.com/sindresorhus/boxen) - Create boxes in the terminal
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-cli-boxes?utm_source=npm-cli-boxes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
export default function escapeCommas(className) {
|
||||
return className.replace(/\\,/g, '\\2c ')
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "2.0.1",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export { identity as linear } from 'svelte/internal';
|
||||
export declare function backInOut(t: number): number;
|
||||
export declare function backIn(t: number): number;
|
||||
export declare function backOut(t: number): number;
|
||||
export declare function bounceOut(t: number): number;
|
||||
export declare function bounceInOut(t: number): number;
|
||||
export declare function bounceIn(t: number): number;
|
||||
export declare function circInOut(t: number): number;
|
||||
export declare function circIn(t: number): number;
|
||||
export declare function circOut(t: number): number;
|
||||
export declare function cubicInOut(t: number): number;
|
||||
export declare function cubicIn(t: number): number;
|
||||
export declare function cubicOut(t: number): number;
|
||||
export declare function elasticInOut(t: number): number;
|
||||
export declare function elasticIn(t: number): number;
|
||||
export declare function elasticOut(t: number): number;
|
||||
export declare function expoInOut(t: number): number;
|
||||
export declare function expoIn(t: number): number;
|
||||
export declare function expoOut(t: number): number;
|
||||
export declare function quadInOut(t: number): number;
|
||||
export declare function quadIn(t: number): number;
|
||||
export declare function quadOut(t: number): number;
|
||||
export declare function quartInOut(t: number): number;
|
||||
export declare function quartIn(t: number): number;
|
||||
export declare function quartOut(t: number): number;
|
||||
export declare function quintInOut(t: number): number;
|
||||
export declare function quintIn(t: number): number;
|
||||
export declare function quintOut(t: number): number;
|
||||
export declare function sineInOut(t: number): number;
|
||||
export declare function sineIn(t: number): number;
|
||||
export declare function sineOut(t: number): number;
|
||||
@@ -0,0 +1,100 @@
|
||||
import { statSync, createReadStream, promises as fs } from 'node:fs'
|
||||
import { basename } from 'node:path'
|
||||
import DOMException from 'node-domexception'
|
||||
|
||||
import File from './file.js'
|
||||
import Blob from './index.js'
|
||||
|
||||
const { stat } = fs
|
||||
|
||||
/**
|
||||
* @param {string} path filepath on the disk
|
||||
* @param {string} [type] mimetype to use
|
||||
*/
|
||||
const blobFromSync = (path, type) => fromBlob(statSync(path), path, type)
|
||||
|
||||
/**
|
||||
* @param {string} path filepath on the disk
|
||||
* @param {string} [type] mimetype to use
|
||||
* @returns {Promise<Blob>}
|
||||
*/
|
||||
const blobFrom = (path, type) => stat(path).then(stat => fromBlob(stat, path, type))
|
||||
|
||||
/**
|
||||
* @param {string} path filepath on the disk
|
||||
* @param {string} [type] mimetype to use
|
||||
* @returns {Promise<File>}
|
||||
*/
|
||||
const fileFrom = (path, type) => stat(path).then(stat => fromFile(stat, path, type))
|
||||
|
||||
/**
|
||||
* @param {string} path filepath on the disk
|
||||
* @param {string} [type] mimetype to use
|
||||
*/
|
||||
const fileFromSync = (path, type) => fromFile(statSync(path), path, type)
|
||||
|
||||
// @ts-ignore
|
||||
const fromBlob = (stat, path, type = '') => new Blob([new BlobDataItem({
|
||||
path,
|
||||
size: stat.size,
|
||||
lastModified: stat.mtimeMs,
|
||||
start: 0
|
||||
})], { type })
|
||||
|
||||
// @ts-ignore
|
||||
const fromFile = (stat, path, type = '') => new File([new BlobDataItem({
|
||||
path,
|
||||
size: stat.size,
|
||||
lastModified: stat.mtimeMs,
|
||||
start: 0
|
||||
})], basename(path), { type, lastModified: stat.mtimeMs })
|
||||
|
||||
/**
|
||||
* This is a blob backed up by a file on the disk
|
||||
* with minium requirement. Its wrapped around a Blob as a blobPart
|
||||
* so you have no direct access to this.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
class BlobDataItem {
|
||||
#path
|
||||
#start
|
||||
|
||||
constructor (options) {
|
||||
this.#path = options.path
|
||||
this.#start = options.start
|
||||
this.size = options.size
|
||||
this.lastModified = options.lastModified
|
||||
}
|
||||
|
||||
/**
|
||||
* Slicing arguments is first validated and formatted
|
||||
* to not be out of range by Blob.prototype.slice
|
||||
*/
|
||||
slice (start, end) {
|
||||
return new BlobDataItem({
|
||||
path: this.#path,
|
||||
lastModified: this.lastModified,
|
||||
size: end - start,
|
||||
start: this.#start + start
|
||||
})
|
||||
}
|
||||
|
||||
async * stream () {
|
||||
const { mtimeMs } = await stat(this.#path)
|
||||
if (mtimeMs > this.lastModified) {
|
||||
throw new DOMException('The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.', 'NotReadableError')
|
||||
}
|
||||
yield * createReadStream(this.#path, {
|
||||
start: this.#start,
|
||||
end: this.#start + this.size - 1
|
||||
})
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag] () {
|
||||
return 'Blob'
|
||||
}
|
||||
}
|
||||
|
||||
export default blobFromSync
|
||||
export { File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync }
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
let Node = require('./node')
|
||||
|
||||
class Comment extends Node {
|
||||
constructor(defaults) {
|
||||
super(defaults)
|
||||
this.type = 'comment'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comment
|
||||
Comment.default = Comment
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
// These settings are duplicated in .editorconfig:
|
||||
tabWidth: 2, // indent_size = 2
|
||||
useTabs: false, // indent_style = space
|
||||
endOfLine: 'lf', // end_of_line = lf
|
||||
semi: false, // default: true
|
||||
singleQuote: true, // default: false
|
||||
printWidth: 100, // default: 80
|
||||
trailingComma: 'es5',
|
||||
bracketSpacing: true,
|
||||
overrides: [
|
||||
{
|
||||
files: '*.js',
|
||||
options: {
|
||||
parser: 'flow',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function isExpression(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'ArrayExpression':
|
||||
case 'AssignmentExpression':
|
||||
case 'BinaryExpression':
|
||||
case 'CallExpression':
|
||||
case 'ConditionalExpression':
|
||||
case 'FunctionExpression':
|
||||
case 'Identifier':
|
||||
case 'Literal':
|
||||
case 'LogicalExpression':
|
||||
case 'MemberExpression':
|
||||
case 'NewExpression':
|
||||
case 'ObjectExpression':
|
||||
case 'SequenceExpression':
|
||||
case 'ThisExpression':
|
||||
case 'UnaryExpression':
|
||||
case 'UpdateExpression':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isIterationStatement(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'DoWhileStatement':
|
||||
case 'ForInStatement':
|
||||
case 'ForStatement':
|
||||
case 'WhileStatement':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isStatement(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'BlockStatement':
|
||||
case 'BreakStatement':
|
||||
case 'ContinueStatement':
|
||||
case 'DebuggerStatement':
|
||||
case 'DoWhileStatement':
|
||||
case 'EmptyStatement':
|
||||
case 'ExpressionStatement':
|
||||
case 'ForInStatement':
|
||||
case 'ForStatement':
|
||||
case 'IfStatement':
|
||||
case 'LabeledStatement':
|
||||
case 'ReturnStatement':
|
||||
case 'SwitchStatement':
|
||||
case 'ThrowStatement':
|
||||
case 'TryStatement':
|
||||
case 'VariableDeclaration':
|
||||
case 'WhileStatement':
|
||||
case 'WithStatement':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSourceElement(node) {
|
||||
return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
|
||||
}
|
||||
|
||||
function trailingStatement(node) {
|
||||
switch (node.type) {
|
||||
case 'IfStatement':
|
||||
if (node.alternate != null) {
|
||||
return node.alternate;
|
||||
}
|
||||
return node.consequent;
|
||||
|
||||
case 'LabeledStatement':
|
||||
case 'ForStatement':
|
||||
case 'ForInStatement':
|
||||
case 'WhileStatement':
|
||||
case 'WithStatement':
|
||||
return node.body;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isProblematicIfStatement(node) {
|
||||
var current;
|
||||
|
||||
if (node.type !== 'IfStatement') {
|
||||
return false;
|
||||
}
|
||||
if (node.alternate == null) {
|
||||
return false;
|
||||
}
|
||||
current = node.consequent;
|
||||
do {
|
||||
if (current.type === 'IfStatement') {
|
||||
if (current.alternate == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
current = trailingStatement(current);
|
||||
} while (current);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isExpression: isExpression,
|
||||
isStatement: isStatement,
|
||||
isIterationStatement: isIterationStatement,
|
||||
isSourceElement: isSourceElement,
|
||||
isProblematicIfStatement: isProblematicIfStatement,
|
||||
|
||||
trailingStatement: trailingStatement
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
@@ -0,0 +1,83 @@
|
||||
import { SchedulerLike, ValueFromArray } from '../types';
|
||||
import { Observable } from '../Observable';
|
||||
import { popScheduler } from '../util/args';
|
||||
import { from } from './from';
|
||||
|
||||
// Devs are more likely to pass null or undefined than they are a scheduler
|
||||
// without accompanying values. To make things easier for (naughty) devs who
|
||||
// use the `strictNullChecks: false` TypeScript compiler option, these
|
||||
// overloads with explicit null and undefined values are included.
|
||||
|
||||
export function of(value: null): Observable<null>;
|
||||
export function of(value: undefined): Observable<undefined>;
|
||||
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function of(scheduler: SchedulerLike): Observable<never>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function of<A extends readonly unknown[]>(...valuesAndScheduler: [...A, SchedulerLike]): Observable<ValueFromArray<A>>;
|
||||
|
||||
export function of(): Observable<never>;
|
||||
/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */
|
||||
export function of<T>(): Observable<T>;
|
||||
export function of<T>(value: T): Observable<T>;
|
||||
export function of<A extends readonly unknown[]>(...values: A): Observable<ValueFromArray<A>>;
|
||||
|
||||
/**
|
||||
* Converts the arguments to an observable sequence.
|
||||
*
|
||||
* <span class="informal">Each argument becomes a `next` notification.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Unlike {@link from}, it does not do any flattening and emits each argument in whole
|
||||
* as a separate `next` notification.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Emit the values `10, 20, 30`
|
||||
*
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
*
|
||||
* of(10, 20, 30)
|
||||
* .subscribe({
|
||||
* next: value => console.log('next:', value),
|
||||
* error: err => console.log('error:', err),
|
||||
* complete: () => console.log('the end'),
|
||||
* });
|
||||
*
|
||||
* // Outputs
|
||||
* // next: 10
|
||||
* // next: 20
|
||||
* // next: 30
|
||||
* // the end
|
||||
* ```
|
||||
*
|
||||
* Emit the array `[1, 2, 3]`
|
||||
*
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
*
|
||||
* of([1, 2, 3])
|
||||
* .subscribe({
|
||||
* next: value => console.log('next:', value),
|
||||
* error: err => console.log('error:', err),
|
||||
* complete: () => console.log('the end'),
|
||||
* });
|
||||
*
|
||||
* // Outputs
|
||||
* // next: [1, 2, 3]
|
||||
* // the end
|
||||
* ```
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link range}
|
||||
*
|
||||
* @param {...T} values A comma separated list of arguments you want to be emitted
|
||||
* @return {Observable} An Observable that emits the arguments
|
||||
* described above and then completes.
|
||||
*/
|
||||
export function of<T>(...args: Array<T | SchedulerLike>): Observable<T> {
|
||||
const scheduler = popScheduler(args);
|
||||
return from(args as T[], scheduler);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import _ from 'lodash';
|
||||
import sinon from 'sinon';
|
||||
import semver from 'semver';
|
||||
import { parseVersion } from '../../lib/util.js';
|
||||
import Log from '../../lib/log.js';
|
||||
import Config from '../../lib/config.js';
|
||||
import ShellStub from '../stub/shell.js';
|
||||
import Spinner from '../../lib/spinner.js';
|
||||
import Prompt from '../../lib/prompt.js';
|
||||
|
||||
export let factory = (Definition, { namespace, options = {}, container = {} } = {}) => {
|
||||
_.defaults(options, { ci: true, verbose: false, 'dry-run': false, debug: false });
|
||||
|
||||
const ns = namespace || Definition.name.toLowerCase();
|
||||
|
||||
container.config = container.config || new Config(Object.assign({ config: false }, options));
|
||||
container.log = container.log || sinon.createStubInstance(Log);
|
||||
|
||||
const spinner = container.spinner || sinon.createStubInstance(Spinner);
|
||||
spinner.show.callsFake(({ enabled = true, task }) => (enabled ? task() : () => {}));
|
||||
container.spinner = spinner;
|
||||
container.shell = container.shell || new ShellStub({ container });
|
||||
container.prompt = container.prompt || new Prompt({ container });
|
||||
container.shell.cache = { set: () => {}, has: () => false };
|
||||
|
||||
return new Definition({
|
||||
namespace: ns,
|
||||
options,
|
||||
container
|
||||
});
|
||||
};
|
||||
|
||||
const getIncrement = plugin =>
|
||||
plugin.getIncrement(plugin.options) || plugin.getContext('increment') || plugin.config.getContext('increment');
|
||||
|
||||
const getVersion = async (plugin, options) => {
|
||||
const { latestVersion, increment } = options;
|
||||
return (
|
||||
(await plugin.getIncrementedVersionCI(options)) ||
|
||||
(await plugin.getIncrementedVersion(options)) ||
|
||||
(increment !== false ? semver.inc(latestVersion, increment || 'patch') : latestVersion)
|
||||
);
|
||||
};
|
||||
|
||||
export let runTasks = async plugin => {
|
||||
await plugin.init();
|
||||
|
||||
const name = (await plugin.getName()) || '__test__';
|
||||
const latestVersion = (await plugin.getLatestVersion()) || '1.0.0';
|
||||
const latestTag = plugin.config.getContext('latestTag');
|
||||
const changelog = (await plugin.getChangelog(latestVersion)) || null;
|
||||
const increment = getIncrement(plugin);
|
||||
|
||||
plugin.config.setContext({ name, latestVersion, latestTag, changelog });
|
||||
|
||||
const { preRelease } = plugin.config.options;
|
||||
const isPreRelease = Boolean(preRelease);
|
||||
const preReleaseId = typeof preRelease === 'string' ? preRelease : null;
|
||||
const version = await getVersion(plugin, { latestVersion, increment, isPreRelease, preReleaseId });
|
||||
|
||||
plugin.config.setContext(parseVersion(version));
|
||||
|
||||
await plugin.beforeBump();
|
||||
await plugin.bump(version);
|
||||
|
||||
const tagName = plugin.config.getContext('tagName') || version;
|
||||
plugin.config.setContext({ tagName });
|
||||
|
||||
await plugin.beforeRelease();
|
||||
await plugin.release();
|
||||
await plugin.afterRelease();
|
||||
|
||||
return {
|
||||
name,
|
||||
latestVersion,
|
||||
version
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
import type {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert object properties to delimiter case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see DelimiterCase
|
||||
@see DelimiterCasedPropertiesDeep
|
||||
|
||||
@example
|
||||
```
|
||||
import type {DelimiterCasedProperties} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
userId: number;
|
||||
userName: string;
|
||||
}
|
||||
|
||||
const result: DelimiterCasedProperties<User, '-'> = {
|
||||
'user-id': 1,
|
||||
'user-name': 'Tom',
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type DelimiterCasedProperties<
|
||||
Value,
|
||||
Delimiter extends string,
|
||||
> = Value extends Function
|
||||
? Value
|
||||
: Value extends Array<infer U>
|
||||
? Value
|
||||
: {[K in keyof Value as DelimiterCase<K, Delimiter>]: Value[K]};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"publishReplay.js","sourceRoot":"","sources":["../../../../src/internal/operators/publishReplay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA8EhD,MAAM,UAAU,aAAa,CAC3B,UAAmB,EACnB,UAAmB,EACnB,mBAAgE,EAChE,iBAAqC;IAErC,IAAI,mBAAmB,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE;QAC3D,iBAAiB,GAAG,mBAAmB,CAAC;KACzC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IAGnF,OAAO,CAAC,MAAqB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,aAAa,CAAI,UAAU,EAAE,UAAU,EAAE,iBAAiB,CAAC,EAAE,QAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAClI,CAAC"}
|
||||
@@ -0,0 +1,189 @@
|
||||
import { Transform, TransformOptions, Readable } from "stream";
|
||||
import { CSVParseParam, mergeParams } from "./Parameters";
|
||||
import { ParseRuntime, initParseRuntime } from "./ParseRuntime";
|
||||
import P from "bluebird";
|
||||
import { stringToLines } from "./fileline";
|
||||
import { map } from "lodash/map";
|
||||
import { RowSplit, RowSplitResult } from "./rowSplit";
|
||||
import getEol from "./getEol";
|
||||
import lineToJson, { JSONResult } from "./lineToJson";
|
||||
import { Processor, ProcessLineResult } from "./Processor";
|
||||
// import { ProcessorFork } from "./ProcessFork";
|
||||
import { ProcessorLocal } from "./ProcessorLocal";
|
||||
import { Result } from "./Result";
|
||||
import CSVError from "./CSVError";
|
||||
import { bufFromString } from "./util";
|
||||
|
||||
|
||||
|
||||
export class Converter extends Transform implements PromiseLike<any[]> {
|
||||
preRawData(onRawData: PreRawDataCallback): Converter {
|
||||
this.runtime.preRawDataHook = onRawData;
|
||||
return this;
|
||||
}
|
||||
preFileLine(onFileLine: PreFileLineCallback): Converter {
|
||||
this.runtime.preFileLineHook = onFileLine;
|
||||
return this;
|
||||
}
|
||||
subscribe(
|
||||
onNext?: (data: any, lineNumber: number) => void | PromiseLike<void>,
|
||||
onError?: (err: CSVError) => void,
|
||||
onCompleted?: () => void): Converter {
|
||||
this.parseRuntime.subscribe = {
|
||||
onNext,
|
||||
onError,
|
||||
onCompleted
|
||||
}
|
||||
return this;
|
||||
}
|
||||
fromFile(filePath: string, options?: string | CreateReadStreamOption | undefined): Converter {
|
||||
const fs = require("fs");
|
||||
// var rs = null;
|
||||
// this.wrapCallback(cb, function () {
|
||||
// if (rs && rs.destroy) {
|
||||
// rs.destroy();
|
||||
// }
|
||||
// });
|
||||
fs.exists(filePath, (exist) => {
|
||||
if (exist) {
|
||||
const rs = fs.createReadStream(filePath, options);
|
||||
rs.pipe(this);
|
||||
} else {
|
||||
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
fromStream(readStream: Readable): Converter {
|
||||
readStream.pipe(this);
|
||||
return this;
|
||||
}
|
||||
fromString(csvString: string): Converter {
|
||||
const csv = csvString.toString();
|
||||
const read = new Readable();
|
||||
let idx = 0;
|
||||
read._read = function (size) {
|
||||
if (idx >= csvString.length) {
|
||||
this.push(null);
|
||||
} else {
|
||||
const str = csvString.substr(idx, size);
|
||||
this.push(str);
|
||||
idx += size;
|
||||
}
|
||||
}
|
||||
return this.fromStream(read);
|
||||
}
|
||||
then<TResult1 = any[], TResult2 = never>(onfulfilled?: (value: any[]) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2> {
|
||||
return new P((resolve, reject) => {
|
||||
this.parseRuntime.then = {
|
||||
onfulfilled: (value: any[]) => {
|
||||
if (onfulfilled) {
|
||||
resolve(onfulfilled(value));
|
||||
} else {
|
||||
resolve(value as any);
|
||||
}
|
||||
},
|
||||
onrejected: (err: Error) => {
|
||||
if (onrejected) {
|
||||
resolve(onrejected(err));
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public get parseParam(): CSVParseParam {
|
||||
return this.params;
|
||||
}
|
||||
public get parseRuntime(): ParseRuntime {
|
||||
return this.runtime;
|
||||
}
|
||||
private params: CSVParseParam;
|
||||
private runtime: ParseRuntime;
|
||||
private processor: Processor;
|
||||
private result: Result;
|
||||
constructor(param?: Partial<CSVParseParam>, public options: TransformOptions = {}) {
|
||||
super(options);
|
||||
this.params = mergeParams(param);
|
||||
this.runtime = initParseRuntime(this);
|
||||
this.result = new Result(this);
|
||||
// if (this.params.fork) {
|
||||
// this.processor = new ProcessorFork(this);
|
||||
// } else {
|
||||
this.processor = new ProcessorLocal(this);
|
||||
// }
|
||||
this.once("error", (err: any) => {
|
||||
// console.log("BBB");
|
||||
//wait for next cycle to emit the errors.
|
||||
setImmediate(() => {
|
||||
this.result.processError(err);
|
||||
this.emit("done", err);
|
||||
});
|
||||
|
||||
});
|
||||
this.once("done", () => {
|
||||
this.processor.destroy();
|
||||
})
|
||||
|
||||
return this;
|
||||
}
|
||||
_transform(chunk: any, encoding: string, cb: Function) {
|
||||
this.processor.process(chunk)
|
||||
.then((result) => {
|
||||
// console.log(result);
|
||||
if (result.length > 0) {
|
||||
this.runtime.started = true;
|
||||
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.emit("drained");
|
||||
cb();
|
||||
}, (error) => {
|
||||
this.runtime.hasError = true;
|
||||
this.runtime.error = error;
|
||||
this.emit("error", error);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
_flush(cb: Function) {
|
||||
this.processor.flush()
|
||||
.then((data) => {
|
||||
if (data.length > 0) {
|
||||
|
||||
return this.result.processResult(data);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.processEnd(cb);
|
||||
}, (err) => {
|
||||
this.emit("error", err);
|
||||
cb();
|
||||
})
|
||||
}
|
||||
private processEnd(cb) {
|
||||
this.result.endProcess();
|
||||
this.emit("done");
|
||||
cb();
|
||||
}
|
||||
get parsedLineNumber(): number {
|
||||
return this.runtime.parsedLineNumber;
|
||||
}
|
||||
}
|
||||
export interface CreateReadStreamOption {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
export type CallBack = (err: Error, data: Array<any>) => void;
|
||||
|
||||
|
||||
export type PreFileLineCallback = (line: string, lineNumber: number) => string | PromiseLike<string>;
|
||||
export type PreRawDataCallback = (csvString: string) => string | PromiseLike<string>;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports = require('./ary');
|
||||
@@ -0,0 +1,22 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer)
|
||||
Copyright (c) 2017-2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { Writable, Readable } from 'svelte/store';
|
||||
import type { Params } from '../DataHandler';
|
||||
import type { Sorted } from './Handlers/Rows';
|
||||
export default class Context {
|
||||
rowsPerPage: Writable<number | null>;
|
||||
pageNumber: Writable<number>;
|
||||
triggerChange: Writable<number>;
|
||||
globalSearch: Writable<{
|
||||
value: string | null;
|
||||
scope: string[] | null;
|
||||
}>;
|
||||
filters: Writable<any[]>;
|
||||
rawRows: Writable<any[]>;
|
||||
private filteredRows;
|
||||
rows: Readable<any[]>;
|
||||
rowCount: Readable<{
|
||||
total: number;
|
||||
start: number;
|
||||
end: number;
|
||||
}>;
|
||||
pages: Readable<number[]>;
|
||||
pagesWithEllipsis: Readable<number[]>;
|
||||
pageCount: Readable<number>;
|
||||
sorted: Writable<Sorted>;
|
||||
constructor(data: any[], params: Params);
|
||||
private createFilteredRows;
|
||||
private createPaginatedRows;
|
||||
private createRowCount;
|
||||
private createPages;
|
||||
private createPagesWithEllipsis;
|
||||
private createPageCount;
|
||||
private stringMatch;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var str = "abc\uD834\uDF06def";
|
||||
|
||||
module.exports = function () {
|
||||
if (typeof str.codePointAt !== "function") return false;
|
||||
return str.codePointAt(3) === 0x1d306;
|
||||
};
|
||||
@@ -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.00435,"26":0.0087,"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.00435,"53":0,"54":0,"55":0,"56":0.0087,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.0087,"69":0.00435,"70":0.00435,"71":0.00435,"72":0.0087,"73":0.00435,"74":0.00435,"75":0.00435,"76":0.00435,"77":0.00435,"78":0.0087,"79":0.0522,"80":0.0174,"81":0.0087,"82":0.00435,"83":0.00435,"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.00435,"98":0,"99":0.00435,"100":0,"101":0,"102":0.00435,"103":0,"104":0,"105":0.00435,"106":0,"107":0.00435,"108":0.01305,"109":0.30015,"110":0.17835,"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.01305,"32":0.00435,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.0087,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00435,"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.00435,"64":0,"65":0.00435,"66":0,"67":0,"68":0.03915,"69":0.02175,"70":0.02175,"71":0.0261,"72":0.0348,"73":0.0174,"74":0.03915,"75":0.0261,"76":0.0261,"77":0.0261,"78":0.03915,"79":0.0696,"80":0.10005,"81":0.0435,"83":0.03915,"84":0.0261,"85":0.0435,"86":0.0696,"87":0.0609,"88":0.0522,"89":0.04785,"90":0.28275,"91":0.24795,"92":0.23925,"93":0.23055,"94":0.23055,"95":0.01305,"96":0.0174,"97":0.0087,"98":0.0087,"99":0.0087,"100":0.0261,"101":0.0087,"102":0.0174,"103":0.03915,"104":0.02175,"105":0.02175,"106":0.03915,"107":0.0696,"108":0.31755,"109":7.59075,"110":4.29345,"111":0.00435,"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.00435,"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.0087,"54":0.0087,"55":0.0087,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.0087,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00435,"75":0,"76":0,"77":0,"78":0,"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.01305,"94":0.15225,"95":0.10005,"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.00435,"79":0.00435,"80":0.0174,"81":0.01305,"83":0.01305,"84":0.0174,"85":0.0087,"86":0.01305,"87":0.0087,"88":0.0087,"89":0.01305,"90":0.0087,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0.00435,"97":0,"98":0.00435,"99":0,"100":0,"101":0,"102":0,"103":0.00435,"104":0.00435,"105":0.00435,"106":0.0087,"107":0.0174,"108":0.03045,"109":0.4959,"110":0.5916},E:{"4":0,"5":0,"6":0,"7":0,"8":0.0522,"9":0,"10":0,"11":0,"12":0,"13":0.00435,"14":0.0174,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0.00435,"7.1":0,"9.1":0.2001,"10.1":0,"11.1":0,"12.1":0,"13.1":0.0174,"14.1":0.0522,"15.1":0.00435,"15.2-15.3":0.0087,"15.4":0.01305,"15.5":0.0348,"15.6":0.1305,"16.0":0.01305,"16.1":0.03915,"16.2":0.1305,"16.3":0.08265,"16.4":0},G:{"8":0.00218,"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.02182,"8.1-8.4":0.00436,"9.0-9.2":0.01091,"9.3":0.07856,"10.0-10.2":0.01309,"10.3":0.08074,"11.0-11.2":0.04801,"11.3-11.4":0.02837,"12.0-12.1":0.05237,"12.2-12.5":0.34914,"13.0-13.1":0.02837,"13.2":0.02619,"13.3":0.06765,"13.4-13.7":0.1222,"14.0-14.4":0.40587,"14.5-14.8":0.78556,"15.0-15.1":0.12656,"15.2-15.3":0.18984,"15.4":0.25749,"15.5":0.59572,"15.6":2.2825,"16.0":2.5749,"16.1":5.14544,"16.2":5.14326,"16.3":2.57272,"16.4":0.01091},P:{"4":0.05137,"20":1.94169,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.04109,"8.2":0,"9.2":0.04109,"10.1":0,"11.1-11.2":0.12328,"12.0":0.02055,"13.0":0.12328,"14.0":0.14383,"15.0":0.06164,"16.0":0.17465,"17.0":0.11301,"18.0":0.22602,"19.0":3.66764},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.02179,"4.4":0,"4.4.3-4.4.4":0.03736},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0.00435,"11":0.05655,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.02825},H:{"0":0.21931},L:{"0":50.3023},R:{_:"0"},M:{"0":0.26555},Q:{"13.1":0}};
|
||||
@@ -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.00825,"53":0,"54":0.00413,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.00413,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00413,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.0165,"79":0,"80":0,"81":0,"82":0.03713,"83":0,"84":0.00413,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.00413,"92":0,"93":0,"94":0,"95":0,"96":0.00413,"97":0,"98":0,"99":0,"100":0.00413,"101":0,"102":0.01238,"103":0,"104":0,"105":0.00413,"106":0.00413,"107":0.00825,"108":0.05363,"109":0.84975,"110":0.54863,"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.00825,"39":0,"40":0,"41":0,"42":0,"43":0.00413,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00413,"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,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00413,"74":0,"75":0,"76":0,"77":0.00413,"78":0,"79":0.02475,"80":0,"81":0.00825,"83":0.02063,"84":0.00413,"85":0.00413,"86":0.05363,"87":0.02888,"88":0,"89":0,"90":0,"91":0.00413,"92":0.00413,"93":0,"94":0,"95":0,"96":0.00413,"97":0.00413,"98":0.00413,"99":0.00413,"100":0.02475,"101":0,"102":0.0165,"103":0.15263,"104":0.00825,"105":0.01238,"106":0.01238,"107":0.033,"108":0.17738,"109":4.422,"110":3.32475,"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,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.00413,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00413,"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,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0.06188,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"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.1155,"94":0.49088,"95":0.17325,"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.00413,"13":0,"14":0,"15":0,"16":0,"17":0.00825,"18":0.00413,"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.00413,"93":0.00413,"94":0,"95":0,"96":0,"97":0.04125,"98":0,"99":0,"100":0,"101":0,"102":0.00825,"103":0,"104":0,"105":0,"106":0.00413,"107":0.02475,"108":0.03713,"109":1.31175,"110":1.78613},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00413,"14":0.07425,"15":0.02475,_:"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.033,"13.1":0.15675,"14.1":0.14438,"15.1":0.03713,"15.2-15.3":0.0165,"15.4":0.07838,"15.5":0.06188,"15.6":0.31763,"16.0":0.05363,"16.1":0.16088,"16.2":0.43725,"16.3":0.30525,"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.12635,"10.0-10.2":0,"10.3":0.07088,"11.0-11.2":0.00308,"11.3-11.4":0,"12.0-12.1":0.05239,"12.2-12.5":0.41602,"13.0-13.1":0.01541,"13.2":0.00308,"13.3":0.07088,"13.4-13.7":0.10786,"14.0-14.4":0.29892,"14.5-14.8":0.84745,"15.0-15.1":0.22496,"15.2-15.3":0.24345,"15.4":0.34514,"15.5":2.29583,"15.6":2.40061,"16.0":4.44682,"16.1":6.70567,"16.2":7.08471,"16.3":3.963,"16.4":0.03698},P:{"4":0.02068,"20":1.46799,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.09304,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.04135,"12.0":0.03101,"13.0":0.02068,"14.0":0.04135,"15.0":0.02068,"16.0":0.0827,"17.0":0.04135,"18.0":0.16541,"19.0":2.79126},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00682,"4.4":0,"4.4.3-4.4.4":0.17743},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.0495,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.28788},H:{"0":0.06674},L:{"0":46.094},R:{_:"0"},M:{"0":0.29375},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,69 @@
|
||||
import packageJson from '../../../../package.json'
|
||||
|
||||
export function help({ message, usage, commands, options }) {
|
||||
let indent = 2
|
||||
|
||||
// Render header
|
||||
console.log()
|
||||
console.log(`${packageJson.name} v${packageJson.version}`)
|
||||
|
||||
// Render message
|
||||
if (message) {
|
||||
console.log()
|
||||
for (let msg of message.split('\n')) {
|
||||
console.log(msg)
|
||||
}
|
||||
}
|
||||
|
||||
// Render usage
|
||||
if (usage && usage.length > 0) {
|
||||
console.log()
|
||||
console.log('Usage:')
|
||||
for (let example of usage) {
|
||||
console.log(' '.repeat(indent), example)
|
||||
}
|
||||
}
|
||||
|
||||
// Render commands
|
||||
if (commands && commands.length > 0) {
|
||||
console.log()
|
||||
console.log('Commands:')
|
||||
for (let command of commands) {
|
||||
console.log(' '.repeat(indent), command)
|
||||
}
|
||||
}
|
||||
|
||||
// Render options
|
||||
if (options) {
|
||||
let groupedOptions = {}
|
||||
for (let [key, value] of Object.entries(options)) {
|
||||
if (typeof value === 'object') {
|
||||
groupedOptions[key] = { ...value, flags: [key] }
|
||||
} else {
|
||||
groupedOptions[value].flags.push(key)
|
||||
}
|
||||
}
|
||||
|
||||
console.log()
|
||||
console.log('Options:')
|
||||
for (let { flags, description, deprecated } of Object.values(groupedOptions)) {
|
||||
if (deprecated) continue
|
||||
|
||||
if (flags.length === 1) {
|
||||
console.log(
|
||||
' '.repeat(indent + 4 /* 4 = "-i, ".length */),
|
||||
flags.slice().reverse().join(', ').padEnd(20, ' '),
|
||||
description
|
||||
)
|
||||
} else {
|
||||
console.log(
|
||||
' '.repeat(indent),
|
||||
flags.slice().reverse().join(', ').padEnd(24, ' '),
|
||||
description
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log()
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
var asciiWords = require('./_asciiWords'),
|
||||
hasUnicodeWord = require('./_hasUnicodeWord'),
|
||||
toString = require('./toString'),
|
||||
unicodeWords = require('./_unicodeWords');
|
||||
|
||||
/**
|
||||
* Splits `string` into an array of its words.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to inspect.
|
||||
* @param {RegExp|string} [pattern] The pattern to match words.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
* @example
|
||||
*
|
||||
* _.words('fred, barney, & pebbles');
|
||||
* // => ['fred', 'barney', 'pebbles']
|
||||
*
|
||||
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
||||
* // => ['fred', 'barney', '&', 'pebbles']
|
||||
*/
|
||||
function words(string, pattern, guard) {
|
||||
string = toString(string);
|
||||
pattern = guard ? undefined : pattern;
|
||||
|
||||
if (pattern === undefined) {
|
||||
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
||||
}
|
||||
return string.match(pattern) || [];
|
||||
}
|
||||
|
||||
module.exports = words;
|
||||
@@ -0,0 +1,211 @@
|
||||
# escalade [](https://github.com/lukeed/escalade/actions) [](https://codecov.io/gh/lukeed/escalade)
|
||||
|
||||
> A tiny (183B to 210B) and [fast](#benchmarks) utility to ascend parent directories
|
||||
|
||||
With [escalade](https://en.wikipedia.org/wiki/Escalade), you can scale parent directories until you've found what you're looking for.<br>Given an input file or directory, `escalade` will continue executing your callback function until either:
|
||||
|
||||
1) the callback returns a truthy value
|
||||
2) `escalade` has reached the system root directory (eg, `/`)
|
||||
|
||||
> **Important:**<br>Please note that `escalade` only deals with direct ancestry – it will not dive into parents' sibling directories.
|
||||
|
||||
---
|
||||
|
||||
**Notice:** As of v3.1.0, `escalade` now includes [Deno support](http://deno.land/x/escalade)! Please see [Deno Usage](#deno) below.
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save escalade
|
||||
```
|
||||
|
||||
|
||||
## Modes
|
||||
|
||||
There are two "versions" of `escalade` available:
|
||||
|
||||
#### "async"
|
||||
> **Node.js:** >= 8.x<br>
|
||||
> **Size (gzip):** 210 bytes<br>
|
||||
> **Availability:** [CommonJS](https://unpkg.com/escalade/dist/index.js), [ES Module](https://unpkg.com/escalade/dist/index.mjs)
|
||||
|
||||
This is the primary/default mode. It makes use of `async`/`await` and [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original).
|
||||
|
||||
#### "sync"
|
||||
> **Node.js:** >= 6.x<br>
|
||||
> **Size (gzip):** 183 bytes<br>
|
||||
> **Availability:** [CommonJS](https://unpkg.com/escalade/sync/index.js), [ES Module](https://unpkg.com/escalade/sync/index.mjs)
|
||||
|
||||
This is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
***Example Structure***
|
||||
|
||||
```
|
||||
/Users/lukeed
|
||||
└── oss
|
||||
├── license
|
||||
└── escalade
|
||||
├── package.json
|
||||
└── test
|
||||
└── fixtures
|
||||
├── index.js
|
||||
└── foobar
|
||||
└── demo.js
|
||||
```
|
||||
|
||||
***Example Usage***
|
||||
|
||||
```js
|
||||
//~> demo.js
|
||||
import { join } from 'path';
|
||||
import escalade from 'escalade';
|
||||
|
||||
const input = join(__dirname, 'demo.js');
|
||||
// or: const input = __dirname;
|
||||
|
||||
const pkg = await escalade(input, (dir, names) => {
|
||||
console.log('~> dir:', dir);
|
||||
console.log('~> names:', names);
|
||||
console.log('---');
|
||||
|
||||
if (names.includes('package.json')) {
|
||||
// will be resolved into absolute
|
||||
return 'package.json';
|
||||
}
|
||||
});
|
||||
|
||||
//~> dir: /Users/lukeed/oss/escalade/test/fixtures/foobar
|
||||
//~> names: ['demo.js']
|
||||
//---
|
||||
//~> dir: /Users/lukeed/oss/escalade/test/fixtures
|
||||
//~> names: ['index.js', 'foobar']
|
||||
//---
|
||||
//~> dir: /Users/lukeed/oss/escalade/test
|
||||
//~> names: ['fixtures']
|
||||
//---
|
||||
//~> dir: /Users/lukeed/oss/escalade
|
||||
//~> names: ['package.json', 'test']
|
||||
//---
|
||||
|
||||
console.log(pkg);
|
||||
//=> /Users/lukeed/oss/escalade/package.json
|
||||
|
||||
// Now search for "missing123.txt"
|
||||
// (Assume it doesn't exist anywhere!)
|
||||
const missing = await escalade(input, (dir, names) => {
|
||||
console.log('~> dir:', dir);
|
||||
return names.includes('missing123.txt') && 'missing123.txt';
|
||||
});
|
||||
|
||||
//~> dir: /Users/lukeed/oss/escalade/test/fixtures/foobar
|
||||
//~> dir: /Users/lukeed/oss/escalade/test/fixtures
|
||||
//~> dir: /Users/lukeed/oss/escalade/test
|
||||
//~> dir: /Users/lukeed/oss/escalade
|
||||
//~> dir: /Users/lukeed/oss
|
||||
//~> dir: /Users/lukeed
|
||||
//~> dir: /Users
|
||||
//~> dir: /
|
||||
|
||||
console.log(missing);
|
||||
//=> undefined
|
||||
```
|
||||
|
||||
> **Note:** To run the above example with "sync" mode, import from `escalade/sync` and remove the `await` keyword.
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### escalade(input, callback)
|
||||
Returns: `string|void` or `Promise<string|void>`
|
||||
|
||||
When your `callback` locates a file, `escalade` will resolve/return with an absolute path.<br>
|
||||
If your `callback` was never satisfied, then `escalade` will resolve/return with nothing (undefined).
|
||||
|
||||
> **Important:**<br>The `sync` and `async` versions share the same API.<br>The **only** difference is that `sync` is not Promise-based.
|
||||
|
||||
#### input
|
||||
Type: `string`
|
||||
|
||||
The path from which to start ascending.
|
||||
|
||||
This may be a file or a directory path.<br>However, when `input` is a file, `escalade` will begin with its parent directory.
|
||||
|
||||
> **Important:** Unless given an absolute path, `input` will be resolved from `process.cwd()` location.
|
||||
|
||||
#### callback
|
||||
Type: `Function`
|
||||
|
||||
The callback to execute for each ancestry level. It always is given two arguments:
|
||||
|
||||
1) `dir` - an absolute path of the current parent directory
|
||||
2) `names` - a list (`string[]`) of contents _relative to_ the `dir` parent
|
||||
|
||||
> **Note:** The `names` list can contain names of files _and_ directories.
|
||||
|
||||
When your callback returns a _falsey_ value, then `escalade` will continue with `dir`'s parent directory, re-invoking your callback with new argument values.
|
||||
|
||||
When your callback returns a string, then `escalade` stops iteration immediately.<br>
|
||||
If the string is an absolute path, then it's left as is. Otherwise, the string is resolved into an absolute path _from_ the `dir` that housed the satisfying condition.
|
||||
|
||||
> **Important:** Your `callback` can be a `Promise/AsyncFunction` when using the "async" version of `escalade`.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> Running on Node.js v10.13.0
|
||||
|
||||
```
|
||||
# Load Time
|
||||
find-up 3.891ms
|
||||
escalade 0.485ms
|
||||
escalade/sync 0.309ms
|
||||
|
||||
# Levels: 6 (target = "foo.txt"):
|
||||
find-up x 24,856 ops/sec ±6.46% (55 runs sampled)
|
||||
escalade x 73,084 ops/sec ±4.23% (73 runs sampled)
|
||||
find-up.sync x 3,663 ops/sec ±1.12% (83 runs sampled)
|
||||
escalade/sync x 9,360 ops/sec ±0.62% (88 runs sampled)
|
||||
|
||||
# Levels: 12 (target = "package.json"):
|
||||
find-up x 29,300 ops/sec ±10.68% (70 runs sampled)
|
||||
escalade x 73,685 ops/sec ± 5.66% (66 runs sampled)
|
||||
find-up.sync x 1,707 ops/sec ± 0.58% (91 runs sampled)
|
||||
escalade/sync x 4,667 ops/sec ± 0.68% (94 runs sampled)
|
||||
|
||||
# Levels: 18 (target = "missing123.txt"):
|
||||
find-up x 21,818 ops/sec ±17.37% (14 runs sampled)
|
||||
escalade x 67,101 ops/sec ±21.60% (20 runs sampled)
|
||||
find-up.sync x 1,037 ops/sec ± 2.86% (88 runs sampled)
|
||||
escalade/sync x 1,248 ops/sec ± 0.50% (93 runs sampled)
|
||||
```
|
||||
|
||||
## Deno
|
||||
|
||||
As of v3.1.0, `escalade` is available on the Deno registry.
|
||||
|
||||
Please note that the [API](#api) is identical and that there are still [two modes](#modes) from which to choose:
|
||||
|
||||
```ts
|
||||
// Choose "async" mode
|
||||
import escalade from 'https://deno.land/escalade/async.ts';
|
||||
|
||||
// Choose "sync" mode
|
||||
import escalade from 'https://deno.land/escalade/sync.ts';
|
||||
```
|
||||
|
||||
> **Important:** The `allow-read` permission is required!
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [premove](https://github.com/lukeed/premove) - A tiny (247B) utility to remove items recursively
|
||||
- [totalist](https://github.com/lukeed/totalist) - A tiny (195B to 224B) utility to recursively list all (total) files in a directory
|
||||
- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (420B) utility to make a directory and its parents, recursively
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
||||
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "9.0.0";
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.auditTime = void 0;
|
||||
var async_1 = require("../scheduler/async");
|
||||
var audit_1 = require("./audit");
|
||||
var timer_1 = require("../observable/timer");
|
||||
function auditTime(duration, scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
|
||||
return audit_1.audit(function () { return timer_1.timer(duration, scheduler); });
|
||||
}
|
||||
exports.auditTime = auditTime;
|
||||
//# sourceMappingURL=auditTime.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
// Inspired by: http://documentcloud.github.com/underscore/#compact
|
||||
|
||||
"use strict";
|
||||
|
||||
var isValue = require("../../object/is-value");
|
||||
|
||||
var filter = Array.prototype.filter;
|
||||
|
||||
module.exports = function () {
|
||||
return filter.call(this, function (val) { return isValue(val); });
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "cli-spinners",
|
||||
"version": "2.7.0",
|
||||
"description": "Spinners for use in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/cli-spinners",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"asciicast": "asciinema rec --command='node example-all.js' --title='cli-spinner' --quiet"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"spinners.json"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"spinner",
|
||||
"spinners",
|
||||
"terminal",
|
||||
"term",
|
||||
"console",
|
||||
"ascii",
|
||||
"unicode",
|
||||
"loading",
|
||||
"indicator",
|
||||
"progress",
|
||||
"busy",
|
||||
"wait",
|
||||
"idle",
|
||||
"json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"log-update": "^3.2.0",
|
||||
"string-length": "^4.0.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -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.00236,"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.00236,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0.01887,"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,"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.00236,"100":0,"101":0,"102":0.00236,"103":0,"104":0.00236,"105":0.00236,"106":0.00472,"107":0.00944,"108":0.00944,"109":0.16041,"110":0.08728,"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.00236,"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.00236,"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,"67":0,"68":0,"69":0,"70":0.00236,"71":0,"72":0,"73":0,"74":0.00236,"75":0.00236,"76":0,"77":0,"78":0.00708,"79":0.00472,"80":0.00236,"81":0.00236,"83":0.00236,"84":0.00236,"85":0.00236,"86":0.00472,"87":0.00472,"88":0.00944,"89":0.00708,"90":0.00236,"91":0.00472,"92":0.03067,"93":0.00236,"94":0.00236,"95":0.00472,"96":0.00708,"97":0.00472,"98":0.00472,"99":0.00944,"100":0.00472,"101":0.00236,"102":0.00944,"103":0.0118,"104":0.00472,"105":0.00944,"106":0.02831,"107":0.02595,"108":0.06605,"109":2.27408,"110":1.21724,"111":0.00236,"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,"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,"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,"79":0.00236,"80":0,"81":0,"82":0,"83":0.00236,"84":0.00236,"85":0,"86":0.00472,"87":0,"88":0.00236,"89":0.00236,"90":0.00236,"91":0.00472,"92":0.00236,"93":0.03067,"94":0.07549,"95":0.02123,"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,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.00236,"92":0.00236,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.00236,"108":0.00944,"109":0.18872,"110":0.27836},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00708,"15":0.00236,_:"0","3.1":0,"3.2":0,"5.1":0.01415,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00236,"13.1":0.00708,"14.1":0.01415,"15.1":0.00236,"15.2-15.3":0.00236,"15.4":0.00472,"15.5":0.01887,"15.6":0.04954,"16.0":0.0118,"16.1":0.02595,"16.2":0.07549,"16.3":0.05898,"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.01859,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02479,"10.0-10.2":0,"10.3":0.06197,"11.0-11.2":0.00413,"11.3-11.4":0.00413,"12.0-12.1":0.00826,"12.2-12.5":0.47097,"13.0-13.1":0.00413,"13.2":0,"13.3":0.02892,"13.4-13.7":0.0599,"14.0-14.4":0.26027,"14.5-14.8":0.60111,"15.0-15.1":0.11155,"15.2-15.3":0.21689,"15.4":0.2706,"15.5":0.50815,"15.6":1.55751,"16.0":2.92291,"16.1":3.85659,"16.2":4.59816,"16.3":3.09436,"16.4":0.0062},P:{"4":0.06104,"20":0.92583,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.11191,"8.2":0,"9.2":0.03052,"10.1":0,"11.1-11.2":0.07122,"12.0":0.03052,"13.0":0.05087,"14.0":0.06104,"15.0":0.10174,"16.0":0.10174,"17.0":0.10174,"18.0":0.13226,"19.0":1.90252},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.0185,"4.4":0,"4.4.3-4.4.4":0.14801},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00708,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.28272},H:{"0":0.18808},L:{"0":70.63067},R:{_:"0"},M:{"0":0.16046},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"umd.js","sourceRoot":"","sources":["../../../src/internal/umd.ts"],"names":[],"mappings":"AAKA,cAAc,UAAU,CAAC;AAGzB,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AAGpC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAGhC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC;AAG1B,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AAGpC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC"}
|
||||
@@ -0,0 +1,97 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OperatorFunction, TruthyTypesOf } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
|
||||
export function find<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export function find<T, S extends T, A>(
|
||||
predicate: (this: A, value: T, index: number, source: Observable<T>) => value is S,
|
||||
thisArg: A
|
||||
): OperatorFunction<T, S | undefined>;
|
||||
export function find<T, S extends T>(
|
||||
predicate: (value: T, index: number, source: Observable<T>) => value is S
|
||||
): OperatorFunction<T, S | undefined>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export function find<T, A>(
|
||||
predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,
|
||||
thisArg: A
|
||||
): OperatorFunction<T, T | undefined>;
|
||||
export function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, T | undefined>;
|
||||
/**
|
||||
* Emits only the first value emitted by the source Observable that meets some
|
||||
* condition.
|
||||
*
|
||||
* <span class="informal">Finds the first value that passes some test and emits
|
||||
* that.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `find` searches for the first item in the source Observable that matches the
|
||||
* specified condition embodied by the `predicate`, and returns the first
|
||||
* occurrence in the source. Unlike {@link first}, the `predicate` is required
|
||||
* in `find`, and does not emit an error if a valid value is not found
|
||||
* (emits `undefined` instead).
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Find and emit the first click that happens on a DIV element
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, find } from 'rxjs';
|
||||
*
|
||||
* const div = document.createElement('div');
|
||||
* div.style.cssText = 'width: 200px; height: 200px; background: #09c;';
|
||||
* document.body.appendChild(div);
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const result = clicks.pipe(find(ev => (<HTMLElement>ev.target).tagName === 'DIV'));
|
||||
* result.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link filter}
|
||||
* @see {@link first}
|
||||
* @see {@link findIndex}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
|
||||
* A function called with each item to test for condition matching.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return A function that returns an Observable that emits the first item that
|
||||
* matches the condition.
|
||||
*/
|
||||
export function find<T>(
|
||||
predicate: (value: T, index: number, source: Observable<T>) => boolean,
|
||||
thisArg?: any
|
||||
): OperatorFunction<T, T | undefined> {
|
||||
return operate(createFind(predicate, thisArg, 'value'));
|
||||
}
|
||||
|
||||
export function createFind<T>(
|
||||
predicate: (value: T, index: number, source: Observable<T>) => boolean,
|
||||
thisArg: any,
|
||||
emit: 'value' | 'index'
|
||||
) {
|
||||
const findIndex = emit === 'index';
|
||||
return (source: Observable<T>, subscriber: Subscriber<any>) => {
|
||||
let index = 0;
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => {
|
||||
const i = index++;
|
||||
if (predicate.call(thisArg, value, i, source)) {
|
||||
subscriber.next(findIndex ? i : value);
|
||||
subscriber.complete();
|
||||
}
|
||||
},
|
||||
() => {
|
||||
subscriber.next(findIndex ? -1 : undefined);
|
||||
subscriber.complete();
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dataClean.js","sourceRoot":"","sources":["../src/dataClean.ts"],"names":[],"mappings":";;;;;AACA,wDAAiC;AACjC;;;;;GAKG;AACH,qBAA4B,KAAa,EAAE,OAAqB;IAC9D,IAAM,SAAS,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAClC,IAAM,cAAc,GAAG,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE;QAC7B,OAAO,mBAAQ,CAAC,cAAc,CAAC,CAAC;KACjC;SAAM;QACL,OAAO,cAAc,CAAC;KACvB;AACH,CAAC;AATD,kCASC;AACD;;GAEG;AACH,yBAAyB,KAAa,EAAE,OAAqB;IAC3D,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7D,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;KACtD;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AACD;;GAEG;AACH,wBAAwB,KAAa,EAAE,OAAqB;IAC1D,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,EAAE;YACpC,GAAG,EAAE,CAAC;SACP;QACD,GAAG,EAAE,CAAC;KACP;IACD,IAAI,GAAG,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;QAC9B,cAAc;QACd,iBAAiB;QACjB,iBAAiB;QACjB,8BAA8B;QAC9B,2FAA2F;QAC3F,WAAW;QACX,gCAAgC;QAChC,MAAM;QACN,WAAW;QACX,IAAI;KACL;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAA;AAEhC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,oBAAY,SAAS;IACnB,uCAAuC;IACvC,6BAA6B,IAAI;IACjC,qCAAqC;IACrC,cAAc,IAAI;IAClB,6CAA6C;IAC7C,kBAAkB,IAAI;IACtB,8CAA8C;IAC9C,oBAAoB,IAAI;IACxB,mDAAmD;IACnD,qBAAqB,IAAI;IACzB,wDAAwD;IACxD,qBAAqB,IAAI;IACzB,sCAAsC;IACtC,uBAAuB,IAAI;IAC3B,yCAAyC;IACzC,0BAA0B,IAAI;IAC9B,6EAA6E;IAC7E,sBAAsB,IAAI;IAC1B,8EAA8E;IAC9E,yBAAyB,KAAK;IAC9B,+EAA+E;IAC/E,gCAAgC,KAAK;IACrC,6DAA6D;IAC7D,8BAA8B,KAAK;IAEnC,sGAAsG;IACtG,mCAAmC,KAAK;IACxC,+FAA+F;IAC/F,oCAAoC,KAAK;IAEzC,sEAAsE;IACtE,+BAA+B,KAAK;IACpC,yFAAyF;IACzF,+BAA+B,KAAK;IAEpC,6FAA6F;IAC7F,wCAAwC,KAAK;IAC7C;;;OAGG;IACH,wCAAwC,KAAK;IAE7C,0FAA0F;IAC1F,gCAAgC,KAAK;IAErC;;;OAGG;IACH,kCAAkC,KAAK;IACvC;;OAEG;IACH,kCAAkC,KAAK;IAEvC,iEAAiE;IACjE,oBAAoB,KAAK;IAEzB,uDAAuD;IACvD,WAAW,KAAK;IAChB,uDAAuD;IACvD,gBAAgB,KAAK;IACrB,kFAAkF;IAClF,qBAAqB,KAAK;IAC1B,oEAAoE;IACpE,YAAY,KAAK;CAClB"}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type JwtNotProvidedError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').everyLimit;
|
||||
Reference in New Issue
Block a user