new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1,405 @@
import { asyncScheduler } from '../scheduler/async';
import { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ObservableInput, ObservedValueOf } from '../types';
import { isValidDate } from '../util/isDate';
import { Subscription } from '../Subscription';
import { operate } from '../util/lift';
import { Observable } from '../Observable';
import { innerFrom } from '../observable/innerFrom';
import { createErrorClass } from '../util/createErrorClass';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { executeSchedule } from '../util/executeSchedule';
export interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {
/**
* The time allowed between values from the source before timeout is triggered.
*/
each?: number;
/**
* The relative time as a `number` in milliseconds, or a specific time as a `Date` object,
* by which the first value must arrive from the source before timeout is triggered.
*/
first?: number | Date;
/**
* The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}
*/
scheduler?: SchedulerLike;
/**
* A factory used to create observable to switch to when timeout occurs. Provides
* a {@link TimeoutInfo} about the source observable's emissions and what delay or
* exact time triggered the timeout.
*/
with?: (info: TimeoutInfo<T, M>) => O;
/**
* Optional additional metadata you can provide to code that handles
* the timeout, will be provided through the {@link TimeoutError}.
* This can be used to help identify the source of a timeout or pass along
* other information related to the timeout.
*/
meta?: M;
}
export interface TimeoutInfo<T, M = unknown> {
/** Optional metadata that was provided to the timeout configuration. */
readonly meta: M;
/** The number of messages seen before the timeout */
readonly seen: number;
/** The last message seen */
readonly lastValue: T | null;
}
/**
* An error emitted when a timeout occurs.
*/
export interface TimeoutError<T = unknown, M = unknown> extends Error {
/**
* The information provided to the error by the timeout
* operation that created the error. Will be `null` if
* used directly in non-RxJS code with an empty constructor.
* (Note that using this constructor directly is not recommended,
* you should create your own errors)
*/
info: TimeoutInfo<T, M> | null;
}
export interface TimeoutErrorCtor {
/**
* @deprecated Internal implementation detail. Do not construct error instances.
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
*/
new <T = unknown, M = unknown>(info?: TimeoutInfo<T, M>): TimeoutError<T, M>;
}
/**
* An error thrown by the {@link timeout} operator.
*
* Provided so users can use as a type and do quality comparisons.
* We recommend you do not subclass this or create instances of this class directly.
* If you have need of a error representing a timeout, you should
* create your own error class and use that.
*
* @see {@link timeout}
*
* @class TimeoutError
*/
export const TimeoutError: TimeoutErrorCtor = createErrorClass(
(_super) =>
function TimeoutErrorImpl(this: any, info: TimeoutInfo<any> | null = null) {
_super(this);
this.message = 'Timeout has occurred';
this.name = 'TimeoutError';
this.info = info;
}
);
/**
* If `with` is provided, this will return an observable that will switch to a different observable if the source
* does not push values within the specified time parameters.
*
* <span class="informal">The most flexible option for creating a timeout behavior.</span>
*
* The first thing to know about the configuration is if you do not provide a `with` property to the configuration,
* when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory
* function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by
* the settings in `first` and `each`.
*
* The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the
* point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of
* the first value from the source _only_. The timings of all subsequent values from the source will be checked
* against the time period provided by `each`, if it was provided.
*
* The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of
* time the resulting observable will wait between the arrival of values from the source before timing out. Note that if
* `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first
* value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.
*
* ## Examples
*
* Emit a custom error if there is too much time between values
*
* ```ts
* import { interval, timeout, throwError } from 'rxjs';
*
* class CustomTimeoutError extends Error {
* constructor() {
* super('It was too slow');
* this.name = 'CustomTimeoutError';
* }
* }
*
* const slow$ = interval(900);
*
* slow$.pipe(
* timeout({
* each: 1000,
* with: () => throwError(() => new CustomTimeoutError())
* })
* )
* .subscribe({
* error: console.error
* });
* ```
*
* Switch to a faster observable if your source is slow.
*
* ```ts
* import { interval, timeout } from 'rxjs';
*
* const slow$ = interval(900);
* const fast$ = interval(500);
*
* slow$.pipe(
* timeout({
* each: 1000,
* with: () => fast$,
* })
* )
* .subscribe(console.log);
* ```
* @param config The configuration for the timeout.
*/
export function timeout<T, O extends ObservableInput<unknown>, M = unknown>(
config: TimeoutConfig<T, O, M> & { with: (info: TimeoutInfo<T, M>) => O }
): OperatorFunction<T, T | ObservedValueOf<O>>;
/**
* Returns an observable that will error or switch to a different observable if the source does not push values
* within the specified time parameters.
*
* <span class="informal">The most flexible option for creating a timeout behavior.</span>
*
* The first thing to know about the configuration is if you do not provide a `with` property to the configuration,
* when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory
* function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by
* the settings in `first` and `each`.
*
* The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the
* point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of
* the first value from the source _only_. The timings of all subsequent values from the source will be checked
* against the time period provided by `each`, if it was provided.
*
* The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of
* time the resulting observable will wait between the arrival of values from the source before timing out. Note that if
* `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first
* value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.
*
* ### Handling TimeoutErrors
*
* If no `with` property was provided, subscriptions to the resulting observable may emit an error of {@link TimeoutError}.
* The timeout error provides useful information you can examine when you're handling the error. The most common way to handle
* the error would be with {@link catchError}, although you could use {@link tap} or just the error handler in your `subscribe` call
* directly, if your error handling is only a side effect (such as notifying the user, or logging).
*
* In this case, you would check the error for `instanceof TimeoutError` to validate that the error was indeed from `timeout`, and
* not from some other source. If it's not from `timeout`, you should probably rethrow it if you're in a `catchError`.
*
* ## Examples
*
* Emit a {@link TimeoutError} if the first value, and _only_ the first value, does not arrive within 5 seconds
*
* ```ts
* import { interval, timeout } from 'rxjs';
*
* // A random interval that lasts between 0 and 10 seconds per tick
* const source$ = interval(Math.round(Math.random() * 10_000));
*
* source$.pipe(
* timeout({ first: 5_000 })
* )
* .subscribe({
* next: console.log,
* error: console.error
* });
* ```
*
* Emit a {@link TimeoutError} if the source waits longer than 5 seconds between any two values or the first value
* and subscription.
*
* ```ts
* import { timer, timeout, expand } from 'rxjs';
*
* const getRandomTime = () => Math.round(Math.random() * 10_000);
*
* // An observable that waits a random amount of time between each delivered value
* const source$ = timer(getRandomTime())
* .pipe(expand(() => timer(getRandomTime())));
*
* source$
* .pipe(timeout({ each: 5_000 }))
* .subscribe({
* next: console.log,
* error: console.error
* });
* ```
*
* Emit a {@link TimeoutError} if the source does not emit before 7 seconds, _or_ if the source waits longer than
* 5 seconds between any two values after the first.
*
* ```ts
* import { timer, timeout, expand } from 'rxjs';
*
* const getRandomTime = () => Math.round(Math.random() * 10_000);
*
* // An observable that waits a random amount of time between each delivered value
* const source$ = timer(getRandomTime())
* .pipe(expand(() => timer(getRandomTime())));
*
* source$
* .pipe(timeout({ first: 7_000, each: 5_000 }))
* .subscribe({
* next: console.log,
* error: console.error
* });
* ```
*/
export function timeout<T, M = unknown>(config: Omit<TimeoutConfig<T, any, M>, 'with'>): OperatorFunction<T, T>;
/**
* Returns an observable that will error if the source does not push its first value before the specified time passed as a `Date`.
* This is functionally the same as `timeout({ first: someDate })`.
*
* <span class="informal">Errors if the first value doesn't show up before the given date and time</span>
*
* ![](timeout.png)
*
* @param first The date to at which the resulting observable will timeout if the source observable
* does not emit at least one value.
* @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.
*/
export function timeout<T>(first: Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
/**
* Returns an observable that will error if the source does not push a value within the specified time in milliseconds.
* This is functionally the same as `timeout({ each: milliseconds })`.
*
* <span class="informal">Errors if it waits too long between any value</span>
*
* ![](timeout.png)
*
* @param each The time allowed between each pushed value from the source before the resulting observable
* will timeout.
* @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.
*/
export function timeout<T>(each: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
/**
*
* Errors if Observable does not emit a value in given time span.
*
* <span class="informal">Timeouts on Observable that doesn't emit values fast enough.</span>
*
* ![](timeout.png)
*
* @see {@link timeoutWith}
*
* @return A function that returns an Observable that mirrors behaviour of the
* source Observable, unless timeout happens when it throws an error.
*/
export function timeout<T, O extends ObservableInput<any>, M>(
config: number | Date | TimeoutConfig<T, O, M>,
schedulerArg?: SchedulerLike
): OperatorFunction<T, T | ObservedValueOf<O>> {
// Intentionally terse code.
// If the first argument is a valid `Date`, then we use it as the `first` config.
// Otherwise, if the first argument is a `number`, then we use it as the `each` config.
// Otherwise, it can be assumed the first argument is the configuration object itself, and
// we destructure that into what we're going to use, setting important defaults as we do.
// NOTE: The default for `scheduler` will be the `scheduler` argument if it exists, or
// it will default to the `asyncScheduler`.
const {
first,
each,
with: _with = timeoutErrorFactory,
scheduler = schedulerArg ?? asyncScheduler,
meta = null!,
} = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config) as TimeoutConfig<T, O, M>;
if (first == null && each == null) {
// Ensure timeout was provided at runtime.
throw new TypeError('No timeout provided.');
}
return operate((source, subscriber) => {
// This subscription encapsulates our subscription to the
// source for this operator. We're capturing it separately,
// because if there is a `with` observable to fail over to,
// we want to unsubscribe from our original subscription, and
// hand of the subscription to that one.
let originalSourceSubscription: Subscription;
// The subscription for our timeout timer. This changes
// every time we get a new value.
let timerSubscription: Subscription;
// A bit of state we pass to our with and error factories to
// tell what the last value we saw was.
let lastValue: T | null = null;
// A bit of state we pass to the with and error factories to
// tell how many values we have seen so far.
let seen = 0;
const startTimer = (delay: number) => {
timerSubscription = executeSchedule(
subscriber,
scheduler,
() => {
try {
originalSourceSubscription.unsubscribe();
innerFrom(
_with!({
meta,
lastValue,
seen,
})
).subscribe(subscriber);
} catch (err) {
subscriber.error(err);
}
},
delay
);
};
originalSourceSubscription = source.subscribe(
createOperatorSubscriber(
subscriber,
(value: T) => {
// clear the timer so we can emit and start another one.
timerSubscription?.unsubscribe();
seen++;
// Emit
subscriber.next((lastValue = value));
// null | undefined are both < 0. Thanks, JavaScript.
each! > 0 && startTimer(each!);
},
undefined,
undefined,
() => {
if (!timerSubscription?.closed) {
timerSubscription?.unsubscribe();
}
// Be sure not to hold the last value in memory after unsubscription
// it could be quite large.
lastValue = null;
}
)
);
// Intentionally terse code.
// If we've `seen` a value, that means the "first" clause was met already, if it existed.
// it also means that a timer was already started for "each" (in the next handler above).
// If `first` was provided, and it's a number, then use it.
// If `first` was provided and it's not a number, it's a Date, and we get the difference between it and "now".
// If `first` was not provided at all, then our first timer will be the value from `each`.
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler!.now()) : each!);
});
}
/**
* The default function to use to emit an error when timeout occurs and a `with` function
* is not specified.
* @param info The information about the timeout to pass along to the error
*/
function timeoutErrorFactory(info: TimeoutInfo<any>): Observable<never> {
throw new TimeoutError(info);
}

View File

