new license file version [CI SKIP]

This commit is contained in:
2023-03-15 13:43:57 +00:00
parent d8a3063735
commit 00359d25c1
5600 changed files with 523898 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = rng;
var _crypto = _interopRequireDefault(require("crypto"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
let poolPtr = rnds8Pool.length;
function rng() {
if (poolPtr > rnds8Pool.length - 16) {
_crypto.default.randomFillSync(rnds8Pool);
poolPtr = 0;
}
return rnds8Pool.slice(poolPtr, poolPtr += 16);
}

View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("rxjs-compat/operator/merge"));
//# sourceMappingURL=merge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sequenceEqual.js","sources":["../src/operators/sequenceEqual.ts"],"names":[],"mappings":";;;;;AAAA,yDAAoD"}

View File

@@ -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.00487,"27":0.08276,"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.00487,"44":0,"45":0,"46":0,"47":0.00487,"48":0,"49":0,"50":0,"51":0,"52":0.26774,"53":0,"54":0.37484,"55":0.00487,"56":0.00974,"57":0.00487,"58":0.00487,"59":0,"60":0.00974,"61":0.0146,"62":0.00487,"63":0,"64":0,"65":0.00487,"66":0.00974,"67":0.00487,"68":0.0146,"69":0.00487,"70":0.00487,"71":0,"72":0.01947,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01947,"79":0.00487,"80":0.00487,"81":0.00487,"82":0.00487,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00974,"89":0.00487,"90":0.00487,"91":0.0146,"92":0,"93":0.00487,"94":0.00487,"95":0.00487,"96":0,"97":0,"98":0.00487,"99":0.01947,"100":0.00487,"101":0.00974,"102":0.02921,"103":0.0146,"104":0.01947,"105":0.0146,"106":0.01947,"107":0.03894,"108":0.86164,"109":0.54522,"110":0.00487,"111":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.00487,"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.00487,"43":0,"44":0,"45":0.00487,"46":0,"47":0.00487,"48":0,"49":0.16551,"50":0,"51":0,"52":0.00487,"53":0,"54":0,"55":0,"56":0.00974,"57":0,"58":0.00487,"59":0,"60":0,"61":0,"62":0,"63":0.00487,"64":0.00487,"65":0.02434,"66":0.00487,"67":0.00974,"68":0.0146,"69":0.00974,"70":0.00974,"71":0.00487,"72":0.00487,"73":0.0146,"74":0.00974,"75":0.0146,"76":0.02434,"77":0.00974,"78":0.00487,"79":0.02921,"80":0.00974,"81":0.0146,"83":0.01947,"84":0.01947,"85":0.02921,"86":0.01947,"87":0.03408,"88":0.02921,"89":0.00974,"90":0.0146,"91":0.03894,"92":0.02921,"93":0.01947,"94":0.0146,"95":0.01947,"96":0.04381,"97":0.06328,"98":0.02921,"99":0.03894,"100":0.05842,"101":0.04381,"102":0.05842,"103":0.11196,"104":0.06815,"105":0.11196,"106":0.13144,"107":0.20932,"108":6.83954,"109":5.77345,"110":0.00487,"111":0,"112":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.00487,"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.00487,"55":0,"56":0,"57":0,"58":0,"60":0.00487,"62":0,"63":0.00974,"64":0,"65":0,"66":0.00487,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00974,"74":0.00487,"75":0,"76":0,"77":0,"78":0,"79":0.0146,"80":0,"81":0,"82":0,"83":0.00487,"84":0,"85":0.00974,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00487,"93":0.34076,"94":0.52574,"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.00487,"16":0,"17":0,"18":0.00487,"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.00487,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0.00487,"105":0.00487,"106":0.00487,"107":0.01947,"108":0.45759,"109":0.43812},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00487,"15":0.00487,_:"0","3.1":0,"3.2":0,"5.1":0.00487,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.00974,"14.1":0.0146,"15.1":0.00487,"15.2-15.3":0.00487,"15.4":0.00974,"15.5":0.0146,"15.6":0.05355,"16.0":0.00974,"16.1":0.02921,"16.2":0.03408,"16.3":0},G:{"8":0.00047,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00614,"6.0-6.1":0.00283,"7.0-7.1":0.01086,"8.1-8.4":0.01086,"9.0-9.2":0.00189,"9.3":0.09207,"10.0-10.2":0.00189,"10.3":0.07743,"11.0-11.2":0.00378,"11.3-11.4":0.00283,"12.0-12.1":0.00472,"12.2-12.5":0.24883,"13.0-13.1":0.01275,"13.2":0.00519,"13.3":0.01322,"13.4-13.7":0.02975,"14.0-14.4":0.06988,"14.5-14.8":0.1577,"15.0-15.1":0.03683,"15.2-15.3":0.06469,"15.4":0.07319,"15.5":0.10624,"15.6":0.46839,"16.0":0.6412,"16.1":1.14122,"16.2":0.93488,"16.3":0.08641},P:{"4":0.19827,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.08348,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01044,"12.0":0,"13.0":0.03131,"14.0":0.01044,"15.0":0.01044,"16.0":0.03131,"17.0":0.12522,"18.0":0.05218,"19.0":0.69915},I:{"0":0,"3":0,"4":0.00766,"2.1":0,"2.2":0,"2.3":0,"4.1":0.02298,"4.2-4.3":0.04085,"4.4":0,"4.4.3-4.4.4":0.58214},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.03894,"5.5":0},J:{"7":0,"10":0.00513},N:{"10":0,"11":0},S:{"2.5":0.00513},R:{_:"0"},M:{"0":0.15909},Q:{"13.1":0},O:{"0":0.05132},H:{"0":0.46643},L:{"0":72.35244}};

View File

@@ -0,0 +1,455 @@
/*!
* Toastify js 1.10.0
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2018 Varun A P
*/
/**
* Options used for Toastify
* @typedef {Object} ToastifyConfigurationObject
* @property {string} text - Message to be displayed in the toast
* @property {Element} node - Provide a node to be mounted inside the toast. node takes higher precedence over text
* @property {number} duration - Duration for which the toast should be displayed. -1 for permanent toast
* @property {string|Element} selector - CSS ID Selector on which the toast should be added
* @property {url} destination - URL to which the browser should be navigated on click of the toast
* @property {boolean} newWindow - Decides whether the destination should be opened in a new window or not
* @property {boolean} close - To show the close icon or not
* @property {string} gravity - To show the toast from top or bottom
* @property {string} position - To show the toast on left or right
* @property {string} backgroundColor - Deprecated: Sets the background color of the toast
* @property {url} avatar - Image/icon to be shown before text
* @property {string} className - Ability to provide custom class name for further customization
* @property {boolean} stopOnFocus - To stop timer when hovered over the toast (Only if duration is set)
* @property {Function} callback - Invoked when the toast is dismissed
* @property {Function} onClick - Invoked when the toast is clicked
* @property {Object} offset - Ability to add some offset to axis
* @property {boolean} escapeMarkup - Toggle the default behavior of escaping HTML markup
* @property {Object} style - Use the HTML DOM style property to add styles to toast
*/
class Toastify {
constructor(options) {
/**
* The version of Toastify
* @type {string}
* @public
*/
this.version = "1.10.0";
/**
* The configuration object to configure Toastify
* @type {ToastifyConfigurationObject}
* @public
*/
this.options = {};
/**
* The element that is the Toast
* @type {Element}
* @public
*/
this.toastElement = null;
/**
* The root element that contains all the toasts
* @type {Element}
* @private
*/
this._rootElement = document.body;
this._init(options);
}
/**
* Display the toast
* @public
*/
showToast() {
// Creating the DOM object for the toast
this.toastElement = this._buildToast();
// Getting the root element to with the toast needs to be added
if (typeof this.options.selector === "string") {
this._rootElement = document.getElementById(this.options.selector);
} else if (this.options.selector instanceof HTMLElement || this.options.selector instanceof ShadowRoot) {
this._rootElement = this.options.selector;
} else {
this._rootElement = document.body;
}
// Validating if root element is present in DOM
if (!this._rootElement) {
throw "Root element is not defined";
}
// Adding the DOM element
this._rootElement.insertBefore(this.toastElement, this._rootElement.firstChild);
// Repositioning the toasts in case multiple toasts are present
this._reposition();
if (this.options.duration > 0) {
this.toastElement.timeOutValue = window.setTimeout(
() => {
// Remove the toast from DOM
this._removeElement(this.toastElement);
},
this.options.duration
); // Binding `this` for function invocation
}
// Supporting function chaining
return this;
}
/**
* Hide the toast
* @public
*/
hideToast() {
if (this.toastElement.timeOutValue) {
clearTimeout(this.toastElement.timeOutValue);
}
this._removeElement(this.toastElement);
}
/**
* Init the Toastify class
* @param {ToastifyConfigurationObject} options - The configuration object to configure Toastify
* @param {string} [options.text=Hi there!] - Message to be displayed in the toast
* @param {Element} [options.node] - Provide a node to be mounted inside the toast. node takes higher precedence over text
* @param {number} [options.duration=3000] - Duration for which the toast should be displayed. -1 for permanent toast
* @param {string} [options.selector] - CSS Selector on which the toast should be added
* @param {url} [options.destination] - URL to which the browser should be navigated on click of the toast
* @param {boolean} [options.newWindow=false] - Decides whether the destination should be opened in a new window or not
* @param {boolean} [options.close=false] - To show the close icon or not
* @param {string} [options.gravity=toastify-top] - To show the toast from top or bottom
* @param {string} [options.position=right] - To show the toast on left or right
* @param {string} [options.backgroundColor] - Sets the background color of the toast (To be deprecated)
* @param {url} [options.avatar] - Image/icon to be shown before text
* @param {string} [options.className] - Ability to provide custom class name for further customization
* @param {boolean} [options.stopOnFocus] - To stop timer when hovered over the toast (Only if duration is set)
* @param {Function} [options.callback] - Invoked when the toast is dismissed
* @param {Function} [options.onClick] - Invoked when the toast is clicked
* @param {Object} [options.offset] - Ability to add some offset to axis
* @param {boolean} [options.escapeMarkup=true] - Toggle the default behavior of escaping HTML markup
* @param {Object} [options.style] - Use the HTML DOM style property to add styles to toast
* @private
*/
_init(options) {
// Setting defaults
this.options = Object.assign({
text: "Hi there!",
node: undefined,
duration: 3000,
selector: undefined,
callback: function() {},
destination: undefined,
newWindow: false,
close: false,
gravity: "toastify-top",
position: "right",
backgroundColor: undefined,
avatar: "",
className: "",
stopOnFocus: undefined,
onClick: undefined,
offset: {
x: 0,
y: 0
},
escapeMarkup: true,
style: {}
}, options);
if (this.options.backgroundColor) {
// This is being deprecated in favor of using the style HTML DOM property
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
}
this.toastElement = null;
this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : "toastify-top"; // toast position - top or bottom
this.options.stopOnFocus = options.stopOnFocus === undefined ? true : options.stopOnFocus; // stop timeout on focus
this.options.style.background = this.options.style.background || options.backgroundColor;
}
/**
* Build the Toastify element
* @returns {Element}
* @private
*/
_buildToast() {
// Validating if the options are defined
if (!this.options) {
throw "Toastify is not initialized";
}
// Creating the DOM object
let divElement = document.createElement("div");
divElement.className = `toastify on ${this.options.className}`;
// Positioning toast to left or right or center (default right)
divElement.className += ` toastify-${this.options.position}`;
// Assigning gravity of element
divElement.className += ` ${this.options.gravity}`;
// Loop through our style object and apply styles to divElement
for (const property in this.options.style) {
divElement.style[property] = this.options.style[property];
}
// Adding the toast message/node
if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {
// If we have a valid node, we insert it
divElement.appendChild(this.options.node)
} else {
if (this.options.escapeMarkup) {
divElement.innerText = this.options.text;
} else {
divElement.innerHTML = this.options.text;
}
if (this.options.avatar !== "") {
let avatarElement = document.createElement("img");
avatarElement.src = this.options.avatar;
avatarElement.className = "toastify-avatar";
if (this.options.position == "left") {
// Adding close icon on the left of content
divElement.appendChild(avatarElement);
} else {
// Adding close icon on the right of content
divElement.insertAdjacentElement("afterbegin", avatarElement);
}
}
}
// Adding a close icon to the toast
if (this.options.close === true) {
// Create a span for close element
let closeElement = document.createElement("span");
closeElement.innerHTML = "✖";
closeElement.className = "toast-close";
// Triggering the removal of toast from DOM on close click
closeElement.addEventListener(
"click",
(event) => {
event.stopPropagation();
this._removeElement(this.toastElement);
window.clearTimeout(this.toastElement.timeOutValue);
}
);
//Calculating screen width
const width = window.innerWidth > 0 ? window.innerWidth : screen.width;
// Adding the close icon to the toast element
// Display on the right if screen width is less than or equal to 360px
if ((this.options.position == "left") && width > 360) {
// Adding close icon on the left of content
divElement.insertAdjacentElement("afterbegin", closeElement);
} else {
// Adding close icon on the right of content
divElement.appendChild(closeElement);
}
}
// Clear timeout while toast is focused
if (this.options.stopOnFocus && this.options.duration > 0) {
// stop countdown
divElement.addEventListener(
"mouseover",
(event) => {
window.clearTimeout(divElement.timeOutValue);
}
)
// add back the timeout
divElement.addEventListener(
"mouseleave",
() => {
divElement.timeOutValue = window.setTimeout(
() => {
// Remove the toast from DOM
this._removeElement(divElement);
},
this.options.duration
)
}
)
}
// Adding an on-click destination path
if (typeof this.options.destination !== "undefined") {
divElement.addEventListener(
"click",
(event) => {
event.stopPropagation();
if (this.options.newWindow === true) {
window.open(this.options.destination, "_blank");
} else {
window.location = this.options.destination;
}
}
);
}
if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") {
divElement.addEventListener(
"click",
(event) => {
event.stopPropagation();
this.options.onClick();
}
);
}
// Adding offset
if (typeof this.options.offset === "object") {
const x = this._getAxisOffsetAValue("x", this.options);
const y = this._getAxisOffsetAValue("y", this.options);
const xOffset = this.options.position == "left" ? x : `-${x}`;
const yOffset = this.options.gravity == "toastify-top" ? y : `-${y}`;
divElement.style.transform = `translate(${xOffset},${yOffset})`;
}
// Returning the generated element
return divElement;
}
/**
* Remove the toast from the DOM
* @param {Element} toastElement
*/
_removeElement(toastElement) {
// Hiding the element
toastElement.className = toastElement.className.replace(" on", "");
// Removing the element from DOM after transition end
window.setTimeout(
() => {
// remove options node if any
if (this.options.node && this.options.node.parentNode) {
this.options.node.parentNode.removeChild(this.options.node);
}
// Remove the elemenf from the DOM, only when the parent node was not removed before.
if (toastElement.parentNode) {
toastElement.parentNode.removeChild(toastElement);
}
// Calling the callback function
this.options.callback.call(toastElement);
// Repositioning the toasts again
this._reposition();
},
400
); // Binding `this` for function invocation
}
/**
* Position the toast on the DOM
* @private
*/
_reposition() {
// Top margins with gravity
let topLeftOffsetSize = {
top: 15,
bottom: 15,
};
let topRightOffsetSize = {
top: 15,
bottom: 15,
};
let offsetSize = {
top: 15,
bottom: 15,
};
// Get all toast messages that have been added to the container (selector)
let allToasts = this._rootElement.querySelectorAll(".toastify");
let classUsed;
// Modifying the position of each toast element
for (let i = 0; i < allToasts.length; i++) {
// Getting the applied gravity
if (allToasts[i].classList.contains("toastify-top") === true) {
classUsed = "toastify-top";
} else {
classUsed = "toastify-bottom";
}
let height = allToasts[i].offsetHeight;
classUsed = classUsed.substr(9, classUsed.length - 1)
// Spacing between toasts
let offset = 15;
let width = window.innerWidth > 0 ? window.innerWidth : screen.width;
// Show toast in center if screen with less than or qual to 360px
if (width <= 360) {
// Setting the position
allToasts[i].style[classUsed] = `${offsetSize[classUsed]}px`;
offsetSize[classUsed] += height + offset;
} else {
if (allToasts[i].classList.contains("toastify-left") === true) {
// Setting the position
allToasts[i].style[classUsed] = `${topLeftOffsetSize[classUsed]}px`;
topLeftOffsetSize[classUsed] += height + offset;
} else {
// Setting the position
allToasts[i].style[classUsed] = `${topRightOffsetSize[classUsed]}px`;
topRightOffsetSize[classUsed] += height + offset;
}
}
}
}
/**
* Helper function to get offset
* @param {string} axis - 'x' or 'y'
* @param {ToastifyConfigurationObject} options - The options object containing the offset object
*/
_getAxisOffsetAValue(axis, options) {
if (options.offset[axis]) {
if (isNaN(options.offset[axis])) {
return options.offset[axis];
} else {
return `${options.offset[axis]}px`;
}
}
return '0px';
}
}
// Returning the Toastify function to be assigned to the window object/module
function StartToastifyInstance(options) {
return new Toastify(options);
}
export default StartToastifyInstance;

