new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { AsapAction } from './AsapAction';
|
||||
import { AsapScheduler } from './AsapScheduler';
|
||||
|
||||
/**
|
||||
*
|
||||
* Asap Scheduler
|
||||
*
|
||||
* <span class="informal">Perform task as fast as it can be performed asynchronously</span>
|
||||
*
|
||||
* `asap` scheduler behaves the same as {@link asyncScheduler} scheduler when you use it to delay task
|
||||
* in time. If however you set delay to `0`, `asap` will wait for current synchronously executing
|
||||
* code to end and then it will try to execute given task as fast as possible.
|
||||
*
|
||||
* `asap` scheduler will do its best to minimize time between end of currently executing code
|
||||
* and start of scheduled task. This makes it best candidate for performing so called "deferring".
|
||||
* Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves
|
||||
* some (although minimal) unwanted delay.
|
||||
*
|
||||
* Note that using `asap` scheduler does not necessarily mean that your task will be first to process
|
||||
* after currently executing code. In particular, if some task was also scheduled with `asap` before,
|
||||
* that task will execute first. That being said, if you need to schedule task asynchronously, but
|
||||
* as soon as possible, `asap` scheduler is your best bet.
|
||||
*
|
||||
* ## Example
|
||||
* Compare async and asap scheduler<
|
||||
* ```ts
|
||||
* import { asapScheduler, asyncScheduler } from 'rxjs';
|
||||
*
|
||||
* asyncScheduler.schedule(() => console.log('async')); // scheduling 'async' first...
|
||||
* asapScheduler.schedule(() => console.log('asap'));
|
||||
*
|
||||
* // Logs:
|
||||
* // "asap"
|
||||
* // "async"
|
||||
* // ... but 'asap' goes first!
|
||||
* ```
|
||||
*/
|
||||
|
||||
export const asapScheduler = new AsapScheduler(AsapAction);
|
||||
|
||||
/**
|
||||
* @deprecated Renamed to {@link asapScheduler}. Will be removed in v8.
|
||||
*/
|
||||
export const asap = asapScheduler;
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var RequireObjectCoercible = require('es-abstract/2022/RequireObjectCoercible');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var polyfill = getPolyfill();
|
||||
var shim = require('./shim');
|
||||
|
||||
var $slice = callBound('Array.prototype.slice');
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var boundMapShim = function map(array, callbackfn) {
|
||||
RequireObjectCoercible(array);
|
||||
return polyfill.apply(array, $slice(arguments, 1));
|
||||
};
|
||||
define(boundMapShim, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = boundMapShim;
|
||||
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
var customError = require("es5-ext/error/custom")
|
||||
, isValue = require("es5-ext/object/is-value")
|
||||
, ensurePromise = require("es5-ext/object/ensure-promise")
|
||||
, nextTick = require("next-tick")
|
||||
, ensureTimeout = require("../valid-timeout");
|
||||
|
||||
module.exports = function (/* timeout */) {
|
||||
ensurePromise(this);
|
||||
var timeout = arguments[0];
|
||||
if (isValue(timeout)) timeout = ensureTimeout(timeout);
|
||||
return new this.constructor(
|
||||
function (resolve, reject) {
|
||||
var isSettled = false, timeoutId;
|
||||
var timeoutCallback = function () {
|
||||
if (isSettled) return;
|
||||
reject(
|
||||
customError(
|
||||
"Operation timeout (exceeded " +
|
||||
(isValue(timeout) ? timeout + "ms" : "tick") +
|
||||
")",
|
||||
"PROMISE_TIMEOUT"
|
||||
)
|
||||
);
|
||||
};
|
||||
if (isValue(timeout)) timeoutId = setTimeout(timeoutCallback, timeout);
|
||||
else nextTick(timeoutCallback);
|
||||
this.then(
|
||||
function (value) {
|
||||
isSettled = true;
|
||||
clearTimeout(timeoutId);
|
||||
resolve(value);
|
||||
},
|
||||
function (reason) {
|
||||
isSettled = true;
|
||||
clearTimeout(timeoutId);
|
||||
reject(reason);
|
||||
}
|
||||
);
|
||||
}.bind(this)
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { mergeMap } from './mergeMap';
|
||||
import { isFunction } from '../util/isFunction';
|
||||
export function mergeMapTo(innerObservable, resultSelector, concurrent) {
|
||||
if (concurrent === void 0) { concurrent = Infinity; }
|
||||
if (isFunction(resultSelector)) {
|
||||
return mergeMap(function () { return innerObservable; }, resultSelector, concurrent);
|
||||
}
|
||||
if (typeof resultSelector === 'number') {
|
||||
concurrent = resultSelector;
|
||||
}
|
||||
return mergeMap(function () { return innerObservable; }, concurrent);
|
||||
}
|
||||
//# sourceMappingURL=mergeMapTo.js.map
|
||||
@@ -0,0 +1,27 @@
|
||||
# is-docker
|
||||
|
||||
> Check if the process is running inside a Docker container
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-docker
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isDocker = require('is-docker');
|
||||
|
||||
if (isDocker()) {
|
||||
console.log('Running inside a Docker container');
|
||||
}
|
||||
```
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ is-docker
|
||||
```
|
||||
|
||||
Exits with code 0 if inside a Docker container and 2 if not.
|
||||
@@ -0,0 +1,39 @@
|
||||
const _htmlEscape = string => string
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
|
||||
const _htmlUnescape = htmlString => htmlString
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<')
|
||||
.replace(/�?39;/g, '\'')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/&/g, '&');
|
||||
|
||||
export function htmlEscape(strings, ...values) {
|
||||
if (typeof strings === 'string') {
|
||||
return _htmlEscape(strings);
|
||||
}
|
||||
|
||||
let output = strings[0];
|
||||
for (const [index, value] of values.entries()) {
|
||||
output = output + _htmlEscape(String(value)) + strings[index + 1];
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
export function htmlUnescape(strings, ...values) {
|
||||
if (typeof strings === 'string') {
|
||||
return _htmlUnescape(strings);
|
||||
}
|
||||
|
||||
let output = strings[0];
|
||||
for (const [index, value] of values.entries()) {
|
||||
output = output + _htmlUnescape(String(value)) + strings[index + 1];
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-iswellformedcurrencycode
|
||||
*/
|
||||
export declare function IsWellFormedCurrencyCode(currency: string): boolean;
|
||||
//# sourceMappingURL=IsWellFormedCurrencyCode.d.ts.map
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
export const getRealtimeSignals=function(){
|
||||
const length=SIGRTMAX-SIGRTMIN+1;
|
||||
return Array.from({length},getRealtimeSignal);
|
||||
};
|
||||
|
||||
const getRealtimeSignal=function(value,index){
|
||||
return{
|
||||
name:`SIGRT${index+1}`,
|
||||
number:SIGRTMIN+index,
|
||||
action:"terminate",
|
||||
description:"Application-specific signal (realtime)",
|
||||
standard:"posix"};
|
||||
|
||||
};
|
||||
|
||||
const SIGRTMIN=34;
|
||||
export const SIGRTMAX=64;
|
||||
//# sourceMappingURL=realtime.js.map
|
||||
@@ -0,0 +1,102 @@
|
||||
import {
|
||||
AcceptedPlugin,
|
||||
Plugin,
|
||||
ProcessOptions,
|
||||
Transformer,
|
||||
TransformCallback
|
||||
} from './postcss.js'
|
||||
import LazyResult from './lazy-result.js'
|
||||
import Result from './result.js'
|
||||
import Root from './root.js'
|
||||
import NoWorkResult from './no-work-result.js'
|
||||
|
||||
/**
|
||||
* Contains plugins to process CSS. Create one `Processor` instance,
|
||||
* initialize its plugins, and then use that instance on numerous CSS files.
|
||||
*
|
||||
* ```js
|
||||
* const processor = postcss([autoprefixer, postcssNested])
|
||||
* processor.process(css1).then(result => console.log(result.css))
|
||||
* processor.process(css2).then(result => console.log(result.css))
|
||||
* ```
|
||||
*/
|
||||
export default class Processor {
|
||||
/**
|
||||
* Current PostCSS version.
|
||||
*
|
||||
* ```js
|
||||
* if (result.processor.version.split('.')[0] !== '6') {
|
||||
* throw new Error('This plugin works only with PostCSS 6')
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
version: string
|
||||
|
||||
/**
|
||||
* Plugins added to this processor.
|
||||
*
|
||||
* ```js
|
||||
* const processor = postcss([autoprefixer, postcssNested])
|
||||
* processor.plugins.length //=> 2
|
||||
* ```
|
||||
*/
|
||||
plugins: (Plugin | Transformer | TransformCallback)[]
|
||||
|
||||
/**
|
||||
* @param plugins PostCSS plugins
|
||||
*/
|
||||
constructor(plugins?: AcceptedPlugin[])
|
||||
|
||||
/**
|
||||
* Adds a plugin to be used as a CSS processor.
|
||||
*
|
||||
* PostCSS plugin can be in 4 formats:
|
||||
* * A plugin in `Plugin` format.
|
||||
* * A plugin creator function with `pluginCreator.postcss = true`.
|
||||
* PostCSS will call this function without argument to get plugin.
|
||||
* * A function. PostCSS will pass the function a @{link Root}
|
||||
* as the first argument and current `Result` instance
|
||||
* as the second.
|
||||
* * Another `Processor` instance. PostCSS will copy plugins
|
||||
* from that instance into this one.
|
||||
*
|
||||
* Plugins can also be added by passing them as arguments when creating
|
||||
* a `postcss` instance (see [`postcss(plugins)`]).
|
||||
*
|
||||
* Asynchronous plugins should return a `Promise` instance.
|
||||
*
|
||||
* ```js
|
||||
* const processor = postcss()
|
||||
* .use(autoprefixer)
|
||||
* .use(postcssNested)
|
||||
* ```
|
||||
*
|
||||
* @param plugin PostCSS plugin or `Processor` with plugins.
|
||||
* @return Current processor to make methods chain.
|
||||
*/
|
||||
use(plugin: AcceptedPlugin): this
|
||||
|
||||
/**
|
||||
* Parses source CSS and returns a `LazyResult` Promise proxy.
|
||||
* Because some plugins can be asynchronous it doesn’t make
|
||||
* any transformations. Transformations will be applied
|
||||
* in the `LazyResult` methods.
|
||||
*
|
||||
* ```js
|
||||
* processor.process(css, { from: 'a.css', to: 'a.out.css' })
|
||||
* .then(result => {
|
||||
* console.log(result.css)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param css String with input CSS or any object with a `toString()` method,
|
||||
* like a Buffer. Optionally, senda `Result` instance
|
||||
* and the processor will take the `Root` from it.
|
||||
* @param opts Options.
|
||||
* @return Promise proxy.
|
||||
*/
|
||||
process(
|
||||
css: string | { toString(): string } | Result | LazyResult | Root,
|
||||
options?: ProcessOptions
|
||||
): LazyResult | NoWorkResult
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subject } from '../Subject';
|
||||
import { ObservableInput, OperatorFunction, SubjectLike } from '../types';
|
||||
export interface BasicGroupByOptions<K, T> {
|
||||
element?: undefined;
|
||||
duration?: (grouped: GroupedObservable<K, T>) => ObservableInput<any>;
|
||||
connector?: () => SubjectLike<T>;
|
||||
}
|
||||
export interface GroupByOptionsWithElement<K, E, T> {
|
||||
element: (value: T) => E;
|
||||
duration?: (grouped: GroupedObservable<K, E>) => ObservableInput<any>;
|
||||
connector?: () => SubjectLike<E>;
|
||||
}
|
||||
export declare function groupBy<T, K>(key: (value: T) => K, options: BasicGroupByOptions<K, T>): OperatorFunction<T, GroupedObservable<K, T>>;
|
||||
export declare function groupBy<T, K, E>(key: (value: T) => K, options: GroupByOptionsWithElement<K, E, T>): OperatorFunction<T, GroupedObservable<K, E>>;
|
||||
export declare function groupBy<T, K extends T>(key: (value: T) => value is K): OperatorFunction<T, GroupedObservable<true, K> | GroupedObservable<false, Exclude<T, K>>>;
|
||||
export declare function groupBy<T, K>(key: (value: T) => K): OperatorFunction<T, GroupedObservable<K, T>>;
|
||||
/**
|
||||
* @deprecated use the options parameter instead.
|
||||
*/
|
||||
export declare function groupBy<T, K>(key: (value: T) => K, element: void, duration: (grouped: GroupedObservable<K, T>) => Observable<any>): OperatorFunction<T, GroupedObservable<K, T>>;
|
||||
/**
|
||||
* @deprecated use the options parameter instead.
|
||||
*/
|
||||
export declare function groupBy<T, K, R>(key: (value: T) => K, element?: (value: T) => R, duration?: (grouped: GroupedObservable<K, R>) => Observable<any>): OperatorFunction<T, GroupedObservable<K, R>>;
|
||||
/**
|
||||
* Groups the items emitted by an Observable according to a specified criterion,
|
||||
* and emits these grouped items as `GroupedObservables`, one
|
||||
* {@link GroupedObservable} per group.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* When the Observable emits an item, a key is computed for this item with the key function.
|
||||
*
|
||||
* If a {@link GroupedObservable} for this key exists, this {@link GroupedObservable} emits. Otherwise, a new
|
||||
* {@link GroupedObservable} for this key is created and emits.
|
||||
*
|
||||
* A {@link GroupedObservable} represents values belonging to the same group represented by a common key. The common
|
||||
* key is available as the `key` field of a {@link GroupedObservable} instance.
|
||||
*
|
||||
* The elements emitted by {@link GroupedObservable}s are by default the items emitted by the Observable, or elements
|
||||
* returned by the element function.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Group objects by `id` and return as array
|
||||
*
|
||||
* ```ts
|
||||
* import { of, groupBy, mergeMap, reduce } from 'rxjs';
|
||||
*
|
||||
* of(
|
||||
* { id: 1, name: 'JavaScript' },
|
||||
* { id: 2, name: 'Parcel' },
|
||||
* { id: 2, name: 'webpack' },
|
||||
* { id: 1, name: 'TypeScript' },
|
||||
* { id: 3, name: 'TSLint' }
|
||||
* ).pipe(
|
||||
* groupBy(p => p.id),
|
||||
* mergeMap(group$ => group$.pipe(reduce((acc, cur) => [...acc, cur], [])))
|
||||
* )
|
||||
* .subscribe(p => console.log(p));
|
||||
*
|
||||
* // displays:
|
||||
* // [{ id: 1, name: 'JavaScript' }, { id: 1, name: 'TypeScript'}]
|
||||
* // [{ id: 2, name: 'Parcel' }, { id: 2, name: 'webpack'}]
|
||||
* // [{ id: 3, name: 'TSLint' }]
|
||||
* ```
|
||||
*
|
||||
* Pivot data on the `id` field
|
||||
*
|
||||
* ```ts
|
||||
* import { of, groupBy, mergeMap, reduce, map } from 'rxjs';
|
||||
*
|
||||
* of(
|
||||
* { id: 1, name: 'JavaScript' },
|
||||
* { id: 2, name: 'Parcel' },
|
||||
* { id: 2, name: 'webpack' },
|
||||
* { id: 1, name: 'TypeScript' },
|
||||
* { id: 3, name: 'TSLint' }
|
||||
* ).pipe(
|
||||
* groupBy(p => p.id, { element: p => p.name }),
|
||||
* mergeMap(group$ => group$.pipe(reduce((acc, cur) => [...acc, cur], [`${ group$.key }`]))),
|
||||
* map(arr => ({ id: parseInt(arr[0], 10), values: arr.slice(1) }))
|
||||
* )
|
||||
* .subscribe(p => console.log(p));
|
||||
*
|
||||
* // displays:
|
||||
* // { id: 1, values: [ 'JavaScript', 'TypeScript' ] }
|
||||
* // { id: 2, values: [ 'Parcel', 'webpack' ] }
|
||||
* // { id: 3, values: [ 'TSLint' ] }
|
||||
* ```
|
||||
*
|
||||
* @param key A function that extracts the key
|
||||
* for each item.
|
||||
* @param element A function that extracts the
|
||||
* return element for each item.
|
||||
* @param duration
|
||||
* A function that returns an Observable to determine how long each group should
|
||||
* exist.
|
||||
* @param connector Factory function to create an
|
||||
* intermediate Subject through which grouped elements are emitted.
|
||||
* @return A function that returns an Observable that emits GroupedObservables,
|
||||
* each of which corresponds to a unique key value and each of which emits
|
||||
* those items from the source Observable that share that key value.
|
||||
*
|
||||
* @deprecated Use the options parameter instead.
|
||||
*/
|
||||
export declare function groupBy<T, K, R>(key: (value: T) => K, element?: (value: T) => R, duration?: (grouped: GroupedObservable<K, R>) => Observable<any>, connector?: () => Subject<R>): OperatorFunction<T, GroupedObservable<K, R>>;
|
||||
/**
|
||||
* An observable of values that is the emitted by the result of a {@link groupBy} operator,
|
||||
* contains a `key` property for the grouping.
|
||||
*/
|
||||
export interface GroupedObservable<K, T> extends Observable<T> {
|
||||
/**
|
||||
* The key value for the grouped notifications.
|
||||
*/
|
||||
readonly key: K;
|
||||
}
|
||||
//# sourceMappingURL=groupBy.d.ts.map
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "gopd",
|
||||
"version": "1.0.1",
|
||||
"description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "evalmd README.md",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"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+https://github.com/ljharb/gopd.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"getownpropertydescriptor",
|
||||
"property",
|
||||
"descriptor"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/gopd/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/gopd#readme",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.1",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"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
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"lowercase-keys","version":"3.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883671072,"integrity":"sha512-rPHHKv1aCJd4kFJY2+cNGRTU5BJFpD4AW33GhpjhMS/QF8Iq0GJAiP8+0Cy5tH+F6c9UsGn/FtmnlFCIFh/ifQ==","mode":420,"size":152},"package.json":{"checkedAt":1678883671072,"integrity":"sha512-wSmPiSZONV92bTRBCMeAgNLwUiXb2a2juBnIJ+bRCzCwzVCK6Jie5Z+Lcu/c8cjYn7JWb9ux3G+wozj0VAaVAA==","mode":420,"size":754},"readme.md":{"checkedAt":1678883671072,"integrity":"sha512-GqZYOJDjaEGDnKNhAdXenMMHCqZ9RQukZeHJoqm13JS9R3VBwpoOZ014Snv6+vuRex+hoCJ2iMQq+eLqRfR6YQ==","mode":420,"size":988},"index.d.ts":{"checkedAt":1678883671072,"integrity":"sha512-XfER755jVV2I4ODIFNSbcwoUMDPIvR9FeMru+nCv9sqNKGPkxcKFsJQ1q9I0sjEwZtPTaNaPnQUH/lCjFBgkDw==","mode":420,"size":309}}}
|
||||
@@ -0,0 +1,51 @@
|
||||
var implementation = require('../implementation');
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', function (st) {
|
||||
st['throws'](callBind(implementation, null, undefined, 'a'), TypeError, 'undefined is not an object');
|
||||
st['throws'](callBind(implementation, null, null, 'a'), TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('receiver boxing', function (st) {
|
||||
st.plan(hasStrictMode ? 3 : 2);
|
||||
|
||||
var context = 'x';
|
||||
|
||||
implementation.call(
|
||||
'f',
|
||||
function () {
|
||||
st.equal(typeof this, 'object');
|
||||
st.equal(String.prototype.toString.call(this), context);
|
||||
},
|
||||
context
|
||||
);
|
||||
|
||||
st.test('strict mode', { skip: !hasStrictMode }, function (sst) {
|
||||
sst.plan(2);
|
||||
|
||||
implementation.call(
|
||||
'f',
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
sst.equal(typeof this, 'string');
|
||||
sst.equal(this, context);
|
||||
},
|
||||
context
|
||||
);
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(implementation), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { SvelteComponentTyped } from "svelte";
|
||||
import type { DataHandler } from './core';
|
||||
declare const __propDef: {
|
||||
props: {
|
||||
handler: DataHandler;
|
||||
small?: boolean;
|
||||
};
|
||||
events: {
|
||||
[evt: string]: CustomEvent<any>;
|
||||
};
|
||||
slots: {};
|
||||
};
|
||||
export type RowCountProps = typeof __propDef.props;
|
||||
export type RowCountEvents = typeof __propDef.events;
|
||||
export type RowCountSlots = typeof __propDef.slots;
|
||||
export default class RowCount extends SvelteComponentTyped<RowCountProps, RowCountEvents, RowCountSlots> {
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,37 @@
|
||||
// Based on:
|
||||
// http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/
|
||||
// and:
|
||||
// https://github.com/mathiasbynens/String.fromCodePoint/blob/master
|
||||
// /fromcodepoint.js
|
||||
|
||||
"use strict";
|
||||
|
||||
var floor = Math.floor, fromCharCode = String.fromCharCode;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = function (codePoint1 /*, …codePoints*/) {
|
||||
var chars = [], length = arguments.length, i, codePoint, result = "";
|
||||
for (i = 0; i < length; ++i) {
|
||||
codePoint = Number(arguments[i]);
|
||||
if (
|
||||
!isFinite(codePoint) ||
|
||||
codePoint < 0 ||
|
||||
codePoint > 0x10ffff ||
|
||||
floor(codePoint) !== codePoint
|
||||
) {
|
||||
throw new RangeError("Invalid code point " + codePoint);
|
||||
}
|
||||
|
||||
if (codePoint < 0x10000) {
|
||||
chars.push(codePoint);
|
||||
} else {
|
||||
codePoint -= 0x10000;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
chars.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00);
|
||||
}
|
||||
if (i + 1 !== length && chars.length <= 0x4000) continue;
|
||||
result += fromCharCode.apply(null, chars);
|
||||
chars.length = 0;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interval.js","sourceRoot":"","sources":["../../../../src/internal/observable/interval.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA+ChC,MAAM,UAAU,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,YAA2B,cAAc;IAC5E,IAAI,MAAM,GAAG,CAAC,EAAE;QAEd,MAAM,GAAG,CAAC,CAAC;KACZ;IAED,OAAO,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAC1C,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AsyncSubject.js","sourceRoot":"","sources":["../../../src/internal/AsyncSubject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,MAAM,OAAO,YAAgB,SAAQ,OAAU;IAA/C;;QACU,WAAM,GAAa,IAAI,CAAC;QACxB,cAAS,GAAG,KAAK,CAAC;QAClB,gBAAW,GAAG,KAAK,CAAC;IA4B9B,CAAC;IAzBW,uBAAuB,CAAC,UAAyB;QACzD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAClF,IAAI,QAAQ,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAC/B;aAAM,IAAI,SAAS,IAAI,WAAW,EAAE;YACnC,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,MAAO,CAAC,CAAC;YACtC,UAAU,CAAC,QAAQ,EAAE,CAAC;SACvB;IACH,CAAC;IAED,IAAI,CAAC,KAAQ;QACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;IACH,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAChD,IAAI,CAAC,WAAW,EAAE;YAChB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,MAAO,CAAC,CAAC;YACjC,KAAK,CAAC,QAAQ,EAAE,CAAC;SAClB;IACH,CAAC;CACF"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"widest-line","version":"4.0.1","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883672488,"integrity":"sha512-BhbNowwM5jnHoz7Yyedm/wWTxw/ogLLfUuGbfVg5W4NeoNkySb+V/FuWzbMpY4B2XxXoBK42jYyF2Lm682d7fg==","mode":420,"size":228},"package.json":{"checkedAt":1678883672488,"integrity":"sha512-BSxs4OBdvK6DlmkntD9ab/HfA8UAZXRoM5ze9Z4aW8we6jxvz04prtrBna0ltIzRSx94+JLGQCrwy95EopbqRw==","mode":420,"size":1006},"readme.md":{"checkedAt":1678883672488,"integrity":"sha512-hxHRoRntYYgWymNlDpRUEHDP1j08vkk94Qe2Ry6bpyQBxopuc68MN7Wq0OrSVJxeXtAxeM1keoetZEoOisA+2w==","mode":420,"size":711},"index.d.ts":{"checkedAt":1678883672488,"integrity":"sha512-D9poVIngWfkcxgs0W8ZFfK0YeOv6XxMrtjuQGpl4dnUKps1Ds9CB2wtC0Y0UfsUNHSleRI6GnFP4p1qqmcPqow==","mode":420,"size":272}}}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert object properties to delimiter case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see DelimiterCase
|
||||
@see DelimiterCasedPropertiesDeep
|
||||
|
||||
@example
|
||||
```
|
||||
import type {DelimiterCasedProperties} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
userId: number;
|
||||
userName: string;
|
||||
}
|
||||
|
||||
const result: DelimiterCasedProperties<User, '-'> = {
|
||||
'user-id': 1,
|
||||
'user-name': 'Tom',
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type DelimiterCasedProperties<
|
||||
Value,
|
||||
Delimiter extends string,
|
||||
> = Value extends Function
|
||||
? Value
|
||||
: Value extends Array<infer U>
|
||||
? Value
|
||||
: {[K in keyof Value as DelimiterCase<K, Delimiter>]: Value[K]};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Scheduler } from '../Scheduler';
|
||||
import { SubscriptionLog } from './SubscriptionLog';
|
||||
export declare class SubscriptionLoggable {
|
||||
subscriptions: SubscriptionLog[];
|
||||
scheduler: Scheduler;
|
||||
logSubscribedFrame(): number;
|
||||
logUnsubscribedFrame(index: number): void;
|
||||
}
|
||||
//# sourceMappingURL=SubscriptionLoggable.d.ts.map
|
||||
@@ -0,0 +1,34 @@
|
||||
var baseForOwnRight = require('./_baseForOwnRight'),
|
||||
castFunction = require('./_castFunction');
|
||||
|
||||
/**
|
||||
* This method is like `_.forOwn` except that it iterates over properties of
|
||||
* `object` in the opposite order.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @see _.forOwn
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = 1;
|
||||
* this.b = 2;
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = 3;
|
||||
*
|
||||
* _.forOwnRight(new Foo, function(value, key) {
|
||||
* console.log(key);
|
||||
* });
|
||||
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
|
||||
*/
|
||||
function forOwnRight(object, iteratee) {
|
||||
return object && baseForOwnRight(object, castFunction(iteratee));
|
||||
}
|
||||
|
||||
module.exports = forOwnRight;
|
||||
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.windowTime = void 0;
|
||||
var Subject_1 = require("../Subject");
|
||||
var async_1 = require("../scheduler/async");
|
||||
var Subscription_1 = require("../Subscription");
|
||||
var lift_1 = require("../util/lift");
|
||||
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
||||
var arrRemove_1 = require("../util/arrRemove");
|
||||
var args_1 = require("../util/args");
|
||||
var executeSchedule_1 = require("../util/executeSchedule");
|
||||
function windowTime(windowTimeSpan) {
|
||||
var _a, _b;
|
||||
var otherArgs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
otherArgs[_i - 1] = arguments[_i];
|
||||
}
|
||||
var scheduler = (_a = args_1.popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : async_1.asyncScheduler;
|
||||
var windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
|
||||
var maxWindowSize = otherArgs[1] || Infinity;
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
var windowRecords = [];
|
||||
var restartOnClose = false;
|
||||
var closeWindow = function (record) {
|
||||
var window = record.window, subs = record.subs;
|
||||
window.complete();
|
||||
subs.unsubscribe();
|
||||
arrRemove_1.arrRemove(windowRecords, record);
|
||||
restartOnClose && startWindow();
|
||||
};
|
||||
var startWindow = function () {
|
||||
if (windowRecords) {
|
||||
var subs = new Subscription_1.Subscription();
|
||||
subscriber.add(subs);
|
||||
var window_1 = new Subject_1.Subject();
|
||||
var record_1 = {
|
||||
window: window_1,
|
||||
subs: subs,
|
||||
seen: 0,
|
||||
};
|
||||
windowRecords.push(record_1);
|
||||
subscriber.next(window_1.asObservable());
|
||||
executeSchedule_1.executeSchedule(subs, scheduler, function () { return closeWindow(record_1); }, windowTimeSpan);
|
||||
}
|
||||
};
|
||||
if (windowCreationInterval !== null && windowCreationInterval >= 0) {
|
||||
executeSchedule_1.executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);
|
||||
}
|
||||
else {
|
||||
restartOnClose = true;
|
||||
}
|
||||
startWindow();
|
||||
var loop = function (cb) { return windowRecords.slice().forEach(cb); };
|
||||
var terminate = function (cb) {
|
||||
loop(function (_a) {
|
||||
var window = _a.window;
|
||||
return cb(window);
|
||||
});
|
||||
cb(subscriber);
|
||||
subscriber.unsubscribe();
|
||||
};
|
||||
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
||||
loop(function (record) {
|
||||
record.window.next(value);
|
||||
maxWindowSize <= ++record.seen && closeWindow(record);
|
||||
});
|
||||
}, function () { return terminate(function (consumer) { return consumer.complete(); }); }, function (err) { return terminate(function (consumer) { return consumer.error(err); }); }));
|
||||
return function () {
|
||||
windowRecords = null;
|
||||
};
|
||||
});
|
||||
}
|
||||
exports.windowTime = windowTime;
|
||||
//# sourceMappingURL=windowTime.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
var asinh = Math.asinh;
|
||||
if (typeof asinh !== "function") return false;
|
||||
return asinh(2) === 1.4436354751788103;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export { ajax } from '../internal/ajax/ajax';
|
||||
export { AjaxError, AjaxTimeoutError } from '../internal/ajax/errors';
|
||||
export { AjaxResponse } from '../internal/ajax/AjaxResponse';
|
||||
export { AjaxRequest, AjaxConfig, AjaxDirection } from '../internal/ajax/types';
|
||||
@@ -0,0 +1,204 @@
|
||||
<p align="center">
|
||||
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/main/yargs-logo.png">
|
||||
</p>
|
||||
<h1 align="center"> Yargs </h1>
|
||||
<p align="center">
|
||||
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||

|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![js-standard-style][standard-image]][standard-url]
|
||||
[![Coverage][coverage-image]][coverage-url]
|
||||
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
|
||||
[![Slack][slack-image]][slack-url]
|
||||
|
||||
## Description
|
||||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
|
||||
|
||||
It gives you:
|
||||
|
||||
* commands and (grouped) options (`my-program.js serve --port=5000`).
|
||||
* a dynamically generated help menu based on your arguments:
|
||||
|
||||
```
|
||||
mocha [spec..]
|
||||
|
||||
Run tests with Mocha
|
||||
|
||||
Commands
|
||||
mocha inspect [spec..] Run tests with Mocha [default]
|
||||
mocha init <path> create a client-side Mocha setup at <path>
|
||||
|
||||
Rules & Behavior
|
||||
--allow-uncaught Allow uncaught errors to propagate [boolean]
|
||||
--async-only, -A Require all tests to use a callback (async) or
|
||||
return a Promise [boolean]
|
||||
```
|
||||
|
||||
* bash-completion shortcuts for commands and options.
|
||||
* and [tons more](/docs/api.md).
|
||||
|
||||
## Installation
|
||||
|
||||
Stable version:
|
||||
```bash
|
||||
npm i yargs
|
||||
```
|
||||
|
||||
Bleeding edge version with the most recent features:
|
||||
```bash
|
||||
npm i yargs@next
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple Example
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const yargs = require('yargs/yargs')
|
||||
const { hideBin } = require('yargs/helpers')
|
||||
const argv = yargs(hideBin(process.argv)).argv
|
||||
|
||||
if (argv.ships > 3 && argv.distance < 53.5) {
|
||||
console.log('Plunder more riffiwobbles!')
|
||||
} else {
|
||||
console.log('Retreat from the xupptumblers!')
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./plunder.js --ships=4 --distance=22
|
||||
Plunder more riffiwobbles!
|
||||
|
||||
$ ./plunder.js --ships 12 --distance 98.7
|
||||
Retreat from the xupptumblers!
|
||||
```
|
||||
|
||||
> Note: `hideBin` is a shorthand for [`process.argv.slice(2)`](https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/). It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).
|
||||
|
||||
### Complex Example
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const yargs = require('yargs/yargs')
|
||||
const { hideBin } = require('yargs/helpers')
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
.command('serve [port]', 'start the server', (yargs) => {
|
||||
return yargs
|
||||
.positional('port', {
|
||||
describe: 'port to bind on',
|
||||
default: 5000
|
||||
})
|
||||
}, (argv) => {
|
||||
if (argv.verbose) console.info(`start server on :${argv.port}`)
|
||||
serve(argv.port)
|
||||
})
|
||||
.option('verbose', {
|
||||
alias: 'v',
|
||||
type: 'boolean',
|
||||
description: 'Run with verbose logging'
|
||||
})
|
||||
.parse()
|
||||
```
|
||||
|
||||
Run the example above with `--help` to see the help for the application.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
### TypeScript
|
||||
|
||||
yargs has type definitions at [@types/yargs][type-definitions].
|
||||
|
||||
```
|
||||
npm i @types/yargs --save-dev
|
||||
```
|
||||
|
||||
See usage examples in [docs](/docs/typescript.md).
|
||||
|
||||
### Deno
|
||||
|
||||
As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
|
||||
|
||||
```typescript
|
||||
import yargs from 'https://deno.land/x/yargs/deno.ts'
|
||||
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
|
||||
|
||||
yargs(Deno.args)
|
||||
.command('download <files...>', 'download a list of files', (yargs: any) => {
|
||||
return yargs.positional('files', {
|
||||
describe: 'a list of files to do something with'
|
||||
})
|
||||
}, (argv: Arguments) => {
|
||||
console.info(argv)
|
||||
})
|
||||
.strictCommands()
|
||||
.demandCommand(1)
|
||||
.parse()
|
||||
```
|
||||
|
||||
### ESM
|
||||
|
||||
As of `v16`,`yargs` supports ESM imports:
|
||||
|
||||
```js
|
||||
import yargs from 'yargs'
|
||||
import { hideBin } from 'yargs/helpers'
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
|
||||
console.info(argv)
|
||||
})
|
||||
.demandCommand(1)
|
||||
.parse()
|
||||
```
|
||||
|
||||
### Usage in Browser
|
||||
|
||||
See examples of using yargs in the browser in [docs](/docs/browser.md).
|
||||
|
||||
## Community
|
||||
|
||||
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
|
||||
|
||||
## Documentation
|
||||
|
||||
### Table of Contents
|
||||
|
||||
* [Yargs' API](/docs/api.md)
|
||||
* [Examples](/docs/examples.md)
|
||||
* [Parsing Tricks](/docs/tricks.md)
|
||||
* [Stop the Parser](/docs/tricks.md#stop)
|
||||
* [Negating Boolean Arguments](/docs/tricks.md#negate)
|
||||
* [Numbers](/docs/tricks.md#numbers)
|
||||
* [Arrays](/docs/tricks.md#arrays)
|
||||
* [Objects](/docs/tricks.md#objects)
|
||||
* [Quotes](/docs/tricks.md#quotes)
|
||||
* [Advanced Topics](/docs/advanced.md)
|
||||
* [Composing Your App Using Commands](/docs/advanced.md#commands)
|
||||
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
|
||||
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
|
||||
* [Bundling yargs](/docs/bundling.md)
|
||||
* [Contributing](/contributing.md)
|
||||
|
||||
## Supported Node.js Versions
|
||||
|
||||
Libraries in this ecosystem make a best effort to track
|
||||
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
|
||||
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
||||
|
||||
[npm-url]: https://www.npmjs.com/package/yargs
|
||||
[npm-image]: https://img.shields.io/npm/v/yargs.svg
|
||||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
||||
[standard-url]: http://standardjs.com/
|
||||
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
|
||||
[conventional-commits-url]: https://conventionalcommits.org/
|
||||
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
|
||||
[slack-url]: http://devtoolscommunity.herokuapp.com
|
||||
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
|
||||
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
|
||||
[coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"raceWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/raceWith.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA8C;AAC9C,qCAAuC;AACvC,6CAA4C;AA4B5C,SAAgB,QAAQ;IACtB,sBAA6C;SAA7C,UAA6C,EAA7C,qBAA6C,EAA7C,IAA6C;QAA7C,iCAA6C;;IAE7C,OAAO,CAAC,YAAY,CAAC,MAAM;QACzB,CAAC,CAAC,mBAAQ;QACV,CAAC,CAAC,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;YACzB,eAAQ,gBAAiB,MAAM,UAAK,YAAY,GAAE,CAAC,UAAU,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;AACT,CAAC;AARD,4BAQC"}
|
||||
@@ -0,0 +1,42 @@
|
||||
var compactable = require('../compactable');
|
||||
var InvalidPropertyError = require('../invalid-property-error');
|
||||
|
||||
function populateComponents(properties, validator, warnings) {
|
||||
var component;
|
||||
var j, m;
|
||||
|
||||
for (var i = properties.length - 1; i >= 0; i--) {
|
||||
var property = properties[i];
|
||||
var descriptor = compactable[property.name];
|
||||
|
||||
if (descriptor && descriptor.shorthand) {
|
||||
property.shorthand = true;
|
||||
property.dirty = true;
|
||||
|
||||
try {
|
||||
property.components = descriptor.breakUp(property, compactable, validator);
|
||||
|
||||
if (descriptor.shorthandComponents) {
|
||||
for (j = 0, m = property.components.length; j < m; j++) {
|
||||
component = property.components[j];
|
||||
component.components = compactable[component.name].breakUp(component, compactable, validator);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof InvalidPropertyError) {
|
||||
property.components = []; // this will set property.unused to true below
|
||||
warnings.push(e.message);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.components.length > 0)
|
||||
property.multiplex = property.components[0].multiplex;
|
||||
else
|
||||
property.unused = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = populateComponents;
|
||||
@@ -0,0 +1,82 @@
|
||||
import { Action } from './Action';
|
||||
import { intervalProvider } from './intervalProvider';
|
||||
import { arrRemove } from '../util/arrRemove';
|
||||
export class AsyncAction extends Action {
|
||||
constructor(scheduler, work) {
|
||||
super(scheduler, work);
|
||||
this.scheduler = scheduler;
|
||||
this.work = work;
|
||||
this.pending = false;
|
||||
}
|
||||
schedule(state, delay = 0) {
|
||||
var _a;
|
||||
if (this.closed) {
|
||||
return this;
|
||||
}
|
||||
this.state = state;
|
||||
const id = this.id;
|
||||
const scheduler = this.scheduler;
|
||||
if (id != null) {
|
||||
this.id = this.recycleAsyncId(scheduler, id, delay);
|
||||
}
|
||||
this.pending = true;
|
||||
this.delay = delay;
|
||||
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
||||
return this;
|
||||
}
|
||||
requestAsyncId(scheduler, _id, delay = 0) {
|
||||
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
||||
}
|
||||
recycleAsyncId(_scheduler, id, delay = 0) {
|
||||
if (delay != null && this.delay === delay && this.pending === false) {
|
||||
return id;
|
||||
}
|
||||
if (id != null) {
|
||||
intervalProvider.clearInterval(id);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
execute(state, delay) {
|
||||
if (this.closed) {
|
||||
return new Error('executing a cancelled action');
|
||||
}
|
||||
this.pending = false;
|
||||
const error = this._execute(state, delay);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
else if (this.pending === false && this.id != null) {
|
||||
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
||||
}
|
||||
}
|
||||
_execute(state, _delay) {
|
||||
let errored = false;
|
||||
let errorValue;
|
||||
try {
|
||||
this.work(state);
|
||||
}
|
||||
catch (e) {
|
||||
errored = true;
|
||||
errorValue = e ? e : new Error('Scheduled action threw falsy error');
|
||||
}
|
||||
if (errored) {
|
||||
this.unsubscribe();
|
||||
return errorValue;
|
||||
}
|
||||
}
|
||||
unsubscribe() {
|
||||
if (!this.closed) {
|
||||
const { id, scheduler } = this;
|
||||
const { actions } = scheduler;
|
||||
this.work = this.state = this.scheduler = null;
|
||||
this.pending = false;
|
||||
arrRemove(actions, this);
|
||||
if (id != null) {
|
||||
this.id = this.recycleAsyncId(scheduler, id, null);
|
||||
}
|
||||
this.delay = null;
|
||||
super.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=AsyncAction.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var ToNumber = require('./ToNumber');
|
||||
var ToPrimitive = require('./ToPrimitive');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-11.9.3
|
||||
|
||||
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') && yType === 'Object') {
|
||||
return AbstractEqualityComparison(x, ToPrimitive(y));
|
||||
}
|
||||
if (xType === 'Object' && (yType === 'String' || yType === 'Number')) {
|
||||
return AbstractEqualityComparison(ToPrimitive(x), y);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var pad = require("../../string/#/pad")
|
||||
, toPosInt = require("../to-pos-integer")
|
||||
, toFixed = Number.prototype.toFixed;
|
||||
|
||||
module.exports = function (length /*, precision*/) {
|
||||
var precision;
|
||||
length = toPosInt(length);
|
||||
precision = toPosInt(arguments[1]);
|
||||
|
||||
return pad.call(
|
||||
precision ? toFixed.call(this, precision) : this, "0",
|
||||
length + (precision ? 1 + precision : 0)
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"toidentifier","version":"1.0.1","files":{"LICENSE":{"checkedAt":1678883672283,"integrity":"sha512-rJL8AjV2XpWlXxQVsEvTqFaGesNx8QDMBrV52ydh8G8i/m8VoVJwW+hR2T81VqcjOTGiPv1qSOG4LBfP+7XfLg==","mode":420,"size":1108},"package.json":{"checkedAt":1678883672283,"integrity":"sha512-wI2nt4Usmyl6Kfb7Xc9RpntRPK7BdHSs7LzzJMVhVgH+mXRL1J6Q8KIdilcQq9WOeLSonZyg5LCx8pWEulS1fg==","mode":420,"size":1142},"index.js":{"checkedAt":1678883672283,"integrity":"sha512-lhY2eIJ/Yzy+pgivgx8BjbhXfuIlQ9bf1lUKF2/oS0t4VQ37Xsv+YPEJZDizzkhfvOhiiOvc6LbZBITXzaB5zg==","mode":420,"size":504},"HISTORY.md":{"checkedAt":1678883672283,"integrity":"sha512-zEzgwnta1B1jdgc4AuQXpaOEgoZ5Gsw7Nlpy2aqSykBOsw1NX5KWRkOm4rC1j8bcX3r1bOTnkH8x+Bi8KkalEw==","mode":420,"size":128},"README.md":{"checkedAt":1678883672283,"integrity":"sha512-aRPaylbJiPAML1pDa98UpA2eOz2U2Cc1OYxkbuqttW5SUJHro1h0UhW6p16Jkg2I0J+m0tcBhFL2/MMQ2UneKQ==","mode":420,"size":1803}}}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Renderer, { RenderOptions } from '../Renderer';
|
||||
import Slot from '../../nodes/Slot';
|
||||
export default function (node: Slot, renderer: Renderer, options: RenderOptions & {
|
||||
slot_scopes: Map<any, any>;
|
||||
}): void;
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[850] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷¸°¨·¹³²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,20 @@
|
||||
import Node from './shared/Node';
|
||||
import Expression from './shared/Expression';
|
||||
import Component from '../Component';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import { Node as ESTreeNode } from 'estree';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
import Element from './Element';
|
||||
import InlineComponent from './InlineComponent';
|
||||
import Window from './Window';
|
||||
export default class Binding extends Node {
|
||||
type: 'Binding';
|
||||
name: string;
|
||||
expression: Expression;
|
||||
raw_expression: ESTreeNode;
|
||||
is_contextual: boolean;
|
||||
is_readonly: boolean;
|
||||
constructor(component: Component, parent: Element | InlineComponent | Window, scope: TemplateScope, info: TemplateNode);
|
||||
is_readonly_media_attribute(): boolean;
|
||||
validate_binding_rest_properties(scope: TemplateScope): void;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
NOTE: This is the global export file for rxjs v6 and higher.
|
||||
*/
|
||||
|
||||
/* rxjs */
|
||||
export * from '../index';
|
||||
|
||||
/* rxjs.operators */
|
||||
import * as _operators from '../operators/index';
|
||||
export const operators = _operators;
|
||||
|
||||
/* rxjs.testing */
|
||||
import * as _testing from '../testing/index';
|
||||
export const testing = _testing;
|
||||
|
||||
/* rxjs.ajax */
|
||||
import * as _ajax from '../ajax/index';
|
||||
export const ajax = _ajax;
|
||||
|
||||
/* rxjs.webSocket */
|
||||
import * as _webSocket from '../webSocket/index';
|
||||
export const webSocket = _webSocket;
|
||||
|
||||
/* rxjs.fetch */
|
||||
import * as _fetch from '../fetch/index';
|
||||
export const fetch = _fetch;
|
||||
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isFunction = require("../../function/is")
|
||||
, arrowFunctionIfSupported = require("../_lib/arrow-function-if-supported")
|
||||
, classIfSupported = require("../_lib/class-if-supported");
|
||||
|
||||
describe("function/is", function () {
|
||||
it("Should return true on function", function () {
|
||||
assert.equal(isFunction(function () { return true; }), true);
|
||||
});
|
||||
if (arrowFunctionIfSupported) {
|
||||
it("Should return true on arrow function", function () {
|
||||
assert.equal(isFunction(arrowFunctionIfSupported), true);
|
||||
});
|
||||
}
|
||||
if (classIfSupported) {
|
||||
it("Should return true on class", function () {
|
||||
assert.equal(isFunction(classIfSupported), true);
|
||||
});
|
||||
}
|
||||
it("Should return false on reg-exp", function () { assert.equal(isFunction(/foo/), false); });
|
||||
|
||||
it("Should return false on plain object", function () { assert.equal(isFunction({}), false); });
|
||||
it("Should return false on array", function () { assert.equal(isFunction([]), false); });
|
||||
if (typeof Object.create === "function") {
|
||||
it("Should return false on object with no prototype", function () {
|
||||
assert.equal(isFunction(Object.create(null)), false);
|
||||
});
|
||||
}
|
||||
it("Should return false on string", function () { assert.equal(isFunction("foo"), false); });
|
||||
it("Should return false on empty string", function () { assert.equal(isFunction(""), false); });
|
||||
it("Should return false on number", function () { assert.equal(isFunction(123), false); });
|
||||
it("Should return false on NaN", function () { assert.equal(isFunction(NaN), false); });
|
||||
it("Should return false on boolean", function () { assert.equal(isFunction(true), false); });
|
||||
if (typeof Symbol === "function") {
|
||||
it("Should return false on symbol", function () {
|
||||
assert.equal(isFunction(Symbol("foo")), false);
|
||||
});
|
||||
}
|
||||
|
||||
it("Should return false on null", function () { assert.equal(isFunction(null), false); });
|
||||
it("Should return false on undefined", function () {
|
||||
assert.equal(isFunction(void 0), false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import type {Whitespace} from './internal';
|
||||
|
||||
/**
|
||||
Remove spaces from the left side.
|
||||
*/
|
||||
type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
|
||||
|
||||
/**
|
||||
Remove spaces from the right side.
|
||||
*/
|
||||
type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
|
||||
|
||||
/**
|
||||
Remove leading and trailing spaces from a string.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Trim} from 'type-fest';
|
||||
|
||||
Trim<' foo '>
|
||||
//=> 'foo'
|
||||
```
|
||||
|
||||
@category String
|
||||
@category Template literal
|
||||
*/
|
||||
export type Trim<V extends string> = TrimLeft<TrimRight<V>>;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { ReplaySubject } from '../ReplaySubject';
|
||||
import { share } from './share';
|
||||
export function shareReplay(configOrBufferSize, windowTime, scheduler) {
|
||||
var _a, _b, _c;
|
||||
var bufferSize;
|
||||
var refCount = false;
|
||||
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
|
||||
(_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler);
|
||||
}
|
||||
else {
|
||||
bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
|
||||
}
|
||||
return share({
|
||||
connector: function () { return new ReplaySubject(bufferSize, windowTime, scheduler); },
|
||||
resetOnError: true,
|
||||
resetOnComplete: false,
|
||||
resetOnRefCountZero: refCount,
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=shareReplay.js.map
|
||||
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generate = void 0;
|
||||
var identity_1 = require("../util/identity");
|
||||
var isScheduler_1 = require("../util/isScheduler");
|
||||
var defer_1 = require("./defer");
|
||||
var scheduleIterable_1 = require("../scheduled/scheduleIterable");
|
||||
function generate(initialStateOrOptions, condition, iterate, resultSelectorOrScheduler, scheduler) {
|
||||
var _a, _b;
|
||||
var resultSelector;
|
||||
var initialState;
|
||||
if (arguments.length === 1) {
|
||||
(_a = initialStateOrOptions, initialState = _a.initialState, condition = _a.condition, iterate = _a.iterate, _b = _a.resultSelector, resultSelector = _b === void 0 ? identity_1.identity : _b, scheduler = _a.scheduler);
|
||||
}
|
||||
else {
|
||||
initialState = initialStateOrOptions;
|
||||
if (!resultSelectorOrScheduler || isScheduler_1.isScheduler(resultSelectorOrScheduler)) {
|
||||
resultSelector = identity_1.identity;
|
||||
scheduler = resultSelectorOrScheduler;
|
||||
}
|
||||
else {
|
||||
resultSelector = resultSelectorOrScheduler;
|
||||
}
|
||||
}
|
||||
function gen() {
|
||||
var state;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
state = initialState;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!(!condition || condition(state))) return [3, 4];
|
||||
return [4, resultSelector(state)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
state = iterate(state);
|
||||
return [3, 1];
|
||||
case 4: return [2];
|
||||
}
|
||||
});
|
||||
}
|
||||
return defer_1.defer((scheduler
|
||||
?
|
||||
function () { return scheduleIterable_1.scheduleIterable(gen(), scheduler); }
|
||||
:
|
||||
gen));
|
||||
}
|
||||
exports.generate = generate;
|
||||
//# sourceMappingURL=generate.js.map
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
|
||||
didYouMean.js - A simple JavaScript matching engine
|
||||
===================================================
|
||||
|
||||
[Available on GitHub](https://github.com/dcporter/didyoumean.js).
|
||||
|
||||
A super-simple, highly optimized JS library for matching human-quality input to a list of potential
|
||||
matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer
|
||||
links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project,
|
||||
my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct
|
||||
URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).)
|
||||
Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance).
|
||||
|
||||
didYouMean.js works in the browser as well as in node.js. To install it for use in node:
|
||||
|
||||
```
|
||||
npm install didyoumean
|
||||
```
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Matching against a list of strings:
|
||||
```
|
||||
var input = 'insargrm'
|
||||
var list = ['facebook', 'twitter', 'instagram', 'linkedin'];
|
||||
console.log(didYouMean(input, list));
|
||||
> 'instagram'
|
||||
// The method matches 'insargrm' to 'instagram'.
|
||||
|
||||
input = 'google plus';
|
||||
console.log(didYouMean(input, list));
|
||||
> null
|
||||
// The method was unable to find 'google plus' in the list of options.
|
||||
```
|
||||
|
||||
Matching against a list of objects:
|
||||
```
|
||||
var input = 'insargrm';
|
||||
var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ];
|
||||
var key = 'id';
|
||||
console.log(didYouMean(input, list, key));
|
||||
> 'instagram'
|
||||
// The method returns the matching value.
|
||||
|
||||
didYouMean.returnWinningObject = true;
|
||||
console.log(didYouMean(input, list, key));
|
||||
> { id: 'instagram' }
|
||||
// The method returns the matching object.
|
||||
```
|
||||
|
||||
|
||||
didYouMean(str, list, [key])
|
||||
----------------------------
|
||||
|
||||
- str: The string input to match.
|
||||
- list: An array of strings or objects to match against.
|
||||
- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string
|
||||
to match against.
|
||||
|
||||
Returns: the closest matching string, or null if no strings exceed the threshold.
|
||||
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
Options are set on the didYouMean function object. You may change them at any time.
|
||||
|
||||
### threshold
|
||||
|
||||
By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length.
|
||||
For example, if a ten-letter string is five edits away from its nearest match, the method will return null.
|
||||
|
||||
You can control this by setting the "threshold" value on the didYouMean function. For example, to set the
|
||||
edit distance threshold to 50% of the input string's length:
|
||||
|
||||
```
|
||||
didYouMean.threshold = 0.5;
|
||||
```
|
||||
|
||||
To return the nearest match no matter the threshold, set this value to null.
|
||||
|
||||
### thresholdAbsolute
|
||||
|
||||
This option behaves the same as threshold, but instead takes an integer number of edit steps. For example,
|
||||
if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance
|
||||
is less than 20. Both options apply.
|
||||
|
||||
### caseSensitive
|
||||
|
||||
By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set
|
||||
the "caseSensitive" value to true:
|
||||
|
||||
```
|
||||
didYouMean.caseSensitive = true;
|
||||
```
|
||||
|
||||
### nullResultValue
|
||||
|
||||
By default, the method will return null if there is no sufficiently close match. You can change this value here.
|
||||
|
||||
### returnWinningObject
|
||||
|
||||
By default, the method will return the winning string value (if any). If your list contains objects rather
|
||||
than strings, you may set returnWinningObject to true.
|
||||
|
||||
```
|
||||
didYouMean.returnWinningObject = true;
|
||||
```
|
||||
|
||||
This option has no effect on lists of strings.
|
||||
|
||||
### returnFirstMatch
|
||||
|
||||
By default, the method will search all values and return the closest match. If you're simply looking for a "good-
|
||||
enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed
|
||||
things up.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
didYouMean copyright (c) 2013-2014 Dave Porter.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License
|
||||
[here](http://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
// The didYouMean method.
|
||||
function didYouMean(str, list, key) {
|
||||
if (!str) return null;
|
||||
|
||||
// If we're running a case-insensitive search, smallify str.
|
||||
if (!didYouMean.caseSensitive) { str = str.toLowerCase(); }
|
||||
|
||||
// Calculate the initial value (the threshold) if present.
|
||||
var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length,
|
||||
thresholdAbsolute = didYouMean.thresholdAbsolute,
|
||||
winningVal;
|
||||
if (thresholdRelative !== null && thresholdAbsolute !== null) winningVal = Math.min(thresholdRelative, thresholdAbsolute);
|
||||
else if (thresholdRelative !== null) winningVal = thresholdRelative;
|
||||
else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute;
|
||||
else winningVal = null;
|
||||
|
||||
// Get the edit distance to each option. If the closest one is less than 40% (by default) of str's length,
|
||||
// then return it.
|
||||
var winner, candidate, testCandidate, val,
|
||||
i, len = list.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
// Get item.
|
||||
candidate = list[i];
|
||||
// If there's a key, get the candidate value out of the object.
|
||||
if (key) { candidate = candidate[key]; }
|
||||
// Gatekeep.
|
||||
if (!candidate) { continue; }
|
||||
// If we're running a case-insensitive search, smallify the candidate.
|
||||
if (!didYouMean.caseSensitive) { testCandidate = candidate.toLowerCase(); }
|
||||
else { testCandidate = candidate; }
|
||||
// Get and compare edit distance.
|
||||
val = getEditDistance(str, testCandidate, winningVal);
|
||||
// If this value is smaller than our current winning value, OR if we have no winning val yet (i.e. the
|
||||
// threshold option is set to null, meaning the caller wants a match back no matter how bad it is), then
|
||||
// this is our new winner.
|
||||
if (winningVal === null || val < winningVal) {
|
||||
winningVal = val;
|
||||
// Set the winner to either the value or its object, depending on the returnWinningObject option.
|
||||
if (key && didYouMean.returnWinningObject) winner = list[i];
|
||||
else winner = candidate;
|
||||
// If we're returning the first match, return it now.
|
||||
if (didYouMean.returnFirstMatch) return winner;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a winner, return it.
|
||||
return winner || didYouMean.nullResultValue;
|
||||
}
|
||||
|
||||
// Set default options.
|
||||
didYouMean.threshold = 0.4;
|
||||
didYouMean.thresholdAbsolute = 20;
|
||||
didYouMean.caseSensitive = false;
|
||||
didYouMean.nullResultValue = null;
|
||||
didYouMean.returnWinningObject = null;
|
||||
didYouMean.returnFirstMatch = false;
|
||||
|
||||
// Expose.
|
||||
// In node...
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = didYouMean;
|
||||
}
|
||||
// Otherwise...
|
||||
else {
|
||||
window.didYouMean = didYouMean;
|
||||
}
|
||||
|
||||
var MAX_INT = Math.pow(2,32) - 1; // We could probably go higher than this, but for practical reasons let's not.
|
||||
function getEditDistance(a, b, max) {
|
||||
// Handle null or undefined max.
|
||||
max = max || max === 0 ? max : MAX_INT;
|
||||
|
||||
var lena = a.length;
|
||||
var lenb = b.length;
|
||||
|
||||
// Fast path - no A or B.
|
||||
if (lena === 0) return Math.min(max + 1, lenb);
|
||||
if (lenb === 0) return Math.min(max + 1, lena);
|
||||
|
||||
// Fast path - length diff larger than max.
|
||||
if (Math.abs(lena - lenb) > max) return max + 1;
|
||||
|
||||
// Slow path.
|
||||
var matrix = [],
|
||||
i, j, colMin, minJ, maxJ;
|
||||
|
||||
// Set up the first row ([0, 1, 2, 3, etc]).
|
||||
for (i = 0; i <= lenb; i++) { matrix[i] = [i]; }
|
||||
|
||||
// Set up the first column (same).
|
||||
for (j = 0; j <= lena; j++) { matrix[0][j] = j; }
|
||||
|
||||
// Loop over the rest of the columns.
|
||||
for (i = 1; i <= lenb; i++) {
|
||||
colMin = MAX_INT;
|
||||
minJ = 1;
|
||||
if (i > max) minJ = i - max;
|
||||
maxJ = lenb + 1;
|
||||
if (maxJ > max + i) maxJ = max + i;
|
||||
// Loop over the rest of the rows.
|
||||
for (j = 1; j <= lena; j++) {
|
||||
// If j is out of bounds, just put a large value in the slot.
|
||||
if (j < minJ || j > maxJ) {
|
||||
matrix[i][j] = max + 1;
|
||||
}
|
||||
|
||||
// Otherwise do the normal Levenshtein thing.
|
||||
else {
|
||||
// If the characters are the same, there's no change in edit distance.
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
}
|
||||
// Otherwise, see if we're substituting, inserting or deleting.
|
||||
else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitute
|
||||
Math.min(matrix[i][j - 1] + 1, // Insert
|
||||
matrix[i - 1][j] + 1)); // Delete
|
||||
}
|
||||
}
|
||||
|
||||
// Either way, update colMin.
|
||||
if (matrix[i][j] < colMin) colMin = matrix[i][j];
|
||||
}
|
||||
|
||||
// If this column's minimum is greater than the allowed maximum, there's no point
|
||||
// in going on with life.
|
||||
if (colMin > max) return max + 1;
|
||||
}
|
||||
// If we made it this far without running into the max, then return the final matrix value.
|
||||
return matrix[lenb][lena];
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,2 @@
|
||||
column1,user.name,column2,column3, colume4, column5, column6 , column7, column8, column9,column10.0,column10.1,name#!,column11
|
||||
1234,hello world,a1234,2012-01-01,someinvaliddate, {"hello":"world"}, {"hello":"world"}, 1234,abcd, true,23,31,false,[{"hello":"world"}]
|
||||
@@ -0,0 +1,76 @@
|
||||
import { Observable } from './Observable';
|
||||
import { EmptyError } from './util/EmptyError';
|
||||
|
||||
export interface LastValueFromConfig<T> {
|
||||
defaultValue: T;
|
||||
}
|
||||
|
||||
export function lastValueFrom<T, D>(source: Observable<T>, config: LastValueFromConfig<D>): Promise<T | D>;
|
||||
export function lastValueFrom<T>(source: Observable<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Converts an observable to a promise by subscribing to the observable,
|
||||
* waiting for it to complete, and resolving the returned promise with the
|
||||
* last value from the observed stream.
|
||||
*
|
||||
* If the observable stream completes before any values were emitted, the
|
||||
* returned promise will reject with {@link EmptyError} or will resolve
|
||||
* with the default value if a default was specified.
|
||||
*
|
||||
* If the observable stream emits an error, the returned promise will reject
|
||||
* with that error.
|
||||
*
|
||||
* **WARNING**: Only use this with observables you *know* will complete. If the source
|
||||
* observable does not complete, you will end up with a promise that is hung up, and
|
||||
* potentially all of the state of an async function hanging out in memory. To avoid
|
||||
* this situation, look into adding something like {@link timeout}, {@link take},
|
||||
* {@link takeWhile}, or {@link takeUntil} amongst others.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Wait for the last value from a stream and emit it from a promise in
|
||||
* an async function
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take, lastValueFrom } from 'rxjs';
|
||||
*
|
||||
* async function execute() {
|
||||
* const source$ = interval(2000).pipe(take(10));
|
||||
* const finalNumber = await lastValueFrom(source$);
|
||||
* console.log(`The final number is ${ finalNumber }`);
|
||||
* }
|
||||
*
|
||||
* execute();
|
||||
*
|
||||
* // Expected output:
|
||||
* // 'The final number is 9'
|
||||
* ```
|
||||
*
|
||||
* @see {@link firstValueFrom}
|
||||
*
|
||||
* @param source the observable to convert to a promise
|
||||
* @param config a configuration object to define the `defaultValue` to use if the source completes without emitting a value
|
||||
*/
|
||||
export function lastValueFrom<T, D>(source: Observable<T>, config?: LastValueFromConfig<D>): Promise<T | D> {
|
||||
const hasConfig = typeof config === 'object';
|
||||
return new Promise<T | D>((resolve, reject) => {
|
||||
let _hasValue = false;
|
||||
let _value: T;
|
||||
source.subscribe({
|
||||
next: (value) => {
|
||||
_value = value;
|
||||
_hasValue = true;
|
||||
},
|
||||
error: reject,
|
||||
complete: () => {
|
||||
if (_hasValue) {
|
||||
resolve(_value);
|
||||
} else if (hasConfig) {
|
||||
resolve(config!.defaultValue);
|
||||
} else {
|
||||
reject(new EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
## [v1.1.3](https://github.com/ljharb/es-get-iterator/compare/v1.1.2...v1.1.3) - 2023-01-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`c97cb76`](https://github.com/ljharb/es-get-iterator/commit/c97cb764624f8c0e263695f1dcc9351b11000ea4)
|
||||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`6d09911`](https://github.com/ljharb/es-get-iterator/commit/6d09911097b54f59e6b3f3961f57dc594b3c649a)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`c7e0e85`](https://github.com/ljharb/es-get-iterator/commit/c7e0e85212a756b0989f8ff24896f2a936a3fe20)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es5-shim`, `object-inspect`, `tape` [`1353190`](https://github.com/ljharb/es-get-iterator/commit/13531904d91ee41ea22f02fd2bafd3034fba3758)
|
||||
- [Refactor] extract logic to `stop-iteration-iterator` [`ab19956`](https://github.com/ljharb/es-get-iterator/commit/ab199561031139e4d5c8249cda77196ff2590aaf)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es5-shim`, `object-inspect`, `safe-publish-latest`, `tape` [`de2ae73`](https://github.com/ljharb/es-get-iterator/commit/de2ae73a1c4395f4459450c11cd146fb73bee90c)
|
||||
- [Tests] start testing more variants [`e059f33`](https://github.com/ljharb/es-get-iterator/commit/e059f33c5ab89043d731a3ea7c301301ed1b315b)
|
||||
- [actions] update codecov uploader [`c8ffcec`](https://github.com/ljharb/es-get-iterator/commit/c8ffcec4ff8bfbab82e039f43d3283a345e7c94c)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es5-shim`, `has-bigints`, `object-inspect`, `tape` [`8cd2e87`](https://github.com/ljharb/es-get-iterator/commit/8cd2e8716d5b175c5f90cce3999e5c0de3b5be69)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`7676030`](https://github.com/ljharb/es-get-iterator/commit/7676030b4aa2d41cb3579c1aaea55911a62ca9ee)
|
||||
- [actions] update checkout action [`bdbe6c9`](https://github.com/ljharb/es-get-iterator/commit/bdbe6c9664eae9c87fa98128419b2d086a40988f)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `es6-shim` [`67cddd6`](https://github.com/ljharb/es-get-iterator/commit/67cddd66e4d9ad51fb9142ff3b1871b1b2fb1cf9)
|
||||
- [Tests] fix debug output issues in FF 24 [`a726fdc`](https://github.com/ljharb/es-get-iterator/commit/a726fdce1defeb2e0fec0dcc7a645668d574a1ac)
|
||||
- [Deps] update `has-symbols`, `is-arguments`, `is-string` [`044907b`](https://github.com/ljharb/es-get-iterator/commit/044907b42a2c1950855e9a2d1f455ba3595b2980)
|
||||
- [Deps] update `get-intrinsic`, `has-symbols` [`e492f8f`](https://github.com/ljharb/es-get-iterator/commit/e492f8f3a1a1d47ed032303bcfebb5d75b756267)
|
||||
- [meta] use `prepublishOnly` script for npm 7+ [`eccda6b`](https://github.com/ljharb/es-get-iterator/commit/eccda6bbfd20ed1c2ec1ad5c92c02169b50608e6)
|
||||
- [Dev Deps] update `object-inspect` [`c24dfa5`](https://github.com/ljharb/es-get-iterator/commit/c24dfa542267132515128172955a1d4a4049c14e)
|
||||
- [Deps] update `get-intrinsic` [`1bd68ce`](https://github.com/ljharb/es-get-iterator/commit/1bd68ceb11bc078edafb80a50631149056e8ffdf)
|
||||
|
||||
## [v1.1.2](https://github.com/ljharb/es-get-iterator/compare/v1.1.1...v1.1.2) - 2021-01-26
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] npmignore github action workflows [`0cd2f21`](https://github.com/ljharb/es-get-iterator/commit/0cd2f218f16b08efccbc29daf3831f4f37e30a74)
|
||||
- [readme] remove travis badge [`357065b`](https://github.com/ljharb/es-get-iterator/commit/357065b649cca3122cc32c73ef97739e3ab6cf6c)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-bigints`, `object-inspect`, `tape` [`13a77f2`](https://github.com/ljharb/es-get-iterator/commit/13a77f279cda7ddffbb769ea57933ffc3cac62f0)
|
||||
- [Deps] update `get-intrinsic`, `is-arguments`, `is-map`, `is-set` [`5f8d7f1`](https://github.com/ljharb/es-get-iterator/commit/5f8d7f14c71bffd470bb61f6f0e125da41bfcf06)
|
||||
- [meta] update actions, dotfiles [`5ea3e50`](https://github.com/ljharb/es-get-iterator/commit/5ea3e506d0ca1d80df6b37836c62e85934804f89)
|
||||
- [Tests] fix ESM test matrix [`9ab614c`](https://github.com/ljharb/es-get-iterator/commit/9ab614ce13b1a210d18827e47d4ad631a431dd39)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es5-shim` [`e843ad9`](https://github.com/ljharb/es-get-iterator/commit/e843ad96802c3579a79b82ef49d98239f8288db8)
|
||||
- [Deps] update `call-bind`, `get-intrinsic` [`4301b3e`](https://github.com/ljharb/es-get-iterator/commit/4301b3e70982434feda67e5868d7a50f5101ae8f)
|
||||
- [meta] avoid upcoming deprecation warning in node; add "browser" field [`57297b1`](https://github.com/ljharb/es-get-iterator/commit/57297b19b54b0970fe986890be6c7a97fa4fdd3a)
|
||||
- [Tests] skip `npm ls` in node 0.x tests [`1409196`](https://github.com/ljharb/es-get-iterator/commit/1409196062de66d84d3cf1d368bed18488e767f2)
|
||||
- [Dev Deps] update `eslint` [`e4dcea4`](https://github.com/ljharb/es-get-iterator/commit/e4dcea49104de45a0bcf861f9aa2923f0209ed66)
|
||||
|
||||
## [v1.1.1](https://github.com/ljharb/es-get-iterator/compare/v1.1.0...v1.1.1) - 2020-11-06
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] migrate tests to Github Actions [`e10fd31`](https://github.com/ljharb/es-get-iterator/commit/e10fd31909fc6451e4be5d8d9fb031d04ab72267)
|
||||
- [Fix] Support iterators defined by es6-shim when loaded after es-get-iterator [`f2ef7e1`](https://github.com/ljharb/es-get-iterator/commit/f2ef7e1d1cf5fa3357e460fc0023eaf11e79b573)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es6-shim`, `object-inspect`, `tape` [`1ee86fc`](https://github.com/ljharb/es-get-iterator/commit/1ee86fcf0ff0fa115e78ef589d3a76cd299fe89e)
|
||||
- [actions] add "Allow Edits" workflow [`c785c69`](https://github.com/ljharb/es-get-iterator/commit/c785c69933afd98a670250f1d52e3b514cbd1d7a)
|
||||
- [Refactor] use `get-intrinsic` and `call-bind` instead of `es-abstract` [`65f4ef5`](https://github.com/ljharb/es-get-iterator/commit/65f4ef5018688432ca87a4b5aa971fee182722df)
|
||||
- [Dev Deps] update `auto-changelog`, `es5-shim`, `tape`; add `aud` [`91301ed`](https://github.com/ljharb/es-get-iterator/commit/91301edd87d6b753e0129ac7007e39d410030340)
|
||||
- [Dev Deps] update `aud` [`afc91d9`](https://github.com/ljharb/es-get-iterator/commit/afc91d98ae243c8563ac7295b8775c5a4b37c92f)
|
||||
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`1962743`](https://github.com/ljharb/es-get-iterator/commit/19627437efac78d71d78d5e2ef0192052598bc1b)
|
||||
- [Deps] update `es-abstract` [`d2b57c8`](https://github.com/ljharb/es-get-iterator/commit/d2b57c8896b22eb90b0b894d80ba34f69ed68c3d)
|
||||
|
||||
## [v1.1.0](https://github.com/ljharb/es-get-iterator/compare/v1.0.2...v1.1.0) - 2020-01-25
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add native ESM variant via conditional exports [`325629d`](https://github.com/ljharb/es-get-iterator/commit/325629d43b6b8d4f2f5ff7d6623e81e01080dde7)
|
||||
- [Tests] fix test matrix [`01c20cf`](https://github.com/ljharb/es-get-iterator/commit/01c20cf6ed810e567f5fba5c29425df7f2aceb7a)
|
||||
- [Docs] Add modern browser example for Rollup [`ab9f17d`](https://github.com/ljharb/es-get-iterator/commit/ab9f17da94542940086280d8792d4e6c71186b47)
|
||||
- [Deps] update `is-map`, `is-set`, `es-abstract`, `is-string` [`a1b9645`](https://github.com/ljharb/es-get-iterator/commit/a1b964517cbd5b16a34fb15df50ec48d684c34c1)
|
||||
- [Fix] `node.js` only runs where "exports" is supported, and arguments is iterable there [`ccc7646`](https://github.com/ljharb/es-get-iterator/commit/ccc76469077f2fbc82fd4647894ebd660d21a2cb)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`4281453`](https://github.com/ljharb/es-get-iterator/commit/42814531965adb169abb3186a78c0926d4146232)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`f4fc99c`](https://github.com/ljharb/es-get-iterator/commit/f4fc99c83935d0c03aade04030f103d5328abf15)
|
||||
- [Deps] update `es-abstract` [`70b0423`](https://github.com/ljharb/es-get-iterator/commit/70b042317239eb79df71b16a9531900bdad812f4)
|
||||
- [Tests] add string coverage for a lone surrogate not followed by a proper surrogate ending [`796e497`](https://github.com/ljharb/es-get-iterator/commit/796e4979168b6ee8ec323d54ca157296166e36d0)
|
||||
|
||||
## [v1.0.2](https://github.com/ljharb/es-get-iterator/compare/v1.0.1...v1.0.2) - 2019-12-16
|
||||
|
||||
### Commits
|
||||
|
||||
- [Deps] update `es-abstract` [`1554229`](https://github.com/ljharb/es-get-iterator/commit/15542291b91d82ccf9da063d1350e7fe685f6bcd)
|
||||
- [Dev Deps] update `eslint` [`577bbb1`](https://github.com/ljharb/es-get-iterator/commit/577bbb136f7c44cc2d774b0360061b1f1bb10f30)
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/es-get-iterator/compare/v1.0.0...v1.0.1) - 2019-11-27
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] fix bugs in pre-Symbol environments [`592f78a`](https://github.com/ljharb/es-get-iterator/commit/592f78a1d38a0e3e3c4c3dafe1552899decd8c34)
|
||||
|
||||
## v1.0.0 - 2019-11-25
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial tests. [`71f5fdd`](https://github.com/ljharb/es-get-iterator/commit/71f5fdd9c1fdd7b34b5c6f4e1a14cb0cbffc0d9c)
|
||||
- Initial implementation [`d7e0480`](https://github.com/ljharb/es-get-iterator/commit/d7e04808b322fb6648f4890d86df7f3384b53421)
|
||||
- Initial commit [`eb5372c`](https://github.com/ljharb/es-get-iterator/commit/eb5372c438b3ca4136e8253ffc4cc7834a4c8ca8)
|
||||
- readme [`8d6ad14`](https://github.com/ljharb/es-get-iterator/commit/8d6ad14a7f17339ccc20143562f0618773aba3b8)
|
||||
- npm init [`9b84446`](https://github.com/ljharb/es-get-iterator/commit/9b84446a4e346d4e12c59da5f2f928e1f71d3d69)
|
||||
- [meta] add `auto-changelog` [`e2d2e4f`](https://github.com/ljharb/es-get-iterator/commit/e2d2e4f55245b786581ef5d42d03cd0efb62db12)
|
||||
- [meta] add `funding` field; create FUNDING.yml [`5a31c77`](https://github.com/ljharb/es-get-iterator/commit/5a31c7722fc54edfe56975f5a4b7414c48136d36)
|
||||
- [actions] add automatic rebasing / merge commit blocking [`644429e`](https://github.com/ljharb/es-get-iterator/commit/644429e791abc1b85b65c90d0ee4aac57416ee90)
|
||||
- [Tests] add `npm run lint` [`f22172f`](https://github.com/ljharb/es-get-iterator/commit/f22172f2dcdd6f41ca45862698b8ea496134b164)
|
||||
- Only apps should have lockfiles [`fcf8441`](https://github.com/ljharb/es-get-iterator/commit/fcf8441df29d902647fd87d14224c7af19e40c31)
|
||||
- [meta] add `safe-publish-latest` [`946befa`](https://github.com/ljharb/es-get-iterator/commit/946befa7eb4a91ca648b98660b086ed7813cd3b1)
|
||||
- [Tests] only test on majors, since travis has a 200 build limit [`aeb5f09`](https://github.com/ljharb/es-get-iterator/commit/aeb5f09a66957c2cff0af22cb1a731ecafb82f24)
|
||||
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var isEmpty = require('es5-ext/object/is-empty')
|
||||
, value = require('es5-ext/object/valid-value')
|
||||
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
module.exports = function (obj/*, type*/) {
|
||||
var type;
|
||||
value(obj);
|
||||
type = arguments[1];
|
||||
if (arguments.length > 1) {
|
||||
return hasOwnProperty.call(obj, '__ee__') && Boolean(obj.__ee__[type]);
|
||||
}
|
||||
return obj.hasOwnProperty('__ee__') && !isEmpty(obj.__ee__);
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isISO8601;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// from http://goo.gl/0ejHHW
|
||||
var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; // same as above, except with a strict 'T' separator between date and time
|
||||
|
||||
var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
||||
/* eslint-enable max-len */
|
||||
|
||||
var isValidDate = function isValidDate(str) {
|
||||
// str must have passed the ISO8601 check
|
||||
// this check is meant to catch invalid dates
|
||||
// like 2009-02-31
|
||||
// first check for ordinal dates
|
||||
var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
|
||||
|
||||
if (ordinalMatch) {
|
||||
var oYear = Number(ordinalMatch[1]);
|
||||
var oDay = Number(ordinalMatch[2]); // if is leap year
|
||||
|
||||
if (oYear % 4 === 0 && oYear % 100 !== 0 || oYear % 400 === 0) return oDay <= 366;
|
||||
return oDay <= 365;
|
||||
}
|
||||
|
||||
var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number);
|
||||
var year = match[1];
|
||||
var month = match[2];
|
||||
var day = match[3];
|
||||
var monthString = month ? "0".concat(month).slice(-2) : month;
|
||||
var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare
|
||||
|
||||
var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01'));
|
||||
|
||||
if (month && day) {
|
||||
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function isISO8601(str) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
(0, _assertString.default)(str);
|
||||
var check = options.strictSeparator ? iso8601StrictSeparator.test(str) : iso8601.test(str);
|
||||
if (check && options.strict) return isValidDate(str);
|
||||
return check;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "y18n",
|
||||
"version": "5.0.8",
|
||||
"description": "the bare-bones internationalization library used by yargs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./build/lib/index.js",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"internationalization",
|
||||
"yargs"
|
||||
],
|
||||
"homepage": "https://github.com/yargs/y18n",
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/y18n/issues"
|
||||
},
|
||||
"repository": "yargs/y18n",
|
||||
"license": "ISC",
|
||||
"author": "Ben Coe <bencoe@gmail.com>",
|
||||
"main": "./build/index.cjs",
|
||||
"scripts": {
|
||||
"check": "standardx **/*.ts **/*.cjs **/*.mjs",
|
||||
"fix": "standardx --fix **/*.ts **/*.cjs **/*.mjs",
|
||||
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
|
||||
"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
|
||||
"test:esm": "c8 --reporter=text --reporter=html mocha test/esm/*.mjs",
|
||||
"posttest": "npm run check",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.6.4",
|
||||
"@wessberg/rollup-plugin-ts": "^1.3.1",
|
||||
"c8": "^7.3.0",
|
||||
"chai": "^4.0.1",
|
||||
"cross-env": "^7.0.2",
|
||||
"gts": "^3.0.0",
|
||||
"mocha": "^8.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.26.10",
|
||||
"standardx": "^7.0.0",
|
||||
"ts-transform-default-export": "^1.0.2",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build",
|
||||
"index.mjs",
|
||||
"!*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"standardx": {
|
||||
"ignore": [
|
||||
"build"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
# rechoir [](http://travis-ci.org/tkellen/js-rechoir)
|
||||
> Require any supported file as a node module.
|
||||
|
||||
[](https://nodei.co/npm/rechoir/)
|
||||
|
||||
## What is it?
|
||||
This module, in conjunction with [interpret]-like objects can register any file type the npm ecosystem has a module loader for. This library is a dependency of [Liftoff].
|
||||
|
||||
## API
|
||||
|
||||
### prepare(config, filepath, requireFrom)
|
||||
Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into [require.extensions](http://nodejs.org/api/globals.html#globals_require_extensions).
|
||||
|
||||
`config` An [interpret]-like configuration object.
|
||||
|
||||
`filepath` A file whose type you'd like to register a module loader for.
|
||||
|
||||
`requireFrom` An optional path to start searching for the module required to load the requested file. Defaults to the directory of `filepath`.
|
||||
|
||||
If calling this method is successful (aka: it doesn't throw), you can now require files of the type you requested natively.
|
||||
|
||||
An error with a `failures` property will be thrown if the module loader(s) configured for a given extension cannot be registered.
|
||||
|
||||
If a loader is already registered, this will simply return `true`.
|
||||
|
||||
**Note:** While rechoir will automatically load and register transpilers like `coffee-script`, you must provide a local installation. The transpilers are **not** bundled with this module.
|
||||
|
||||
#### Usage
|
||||
```js
|
||||
const config = require('interpret').extensions;
|
||||
const rechoir = require('rechoir');
|
||||
rechoir.prepare(config, './test/fixtures/test.coffee');
|
||||
rechoir.prepare(config, './test/fixtures/test.csv');
|
||||
rechoir.prepare(config, './test/fixtures/test.toml');
|
||||
|
||||
console.log(require('./test/fixtures/test.coffee'));
|
||||
console.log(require('./test/fixtures/test.csv'));
|
||||
console.log(require('./test/fixtures/test.toml'));
|
||||
```
|
||||
|
||||
[interpret]: http://github.com/tkellen/js-interpret
|
||||
[Liftoff]: http://github.com/tkellen/js-liftoff
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "es-to-primitive",
|
||||
"version": "1.2.1",
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"description": "ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "npx aud",
|
||||
"tests-only": "node --es-staging test",
|
||||
"coverage": "covert test/*.js",
|
||||
"coverage-quiet": "covert test/*.js --quiet",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ljharb/es-to-primitive.git"
|
||||
},
|
||||
"keywords": [
|
||||
"primitive",
|
||||
"abstract",
|
||||
"ecmascript",
|
||||
"es5",
|
||||
"es6",
|
||||
"es2015",
|
||||
"toPrimitive",
|
||||
"coerce",
|
||||
"type",
|
||||
"object",
|
||||
"string",
|
||||
"number",
|
||||
"boolean",
|
||||
"symbol",
|
||||
"null",
|
||||
"undefined"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-callable": "^1.1.4",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-symbol": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^15.0.0",
|
||||
"covert": "^1.1.1",
|
||||
"eslint": "^6.6.0",
|
||||
"foreach": "^2.0.5",
|
||||
"function.prototype.name": "^1.1.1",
|
||||
"has-symbols": "^1.0.0",
|
||||
"object-inspect": "^1.6.0",
|
||||
"object-is": "^1.0.1",
|
||||
"replace": "^1.1.1",
|
||||
"semver": "^6.3.0",
|
||||
"tape": "^4.11.0"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference types="node" />
|
||||
import * as taskManager from './managers/tasks';
|
||||
import { Options as OptionsInternal } from './settings';
|
||||
import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
|
||||
declare type EntryObjectModePredicate = {
|
||||
[TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
|
||||
};
|
||||
declare type EntryStatsPredicate = {
|
||||
[TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
|
||||
};
|
||||
declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
|
||||
declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
|
||||
declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
|
||||
declare namespace FastGlob {
|
||||
type Options = OptionsInternal;
|
||||
type Entry = EntryInternal;
|
||||
type Task = taskManager.Task;
|
||||
type Pattern = PatternInternal;
|
||||
type FileSystemAdapter = FileSystemAdapterInternal;
|
||||
function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
|
||||
function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
|
||||
function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
|
||||
function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
|
||||
function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
|
||||
function escapePath(source: PatternInternal): PatternInternal;
|
||||
}
|
||||
export = FastGlob;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isInteropObservable.d.ts","sourceRoot":"","sources":["../../../../src/internal/util/isInteropObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAE/E"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"registry-auth-token","version":"5.0.2","files":{"LICENSE":{"checkedAt":1678883672616,"integrity":"sha512-iQ3WRPWUcyTqfph7n8EaZ8CWrgqeALDcwxaqqp/6F3vDTnEMs7Y/tBzWpY0mpSmbVwtvz2iswy4RSMZ2r8CQNg==","mode":420,"size":1084},"registry-url.js":{"checkedAt":1678883672616,"integrity":"sha512-Xl1Ffqi2Z6GZJ1hLwyRUUaMoXav7hYhBpR+gFkO7lefKDC/xyPYwz3lwbAoL3pht5RjkM7cL5UMhETxM8B3MRg==","mode":420,"size":333},"index.js":{"checkedAt":1678883672616,"integrity":"sha512-onziLCpB09xA5LUQo/Ig5v73xnmV0lcHFCaZ+9+uPQKGwpVsZKO5jr3LlXXVIvkIUbcmkEX1w5f01sZ/c6JVEg==","mode":420,"size":3974},"package.json":{"checkedAt":1678883672616,"integrity":"sha512-TIZvEnnWEKzkISGbmlapEeLYJzapNMzKPK/HA5dBD9OW93csXsam5yVuko3y1jCvRTAdhLOjtb2Px7vNCtP4DQ==","mode":420,"size":1062},"CHANGELOG.md":{"checkedAt":1678883672616,"integrity":"sha512-7Co6dlnM75uL2M85EuN+jTZp8eKxpT8+DmNLbOatpbsUEKEU5M1YqPxG61pJQCre01RltNDVc9ALLRod7QlWYw==","mode":420,"size":3979},"README.md":{"checkedAt":1678883672617,"integrity":"sha512-EFZtuzzoX28S79xYgH1NZ2aU76uVLyddUrtJ1fVbRwlRkcqr0ZL7U4xVRLzbfPnc9HdUc19aWWw1XslzXEq0bg==","mode":420,"size":2166},"index.d.ts":{"checkedAt":1678883672617,"integrity":"sha512-8U5TzHhW7TJWdXr4GWAsaOXD/N7zXyGOYDXE5M410qToXqitXQhXXPupMBwXOYRW4+2e3uZNxq82j+F4baaSXA==","mode":420,"size":2017},"registry-url.d.ts":{"checkedAt":1678883672617,"integrity":"sha512-VGoNv1n0BNgkTuUjevZnkMwjkTspKOnACbGGkmhidVWMEfqf6I4PIE+r/9q287B5+z6NWf8+rt1S/2VDkHZxCg==","mode":420,"size":442}}}
|
||||
Reference in New Issue
Block a user