@@ -0,0 +1,58 @@
{
"name": "deep-is",
"version": "0.1.4",
"description": "node's assert.deepEqual algorithm except for NaN being equal to NaN",
"main": "index.js",
"directories": {
"lib": ".",
"example": "example",
"test": "test"
},
"scripts": {
"test": "tape test/*.js"
},
"devDependencies": {
"tape": "~1.0.2"
},
"repository": {
"type": "git",
"url": "http://github.com/thlorenz/deep-is.git"
},
"keywords": [
"equality",
"equal",
"compare"
],
"author": {
"name": "Thorsten Lorenz",
"email": "thlorenz@gmx.de",
"url": "http://thlorenz.com"
},
"license": "MIT",
"testling": {
"files": "test/*.js",
"browsers": {
"ie": [
6,
7,
8,
9
],
"ff": [
3.5,
10,
15
],
"chrome": [
10,
22
],
"safari": [
5.1
],
"opera": [
12
]
}
}
}

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('escapeRegExp', require('../escapeRegExp'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,23 @@
export interface EmptyError extends Error {
}
export interface EmptyErrorCtor {
/**
* @deprecated Internal implementation detail. Do not construct error instances.
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
*/
new (): EmptyError;
}
/**
* An error thrown when an Observable or a sequence was queried but has no
* elements.
*
* @see {@link first}
* @see {@link last}
* @see {@link single}
* @see {@link firstValueFrom}
* @see {@link lastValueFrom}
*
* @class EmptyError
*/
export declare const EmptyError: EmptyErrorCtor;
//# sourceMappingURL=EmptyError.d.ts.map

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: ()=>toColorValue
});
function toColorValue(maybeFunction) {
return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
}

View File

@@ -0,0 +1,102 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for csv2json/libs/core/Converter.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">All files</a> / <a href="index.html">csv2json/libs/core</a> Converter.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/375</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/226</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/43</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/374</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/Converter.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/Converter.js')
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/Converter.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/Converter.js')
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
at Array.forEach (native)
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
<script src="../../../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,236 @@
"use strict";
/*
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntlMessageFormat = void 0;
var tslib_1 = require("tslib");
var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
var fast_memoize_1 = (0, tslib_1.__importStar)(require("@formatjs/fast-memoize"));
var formatters_1 = require("./formatters");
// -- MessageFormat --------------------------------------------------------
function mergeConfig(c1, c2) {
if (!c2) {
return c1;
}
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {
all[k] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, c1[k]), (c2[k] || {}));
return all;
}, {}));
}
function mergeConfigs(defaultConfig, configs) {
if (!configs) {
return defaultConfig;
}
return Object.keys(defaultConfig).reduce(function (all, k) {
all[k] = mergeConfig(defaultConfig[k], configs[k]);
return all;
}, (0, tslib_1.__assign)({}, defaultConfig));
}
function createFastMemoizeCache(store) {
return {
create: function () {
return {
get: function (key) {
return store[key];
},
set: function (key, value) {
store[key] = value;
},
};
},
};
}
function createDefaultFormatters(cache) {
if (cache === void 0) { cache = {
number: {},
dateTime: {},
pluralRules: {},
}; }
return {
getNumberFormat: (0, fast_memoize_1.default)(function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.NumberFormat).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
}, {
cache: createFastMemoizeCache(cache.number),
strategy: fast_memoize_1.strategies.variadic,
}),
getDateTimeFormat: (0, fast_memoize_1.default)(function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
}, {
cache: createFastMemoizeCache(cache.dateTime),
strategy: fast_memoize_1.strategies.variadic,
}),
getPluralRules: (0, fast_memoize_1.default)(function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.PluralRules).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
}, {
cache: createFastMemoizeCache(cache.pluralRules),
strategy: fast_memoize_1.strategies.variadic,
}),
};
}
var IntlMessageFormat = /** @class */ (function () {
function IntlMessageFormat(message, locales, overrideFormats, opts) {
var _this = this;
if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
this.formatterCache = {
number: {},
dateTime: {},
pluralRules: {},
};
this.format = function (values) {
var parts = _this.formatToParts(values);
// Hot path for straight simple msg translations
if (parts.length === 1) {
return parts[0].value;
}
var result = parts.reduce(function (all, part) {
if (!all.length ||
part.type !== formatters_1.PART_TYPE.literal ||
typeof all[all.length - 1] !== 'string') {
all.push(part.value);
}
else {
all[all.length - 1] += part.value;
}
return all;
}, []);
if (result.length <= 1) {
return result[0] || '';
}
return result;
};
this.formatToParts = function (values) {
return (0, formatters_1.formatToParts)(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);
};
this.resolvedOptions = function () { return ({
locale: _this.resolvedLocale.toString(),
}); };
this.getAst = function () { return _this.ast; };
// Defined first because it's used to build the format pattern.
this.locales = locales;
this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);
if (typeof message === 'string') {
this.message = message;
if (!IntlMessageFormat.__parse) {
throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');
}
// Parse string messages into an AST.
this.ast = IntlMessageFormat.__parse(message, {
ignoreTag: opts === null || opts === void 0 ? void 0 : opts.ignoreTag,
locale: this.resolvedLocale,
});
}
else {
this.ast = message;
}
if (!Array.isArray(this.ast)) {
throw new TypeError('A message must be provided as a String or AST.');
}
// Creates a new object with the specified `formats` merged with the default
// formats.
this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
this.formatters =
(opts && opts.formatters) || createDefaultFormatters(this.formatterCache);
}
Object.defineProperty(IntlMessageFormat, "defaultLocale", {
get: function () {
if (!IntlMessageFormat.memoizedDefaultLocale) {
IntlMessageFormat.memoizedDefaultLocale =
new Intl.NumberFormat().resolvedOptions().locale;
}
return IntlMessageFormat.memoizedDefaultLocale;
},
enumerable: false,
configurable: true
});
IntlMessageFormat.memoizedDefaultLocale = null;
IntlMessageFormat.resolveLocale = function (locales) {
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
if (supportedLocales.length > 0) {
return new Intl.Locale(supportedLocales[0]);
}
return new Intl.Locale(typeof locales === 'string' ? locales : locales[0]);
};
IntlMessageFormat.__parse = icu_messageformat_parser_1.parse;
// Default format options used as the prototype of the `formats` provided to the
// constructor. These are used when constructing the internal Intl.NumberFormat
// and Intl.DateTimeFormat instances.
IntlMessageFormat.formats = {
number: {
integer: {
maximumFractionDigits: 0,
},
currency: {
style: 'currency',
},
percent: {
style: 'percent',
},
},
date: {
short: {
month: 'numeric',
day: 'numeric',
year: '2-digit',
},
medium: {
month: 'short',
day: 'numeric',
year: 'numeric',
},
long: {
month: 'long',
day: 'numeric',
year: 'numeric',
},
full: {
weekday: 'long',
month: 'long',
day: 'numeric',
year: 'numeric',
},
},
time: {
short: {
hour: 'numeric',
minute: 'numeric',
},
medium: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
},
long: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
timeZoneName: 'short',
},
full: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
timeZoneName: 'short',
},
},
};
return IntlMessageFormat;
}());
exports.IntlMessageFormat = IntlMessageFormat;

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('zipAll', require('../zip'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,35 @@
import{constants}from"node:os";
import{SIGNALS}from"./core.js";
import{getRealtimeSignals}from"./realtime.js";
export const getSignals=function(){
const realtimeSignals=getRealtimeSignals();
const signals=[...SIGNALS,...realtimeSignals].map(normalizeSignal);
return signals;
};
const normalizeSignal=function({
name,
number:defaultNumber,
description,
action,
forced=false,
standard})
{
const{
signals:{[name]:constantSignal}}=
constants;
const supported=constantSignal!==undefined;
const number=supported?constantSignal:defaultNumber;
return{name,number,description,supported,action,forced,standard};
};
//# sourceMappingURL=signals.js.map

View File

@@ -0,0 +1,62 @@
{
"name": "deep-extend",
"description": "Recursive object extending",
"license": "MIT",
"version": "0.6.0",
"homepage": "https://github.com/unclechu/node-deep-extend",
"keywords": [
"deep-extend",
"extend",
"deep",
"recursive",
"xtend",
"clone",
"merge",
"json"
],
"licenses": [
{
"type": "MIT",
"url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "git://github.com/unclechu/node-deep-extend.git"
},
"author": "Viacheslav Lotsmanov <lotsmanov89@gmail.com>",
"bugs": "https://github.com/unclechu/node-deep-extend/issues",
"contributors": [
{
"name": "Romain Prieto",
"url": "https://github.com/rprieto"
},
{
"name": "Max Maximov",
"url": "https://github.com/maxmaximov"
},
{
"name": "Marshall Bowers",
"url": "https://github.com/maxdeviant"
},
{
"name": "Misha Wakerman",
"url": "https://github.com/mwakerman"
}
],
"main": "lib/deep-extend.js",
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"test": "./node_modules/.bin/mocha"
},
"devDependencies": {
"mocha": "5.2.0",
"should": "13.2.1"
},
"files": [
"index.js",
"lib/"
]
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"onErrorResumeNext.js","sourceRoot":"","sources":["../../../../src/internal/observable/onErrorResumeNext.ts"],"names":[],"mappings":";;;AAAA,4CAA2C;AAE3C,yDAAwD;AACxD,sEAAqE;AACrE,qCAAoC;AACpC,yCAAwC;AAsExC,SAAgB,iBAAiB;IAC/B,iBAAyE;SAAzE,UAAyE,EAAzE,qBAAyE,EAAzE,IAAyE;QAAzE,4BAAyE;;IAEzE,IAAM,WAAW,GAA4B,+BAAc,CAAC,OAAO,CAAQ,CAAC;IAE5E,OAAO,IAAI,uBAAU,CAAC,UAAC,UAAU;QAC/B,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAM,aAAa,GAAG;YACpB,IAAI,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE;gBACpC,IAAI,UAAU,SAAuB,CAAC;gBACtC,IAAI;oBACF,UAAU,GAAG,qBAAS,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;iBACpD;gBAAC,OAAO,GAAG,EAAE;oBACZ,aAAa,EAAE,CAAC;oBAChB,OAAO;iBACR;gBACD,IAAM,eAAe,GAAG,IAAI,uCAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,WAAI,EAAE,WAAI,CAAC,CAAC;gBAClF,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;gBACtC,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;aACpC;iBAAM;gBACL,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,CAAC;QACF,aAAa,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAzBD,8CAyBC"}

View File

@@ -0,0 +1,10 @@
"use strict";
var resolveException = require("../lib/resolve-exception")
, coerce = require("./coerce");
module.exports = function (value/*, options*/) {
var coerced = coerce(value);
if (coerced !== null) return coerced;
return resolveException(value, "%v is not a valid array length", arguments[1]);
};

View File

@@ -0,0 +1,28 @@
/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
* The purpose of this method is to "pass thru" values replacing intermediate
* results in a method chain sequence.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
* @returns {*} Returns the result of `interceptor`.
* @example
*
* _(' abc ')
* .chain()
* .trim()
* .thru(function(value) {
* return [value];
* })
* .value();
* // => ['abc']
*/
function thru(value, interceptor) {
return interceptor(value);
}
module.exports = thru;

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../src/internal/operators/filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AA0DhE,MAAM,UAAU,MAAM,CAAI,SAA+C,EAAE,OAAa;IACtF,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,KAAK,GAAG,CAAC,CAAC;QAId,MAAM,CAAC,SAAS,CAId,wBAAwB,CAAC,UAAU,EAAE,UAAC,KAAK,IAAK,OAAA,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAjE,CAAiE,CAAC,CACnH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,126 @@
// Generated by LiveScript 1.4.0
(function(){
var ref$, any, all, isItNaN, types, defaultType, customTypes, toString$ = {}.toString;
ref$ = require('prelude-ls'), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN;
types = {
Number: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it);
}
},
NaN: {
typeOf: 'Number',
validate: isItNaN
},
Int: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it) && it % 1 === 0;
}
},
Float: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it);
}
},
Date: {
typeOf: 'Date',
validate: function(it){
return !isItNaN(it.getTime());
}
}
};
defaultType = {
array: 'Array',
tuple: 'Array'
};
function checkArray(input, type){
return all(function(it){
return checkMultiple(it, type.of);
}, input);
}
function checkTuple(input, type){
var i, i$, ref$, len$, types;
i = 0;
for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
types = ref$[i$];
if (!checkMultiple(input[i], types)) {
return false;
}
i++;
}
return input.length <= i;
}
function checkFields(input, type){
var inputKeys, numInputKeys, k, numOfKeys, key, ref$, types;
inputKeys = {};
numInputKeys = 0;
for (k in input) {
inputKeys[k] = true;
numInputKeys++;
}
numOfKeys = 0;
for (key in ref$ = type.of) {
types = ref$[key];
if (!checkMultiple(input[key], types)) {
return false;
}
if (inputKeys[key]) {
numOfKeys++;
}
}
return type.subset || numInputKeys === numOfKeys;
}
function checkStructure(input, type){
if (!(input instanceof Object)) {
return false;
}
switch (type.structure) {
case 'fields':
return checkFields(input, type);
case 'array':
return checkArray(input, type);
case 'tuple':
return checkTuple(input, type);
}
}
function check(input, typeObj){
var type, structure, setting, that;
type = typeObj.type, structure = typeObj.structure;
if (type) {
if (type === '*') {
return true;
}
setting = customTypes[type] || types[type];
if (setting) {
return setting.typeOf === toString$.call(input).slice(8, -1) && setting.validate(input);
} else {
return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj));
}
} else if (structure) {
if (that = defaultType[structure]) {
if (that !== toString$.call(input).slice(8, -1)) {
return false;
}
}
return checkStructure(input, typeObj);
} else {
throw new Error("No type defined. Input: " + input + ".");
}
}
function checkMultiple(input, types){
if (toString$.call(types).slice(8, -1) !== 'Array') {
throw new Error("Types must be in an array. Input: " + input + ".");
}
return any(function(it){
return check(input, it);
}, types);
}
module.exports = function(parsedType, input, options){
options == null && (options = {});
customTypes = options.customTypes || {};
return checkMultiple(input, parsedType);
};
}).call(this);