View File

@@ -0,0 +1 @@
{"version":3,"file":"onErrorResumeNext.js","sources":["../../src/add/observable/onErrorResumeNext.ts"],"names":[],"mappings":";;AAAA,wDAAsD"}

View File

@@ -0,0 +1,73 @@
import { map } from './map';
import { from } from '../observable/from';
import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
export function exhaustMap(project, resultSelector) {
if (resultSelector) {
return (source) => source.pipe(exhaustMap((a, i) => from(project(a, i)).pipe(map((b, ii) => resultSelector(a, b, i, ii)))));
}
return (source) => source.lift(new ExhaustMapOperator(project));
}
class ExhaustMapOperator {
constructor(project) {
this.project = project;
}
call(subscriber, source) {
return source.subscribe(new ExhaustMapSubscriber(subscriber, this.project));
}
}
class ExhaustMapSubscriber extends SimpleOuterSubscriber {
constructor(destination, project) {
super(destination);
this.project = project;
this.hasSubscription = false;
this.hasCompleted = false;
this.index = 0;
}
_next(value) {
if (!this.hasSubscription) {
this.tryNext(value);
}
}
tryNext(value) {
let result;
const index = this.index++;
try {
result = this.project(value, index);
}
catch (err) {
this.destination.error(err);
return;
}
this.hasSubscription = true;
this._innerSub(result);
}
_innerSub(result) {
const innerSubscriber = new SimpleInnerSubscriber(this);
const destination = this.destination;
destination.add(innerSubscriber);
const innerSubscription = innerSubscribe(result, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
destination.add(innerSubscription);
}
}
_complete() {
this.hasCompleted = true;
if (!this.hasSubscription) {
this.destination.complete();
}
this.unsubscribe();
}
notifyNext(innerValue) {
this.destination.next(innerValue);
}
notifyError(err) {
this.destination.error(err);
}
notifyComplete() {
this.hasSubscription = false;
if (this.hasCompleted) {
this.destination.complete();
}
}
}
//# sourceMappingURL=exhaustMap.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"retry.js","sources":["../src/operator/retry.ts"],"names":[],"mappings":";;;;;AAAA,gDAA2C"}