View File

@@ -0,0 +1,112 @@
var Symbol = require('./_Symbol'),
Uint8Array = require('./_Uint8Array'),
eq = require('./eq'),
equalArrays = require('./_equalArrays'),
mapToArray = require('./_mapToArray'),
setToArray = require('./_setToArray');
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
module.exports = equalByTag;

View File

@@ -0,0 +1,17 @@
import { Observable } from '../Observable';
import { innerFrom } from './innerFrom';
import { EMPTY } from './empty';
export function using(resourceFactory, observableFactory) {
return new Observable((subscriber) => {
const resource = resourceFactory();
const result = observableFactory(resource);
const source = result ? innerFrom(result) : EMPTY;
source.subscribe(subscriber);
return () => {
if (resource) {
resource.unsubscribe();
}
};
});
}
//# sourceMappingURL=using.js.map

View File

@@ -0,0 +1,58 @@
# svelte-focus-trap
![npm](https://img.shields.io/npm/v/svelte-focus-trap)
A svelte directive that will trap focus within an element.
You can navigate child focusable elements with up, down, tab, shift + tab, alt + tab. I have attempted to match the accesibility best practices listed [here](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html).
This could be useful if you wanted to trap focus within something like a modal. When you gotta... focus-trap and focus-wrap.
* Does not auto focus the first item.
<!-- * Scope this [auto-focus modifier](https://github.com/qonto/ember-autofocus-modifier) out if you need that. -->
* When pressing `down` or `tab`:
* When the known focusables are not focused, gives focus to the first item.
* If focus is on the last known focusable, it gives focus to the first item.
* Gives focus to the next item.
* When pressing `up` or `shift+tab` or `alt+tab`:
* When the known focusables are not focused, gives focus to the last item.
* If focus is on the first known focuable, it gives focus to the last item.
* Gives focus to the previous item.
* When pressing `home`:
* Gives focus to the first item.
* When pressing `end`:
* Gives focus to the last item.
* Attempts to skip hidden items and items with display none of tabindex="-1".
Todos:
- [ ] Demo
- [ ] Tests + Ci
Installation
------------------------------------------------------------------------------
```
npm install --save-dev svelte-focus-trap
```
Usage
------------------------------------------------------------------------------
```html
<script>
import { focusTrap } from 'svelte-focus-trap'
</script>
{#if showing}
<div
use:focusTrap
>
<!-- ...modal contents -->
</div>
{/if}
```
License
------------------------------------------------------------------------------
This project is licensed under the [MIT License](LICENSE.md).

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,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.01008,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00504,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00504,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.10082,"103":0.00504,"104":0,"105":0,"106":0,"107":0,"108":0.01512,"109":0.69566,"110":0.40328,"111":0.00504,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00504,"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.00504,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.05041,"77":0.01008,"78":0,"79":0,"80":0,"81":0,"83":0.01008,"84":0.00504,"85":0,"86":0.01008,"87":0.01512,"88":0,"89":0.01008,"90":0,"91":0.00504,"92":0.00504,"93":0.01512,"94":0.00504,"95":0.00504,"96":0.00504,"97":0,"98":0.00504,"99":0.01008,"100":0.00504,"101":0,"102":0.00504,"103":0.05041,"104":0,"105":0.00504,"106":0.02016,"107":0.10586,"108":0.43857,"109":6.29117,"110":3.43796,"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,"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,"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.18148,"95":0.05041,"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.00504,"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,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.03529,"104":0,"105":0,"106":0,"107":0.0857,"108":0.12603,"109":1.57279,"110":2.34911},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.01008,"14":0.09578,"15":0.01008,_:"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.06049,"12.1":0.06553,"13.1":0.16131,"14.1":0.26213,"15.1":0.01512,"15.2-15.3":0.01512,"15.4":0.14115,"15.5":0.16131,"15.6":1.92566,"16.0":0.05041,"16.1":0.32767,"16.2":2.78263,"16.3":1.49214,"16.4":0},G:{"8":0.00512,"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.00512,"9.0-9.2":0.00512,"9.3":0.31734,"10.0-10.2":0,"10.3":0.62957,"11.0-11.2":0.10237,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":1.62255,"13.0-13.1":0.00512,"13.2":0,"13.3":0.02559,"13.4-13.7":0.0819,"14.0-14.4":0.86502,"14.5-14.8":2.23165,"15.0-15.1":0.22009,"15.2-15.3":0.17915,"15.4":0.389,"15.5":0.98786,"15.6":4.30462,"16.0":3.9105,"16.1":12.40202,"16.2":13.63045,"16.3":6.29058,"16.4":0},P:{"4":0.0324,"20":1.51218,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0.0324,"14.0":0.0108,"15.0":0,"16.0":0.0108,"17.0":0.0108,"18.0":0.0216,"19.0":2.61391},I:{"0":0,"3":0,"4":0.01683,"2.1":0,"2.2":0,"2.3":0.01262,"4.1":0,"4.2-4.3":0.08835,"4.4":0,"4.4.3-4.4.4":0.26506},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.17139,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0},H:{"0":0.00939},L:{"0":19.5901},R:{_:"0"},M:{"0":0.76369},Q:{"13.1":0}};

View File

@@ -0,0 +1,2 @@
import Renderer, { RenderOptions } from '../Renderer';
export default function (node: any, renderer: Renderer, _options: RenderOptions): void;

View File

@@ -0,0 +1,19 @@
export interface NotFoundError extends Error {
}
export interface NotFoundErrorCtor {
/**
* @deprecated Internal implementation detail. Do not construct error instances.
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
*/
new (message: string): NotFoundError;
}
/**
* An error thrown when a value or values are missing from an
* observable sequence.
*
* @see {@link operators/single}
*
* @class NotFoundError
*/
export declare const NotFoundError: NotFoundErrorCtor;
//# sourceMappingURL=NotFoundError.d.ts.map

View File

@@ -0,0 +1,79 @@
{
"name": "string.prototype.trimstart",
"version": "1.0.6",
"author": "Jordan Harband <ljharb@gmail.com>",
"contributors": [
"Jordan Harband <ljharb@gmail.com>",
"Khaled Al-Ansari <khaledelansari@gmail.com>"
],
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"description": "ES2019 spec-compliant String.prototype.trimStart shim.",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/es-shims/String.prototype.trimStart.git"
},
"keywords": [
"es6",
"es7",
"es8",
"javascript",
"prototype",
"polyfill",
"utility",
"trim",
"trimLeft",
"trimRight",
"trimStart",
"trimEnd",
"tc39"
],
"devDependencies": {
"@es-shims/api": "^2.2.3",
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.1",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"functions-have-names": "^1.2.3",
"has-strict-mode": "^1.0.1",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.6.1"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

View File

@@ -0,0 +1,27 @@
"use strict";
exports.__esModule = true;
exports["default"] = stripComments;
function stripComments(str) {
var s = "";
var commentStart = str.indexOf("/*");
var lastEnd = 0;
while (commentStart >= 0) {
s = s + str.slice(lastEnd, commentStart);
var commentEnd = str.indexOf("*/", commentStart + 2);
if (commentEnd < 0) {
return s;
}
lastEnd = commentEnd + 2;
commentStart = str.indexOf("/*", lastEnd);
}
s = s + str.slice(lastEnd);
return s;
}
module.exports = exports.default;

View File

@@ -0,0 +1,3 @@
import Renderer, { RenderOptions } from '../Renderer';
import InlineComponent from '../../nodes/InlineComponent';
export default function (node: InlineComponent, renderer: Renderer, options: RenderOptions): void;

View File

@@ -0,0 +1,45 @@
// @ts-check
/**
* @typedef {{type: 'dependency', file: string} | {type: 'dir-dependency', dir: string, glob: string}} Dependency
*/ /**
*
* @param {import('../lib/content.js').ContentPath} contentPath
* @returns {Dependency[]}
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: ()=>parseDependency
});
function parseDependency(contentPath) {
if (contentPath.ignore) {
return [];
}
if (!contentPath.glob) {
return [
{
type: "dependency",
file: contentPath.base
}
];
}
if (process.env.ROLLUP_WATCH === "true") {
// rollup-plugin-postcss does not support dir-dependency messages
// but directories can be watched in the same way as files
return [
{
type: "dependency",
file: contentPath.base
}
];
}
return [
{
type: "dir-dependency",
dir: contentPath.base,
glob: contentPath.glob
}
];
}

View File

@@ -0,0 +1 @@
{"name":"is-stream","version":"3.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883670737,"integrity":"sha512-gHdUM+I9jcGce+EZmSVAOibcAgHu7JTFhf/aR+3PpuCYg03tkVFW2Dh3+x2RT3QMh/N14D9jHNP2acwrT+tnvw==","mode":420,"size":746},"package.json":{"checkedAt":1678883670737,"integrity":"sha512-LfhnbKdCYNq9OTz32QjSb9+yyUewyUunyVcOVTbsywZay12l70GA3xvVfpgQUXGMT0Ffgxy7mhPYWmRB7zSfHg==","mode":420,"size":810},"index.d.ts":{"checkedAt":1678883670737,"integrity":"sha512-JehjLP+VhNMy2QbCK1JvtCaHe3wgaUENNIgL0Trwkqi0v4KMs4ypVMVumpGZovapbKSviqWTCHc47QpOZHWnGg==","mode":420,"size":1942},"readme.md":{"checkedAt":1678883670737,"integrity":"sha512-6ocAqaMKOXQ3FQh0c08Dz0wsZ0Si5Xw0xJnYk2uSvVHanns22hjvjMZ2UHgi6l7wr5PauyGt8ntxpqYPhA8R3w==","mode":420,"size":1614}}}

View File

@@ -0,0 +1,101 @@
# Mousetrap
[![CDNJS](https://img.shields.io/cdnjs/v/mousetrap.svg)](https://cdnjs.com/libraries/mousetrap)
Mousetrap is a simple library for handling keyboard shortcuts in Javascript.
It is licensed under the Apache 2.0 license.
It is around **2kb** minified and gzipped and **4.5kb** minified, has no external dependencies, and has been tested in the following browsers:
- Internet Explorer 6+
- Safari
- Firefox
- Chrome
It has support for `keypress`, `keydown`, and `keyup` events on specific keys, keyboard combinations, or key sequences.
## Getting started
1. Include mousetrap on your page before the closing `</body>` tag
```html
<script src="/path/to/mousetrap.min.js"></script>
```
or install `mousetrap` from `npm` and require it
```js
var Mousetrap = require('mousetrap');
```
2. Add some keyboard events to listen for
```html
<script>
// single keys
Mousetrap.bind('4', function() { console.log('4'); });
Mousetrap.bind("?", function() { console.log('show shortcuts!'); });
Mousetrap.bind('esc', function() { console.log('escape'); }, 'keyup');
// combinations
Mousetrap.bind('command+shift+k', function() { console.log('command shift k'); });
// map multiple combinations to the same callback
Mousetrap.bind(['command+k', 'ctrl+k'], function() {
console.log('command k or control k');
// return false to prevent default browser behavior
// and stop event from bubbling
return false;
});
// gmail style sequences
Mousetrap.bind('g i', function() { console.log('go to inbox'); });
Mousetrap.bind('* a', function() { console.log('select all'); });
// konami code!
Mousetrap.bind('up up down down left right left right b a enter', function() {
console.log('konami code');
});
</script>
```
## Why Mousetrap?
There are a number of other similar libraries out there so what makes this one different?
- There are no external dependencies, no framework is required
- You are not limited to `keydown` events (You can specify `keypress`, `keydown`, or `keyup` or let Mousetrap choose for you).
- You can bind key events directly to special keys such as `?` or `*` without having to specify `shift+/` or `shift+8` which are not consistent across all keyboards
- It works with international keyboard layouts
- You can bind Gmail like key sequences in addition to regular keys and key combinations
- You can programatically trigger key events with the `trigger()` method
- It works with the numeric keypad on your keyboard
- The code is well documented/commented
## Tests
Unit tests are run with <a href="https://mochajs.org/">mocha</a>.
### Running in browser
[View it online](http://rawgit.com/ccampbell/mousetrap/master/tests/mousetrap.html) to check your browser compatibility. You may also download the repo and open `tests/mousetrap.html` in your browser.
### Running with Node.js
1. Install development dependencies
```sh
cd /path/to/repo
npm install
```
3. Run tests
```sh
npm test
```
## Documentation
Full documentation can be found at https://craig.is/killing/mice

View File

@@ -0,0 +1,56 @@
"use strict";
var generate = require("es5-ext/array/generate")
, from = require("es5-ext/array/from")
, iterable = require("es5-ext/iterable/validate-object")
, isValue = require("es5-ext/object/is-value")
, stringifiable = require("es5-ext/object/validate-stringifiable")
, repeat = require("es5-ext/string/#/repeat")
, getStrippedLength = require("./get-stripped-length");
var push = Array.prototype.push;
module.exports = function (inputRows /*, options*/) {
var options = Object(arguments[1])
, colsMeta = []
, colsOptions = options.columns || []
, rows = [];
from(iterable(inputRows), function (row) {
var rowRows = [[]];
from(iterable(row), function (cellStr, columnIndex) {
var cellRows = stringifiable(cellStr).split("\n");
while (cellRows.length > rowRows.length) rowRows.push(generate(columnIndex, ""));
cellRows.forEach(function (cellRow, rowRowIndex) {
rowRows[rowRowIndex][columnIndex] = cellRow;
});
});
push.apply(rows, rowRows);
});
return (
rows
.map(function (row) {
return from(iterable(row), function (str, index) {
var col = colsMeta[index], strLength;
if (!col) col = colsMeta[index] = { width: 0 };
str = stringifiable(str);
strLength = getStrippedLength(str);
if (strLength > col.width) col.width = strLength;
return { str: str, length: strLength };
});
})
.map(function (row) {
return row
.map(function (item, index) {
var pad, align = "left", colOptions = colsOptions && colsOptions[index];
align = colOptions && colOptions.align === "right" ? "right" : "left";
pad = repeat.call(" ", colsMeta[index].width - item.length);
if (align === "left") return item.str + pad;
return pad + item.str;
})
.join(isValue(options.sep) ? options.sep : " | ");
})
.join("\n") + "\n"
);
};

View File

@@ -0,0 +1,179 @@
'use strict';
const path = require('path');
const WIN_SLASH = '\\\\/';
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
/**
* Posix glob regex
*/
const DOT_LITERAL = '\\.';
const PLUS_LITERAL = '\\+';
const QMARK_LITERAL = '\\?';
const SLASH_LITERAL = '\\/';
const ONE_CHAR = '(?=.)';
const QMARK = '[^/]';
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
const NO_DOT = `(?!${DOT_LITERAL})`;
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
const STAR = `${QMARK}*?`;
const POSIX_CHARS = {
DOT_LITERAL,
PLUS_LITERAL,
QMARK_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
QMARK,
END_ANCHOR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK_NO_DOT,
STAR,
START_ANCHOR
};
/**
* Windows glob regex
*/
const WINDOWS_CHARS = {
...POSIX_CHARS,
SLASH_LITERAL: `[${WIN_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};
/**
* POSIX Bracket Regex
*/
const POSIX_REGEX_SOURCE = {
alnum: 'a-zA-Z0-9',
alpha: 'a-zA-Z',
ascii: '\\x00-\\x7F',
blank: ' \\t',
cntrl: '\\x00-\\x1F\\x7F',
digit: '0-9',
graph: '\\x21-\\x7E',
lower: 'a-z',
print: '\\x20-\\x7E ',
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
space: ' \\t\\r\\n\\v\\f',
upper: 'A-Z',
word: 'A-Za-z0-9_',
xdigit: 'A-Fa-f0-9'
};
module.exports = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE,
// regular expressions
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
'***': '*',
'**/**': '**',
'**/**/**': '**'
},
// Digits
CHAR_0: 48, /* 0 */
CHAR_9: 57, /* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: 65, /* A */
CHAR_LOWERCASE_A: 97, /* a */
CHAR_UPPERCASE_Z: 90, /* Z */
CHAR_LOWERCASE_Z: 122, /* z */
CHAR_LEFT_PARENTHESES: 40, /* ( */
CHAR_RIGHT_PARENTHESES: 41, /* ) */
CHAR_ASTERISK: 42, /* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: 38, /* & */
CHAR_AT: 64, /* @ */
CHAR_BACKWARD_SLASH: 92, /* \ */
CHAR_CARRIAGE_RETURN: 13, /* \r */
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
CHAR_COLON: 58, /* : */
CHAR_COMMA: 44, /* , */
CHAR_DOT: 46, /* . */
CHAR_DOUBLE_QUOTE: 34, /* " */
CHAR_EQUAL: 61, /* = */
CHAR_EXCLAMATION_MARK: 33, /* ! */
CHAR_FORM_FEED: 12, /* \f */
CHAR_FORWARD_SLASH: 47, /* / */
CHAR_GRAVE_ACCENT: 96, /* ` */
CHAR_HASH: 35, /* # */
CHAR_HYPHEN_MINUS: 45, /* - */
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
CHAR_LEFT_CURLY_BRACE: 123, /* { */
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
CHAR_LINE_FEED: 10, /* \n */
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
CHAR_PERCENT: 37, /* % */
CHAR_PLUS: 43, /* + */
CHAR_QUESTION_MARK: 63, /* ? */
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
CHAR_SEMICOLON: 59, /* ; */
CHAR_SINGLE_QUOTE: 39, /* ' */
CHAR_SPACE: 32, /* */
CHAR_TAB: 9, /* \t */
CHAR_UNDERSCORE: 95, /* _ */
CHAR_VERTICAL_LINE: 124, /* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
SEP: path.sep,
/**
* Create EXTGLOB_CHARS
*/
extglobChars(chars) {
return {
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
'?': { type: 'qmark', open: '(?:', close: ')?' },
'+': { type: 'plus', open: '(?:', close: ')+' },
'*': { type: 'star', open: '(?:', close: ')*' },
'@': { type: 'at', open: '(?:', close: ')' }
};
},
/**
* Create GLOB_CHARS
*/
globChars(win32) {
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
}
};

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
var detective = require('../');
var argv = require('minimist')(process.argv.slice(2));
var fs = require('fs');
argv._.forEach(function(file) {
var src = fs.readFileSync(file, 'utf8');
var requires = detective(src, argv);
console.log(requires.join('\n'));
});

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"A B","2":"J D E F CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","16":"I v J D E F A B C K L"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e TC rB","2":"F PC QC","16":"B RC SC qB AC"},G:{"1":"E WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC"},H:{"2":"oC"},I:{"1":"f tC uC","2":"tB I pC qC rC sC BC"},J:{"1":"A","2":"D"},K:{"1":"C h AC rB","2":"A","16":"B qB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"FileReaderSync"};