View File

@@ -0,0 +1,39 @@
import { Subject } from './Subject';
import { Observer } from './types';
import { Subscription } from './Subscription';
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class SubjectSubscription<T> extends Subscription {
closed: boolean = false;
constructor(public subject: Subject<T>, public subscriber: Observer<T>) {
super();
}
unsubscribe() {
if (this.closed) {
return;
}
this.closed = true;
const subject = this.subject;
const observers = subject.observers;
this.subject = null;
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
return;
}
const subscriberIndex = observers.indexOf(this.subscriber);
if (subscriberIndex !== -1) {
observers.splice(subscriberIndex, 1);
}
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"finally.js","sources":["../../src/add/operator/finally.ts"],"names":[],"mappings":";;AAAA,4CAA0C"}

View File

@@ -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.00426,"45":0,"46":0,"47":0,"48":0.00426,"49":0,"50":0,"51":0,"52":0.00852,"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.00426,"71":0,"72":0.00426,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00852,"79":0,"80":0,"81":0,"82":0.00426,"83":0,"84":0.00426,"85":0,"86":0,"87":0,"88":0.00426,"89":0.00426,"90":0,"91":0,"92":0,"93":0.00426,"94":0,"95":0.00426,"96":0,"97":0,"98":0,"99":0.00426,"100":0,"101":0,"102":0.00426,"103":0,"104":0.01279,"105":0,"106":0.01279,"107":0.02131,"108":0.64782,"109":0.31113,"110":0.00852,"111":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.00426,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.02131,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.02557,"48":0,"49":0.08098,"50":0.00426,"51":0,"52":0,"53":0.00426,"54":0,"55":0.00852,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0.01705,"63":0.00426,"64":0,"65":0.01279,"66":0,"67":0,"68":0.00426,"69":0.00426,"70":0.00426,"71":0.01279,"72":0.00426,"73":0.00426,"74":0,"75":0.00426,"76":0,"77":0,"78":0.00426,"79":0.0895,"80":0.00426,"81":0.00852,"83":0.00426,"84":0.00426,"85":0.00852,"86":0,"87":0.02983,"88":0.00852,"89":0.00426,"90":0,"91":0.01279,"92":0.05114,"93":0.00426,"94":0.00852,"95":0.01279,"96":0.00426,"97":0.01705,"98":0.01279,"99":0.00426,"100":0.01279,"101":0.00426,"102":0.01279,"103":0.0895,"104":0.01705,"105":0.02557,"106":0.02131,"107":0.08098,"108":6.08187,"109":5.1144,"110":0.01279,"111":0,"112":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.01705,"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.01279,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.00426,"56":0,"57":0,"58":0.00426,"60":0.01279,"62":0,"63":0.00852,"64":0.00852,"65":0.00852,"66":0.00426,"67":0.02131,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.01705,"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.23015,"94":0.20031,"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.00852,"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.00426,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00426,"103":0.00426,"104":0.00426,"105":0,"106":0,"107":0.01279,"108":0.68192,"109":0.55406},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00426,"13":0.01705,"14":0.05967,"15":0.01279,_:"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.01705,"13.1":0.05114,"14.1":0.10229,"15.1":0.0341,"15.2-15.3":0.02131,"15.4":0.06819,"15.5":0.08524,"15.6":0.72454,"16.0":0.10229,"16.1":0.27703,"16.2":0.41768,"16.3":0.02557},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.11998,"8.1-8.4":0.03574,"9.0-9.2":0.03063,"9.3":0.24506,"10.0-10.2":0,"10.3":0.42119,"11.0-11.2":0.01276,"11.3-11.4":0.00766,"12.0-12.1":0.08424,"12.2-12.5":0.7709,"13.0-13.1":0.01532,"13.2":0.03574,"13.3":0.02042,"13.4-13.7":0.10466,"14.0-14.4":0.16337,"14.5-14.8":0.56669,"15.0-15.1":0.27058,"15.2-15.3":0.22208,"15.4":0.43395,"15.5":0.48501,"15.6":2.09063,"16.0":4.40845,"16.1":7.52525,"16.2":5.02619,"16.3":0.32164},P:{"4":0.44605,"5.0-5.4":0.02124,"6.2-6.4":0,"7.2-7.4":0.0531,"8.2":0,"9.2":0,"10.1":0.02124,"11.1-11.2":0.04248,"12.0":0,"13.0":0.04248,"14.0":0.01062,"15.0":0.01062,"16.0":0.0531,"17.0":0.0531,"18.0":0.0531,"19.0":1.61429},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.01557,"4.4":0,"4.4.3-4.4.4":0.03426},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.01279,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.24673},Q:{"13.1":0},O:{"0":1.66402},H:{"0":1.98825},L:{"0":50.28847},S:{"2.5":0}};