View File

@@ -0,0 +1 @@
{"version":3,"file":"pluck.js","sourceRoot":"","sources":["../../../../src/internal/operators/pluck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAwF5B,MAAM,UAAU,KAAK,CAAO,GAAG,UAA2C;IACxE,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,IAAI,MAAM,KAAK,CAAC,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACf,IAAI,WAAW,GAAQ,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,MAAM,CAAC,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,OAAO,CAAC,KAAK,WAAW,EAAE;gBAC5B,WAAW,GAAG,CAAC,CAAC;aACjB;iBAAM;gBACL,OAAO,SAAS,CAAC;aAClB;SACF;QACD,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,49 @@
1.2.1 / 2019-11-08
=================
* [readme] remove testling URLs
* [meta] add `funding` field
* [meta] create FUNDING.yml
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `replace`, `semver`, `tape`, `function.prototype.name`
* [Tests] use shared travis-ci configs
* [Tests] Add es5 tests for `symbol` types (#45)
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
* [Tests] remove `jscs`
1.2.0 / 2018-09-27
=================
* [New] create ES2015 entry point/property, to replace ES6
* [Fix] Ensure optional arguments are not part of the length (#29)
* [Deps] update `is-callable`
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `object-inspect`, `replace`
* [Tests] avoid util.inspect bug with `new Date(NaN)` on node v6.0 and v6.1.
* [Tests] up to `node` `v10.11`, `v9.11`, `v8.12`, `v6.14`, `v4.9`
1.1.1 / 2016-01-03
=================
* [Fix: ES5] fix coercion logic: ES5s ToPrimitive does not coerce any primitive value, regardless of hint (#2)
1.1.0 / 2015-12-27
=================
* [New] add `Symbol.toPrimitive` support
* [Deps] update `is-callable`, `is-date-object`
* [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config`
* [Dev Deps] remove unused deps
* [Tests] up to `node` `v5.3`
* [Tests] fix npm upgrades on older node versions
* [Tests] fix testling
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
1.0.1 / 2016-01-03
=================
* [Fix: ES5] fix coercion logic: ES5s ToPrimitive does not coerce any primitive value, regardless of hint (#2)
* [Deps] update `is-callable`, `is-date-object`
* [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config`
* [Dev Deps] remove unused deps
* [Tests] up to `node` `v5.3`
* [Tests] fix npm upgrades on older node versions
* [Tests] fix testling
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
1.0.0 / 2015-03-19
=================
* Initial release.

View File

@@ -0,0 +1 @@
{"version":3,"file":"NotFoundError.js","sourceRoot":"","sources":["../../../../src/internal/util/NotFoundError.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAoBzC,QAAA,aAAa,GAAsB,mCAAgB,CAC9D,UAAC,MAAM;IACL,OAAA,SAAS,iBAAiB,CAAY,OAAe;QACnD,MAAM,CAAC,IAAI,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;AAJD,CAIC,CACJ,CAAC"}

View File

@@ -0,0 +1,56 @@
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
// TypeScript Version: 2.2
/** Version string */
export const version: string;
/** Render value using format string or code */
export function format(fmt: string|number, val: any, opts?: any): string;
/** Load format string */
export function load(fmt: string, idx?: number): number;
/** Test if the format is a Date format */
export function is_date(fmt: string): boolean;
/** Format Table */
export interface SSF$Table {
[key: number]: string;
[key: string]: string;
}
/** Get format table */
export function get_table(): SSF$Table;
/** Set format table */
export function load_table(tbl: SSF$Table): void;
/** Parsed date */
export interface SSF$Date {
/** number of whole days since relevant epoch, 0 <= D */
D: number;
/** integral year portion, epoch_year <= y */
y: number;
/** integral month portion, 1 <= m <= 12 */
m: number;
/** integral day portion, subject to gregorian YMD constraints */
d: number;
/** integral day of week (0=Sunday .. 6=Saturday) 0 <= q <= 6 */
q: number;
/** number of seconds since midnight, 0 <= T < 86400 */
T: number;
/** integral number of hours since midnight, 0 <= H < 24 */
H: number;
/** integral number of minutes since the last hour, 0 <= M < 60 */
M: number;
/** integral number of seconds since the last minute, 0 <= S < 60 */
S: number;
/** sub-second part of time, 0 <= u < 1 */
u: number;
}
/** Parse numeric date code */
export function parse_date_code(v: number, opts?: any): SSF$Date;

View File

@@ -0,0 +1,772 @@
/**
* The following strategy of importing modules allows the tests to be run in a browser environment.
* Test libraries like `mocha`, `sinon`, etc. are expected to be loaded before this file.
*/
var sinon = sinon || require('sinon');
var chai = chai || require('chai');
var expect = chai.expect;
if (typeof window === 'undefined') {
require('mocha');
require('jsdom-global')();
}
// Load libraries that require access to the DOM after `jsdom-global`
var Mousetrap = Mousetrap || require('./../mousetrap');
var KeyEvent = KeyEvent || require('./libs/key-event');
// Reset Mousetrap after each test
afterEach(function () {
Mousetrap.reset();
});
describe('Mousetrap.bind', function () {
describe('basic', function () {
it('z key fires when pressing z', function () {
var spy = sinon.spy();
Mousetrap.bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90);
// really slow for some reason
// expect(spy).to.have.been.calledOnce;
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('z', 'second argument should be key combo');
});
it('z key fires from keydown', function () {
var spy = sinon.spy();
Mousetrap.bind('z', spy, 'keydown');
KeyEvent.simulate('Z'.charCodeAt(0), 90);
// really slow for some reason
// expect(spy).to.have.been.calledOnce;
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('z', 'second argument should be key combo');
});
it('z key does not fire when pressing b', function () {
var spy = sinon.spy();
Mousetrap.bind('z', spy);
KeyEvent.simulate('B'.charCodeAt(0), 66);
expect(spy.callCount).to.equal(0);
});
it('z key does not fire when holding a modifier key', function () {
var spy = sinon.spy();
var modifiers = ['ctrl', 'alt', 'meta', 'shift'];
var charCode;
var modifier;
Mousetrap.bind('z', spy);
for (var i = 0; i < 4; i++) {
modifier = modifiers[i];
charCode = 'Z'.charCodeAt(0);
// character code is different when alt is pressed
if (modifier == 'alt') {
charCode = 'Ω'.charCodeAt(0);
}
spy.resetHistory();
KeyEvent.simulate(charCode, 90, [modifier]);
expect(spy.callCount).to.equal(0);
}
});
it('z key does not fire when inside an input element in an open shadow dom', function() {
var spy = sinon.spy();
var shadowHost = document.createElement('div');
var shadowRoot = shadowHost.attachShadow({ mode: 'open' });
document.body.appendChild(shadowHost);
var inputElement = document.createElement('input');
shadowRoot.appendChild(inputElement);
expect(shadowHost.shadowRoot).to.equal(shadowRoot, 'shadow root accessible');
Mousetrap.bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90, [], inputElement, 1, { shadowHost: shadowHost });
document.body.removeChild(shadowHost);
expect(spy.callCount).to.equal(0, 'callback should not have fired');
});
it('z key does fire when inside an input element in a closed shadow dom', function() {
var spy = sinon.spy();
var shadowHost = document.createElement('div');
var shadowRoot = shadowHost.attachShadow({ mode: 'closed' });
document.body.appendChild(shadowHost);
var inputElement = document.createElement('input');
shadowRoot.appendChild(inputElement);
expect(shadowHost.shadowRoot).to.equal(null, 'shadow root unaccessible');
Mousetrap.bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90, [], inputElement, 1, { shadowHost: shadowHost });
document.body.removeChild(shadowHost);
expect(spy.callCount).to.equal(1, 'callback should have fired once');
});
it('keyup events should fire', function() {
var spy = sinon.spy();
Mousetrap.bind('z', spy, 'keyup');
KeyEvent.simulate('Z'.charCodeAt(0), 90);
expect(spy.callCount).to.equal(1, 'keyup event for "z" should fire');
// for key held down we should only get one key up
KeyEvent.simulate('Z'.charCodeAt(0), 90, [], document, 10);
expect(spy.callCount).to.equal(2, 'keyup event for "z" should fire once for held down key');
});
it('keyup event for 0 should fire', function () {
var spy = sinon.spy();
Mousetrap.bind('0', spy, 'keyup');
KeyEvent.simulate(0, 48);
expect(spy.callCount).to.equal(1, 'keyup event for "0" should fire');
});
it('rebinding a key overwrites the callback for that key', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('x', spy1);
Mousetrap.bind('x', spy2);
KeyEvent.simulate('X'.charCodeAt(0), 88);
expect(spy1.callCount).to.equal(0, 'original callback should not fire');
expect(spy2.callCount).to.equal(1, 'new callback should fire');
});
it('binding an array of keys', function () {
var spy = sinon.spy();
Mousetrap.bind(['a', 'b', 'c'], spy);
KeyEvent.simulate('A'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'new callback was called');
expect(spy.args[0][1]).to.equal('a', 'callback should match "a"');
KeyEvent.simulate('B'.charCodeAt(0), 66);
expect(spy.callCount).to.equal(2, 'new callback was called twice');
expect(spy.args[1][1]).to.equal('b', 'callback should match "b"');
KeyEvent.simulate('C'.charCodeAt(0), 67);
expect(spy.callCount).to.equal(3, 'new callback was called three times');
expect(spy.args[2][1]).to.equal('c', 'callback should match "c"');
});
it('return false should prevent default and stop propagation', function () {
var spy = sinon.spy(function () {
return false;
});
Mousetrap.bind('command+s', spy);
KeyEvent.simulate('S'.charCodeAt(0), 83, ['meta']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][0].defaultPrevented).to.be.true;
// cancelBubble is not correctly set to true in webkit/blink
//
// @see https://code.google.com/p/chromium/issues/detail?id=162270
// expect(spy.args[0][0].cancelBubble).to.be.true;
// try without return false
spy = sinon.spy();
Mousetrap.bind('command+s', spy);
KeyEvent.simulate('S'.charCodeAt(0), 83, ['meta']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][0].cancelBubble).to.be.false;
expect(spy.args[0][0].defaultPrevented).to.be.false;
});
it('capslock key is ignored', function () {
var spy = sinon.spy();
Mousetrap.bind('a', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'callback should fire for lowercase a');
spy.resetHistory();
KeyEvent.simulate('A'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'callback should fire for capslock A');
spy.resetHistory();
KeyEvent.simulate('A'.charCodeAt(0), 65, ['shift']);
expect(spy.callCount).to.equal(0, 'callback should not fire fort shift+a');
});
});
describe('special characters', function () {
it('binding special characters', function () {
var spy = sinon.spy();
Mousetrap.bind('*', spy);
KeyEvent.simulate('*'.charCodeAt(0), 56, ['shift']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][1]).to.equal('*', 'callback should match *');
});
it('binding special characters keyup', function () {
var spy = sinon.spy();
Mousetrap.bind('*', spy, 'keyup');
KeyEvent.simulate('*'.charCodeAt(0), 56, ['shift']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][1]).to.equal('*', 'callback should match "*"');
});
it('binding keys with no associated charCode', function () {
var spy = sinon.spy();
Mousetrap.bind('left', spy);
KeyEvent.simulate(0, 37);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][1]).to.equal('left', 'callback should match "left"');
});
it('binding plus key alone should work', function () {
var spy = sinon.spy();
Mousetrap.bind('+', spy);
// fires for regular + character
KeyEvent.simulate('+'.charCodeAt(0), 43);
// and for shift+=
KeyEvent.simulate(43, 187, ['shift']);
expect(spy.callCount).to.equal(2, 'callback should fire');
expect(spy.args[0][1]).to.equal('+', 'callback should match "+"');
});
it('binding plus key as "plus" should work', function () {
var spy = sinon.spy();
Mousetrap.bind('plus', spy);
// fires for regular + character
KeyEvent.simulate('+'.charCodeAt(0), 43);
// and for shift+=
KeyEvent.simulate(43, 187, ['shift']);
expect(spy.callCount).to.equal(2, 'callback should fire');
expect(spy.args[0][1]).to.equal('plus', 'callback should match "plus"');
});
it('binding to alt++ should work', function () {
var spy = sinon.spy();
Mousetrap.bind('alt++', spy);
KeyEvent.simulate('+'.charCodeAt(0), 43, ['alt']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][1]).to.equal('alt++', 'callback should match "alt++"');
});
it('binding to alt+shift++ should work as well', function () {
var spy = sinon.spy();
Mousetrap.bind('alt+shift++', spy);
KeyEvent.simulate('+'.charCodeAt(0), 43, ['shift', 'alt']);
expect(spy.callCount).to.equal(1, 'callback should fire');
expect(spy.args[0][1]).to.equal('alt+shift++', 'callback should match "alt++"');
});
});
describe('combos with modifiers', function () {
it('binding key combinations', function () {
var spy = sinon.spy();
Mousetrap.bind('command+o', spy);
KeyEvent.simulate('O'.charCodeAt(0), 79, ['meta']);
expect(spy.callCount).to.equal(1, 'command+o callback should fire');
expect(spy.args[0][1]).to.equal('command+o', 'keyboard string returned is correct');
});
it('binding key combos with multiple modifiers', function () {
var spy = sinon.spy();
Mousetrap.bind('command+shift+o', spy);
KeyEvent.simulate('O'.charCodeAt(0), 79, ['meta']);
expect(spy.callCount).to.equal(0, 'command+o callback should not fire');
KeyEvent.simulate('O'.charCodeAt(0), 79, ['meta', 'shift']);
expect(spy.callCount).to.equal(1, 'command+o callback should fire');
});
it('should fire callback when ctrl+numpad 0 is pressed', function () {
var spy = sinon.spy();
Mousetrap.bind('ctrl+0', spy);
// numpad 0 keycode
KeyEvent.simulate(96, 96, ['ctrl']);
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('ctrl+0', 'second argument should be key combo');
});
});
describe('sequences', function () {
it('binding sequences', function () {
var spy = sinon.spy();
Mousetrap.bind('g i', spy);
KeyEvent.simulate('G'.charCodeAt(0), 71);
expect(spy.callCount).to.equal(0, 'callback should not fire');
KeyEvent.simulate('I'.charCodeAt(0), 73);
expect(spy.callCount).to.equal(1, 'callback should fire');
});
it('binding sequences with mixed types', function () {
var spy = sinon.spy();
Mousetrap.bind('g o enter', spy);
KeyEvent.simulate('G'.charCodeAt(0), 71);
expect(spy.callCount).to.equal(0, 'callback should not fire');
KeyEvent.simulate('O'.charCodeAt(0), 79);
expect(spy.callCount).to.equal(0, 'callback should not fire');
KeyEvent.simulate(0, 13);
expect(spy.callCount).to.equal(1, 'callback should fire');
});
it('binding sequences starting with modifier keys', function () {
var spy = sinon.spy();
Mousetrap.bind('option enter', spy);
KeyEvent.simulate(0, 18, ['alt']);
KeyEvent.simulate(0, 13);
expect(spy.callCount).to.equal(1, 'callback should fire');
spy = sinon.spy();
Mousetrap.bind('command enter', spy);
KeyEvent.simulate(0, 91, ['meta']);
KeyEvent.simulate(0, 13);
expect(spy.callCount).to.equal(1, 'callback should fire');
spy = sinon.spy();
Mousetrap.bind('escape enter', spy);
KeyEvent.simulate(0, 27);
KeyEvent.simulate(0, 13);
expect(spy.callCount).to.equal(1, 'callback should fire');
});
it('key within sequence should not fire', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('a', spy1);
Mousetrap.bind('c a t', spy2);
KeyEvent.simulate('A'.charCodeAt(0), 65);
expect(spy1.callCount).to.equal(1, 'callback 1 should fire');
spy1.resetHistory();
KeyEvent.simulate('C'.charCodeAt(0), 67);
KeyEvent.simulate('A'.charCodeAt(0), 65);
KeyEvent.simulate('T'.charCodeAt(0), 84);
expect(spy1.callCount).to.equal(0, 'callback for "a" key should not fire');
expect(spy2.callCount).to.equal(1, 'callback for "c a t" sequence should fire');
});
it('keyup at end of sequence should not fire', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('t', spy1, 'keyup');
Mousetrap.bind('b a t', spy2);
KeyEvent.simulate('B'.charCodeAt(0), 66);
KeyEvent.simulate('A'.charCodeAt(0), 65);
KeyEvent.simulate('T'.charCodeAt(0), 84);
expect(spy1.callCount).to.equal(0, 'callback for "t" keyup should not fire');
expect(spy2.callCount).to.equal(1, 'callback for "b a t" sequence should fire');
});
it('keyup sequences should work', function () {
var spy = sinon.spy();
Mousetrap.bind('b a t', spy, 'keyup');
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('a'.charCodeAt(0), 65);
// hold the last key down for a while
KeyEvent.simulate('t'.charCodeAt(0), 84, [], document, 10);
expect(spy.callCount).to.equal(1, 'callback for "b a t" sequence should fire on keyup');
});
it('extra spaces in sequences should be ignored', function () {
var spy = sinon.spy();
Mousetrap.bind('b a t', spy);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('t'.charCodeAt(0), 84);
expect(spy.callCount).to.equal(1, 'callback for "b a t" sequence should fire');
});
it('modifiers and sequences play nicely', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('ctrl a', spy1);
Mousetrap.bind('ctrl+b', spy2);
KeyEvent.simulate(0, 17, ['ctrl']);
KeyEvent.simulate('A'.charCodeAt(0), 65);
expect(spy1.callCount).to.equal(1, '"ctrl a" should fire');
KeyEvent.simulate('B'.charCodeAt(0), 66, ['ctrl']);
expect(spy2.callCount).to.equal(1, '"ctrl+b" should fire');
});
it('sequences that start the same work', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('g g l', spy2);
Mousetrap.bind('g g o', spy1);
KeyEvent.simulate('g'.charCodeAt(0), 71);
KeyEvent.simulate('g'.charCodeAt(0), 71);
KeyEvent.simulate('o'.charCodeAt(0), 79);
expect(spy1.callCount).to.equal(1, '"g g o" should fire');
expect(spy2.callCount).to.equal(0, '"g g l" should not fire');
spy1.resetHistory();
spy2.resetHistory();
KeyEvent.simulate('g'.charCodeAt(0), 71);
KeyEvent.simulate('g'.charCodeAt(0), 71);
KeyEvent.simulate('l'.charCodeAt(0), 76);
expect(spy1.callCount).to.equal(0, '"g g o" should not fire');
expect(spy2.callCount).to.equal(1, '"g g l" should fire');
});
it('sequences should not fire subsequences', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('a b c', spy1);
Mousetrap.bind('b c', spy2);
KeyEvent.simulate('A'.charCodeAt(0), 65);
KeyEvent.simulate('B'.charCodeAt(0), 66);
KeyEvent.simulate('C'.charCodeAt(0), 67);
expect(spy1.callCount).to.equal(1, '"a b c" should fire');
expect(spy2.callCount).to.equal(0, '"b c" should not fire');
spy1.resetHistory();
spy2.resetHistory();
Mousetrap.bind('option b', spy1);
Mousetrap.bind('a option b', spy2);
KeyEvent.simulate('A'.charCodeAt(0), 65);
KeyEvent.simulate(0, 18, ['alt']);
KeyEvent.simulate('B'.charCodeAt(0), 66);
expect(spy1.callCount).to.equal(0, '"option b" should not fire');
expect(spy2.callCount).to.equal(1, '"a option b" should fire');
});
it('rebinding same sequence should override previous', function () {
var spy1 = sinon.spy();
var spy2 = sinon.spy();
Mousetrap.bind('a b c', spy1);
Mousetrap.bind('a b c', spy2);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('c'.charCodeAt(0), 67);
expect(spy1.callCount).to.equal(0, 'first callback should not fire');
expect(spy2.callCount).to.equal(1, 'second callback should fire');
});
it('broken sequences', function () {
var spy = sinon.spy();
Mousetrap.bind('h a t', spy);
KeyEvent.simulate('h'.charCodeAt(0), 72);
KeyEvent.simulate('e'.charCodeAt(0), 69);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('r'.charCodeAt(0), 82);
KeyEvent.simulate('t'.charCodeAt(0), 84);
expect(spy.callCount).to.equal(0, 'sequence for "h a t" should not fire for "h e a r t"');
});
it('sequences containing combos should work', function () {
var spy = sinon.spy();
Mousetrap.bind('a ctrl+b', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('B'.charCodeAt(0), 66, ['ctrl']);
expect(spy.callCount).to.equal(1, '"a ctrl+b" should fire');
Mousetrap.unbind('a ctrl+b');
spy = sinon.spy();
Mousetrap.bind('ctrl+b a', spy);
KeyEvent.simulate('b'.charCodeAt(0), 66, ['ctrl']);
KeyEvent.simulate('a'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, '"ctrl+b a" should fire');
});
it('sequences starting with spacebar should work', function () {
var spy = sinon.spy();
Mousetrap.bind('a space b c', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate(32, 32);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('c'.charCodeAt(0), 67);
expect(spy.callCount).to.equal(1, '"a space b c" should fire');
});
it('konami code', function () {
var spy = sinon.spy();
Mousetrap.bind('up up down down left right left right b a enter', spy);
KeyEvent.simulate(0, 38);
KeyEvent.simulate(0, 38);
KeyEvent.simulate(0, 40);
KeyEvent.simulate(0, 40);
KeyEvent.simulate(0, 37);
KeyEvent.simulate(0, 39);
KeyEvent.simulate(0, 37);
KeyEvent.simulate(0, 39);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate(0, 13);
expect(spy.callCount).to.equal(1, 'konami code should fire');
});
it('sequence timer resets', function () {
var spy = sinon.spy();
var clock = sinon.useFakeTimers();
Mousetrap.bind('h a t', spy);
KeyEvent.simulate('h'.charCodeAt(0), 72);
clock.tick(600);
KeyEvent.simulate('a'.charCodeAt(0), 65);
clock.tick(900);
KeyEvent.simulate('t'.charCodeAt(0), 84);
expect(spy.callCount).to.equal(1, 'sequence should fire after waiting');
clock.restore();
});
it('sequences timeout', function () {
var spy = sinon.spy();
var clock = sinon.useFakeTimers();
Mousetrap.bind('g t', spy);
KeyEvent.simulate('g'.charCodeAt(0), 71);
clock.tick(1000);
KeyEvent.simulate('t'.charCodeAt(0), 84);
expect(spy.callCount).to.equal(0, 'sequence callback should not fire');
clock.restore();
});
});
describe('default actions', function () {
var keys = {
keypress: [
['a', 65],
['A', 65, ['shift']],
['7', 55],
['?', 191],
['*', 56],
['+', 187],
['$', 52],
['[', 219],
['.', 190]
],
keydown: [
['shift+\'', 222, ['shift']],
['shift+a', 65, ['shift']],
['shift+5', 53, ['shift']],
['command+shift+p', 80, ['meta', 'shift']],
['space', 32],
['left', 37]
]
};
function getCallback(key, keyCode, type, modifiers) {
return function () {
var spy = sinon.spy();
Mousetrap.bind(key, spy);
KeyEvent.simulate(key.charCodeAt(0), keyCode, modifiers);
expect(spy.callCount).to.equal(1);
expect(spy.args[0][0].type).to.equal(type);
};
}
for (var type in keys) {
for (var i = 0; i < keys[type].length; i++) {
var key = keys[type][i][0];
var keyCode = keys[type][i][1];
var modifiers = keys[type][i][2] || [];
it('"' + key + '" uses "' + type + '"', getCallback(key, keyCode, type, modifiers));
}
}
});
});
describe('Mousetrap.unbind', function () {
it('unbind works', function () {
var spy = sinon.spy();
Mousetrap.bind('a', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'callback for a should fire');
Mousetrap.unbind('a');
KeyEvent.simulate('a'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'callback for a should not fire after unbind');
});
it('unbind accepts an array', function () {
var spy = sinon.spy();
Mousetrap.bind(['a', 'b', 'c'], spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('c'.charCodeAt(0), 67);
expect(spy.callCount).to.equal(3, 'callback should have fired 3 times');
Mousetrap.unbind(['a', 'b', 'c']);
KeyEvent.simulate('a'.charCodeAt(0), 65);
KeyEvent.simulate('b'.charCodeAt(0), 66);
KeyEvent.simulate('c'.charCodeAt(0), 67);
expect(spy.callCount).to.equal(3, 'callback should not fire after unbind');
});
});
describe('wrapping a specific element', function () {
// Prepare the DOM for these tests.
document.body.insertAdjacentHTML('afterbegin', `
<form style="display: none;">
<textarea></textarea>
</form>
`);
var form = document.querySelector('form');
var textarea = form.querySelector('textarea');
it('z key fires when pressing z in the target element', function () {
var spy = sinon.spy();
Mousetrap(form).bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90, [], form);
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('z', 'second argument should be key combo');
});
it('z key fires when pressing z in a child of the target element', function () {
var spy = sinon.spy();
Mousetrap(form).bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90, [], textarea);
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('z', 'second argument should be key combo');
});
it('z key does not fire when pressing z outside the target element', function () {
var spy = sinon.spy();
Mousetrap(textarea).bind('z', spy);
KeyEvent.simulate('Z'.charCodeAt(0), 90);
expect(spy.callCount).to.equal(0, 'callback should not have fired');
});
it('should work when constructing a new mousetrap object', function () {
var spy = sinon.spy();
var mousetrap = new Mousetrap(form);
mousetrap.bind('a', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65, [], textarea);
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('a', 'second argument should be key combo');
});
it('should allow you to create an empty mousetrap constructor', function () {
var spy = sinon.spy();
var mousetrap = new Mousetrap();
mousetrap.bind('a', spy);
KeyEvent.simulate('a'.charCodeAt(0), 65);
expect(spy.callCount).to.equal(1, 'callback should fire once');
expect(spy.args[0][0]).to.be.an.instanceOf(Event, 'first argument should be Event');
expect(spy.args[0][1]).to.equal('a', 'second argument should be key combo');
});
});
describe('Mouestrap.addKeycodes', function () {
it('should properly recognize non-default mapping', function () {
const spy = sinon.spy();
Mousetrap.addKeycodes({
144: 'num',
});
Mousetrap.bind('num', spy);
KeyEvent.simulate(144, 144);
expect(spy.callCount).to.equal(1, 'callback should fire for num');
spy.resetHistory();
});
});

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"I v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC rB","2":"F"},G:{"1":"E UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB"},H:{"1":"oC"},I:{"1":"tB I f pC qC rC sC BC tC uC"},J:{"1":"D A"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:2,C:"CSS currentColor value"};

View File

@@ -0,0 +1,469 @@
/* global host, data, VMError */
'use strict';
const LocalError = Error;
const LocalTypeError = TypeError;
const LocalWeakMap = WeakMap;
const {
apply: localReflectApply,
defineProperty: localReflectDefineProperty
} = Reflect;
const {
set: localWeakMapSet,
get: localWeakMapGet
} = LocalWeakMap.prototype;
const {
isArray: localArrayIsArray
} = Array;
function uncurryThis(func) {
return (thiz, ...args) => localReflectApply(func, thiz, args);
}
const localArrayPrototypeSlice = uncurryThis(Array.prototype.slice);
const localArrayPrototypeIncludes = uncurryThis(Array.prototype.includes);
const localArrayPrototypePush = uncurryThis(Array.prototype.push);
const localArrayPrototypeIndexOf = uncurryThis(Array.prototype.indexOf);
const localArrayPrototypeSplice = uncurryThis(Array.prototype.splice);
const localStringPrototypeStartsWith = uncurryThis(String.prototype.startsWith);
const localStringPrototypeSlice = uncurryThis(String.prototype.slice);
const localStringPrototypeIndexOf = uncurryThis(String.prototype.indexOf);
const {
argv: optionArgv,
env: optionEnv,
console: optionConsole,
vm,
resolver,
extensions
} = data;
function ensureSandboxArray(a) {
return localArrayPrototypeSlice(a);
}
const globalPaths = ensureSandboxArray(resolver.globalPaths);
class Module {
constructor(id, path, parent) {
this.id = id;
this.filename = id;
this.path = path;
this.parent = parent;
this.loaded = false;
this.paths = path ? ensureSandboxArray(resolver.genLookupPaths(path)) : [];
this.children = [];
this.exports = {};
}
_updateChildren(child, isNew) {
const children = this.children;
if (children && (isNew || !localArrayPrototypeIncludes(children, child))) {
localArrayPrototypePush(children, child);
}
}
require(id) {
return requireImpl(this, id, false);
}
}
const originalRequire = Module.prototype.require;
const cacheBuiltins = {__proto__: null};
function requireImpl(mod, id, direct) {
if (direct && mod.require !== originalRequire) {
return mod.require(id);
}
const filename = resolver.resolve(mod, id, undefined, Module._extensions, direct);
if (localStringPrototypeStartsWith(filename, 'node:')) {
id = localStringPrototypeSlice(filename, 5);
let nmod = cacheBuiltins[id];
if (!nmod) {
nmod = resolver.loadBuiltinModule(vm, id);
if (!nmod) throw new VMError(`Cannot find module '${filename}'`, 'ENOTFOUND');
cacheBuiltins[id] = nmod;
}
return nmod;
}
const cachedModule = Module._cache[filename];
if (cachedModule !== undefined) {
mod._updateChildren(cachedModule, false);
return cachedModule.exports;
}
let nmod = cacheBuiltins[id];
if (nmod) return nmod;
nmod = resolver.loadBuiltinModule(vm, id);
if (nmod) {
cacheBuiltins[id] = nmod;
return nmod;
}
const path = resolver.fs.dirname(filename);
const module = new Module(filename, path, mod);
resolver.registerModule(module, filename, path, mod, direct);
mod._updateChildren(module, true);
try {
Module._cache[filename] = module;
const handler = findBestExtensionHandler(filename);
handler(module, filename);
module.loaded = true;
} catch (e) {
delete Module._cache[filename];
const children = mod.children;
if (localArrayIsArray(children)) {
const index = localArrayPrototypeIndexOf(children, module);
if (index !== -1) {
localArrayPrototypeSplice(children, index, 1);
}
}
throw e;
}
return module.exports;
}
Module.builtinModules = ensureSandboxArray(resolver.getBuiltinModulesList());
Module.globalPaths = globalPaths;
Module._extensions = {__proto__: null};
Module._cache = {__proto__: null};
{
const keys = Object.getOwnPropertyNames(extensions);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const handler = extensions[key];
Module._extensions[key] = (mod, filename) => handler(mod, filename);
}
}
function findBestExtensionHandler(filename) {
const name = resolver.fs.basename(filename);
for (let i = 0; (i = localStringPrototypeIndexOf(name, '.', i + 1)) !== -1;) {
const ext = localStringPrototypeSlice(name, i);
const handler = Module._extensions[ext];
if (handler) return handler;
}
const js = Module._extensions['.js'];
if (js) return js;
const keys = Object.getOwnPropertyNames(Module._extensions);
if (keys.length === 0) throw new VMError(`Failed to load '${filename}': Unknown type.`, 'ELOADFAIL');
return Module._extensions[keys[0]];
}
function createRequireForModule(mod) {
// eslint-disable-next-line no-shadow
function require(id) {
return requireImpl(mod, id, true);
}
function resolve(id, options) {
return resolver.resolve(mod, id, options, Module._extensions, true);
}
require.resolve = resolve;
function paths(id) {
return ensureSandboxArray(resolver.lookupPaths(mod, id));
}
resolve.paths = paths;
require.extensions = Module._extensions;
require.cache = Module._cache;
return require;
}
/**
* Prepare sandbox.
*/
const TIMERS = new LocalWeakMap();
class Timeout {
}
class Interval {
}
class Immediate {
}
function clearTimer(timer) {
const obj = localReflectApply(localWeakMapGet, TIMERS, [timer]);
if (obj) {
obj.clear(obj.value);
}
}
// This is a function and not an arrow function, since the original is also a function
// eslint-disable-next-line no-shadow
global.setTimeout = function setTimeout(callback, delay, ...args) {
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
const obj = new Timeout(callback, args);
const cb = () => {
localReflectApply(callback, null, args);
};
const tmr = host.setTimeout(cb, delay);
const ref = {
__proto__: null,
clear: host.clearTimeout,
value: tmr
};
localReflectApply(localWeakMapSet, TIMERS, [obj, ref]);
return obj;
};
// eslint-disable-next-line no-shadow
global.setInterval = function setInterval(callback, interval, ...args) {
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
const obj = new Interval();
const cb = () => {
localReflectApply(callback, null, args);
};
const tmr = host.setInterval(cb, interval);
const ref = {
__proto__: null,
clear: host.clearInterval,
value: tmr
};
localReflectApply(localWeakMapSet, TIMERS, [obj, ref]);
return obj;
};
// eslint-disable-next-line no-shadow
global.setImmediate = function setImmediate(callback, ...args) {
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
const obj = new Immediate();
const cb = () => {
localReflectApply(callback, null, args);
};
const tmr = host.setImmediate(cb);
const ref = {
__proto__: null,
clear: host.clearImmediate,
value: tmr
};
localReflectApply(localWeakMapSet, TIMERS, [obj, ref]);
return obj;
};
// eslint-disable-next-line no-shadow
global.clearTimeout = function clearTimeout(timeout) {
clearTimer(timeout);
};
// eslint-disable-next-line no-shadow
global.clearInterval = function clearInterval(interval) {
clearTimer(interval);
};
// eslint-disable-next-line no-shadow
global.clearImmediate = function clearImmediate(immediate) {
clearTimer(immediate);
};
const localProcess = host.process;
function vmEmitArgs(event, args) {
const allargs = [event];
for (let i = 0; i < args.length; i++) {
if (!localReflectDefineProperty(allargs, i + 1, {
__proto__: null,
value: args[i],
writable: true,
enumerable: true,
configurable: true
})) throw new LocalError('Unexpected');
}
return localReflectApply(vm.emit, vm, allargs);
}
const LISTENERS = new LocalWeakMap();
const LISTENER_HANDLER = new LocalWeakMap();
/**
*
* @param {*} name
* @param {*} handler
* @this process
* @return {this}
*/
function addListener(name, handler) {
if (name !== 'beforeExit' && name !== 'exit') {
throw new LocalError(`Access denied to listen for '${name}' event.`);
}
let cb = localReflectApply(localWeakMapGet, LISTENERS, [handler]);
if (!cb) {
cb = () => {
handler();
};
localReflectApply(localWeakMapSet, LISTENER_HANDLER, [cb, handler]);
localReflectApply(localWeakMapSet, LISTENERS, [handler, cb]);
}
localProcess.on(name, cb);
return this;
}
/**
*
* @this process
* @return {this}
*/
// eslint-disable-next-line no-shadow
function process() {
return this;
}
const baseUptime = localProcess.uptime();
// FIXME wrong class structure
global.process = {
__proto__: process.prototype,
argv: optionArgv !== undefined ? optionArgv : [],
title: localProcess.title,
version: localProcess.version,
versions: localProcess.versions,
arch: localProcess.arch,
platform: localProcess.platform,
env: optionEnv !== undefined ? optionEnv : {},
pid: localProcess.pid,
features: localProcess.features,
nextTick: function nextTick(callback, ...args) {
if (typeof callback !== 'function') {
throw new LocalError('Callback must be a function.');
}
localProcess.nextTick(()=>{
localReflectApply(callback, null, args);
});
},
hrtime: function hrtime(time) {
return localProcess.hrtime(time);
},
uptime: function uptime() {
return localProcess.uptime() - baseUptime;
},
cwd: function cwd() {
return localProcess.cwd();
},
addListener,
on: addListener,
once: function once(name, handler) {
if (name !== 'beforeExit' && name !== 'exit') {
throw new LocalError(`Access denied to listen for '${name}' event.`);
}
let triggered = false;
const cb = () => {
if (triggered) return;
triggered = true;
localProcess.removeListener(name, cb);
handler();
};
localReflectApply(localWeakMapSet, LISTENER_HANDLER, [cb, handler]);
localProcess.on(name, cb);
return this;
},
listeners: function listeners(name) {
if (name !== 'beforeExit' && name !== 'exit') {
// Maybe add ({__proto__:null})[name] to throw when name fails in https://tc39.es/ecma262/#sec-topropertykey.
return [];
}
// Filter out listeners, which were not created in this sandbox
const all = localProcess.listeners(name);
const filtered = [];
let j = 0;
for (let i = 0; i < all.length; i++) {
const h = localReflectApply(localWeakMapGet, LISTENER_HANDLER, [all[i]]);
if (h) {
if (!localReflectDefineProperty(filtered, j, {
__proto__: null,
value: h,
writable: true,
enumerable: true,
configurable: true
})) throw new LocalError('Unexpected');
j++;
}
}
return filtered;
},
removeListener: function removeListener(name, handler) {
if (name !== 'beforeExit' && name !== 'exit') {
return this;
}
const cb = localReflectApply(localWeakMapGet, LISTENERS, [handler]);
if (cb) localProcess.removeListener(name, cb);
return this;
},
umask: function umask() {
if (arguments.length) {
throw new LocalError('Access denied to set umask.');
}
return localProcess.umask();
}
};
if (optionConsole === 'inherit') {
global.console = host.console;
} else if (optionConsole === 'redirect') {
global.console = {
debug(...args) {
vmEmitArgs('console.debug', args);
},
log(...args) {
vmEmitArgs('console.log', args);
},
info(...args) {
vmEmitArgs('console.info', args);
},
warn(...args) {
vmEmitArgs('console.warn', args);
},
error(...args) {
vmEmitArgs('console.error', args);
},
dir(...args) {
vmEmitArgs('console.dir', args);
},
time() {},
timeEnd() {},
trace(...args) {
vmEmitArgs('console.trace', args);
}
};
}
return {
__proto__: null,
Module,
jsonParse: JSON.parse,
createRequireForModule,
requireImpl
};