View File

@@ -0,0 +1 @@
{"version":3,"file":"merge.js","sources":["../../src/internal/operators/merge.ts"],"names":[],"mappings":";;AAAA,6CAA2D;AAsC3D,SAAgB,KAAK;IAAO,qBAAoE;SAApE,UAAoE,EAApE,qBAAoE,EAApE,IAAoE;QAApE,gCAAoE;;IAC9F,OAAO,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAW,gBAAC,MAAM,SAAK,WAAW,GAAE,EAArD,CAAqD,CAAC;AAC1F,CAAC;AAFD,sBAEC"}

View File

@@ -0,0 +1,35 @@
import validate from './validate.js';
function parse(uuid) {
if (!validate(uuid)) {
throw TypeError('Invalid UUID');
}
let v;
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
arr[1] = v >>> 16 & 0xff;
arr[2] = v >>> 8 & 0xff;
arr[3] = v & 0xff; // Parse ........-####-....-....-............
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
arr[5] = v & 0xff; // Parse ........-....-####-....-............
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
arr[7] = v & 0xff; // Parse ........-....-....-####-............
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
arr[9] = v & 0xff; // Parse ........-....-....-....-############
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
arr[11] = v / 0x100000000 & 0xff;
arr[12] = v >>> 24 & 0xff;
arr[13] = v >>> 16 & 0xff;
arr[14] = v >>> 8 & 0xff;
arr[15] = v & 0xff;
return arr;
}
export default parse;

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mergeMap_1 = require("./mergeMap");
var identity_1 = require("../util/identity");
function mergeAll(concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
return mergeMap_1.mergeMap(identity_1.identity, concurrent);
}
exports.mergeAll = mergeAll;
//# sourceMappingURL=mergeAll.js.map