View File

@@ -0,0 +1,11 @@
"use strict";
var forOf = require("es6-iterator/for-of")
, isIterable = require("es6-iterator/is-iterable")
, iterable = require("./validate")
, forEach = Array.prototype.forEach;
module.exports = function (target, cb /*, thisArg*/) {
if (isIterable(iterable(target))) forOf(target, cb, arguments[2]);
else forEach.call(target, cb, arguments[2]);
};

View File

@@ -0,0 +1,86 @@
"use strict";
module.exports = function(Promise, INTERNAL) {
var util = require("./util");
var errorObj = util.errorObj;
var isObject = util.isObject;
function tryConvertToPromise(obj, context) {
if (isObject(obj)) {
if (obj instanceof Promise) return obj;
var then = getThen(obj);
if (then === errorObj) {
if (context) context._pushContext();
var ret = Promise.reject(then.e);
if (context) context._popContext();
return ret;
} else if (typeof then === "function") {
if (isAnyBluebirdPromise(obj)) {
var ret = new Promise(INTERNAL);
obj._then(
ret._fulfill,
ret._reject,
undefined,
ret,
null
);
return ret;
}
return doThenable(obj, then, context);
}
}
return obj;
}
function doGetThen(obj) {
return obj.then;
}
function getThen(obj) {
try {
return doGetThen(obj);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
var hasProp = {}.hasOwnProperty;
function isAnyBluebirdPromise(obj) {
try {
return hasProp.call(obj, "_promise0");
} catch (e) {
return false;
}
}
function doThenable(x, then, context) {
var promise = new Promise(INTERNAL);
var ret = promise;
if (context) context._pushContext();
promise._captureStackTrace();
if (context) context._popContext();
var synchronous = true;
var result = util.tryCatch(then).call(x, resolve, reject);
synchronous = false;
if (promise && result === errorObj) {
promise._rejectCallback(result.e, true, true);
promise = null;
}
function resolve(value) {
if (!promise) return;
promise._resolveCallback(value);
promise = null;
}
function reject(reason) {
if (!promise) return;
promise._rejectCallback(reason, synchronous, true);
promise = null;
}
return ret;
}
return tryConvertToPromise;
};

View File

@@ -0,0 +1,28 @@
import { config } from '../config';
var context = null;
export function errorContext(cb) {
if (config.useDeprecatedSynchronousErrorHandling) {
var isRoot = !context;
if (isRoot) {
context = { errorThrown: false, error: null };
}
cb();
if (isRoot) {
var _a = context, errorThrown = _a.errorThrown, error = _a.error;
context = null;
if (errorThrown) {
throw error;
}
}
}
else {
cb();
}
}
export function captureError(err) {
if (config.useDeprecatedSynchronousErrorHandling && context) {
context.errorThrown = true;
context.error = err;
}
}
//# sourceMappingURL=errorContext.js.map

View File

@@ -0,0 +1,37 @@
'use strict';
var ToNumber = require('./ToNumber');
var ToPrimitive = require('./ToPrimitive');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison
module.exports = function AbstractEqualityComparison(x, y) {
var xType = Type(x);
var yType = Type(y);
if (xType === yType) {
return x === y; // ES6+ specified this shortcut anyways.
}
if (x == null && y == null) {
return true;
}
if (xType === 'Number' && yType === 'String') {
return AbstractEqualityComparison(x, ToNumber(y));
}
if (xType === 'String' && yType === 'Number') {
return AbstractEqualityComparison(ToNumber(x), y);
}
if (xType === 'Boolean') {
return AbstractEqualityComparison(ToNumber(x), y);
}
if (yType === 'Boolean') {
return AbstractEqualityComparison(x, ToNumber(y));
}
if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') {
return AbstractEqualityComparison(x, ToPrimitive(y));
}
if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) {
return AbstractEqualityComparison(ToPrimitive(x), y);
}
return false;
};

View File

@@ -0,0 +1,2 @@
declare function isRegExp(value: any): boolean;
export default isRegExp;

View File

@@ -0,0 +1,95 @@
import { MonoTypeOperatorFunction } from '../types';
import { identity } from '../util/identity';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
/**
* Skip a specified number of values before the completion of an observable.
*
* ![](skipLast.png)
*
* Returns an observable that will emit values as soon as it can, given a number of
* skipped values. For example, if you `skipLast(3)` on a source, when the source
* emits its fourth value, the first value the source emitted will finally be emitted
* from the returned observable, as it is no longer part of what needs to be skipped.
*
* All values emitted by the result of `skipLast(N)` will be delayed by `N` emissions,
* as each value is held in a buffer until enough values have been emitted that that
* the buffered value may finally be sent to the consumer.
*
* After subscribing, unsubscribing will not result in the emission of the buffered
* skipped values.
*
* ## Example
*
* Skip the last 2 values of an observable with many values
*
* ```ts
* import { of, skipLast } from 'rxjs';
*
* const numbers = of(1, 2, 3, 4, 5);
* const skipLastTwo = numbers.pipe(skipLast(2));
* skipLastTwo.subscribe(x => console.log(x));
*
* // Results in:
* // 1 2 3
* // (4 and 5 are skipped)
* ```
*
* @see {@link skip}
* @see {@link skipUntil}
* @see {@link skipWhile}
* @see {@link take}
*
* @param skipCount Number of elements to skip from the end of the source Observable.
* @return A function that returns an Observable that skips the last `count`
* values emitted by the source Observable.
*/
export function skipLast<T>(skipCount: number): MonoTypeOperatorFunction<T> {
return skipCount <= 0
? // For skipCounts less than or equal to zero, we are just mirroring the source.
identity
: operate((source, subscriber) => {
// A ring buffer to hold the values while we wait to see
// if we can emit it or it's part of the "skipped" last values.
// Note that it is the _same size_ as the skip count.
let ring: T[] = new Array(skipCount);
// The number of values seen so far. This is used to get
// the index of the current value when it arrives.
let seen = 0;
source.subscribe(
createOperatorSubscriber(subscriber, (value) => {
// Get the index of the value we have right now
// relative to all other values we've seen, then
// increment `seen`. This ensures we've moved to
// the next slot in our ring buffer.
const valueIndex = seen++;
if (valueIndex < skipCount) {
// If we haven't seen enough values to fill our buffer yet,
// Then we aren't to a number of seen values where we can
// emit anything, so let's just start by filling the ring buffer.
ring[valueIndex] = value;
} else {
// We are traversing over the ring array in such
// a way that when we get to the end, we loop back
// and go to the start.
const index = valueIndex % skipCount;
// Pull the oldest value out so we can emit it,
// and stuff the new value in it's place.
const oldValue = ring[index];
ring[index] = value;
// Emit the old value. It is important that this happens
// after we swap the value in the buffer, if it happens
// before we swap the value in the buffer, then a synchronous
// source can get the buffer out of whack.
subscriber.next(oldValue);
}
})
);
return () => {
// Release our values in memory
ring = null!;
};
});
}