View File

@@ -0,0 +1,65 @@
# pump
pump is a small node module that pipes streams together and destroys all of them if one of them closes.
```
npm install pump
```
[![build status](http://img.shields.io/travis/mafintosh/pump.svg?style=flat)](http://travis-ci.org/mafintosh/pump)
## What problem does it solve?
When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error.
You are also not able to provide a callback to tell when then pipe has finished.
pump does these two things for you
## Usage
Simply pass the streams you want to pipe together to pump and add an optional callback
``` js
var pump = require('pump')
var fs = require('fs')
var source = fs.createReadStream('/dev/random')
var dest = fs.createWriteStream('/dev/null')
pump(source, dest, function(err) {
console.log('pipe finished', err)
})
setTimeout(function() {
dest.destroy() // when dest is closed pump will destroy source
}, 1000)
```
You can use pump to pipe more than two streams together as well
``` js
var transform = someTransformStream()
pump(source, transform, anotherTransform, dest, function(err) {
console.log('pipe finished', err)
})
```
If `source`, `transform`, `anotherTransform` or `dest` closes all of them will be destroyed.
Similarly to `stream.pipe()`, `pump()` returns the last stream passed in, so you can do:
```
return pump(s1, s2) // returns s2
```
If you want to return a stream that combines *both* s1 and s2 to a single stream use
[pumpify](https://github.com/mafintosh/pumpify) instead.
## License
MIT
## Related
`pump` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.

View File

@@ -0,0 +1,202 @@
<p align="center">
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/master/yargs-logo.png">
</p>
<h1 align="center"> Yargs </h1>
<p align="center">
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
</p>
<br>
![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg)
[![NPM version][npm-image]][npm-url]
[![js-standard-style][standard-image]][standard-url]
[![Coverage][coverage-image]][coverage-url]
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
[![Slack][slack-image]][slack-url]
## Description
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
It gives you:
* commands and (grouped) options (`my-program.js serve --port=5000`).
* a dynamically generated help menu based on your arguments:
```
mocha [spec..]
Run tests with Mocha
Commands
mocha inspect [spec..] Run tests with Mocha [default]
mocha init <path> create a client-side Mocha setup at <path>
Rules & Behavior
--allow-uncaught Allow uncaught errors to propagate [boolean]
--async-only, -A Require all tests to use a callback (async) or
return a Promise [boolean]
```
* bash-completion shortcuts for commands and options.
* and [tons more](/docs/api.md).
## Installation
Stable version:
```bash
npm i yargs
```
Bleeding edge version with the most recent features:
```bash
npm i yargs@next
```
## Usage
### Simple Example
```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv)).argv
if (argv.ships > 3 && argv.distance < 53.5) {
console.log('Plunder more riffiwobbles!')
} else {
console.log('Retreat from the xupptumblers!')
}
```
```bash
$ ./plunder.js --ships=4 --distance=22
Plunder more riffiwobbles!
$ ./plunder.js --ships 12 --distance 98.7
Retreat from the xupptumblers!
```
### Complex Example
```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
yargs(hideBin(process.argv))
.command('serve [port]', 'start the server', (yargs) => {
yargs
.positional('port', {
describe: 'port to bind on',
default: 5000
})
}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
.option('verbose', {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging'
})
.argv
```
Run the example above with `--help` to see the help for the application.
## Supported Platforms
### TypeScript
yargs has type definitions at [@types/yargs][type-definitions].
```
npm i @types/yargs --save-dev
```
See usage examples in [docs](/docs/typescript.md).
### Deno
As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
```typescript
import yargs from 'https://deno.land/x/yargs/deno.ts'
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
yargs(Deno.args)
.command('download <files...>', 'download a list of files', (yargs: any) => {
return yargs.positional('files', {
describe: 'a list of files to do something with'
})
}, (argv: Arguments) => {
console.info(argv)
})
.strictCommands()
.demandCommand(1)
.argv
```
### ESM
As of `v16`,`yargs` supports ESM imports:
```js
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
yargs(hideBin(process.argv))
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
console.info(argv)
})
.demandCommand(1)
.argv
```
### Usage in Browser
See examples of using yargs in the browser in [docs](/docs/browser.md).
## Community
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
## Documentation
### Table of Contents
* [Yargs' API](/docs/api.md)
* [Examples](/docs/examples.md)
* [Parsing Tricks](/docs/tricks.md)
* [Stop the Parser](/docs/tricks.md#stop)
* [Negating Boolean Arguments](/docs/tricks.md#negate)
* [Numbers](/docs/tricks.md#numbers)
* [Arrays](/docs/tricks.md#arrays)
* [Objects](/docs/tricks.md#objects)
* [Quotes](/docs/tricks.md#quotes)
* [Advanced Topics](/docs/advanced.md)
* [Composing Your App Using Commands](/docs/advanced.md#commands)
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
* [Bundling yargs](/docs/bundling.md)
* [Contributing](/contributing.md)
## Supported Node.js Versions
Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
[npm-url]: https://www.npmjs.com/package/yargs
[npm-image]: https://img.shields.io/npm/v/yargs.svg
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: http://standardjs.com/
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
[conventional-commits-url]: https://conventionalcommits.org/
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
[slack-url]: http://devtoolscommunity.herokuapp.com
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc

View File

@@ -0,0 +1,19 @@
(The MIT License)
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
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.

View File

@@ -0,0 +1 @@
{"name":"got","version":"9.6.0","files":{"package.json":{"checkedAt":1678887830284,"integrity":"sha512-yZ8sXZgRQyPBE1kzN+kTLsD3hdv7xw/LhytFS1b1cW9GbonSTRdCPtC18T7BIaJlpvjsDwGt0cMjeMc1Bqi1dQ==","mode":420,"size":1323},"license":{"checkedAt":1678887829653,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"readme.md":{"checkedAt":1678887830307,"integrity":"sha512-kcZjyCCbpJDOElkJ+C01ETb0yVsWZNYZ6G/ZMeiqh+9B6UdAmjiHIHuig/xtnNj+x5DhWTc0mn/fgYXawaREXw==","mode":420,"size":44187},"source/as-promise.js":{"checkedAt":1678887830313,"integrity":"sha512-n417awapHg+X5FS9lNTDVgt4TvKdsA8roiZ6YUwpactGB0nNY+LLd1fEJFBih8tQu7Ff4LG4L5m+IgtPHYCc+w==","mode":420,"size":2878},"source/as-stream.js":{"checkedAt":1678887830313,"integrity":"sha512-WqEoCkGlKwHss493FlfFf505rYs5mikQMSJ4W5FRE7QevkJGOKMGomMmQV1hhGHUFBa2kjlRrr2GhbTIbrrvZw==","mode":420,"size":2310},"source/errors.js":{"checkedAt":1678887830313,"integrity":"sha512-iHOM+LuheupqNLDON8IXwjyd8S4/Jdp+tCBHmsKRetCxrRNQu9TPzjFrZhdXC2CmvTftgc49jBh0Eftxz/8qBg==","mode":420,"size":2842},"source/create.js":{"checkedAt":1678887830313,"integrity":"sha512-9m+4+VDHSFfrtItC3HVWu+pk1y6d1MQqmqefvLx522aBldTOujAGqBp5BHGxWG2EG1UBBJPfwvvDd2Aal5IKKQ==","mode":420,"size":2106},"source/get-response.js":{"checkedAt":1678887830313,"integrity":"sha512-ECNof8LHD4HXx/WZOk63VEy19YgvycOObMhsBmFfFB/I0W285mrhUzO4W+Z9D3VBmXbhvlMfTO4FCvbqJjKUHQ==","mode":420,"size":935},"source/index.js":{"checkedAt":1678887830313,"integrity":"sha512-eD6vTr8ERTLbg9qFe5D2WGqNtZUHFxLt+oAfMLUHGmyc5UkaTK5jYjEH8vwohcnXSnohAbgfuOJU7P1Y2X2YqA==","mode":420,"size":939},"source/known-hook-events.js":{"checkedAt":1678887830319,"integrity":"sha512-HtZMkJR1tmLEKT/STuWkoWzkEqWLUO9ESe0QNVZbGcxo1ktQv0kNHcw060N/9M3A9s8SXzAa8roT/eqfnV2Kxg==","mode":420,"size":132},"source/normalize-arguments.js":{"checkedAt":1678887830319,"integrity":"sha512-pLs8DSbV/4mFTeKc2Ja8/ZSsiF02PfARyZLm/XUjopHS0/BKb6IbkadYsSoxquMjo6PrXgGMKMLQ0rc0xGRxqA==","mode":420,"size":7549},"source/merge.js":{"checkedAt":1678887830319,"integrity":"sha512-5cizygDrCfqasp1lUZr4CzEswsmXui2YfYMaCZVnPBh77iCqro7eASXMZyrGk943NJOAdPpTkHG4ZJJykYzQUQ==","mode":420,"size":1858},"source/progress.js":{"checkedAt":1678887830319,"integrity":"sha512-0QtbqIX2J7hcJwzK6Se/0G0MmcfvxqCtW0fgIDBC8KpeSyVTbtqhcNcK0QJ9ZwUrb75y6DWJH+wF4EU1/GISPg==","mode":420,"size":2324},"source/utils/get-body-size.js":{"checkedAt":1678887830325,"integrity":"sha512-OJGCO2F+C6kdO6q+91GabEM3EoM0Pf4PaWvg8ZVWjl535VOAI4nlvk9No3kiWPNeYslbKV8x6l7dItcHCmIggA==","mode":420,"size":644},"source/utils/deep-freeze.js":{"checkedAt":1678887830325,"integrity":"sha512-2V6N0KTokXh43AUpDPtKmsSZADXvCus73UGRp17334pPvvUT5m5UKf7GEz7/ZqPZNvu2u0sP/QDyMI+4v/XBiA==","mode":420,"size":276},"source/request-as-event-emitter.js":{"checkedAt":1678887830325,"integrity":"sha512-ykWfFaWaJHq1p4+AhJ+rY2FncaGYohjnR9b2zTByzEobl6ntNjkMvD172ZFK8YAxOAmhq+h38+IjeMwEwr+hpQ==","mode":420,"size":8856},"source/utils/is-form-data.js":{"checkedAt":1678887830325,"integrity":"sha512-WYXFa2wkG7YihCbbckSYXzcoZOBoMwECZF2+BSjIt4gXAf5KxCXw6epyBbDlNpYVsYuf7uQ0BDae7EwdqHocYQ==","mode":420,"size":134},"source/utils/timed-out.js":{"checkedAt":1678887830329,"integrity":"sha512-yjm2xA2TMWC7iCtiKKPntbMsXdll+cIKeOr5zlqwMCR+Occ1X/ypoF8ggU7PR9Nw7HgYVMGy5UAuSqJF3o/1rA==","mode":420,"size":4421},"source/utils/url-to-options.js":{"checkedAt":1678887830329,"integrity":"sha512-tzU338dydAgXV9UiCkhCIdcf15pnGtvrw+ds4Wu56N6ClE8xdJrpzjKHsQQfFJ+C1gI9gpif0iZsh8EwPTU1FQ==","mode":420,"size":588}}}

View File

@@ -0,0 +1,136 @@
'use strict';
var test = require('tape');
var inspect = require('object-inspect');
var SaferBuffer = require('safer-buffer').Buffer;
var forEach = require('for-each');
var utils = require('../lib/utils');
test('merge()', function (t) {
t.deepEqual(utils.merge(null, true), [null, true], 'merges true into null');
t.deepEqual(utils.merge(null, [42]), [null, 42], 'merges null into an array');
t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key');
var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } });
t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array');
var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } });
t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array');
var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' });
t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array');
var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] });
t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] });
var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
t.test(
'avoids invoking array setters unnecessarily',
{ skip: typeof Object.defineProperty !== 'function' },
function (st) {
var setCount = 0;
var getCount = 0;
var observed = [];
Object.defineProperty(observed, 0, {
get: function () {
getCount += 1;
return { bar: 'baz' };
},
set: function () { setCount += 1; }
});
utils.merge(observed, [null]);
st.equal(setCount, 0);
st.equal(getCount, 1);
observed[0] = observed[0]; // eslint-disable-line no-self-assign
st.equal(setCount, 1);
st.equal(getCount, 2);
st.end();
}
);
t.end();
});
test('assign()', function (t) {
var target = { a: 1, b: 2 };
var source = { b: 3, c: 4 };
var result = utils.assign(target, source);
t.equal(result, target, 'returns the target');
t.deepEqual(target, { a: 1, b: 3, c: 4 }, 'target and source are merged');
t.deepEqual(source, { b: 3, c: 4 }, 'source is untouched');
t.end();
});
test('combine()', function (t) {
t.test('both arrays', function (st) {
var a = [1];
var b = [2];
var combined = utils.combine(a, b);
st.deepEqual(a, [1], 'a is not mutated');
st.deepEqual(b, [2], 'b is not mutated');
st.notEqual(a, combined, 'a !== combined');
st.notEqual(b, combined, 'b !== combined');
st.deepEqual(combined, [1, 2], 'combined is a + b');
st.end();
});
t.test('one array, one non-array', function (st) {
var aN = 1;
var a = [aN];
var bN = 2;
var b = [bN];
var combinedAnB = utils.combine(aN, b);
st.deepEqual(b, [bN], 'b is not mutated');
st.notEqual(aN, combinedAnB, 'aN + b !== aN');
st.notEqual(a, combinedAnB, 'aN + b !== a');
st.notEqual(bN, combinedAnB, 'aN + b !== bN');
st.notEqual(b, combinedAnB, 'aN + b !== b');
st.deepEqual([1, 2], combinedAnB, 'first argument is array-wrapped when not an array');
var combinedABn = utils.combine(a, bN);
st.deepEqual(a, [aN], 'a is not mutated');
st.notEqual(aN, combinedABn, 'a + bN !== aN');
st.notEqual(a, combinedABn, 'a + bN !== a');
st.notEqual(bN, combinedABn, 'a + bN !== bN');
st.notEqual(b, combinedABn, 'a + bN !== b');
st.deepEqual([1, 2], combinedABn, 'second argument is array-wrapped when not an array');
st.end();
});
t.test('neither is an array', function (st) {
var combined = utils.combine(1, 2);
st.notEqual(1, combined, '1 + 2 !== 1');
st.notEqual(2, combined, '1 + 2 !== 2');
st.deepEqual([1, 2], combined, 'both arguments are array-wrapped when not an array');
st.end();
});
t.end();
});
test('isBuffer()', function (t) {
forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) {
t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer');
});
var fakeBuffer = { constructor: Buffer };
t.equal(utils.isBuffer(fakeBuffer), false, 'fake buffer is not a buffer');
var saferBuffer = SaferBuffer.from('abc');
t.equal(utils.isBuffer(saferBuffer), true, 'SaferBuffer instance is a buffer');
var buffer = Buffer.from && Buffer.alloc ? Buffer.from('abc') : new Buffer('abc');
t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer');
t.end();
});