View File

@@ -0,0 +1,8 @@
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:seq', {
kind: 'sequence',
construct: function (data) { return data !== null ? data : []; }
});

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ajax/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}

View File

@@ -0,0 +1,55 @@
/* Generated by `npm run build`, do not edit! */
"use strict"
var tt = require("acorn").tokTypes
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
var nextTokenIsDot = function (parser) {
skipWhiteSpace.lastIndex = parser.pos
var skip = skipWhiteSpace.exec(parser.input)
var next = parser.pos + skip[0].length
return parser.input.slice(next, next + 1) === "."
}
module.exports = function(Parser) {
return /*@__PURE__*/(function (Parser) {
function anonymous () {
Parser.apply(this, arguments);
}
if ( Parser ) anonymous.__proto__ = Parser;
anonymous.prototype = Object.create( Parser && Parser.prototype );
anonymous.prototype.constructor = anonymous;
anonymous.prototype.parseExprAtom = function parseExprAtom (refDestructuringErrors) {
if (this.type !== tt._import || !nextTokenIsDot(this)) { return Parser.prototype.parseExprAtom.call(this, refDestructuringErrors) }
if (!this.options.allowImportExportEverywhere && !this.inModule) {
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
}
var node = this.startNode()
node.meta = this.parseIdent(true)
this.expect(tt.dot)
node.property = this.parseIdent(true)
if (node.property.name !== "meta") {
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
}
return this.finishNode(node, "MetaProperty")
};
anonymous.prototype.parseStatement = function parseStatement (context, topLevel, exports) {
if (this.type !== tt._import || !nextTokenIsDot(this)) {
return Parser.prototype.parseStatement.call(this, context, topLevel, exports)
}
var node = this.startNode()
var expr = this.parseExpression()
return this.parseExpressionStatement(node, expr)
};
return anonymous;
}(Parser))
}

View File

@@ -0,0 +1,6 @@
/*
* Load this dynamically so that it
* doesn't appear in the rollup bundle.
*/
module.exports.features = require('../../data/features')

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,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.02121,"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.02828,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00707,"79":0,"80":0,"81":0.02121,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0.15556,"88":0.00707,"89":0,"90":0,"91":0,"92":0.02121,"93":0.00707,"94":0,"95":0,"96":0,"97":0.00707,"98":0,"99":0,"100":0.00707,"101":0,"102":0.96873,"103":0.00707,"104":0.02121,"105":0.00707,"106":0.01414,"107":0.01414,"108":0.16263,"109":2.61627,"110":1.92331,"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.00707,"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.00707,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.02121,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0.00707,"73":0,"74":0.00707,"75":0,"76":0.00707,"77":0,"78":0.03536,"79":0.02828,"80":0.00707,"81":0.01414,"83":0.00707,"84":0,"85":0.01414,"86":0.00707,"87":0.02121,"88":0.00707,"89":0.00707,"90":0.00707,"91":0.00707,"92":0.01414,"93":0.05657,"94":0.00707,"95":0.07778,"96":0.10607,"97":0.02121,"98":0.00707,"99":0.00707,"100":0.02121,"101":0.00707,"102":0.07778,"103":0.14142,"104":0.02121,"105":0.19799,"106":0.13435,"107":0.14142,"108":0.93337,"109":18.09469,"110":12.38839,"111":0.00707,"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,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00707,"86":0,"87":0,"88":0,"89":0.00707,"90":0,"91":0,"92":0,"93":0.09899,"94":1.5839,"95":1.81018,"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.00707,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0.00707,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00707,"93":0,"94":0,"95":0,"96":0,"97":0.00707,"98":0,"99":0,"100":0,"101":0,"102":0.00707,"103":0.00707,"104":0,"105":0,"106":0.00707,"107":0.01414,"108":0.06364,"109":1.56976,"110":2.75769},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.01414,"14":0.0495,"15":0.00707,_:"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.05657,"13.1":0.07071,"14.1":0.13435,"15.1":0.02828,"15.2-15.3":0.02828,"15.4":0.06364,"15.5":0.09899,"15.6":0.30405,"16.0":0.09899,"16.1":0.21213,"16.2":0.49497,"16.3":0.38891,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.0076,"6.0-6.1":0,"7.0-7.1":0.0038,"8.1-8.4":0.0038,"9.0-9.2":0,"9.3":0.01141,"10.0-10.2":0.03232,"10.3":0.192,"11.0-11.2":0.01141,"11.3-11.4":0.0076,"12.0-12.1":0.0076,"12.2-12.5":0.20721,"13.0-13.1":0.0038,"13.2":0.0019,"13.3":0.0095,"13.4-13.7":0.15398,"14.0-14.4":0.14067,"14.5-14.8":0.44293,"15.0-15.1":0.08554,"15.2-15.3":0.20151,"15.4":0.1996,"15.5":0.98472,"15.6":1.31359,"16.0":2.45799,"16.1":4.83043,"16.2":4.41791,"16.3":2.46179,"16.4":0.01711},P:{"4":0.01038,"20":0.63338,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01038,"12.0":0,"13.0":0.02077,"14.0":0.03115,"15.0":0.01038,"16.0":0.04153,"17.0":0.03115,"18.0":0.05192,"19.0":1.23561},I:{"0":0,"3":0,"4":0.00878,"2.1":0,"2.2":0,"2.3":0.01756,"4.1":0.00878,"4.2-4.3":0.02634,"4.4":0,"4.4.3-4.4.4":0.06146},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.01414,"9":0,"10":0,"11":0.04243,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.0205},H:{"0":0.26621},L:{"0":27.90952},R:{_:"0"},M:{"0":0.26654},Q:{"13.1":0}};

View File

@@ -0,0 +1,13 @@
import Block from '../Block';
import Wrapper from './shared/Wrapper';
import Body from '../../nodes/Body';
import { Identifier } from 'estree';
import EventHandler from './Element/EventHandler';
import { TemplateNode } from '../../../interfaces';
import Renderer from '../Renderer';
export default class BodyWrapper extends Wrapper {
node: Body;
handlers: EventHandler[];
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
}

View File

@@ -0,0 +1,13 @@
import { ConnectableObservable } from '../observable/ConnectableObservable';
import { isFunction } from '../util/isFunction';
import { connect } from './connect';
export function multicast(subjectOrSubjectFactory, selector) {
var subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : function () { return subjectOrSubjectFactory; };
if (isFunction(selector)) {
return connect(selector, {
connector: subjectFactory,
});
}
return function (source) { return new ConnectableObservable(source, subjectFactory); };
}
//# sourceMappingURL=multicast.js.map

View File

@@ -0,0 +1,5 @@
import { merge } from './merge';
export function mergeWith(...otherSources) {
return merge(...otherSources);
}
//# sourceMappingURL=mergeWith.js.map