View File

@@ -0,0 +1,102 @@
'use strict';
/**
* Sticky bottom bar user interface
*/
var through = require('through');
var Base = require('./baseUI');
var rlUtils = require('../utils/readline');
var _ = {
last: require('lodash/last'),
};
class BottomBar extends Base {
constructor(opt) {
opt = opt || {};
super(opt);
this.log = through(this.writeLog.bind(this));
this.bottomBar = opt.bottomBar || '';
this.render();
}
/**
* Render the prompt to screen
* @return {BottomBar} self
*/
render() {
this.write(this.bottomBar);
return this;
}
clean() {
rlUtils.clearLine(this.rl, this.bottomBar.split('\n').length);
return this;
}
/**
* Update the bottom bar content and rerender
* @param {String} bottomBar Bottom bar content
* @return {BottomBar} self
*/
updateBottomBar(bottomBar) {
rlUtils.clearLine(this.rl, 1);
this.rl.output.unmute();
this.clean();
this.bottomBar = bottomBar;
this.render();
this.rl.output.mute();
return this;
}
/**
* Write out log data
* @param {String} data - The log data to be output
* @return {BottomBar} self
*/
writeLog(data) {
this.rl.output.unmute();
this.clean();
this.rl.output.write(this.enforceLF(data.toString()));
this.render();
this.rl.output.mute();
return this;
}
/**
* Make sure line end on a line feed
* @param {String} str Input string
* @return {String} The input string with a final line feed
*/
enforceLF(str) {
return str.match(/[\r\n]$/) ? str : str + '\n';
}
/**
* Helper for writing message in Prompt
* @param {BottomBar} prompt - The Prompt object that extends tty
* @param {String} message - The message to be output
*/
write(message) {
var msgLines = message.split(/\n/);
this.height = msgLines.length;
// Write message to screen and setPrompt to control backspace
this.rl.setPrompt(_.last(msgLines));
if (this.rl.output.rows === 0 && this.rl.output.columns === 0) {
/* When it's a tty through serial port there's no terminal info and the render will malfunction,
so we need enforce the cursor to locate to the leftmost position for rendering. */
rlUtils.left(this.rl, message.length + this.rl.line.length);
}
this.rl.output.write(message);
}
}
module.exports = BottomBar;

View File

@@ -0,0 +1 @@
export { SvelteComponentDev as SvelteComponent, SvelteComponentTyped, afterUpdate, beforeUpdate, createEventDispatcher, getContext, hasContext, onDestroy, onMount, setContext, tick } from './internal/index.mjs';