new license file version [CI SKIP]
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AnimationFrameScheduler.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduler/AnimationFrameScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,cAAc;IAClD,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI;CAiC9C"}
|
||||
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isISO6391;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var isISO6391Set = new Set(['aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az', 'az', 'ba', 'be', 'bg', 'bh', 'bi', 'bm', 'bn', 'bo', 'br', 'bs', 'ca', 'ce', 'ch', 'co', 'cr', 'cs', 'cu', 'cv', 'cy', 'da', 'de', 'dv', 'dz', 'ee', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'ff', 'fi', 'fj', 'fo', 'fr', 'fy', 'ga', 'gd', 'gl', 'gn', 'gu', 'gv', 'ha', 'he', 'hi', 'ho', 'hr', 'ht', 'hu', 'hy', 'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'io', 'is', 'it', 'iu', 'ja', 'jv', 'ka', 'kg', 'ki', 'kj', 'kk', 'kl', 'km', 'kn', 'ko', 'kr', 'ks', 'ku', 'kv', 'kw', 'ky', 'la', 'lb', 'lg', 'li', 'ln', 'lo', 'lt', 'lu', 'lv', 'mg', 'mh', 'mi', 'mk', 'ml', 'mn', 'mr', 'ms', 'mt', 'my', 'na', 'nb', 'nd', 'ne', 'ng', 'nl', 'nn', 'no', 'nr', 'nv', 'ny', 'oc', 'oj', 'om', 'or', 'os', 'pa', 'pi', 'pl', 'ps', 'pt', 'qu', 'rm', 'rn', 'ro', 'ru', 'rw', 'sa', 'sc', 'sd', 'se', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr', 'ss', 'st', 'su', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tl', 'tn', 'to', 'tr', 'ts', 'tt', 'tw', 'ty', 'ug', 'uk', 'ur', 'uz', 've', 'vi', 'vo', 'wa', 'wo', 'xh', 'yi', 'yo', 'za', 'zh', 'zu']);
|
||||
|
||||
function isISO6391(str) {
|
||||
(0, _assertString.default)(str);
|
||||
return isISO6391Set.has(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,708 @@
|
||||
<h1 align="center">Picomatch</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/v/picomatch.svg" alt="version">
|
||||
</a>
|
||||
<a href="https://github.com/micromatch/picomatch/actions?workflow=Tests">
|
||||
<img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status">
|
||||
</a>
|
||||
<a href="https://coveralls.io/github/micromatch/picomatch">
|
||||
<img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status">
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br>
|
||||
<em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Why picomatch?
|
||||
|
||||
* **Lightweight** - No dependencies
|
||||
* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function.
|
||||
* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps)
|
||||
* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files)
|
||||
* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes.
|
||||
* **Well tested** - Thousands of unit tests
|
||||
|
||||
See the [library comparison](#library-comparisons) to other libraries.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<details><summary> Click to expand </summary>
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
* [picomatch](#picomatch)
|
||||
* [.test](#test)
|
||||
* [.matchBase](#matchbase)
|
||||
* [.isMatch](#ismatch)
|
||||
* [.parse](#parse)
|
||||
* [.scan](#scan)
|
||||
* [.compileRe](#compilere)
|
||||
* [.makeRe](#makere)
|
||||
* [.toRegex](#toregex)
|
||||
- [Options](#options)
|
||||
* [Picomatch options](#picomatch-options)
|
||||
* [Scan Options](#scan-options)
|
||||
* [Options Examples](#options-examples)
|
||||
- [Globbing features](#globbing-features)
|
||||
* [Basic globbing](#basic-globbing)
|
||||
* [Advanced globbing](#advanced-globbing)
|
||||
* [Braces](#braces)
|
||||
* [Matching special characters as literals](#matching-special-characters-as-literals)
|
||||
- [Library Comparisons](#library-comparisons)
|
||||
- [Benchmarks](#benchmarks)
|
||||
- [Philosophies](#philosophies)
|
||||
- [About](#about)
|
||||
* [Author](#author)
|
||||
* [License](#license)
|
||||
|
||||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
|
||||
|
||||
</details>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install --save picomatch
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Usage
|
||||
|
||||
The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
const isMatch = pm('*.js');
|
||||
|
||||
console.log(isMatch('abcd')); //=> false
|
||||
console.log(isMatch('a.js')); //=> true
|
||||
console.log(isMatch('a.md')); //=> false
|
||||
console.log(isMatch('a/b.js')); //=> false
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## API
|
||||
|
||||
### [picomatch](lib/picomatch.js#L32)
|
||||
|
||||
Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.
|
||||
|
||||
**Params**
|
||||
|
||||
* `globs` **{String|Array}**: One or more glob patterns.
|
||||
* `options` **{Object=}**
|
||||
* `returns` **{Function=}**: Returns a matcher function.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch(glob[, options]);
|
||||
|
||||
const isMatch = picomatch('*.!(*a)');
|
||||
console.log(isMatch('a.a')); //=> false
|
||||
console.log(isMatch('a.b')); //=> true
|
||||
```
|
||||
|
||||
### [.test](lib/picomatch.js#L117)
|
||||
|
||||
Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `regex` **{RegExp}**
|
||||
* `returns` **{Object}**: Returns an object with matching info.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.test(input, regex[, options]);
|
||||
|
||||
console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||||
// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||||
```
|
||||
|
||||
### [.matchBase](lib/picomatch.js#L161)
|
||||
|
||||
Match the basename of a filepath.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.matchBase(input, glob[, options]);
|
||||
console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||||
```
|
||||
|
||||
### [.isMatch](lib/picomatch.js#L183)
|
||||
|
||||
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
|
||||
**Params**
|
||||
|
||||
* **{String|Array}**: str The string to test.
|
||||
* **{String|Array}**: patterns One or more glob patterns to use for matching.
|
||||
* **{Object}**: See available [options](#options).
|
||||
* `returns` **{Boolean}**: Returns true if any patterns match `str`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.isMatch(string, patterns[, options]);
|
||||
|
||||
console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||||
console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||||
```
|
||||
|
||||
### [.parse](lib/picomatch.js#L199)
|
||||
|
||||
Parse a glob pattern to create the source string for a regular expression.
|
||||
|
||||
**Params**
|
||||
|
||||
* `pattern` **{String}**
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.parse(pattern[, options]);
|
||||
```
|
||||
|
||||
### [.scan](lib/picomatch.js#L231)
|
||||
|
||||
Scan a glob pattern to separate the pattern into segments.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: Glob pattern to scan.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.scan(input[, options]);
|
||||
|
||||
const result = picomatch.scan('!./foo/*.js');
|
||||
console.log(result);
|
||||
{ prefix: '!./',
|
||||
input: '!./foo/*.js',
|
||||
start: 3,
|
||||
base: 'foo',
|
||||
glob: '*.js',
|
||||
isBrace: false,
|
||||
isBracket: false,
|
||||
isGlob: true,
|
||||
isExtglob: false,
|
||||
isGlobstar: false,
|
||||
negated: true }
|
||||
```
|
||||
|
||||
### [.compileRe](lib/picomatch.js#L245)
|
||||
|
||||
Compile a regular expression from the `state` object returned by the
|
||||
[parse()](#parse) method.
|
||||
|
||||
**Params**
|
||||
|
||||
* `state` **{Object}**
|
||||
* `options` **{Object}**
|
||||
* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser.
|
||||
* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
||||
* `returns` **{RegExp}**
|
||||
|
||||
### [.makeRe](lib/picomatch.js#L286)
|
||||
|
||||
Create a regular expression from a parsed glob pattern.
|
||||
|
||||
**Params**
|
||||
|
||||
* `state` **{String}**: The object returned from the `.parse` method.
|
||||
* `options` **{Object}**
|
||||
* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
||||
* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
||||
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const state = picomatch.parse('*.js');
|
||||
// picomatch.compileRe(state[, options]);
|
||||
|
||||
console.log(picomatch.compileRe(state));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
### [.toRegex](lib/picomatch.js#L321)
|
||||
|
||||
Create a regular expression from the given regex source string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `source` **{String}**: Regular expression source string.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{RegExp}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.toRegex(source[, options]);
|
||||
|
||||
const { output } = picomatch.parse('*.js');
|
||||
console.log(picomatch.toRegex(output));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Options
|
||||
|
||||
### Picomatch options
|
||||
|
||||
The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
|
||||
| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |
|
||||
| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. |
|
||||
| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). |
|
||||
| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` |
|
||||
| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. |
|
||||
| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |
|
||||
| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
|
||||
| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
|
||||
| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
|
||||
| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
|
||||
| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
|
||||
| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
|
||||
| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
|
||||
| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
|
||||
| `matchBase` | `boolean` | `false` | Alias for `basename` |
|
||||
| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
|
||||
| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
|
||||
| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. |
|
||||
| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |
|
||||
| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. |
|
||||
| `noext` | `boolean` | `false` | Alias for `noextglob` |
|
||||
| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) |
|
||||
| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) |
|
||||
| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` |
|
||||
| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. |
|
||||
| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |
|
||||
| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |
|
||||
| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
|
||||
| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). |
|
||||
| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
|
||||
| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. |
|
||||
| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
|
||||
| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
|
||||
| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
|
||||
| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
|
||||
| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
|
||||
|
||||
picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error.
|
||||
|
||||
### Scan Options
|
||||
|
||||
In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |
|
||||
| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.scan('!./foo/*.js', { tokens: true });
|
||||
console.log(result);
|
||||
// {
|
||||
// prefix: '!./',
|
||||
// input: '!./foo/*.js',
|
||||
// start: 3,
|
||||
// base: 'foo',
|
||||
// glob: '*.js',
|
||||
// isBrace: false,
|
||||
// isBracket: false,
|
||||
// isGlob: true,
|
||||
// isExtglob: false,
|
||||
// isGlobstar: false,
|
||||
// negated: true,
|
||||
// maxDepth: 2,
|
||||
// tokens: [
|
||||
// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },
|
||||
// { value: 'foo', depth: 1, isGlob: false },
|
||||
// { value: '*.js', depth: 1, isGlob: true }
|
||||
// ],
|
||||
// slashes: [ 2, 6 ],
|
||||
// parts: [ 'foo', '*.js' ]
|
||||
// }
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### Options Examples
|
||||
|
||||
#### options.expandRange
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need.
|
||||
|
||||
**Example**
|
||||
|
||||
The following example shows how to create a glob that matches a folder
|
||||
|
||||
```js
|
||||
const fill = require('fill-range');
|
||||
const regex = pm.makeRe('foo/{01..25}/bar', {
|
||||
expandRange(a, b) {
|
||||
return `(${fill(a, b, { toRegex: true })})`;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(regex);
|
||||
//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/
|
||||
|
||||
console.log(regex.test('foo/00/bar')) // false
|
||||
console.log(regex.test('foo/01/bar')) // true
|
||||
console.log(regex.test('foo/10/bar')) // true
|
||||
console.log(regex.test('foo/22/bar')) // true
|
||||
console.log(regex.test('foo/25/bar')) // true
|
||||
console.log(regex.test('foo/26/bar')) // false
|
||||
```
|
||||
|
||||
#### options.format
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for formatting strings before they're matched.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
// strip leading './' from strings
|
||||
const format = str => str.replace(/^\.\//, '');
|
||||
const isMatch = picomatch('foo/*.js', { format });
|
||||
console.log(isMatch('./foo/bar.js')); //=> true
|
||||
```
|
||||
|
||||
#### options.onMatch
|
||||
|
||||
```js
|
||||
const onMatch = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onMatch });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onIgnore
|
||||
|
||||
```js
|
||||
const onIgnore = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onResult
|
||||
|
||||
```js
|
||||
const onResult = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onResult, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Globbing features
|
||||
|
||||
* [Basic globbing](#basic-globbing) (Wildcard matching)
|
||||
* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)
|
||||
|
||||
### Basic globbing
|
||||
|
||||
| **Character** | **Description** |
|
||||
| --- | --- |
|
||||
| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. |
|
||||
| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. |
|
||||
| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. |
|
||||
| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |
|
||||
|
||||
#### Matching behavior vs. Bash
|
||||
|
||||
Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions:
|
||||
|
||||
* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.
|
||||
* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`.
|
||||
|
||||
<br>
|
||||
|
||||
### Advanced globbing
|
||||
|
||||
* [extglobs](#extglobs)
|
||||
* [POSIX brackets](#posix-brackets)
|
||||
* [Braces](#brace-expansion)
|
||||
|
||||
#### Extglobs
|
||||
|
||||
| **Pattern** | **Description** |
|
||||
| --- | --- |
|
||||
| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |
|
||||
| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |
|
||||
| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |
|
||||
| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |
|
||||
| `!(pattern)` | Match _anything but_ `pattern` |
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
|
||||
// *(pattern) matches ZERO or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// +(pattern) matches ONE or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// supports multiple extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false
|
||||
|
||||
// supports nested extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true
|
||||
```
|
||||
|
||||
#### POSIX brackets
|
||||
|
||||
POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.
|
||||
|
||||
**Enable POSIX bracket support**
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('[[:word:]]+', { posix: true }));
|
||||
//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/
|
||||
```
|
||||
|
||||
**Supported POSIX classes**
|
||||
|
||||
The following named POSIX bracket expressions are supported:
|
||||
|
||||
* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`
|
||||
* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.
|
||||
* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.
|
||||
* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.
|
||||
* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.
|
||||
* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.
|
||||
* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.
|
||||
* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.
|
||||
* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.
|
||||
* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.
|
||||
* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.
|
||||
* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.
|
||||
* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.
|
||||
* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.
|
||||
|
||||
See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.
|
||||
|
||||
### Braces
|
||||
|
||||
Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces.
|
||||
|
||||
### Matching special characters as literals
|
||||
|
||||
If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes:
|
||||
|
||||
**Special Characters**
|
||||
|
||||
Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
|
||||
|
||||
To match any of the following characters as literals: `$^*+?()[]
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Library Comparisons
|
||||
|
||||
The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets).
|
||||
|
||||
| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |
|
||||
| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - |
|
||||
| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - |
|
||||
| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - |
|
||||
| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - |
|
||||
| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ |
|
||||
| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |
|
||||
| File system operations | - | - | - | - | - | - | - |
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Performance comparison of picomatch and minimatch.
|
||||
|
||||
```
|
||||
# .makeRe star
|
||||
picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled)
|
||||
minimatch x 627,206 ops/sec ±1.96% (87 runs sampled))
|
||||
|
||||
# .makeRe star; dot=true
|
||||
picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled)
|
||||
minimatch x 525,876 ops/sec ±0.60% (88 runs sampled)
|
||||
|
||||
# .makeRe globstar
|
||||
picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled)
|
||||
minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d)
|
||||
|
||||
# .makeRe globstars
|
||||
picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled)
|
||||
minimatch x 477,179 ops/sec ±1.33% (91 runs sampled)
|
||||
|
||||
# .makeRe with leading star
|
||||
picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled)
|
||||
minimatch x 453,564 ops/sec ±1.43% (94 runs sampled)
|
||||
|
||||
# .makeRe - basic braces
|
||||
picomatch x 392,067 ops/sec ±0.70% (90 runs sampled)
|
||||
minimatch x 99,532 ops/sec ±2.03% (87 runs sampled))
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Philosophies
|
||||
|
||||
The goal of this library is to be blazing fast, without compromising on accuracy.
|
||||
|
||||
**Accuracy**
|
||||
|
||||
The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`.
|
||||
|
||||
Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements.
|
||||
|
||||
**Performance**
|
||||
|
||||
Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"vm2","version":"3.9.14","files":{".eslintignore":{"checkedAt":1678883672208,"integrity":"sha512-Sky7PN7iFVDXP3oaywHbf059wM0hToavpW2kUrzDWvId0+GXgZMLwlxNEfHp9p7f1/HeB6AFeJgD343ES3Al9w==","mode":420,"size":81},"bin/vm2":{"checkedAt":1678883672208,"integrity":"sha512-EkgcpXZhYNtTdEKvH9HnLq+28OfqxW/nPPTa9FwEfmoGfBb/u663tTT6rhfvCdto7+p9LuxgcMv32OOvfUxA1w==","mode":420,"size":59},".eslintrc.js":{"checkedAt":1678883672208,"integrity":"sha512-wrCzNEfAzQr1cPEQpbV8Kb6944jWSYbShy+ww0BzJ823HmPPstgulq4Fcy0ZuNe6As0r9cfXz415e7dEmxrpxw==","mode":420,"size":213},"lib/bridge.js":{"checkedAt":1678883672268,"integrity":"sha512-wkH8p9izUdPMb+C9AG00HjAmarKhHJzkxFrZcEkxL95XHa+jnBOc4XZSJK2Gp46/MoL3MOVx28Kz405lgSweSA==","mode":420,"size":29197},"lib/cli.js":{"checkedAt":1678883672268,"integrity":"sha512-srSS8/2CXOqSRRSBMQzbAhqI5U0EeBm+2DJvBAginh8uOHwuN0ZqXcsVbS8A1+jVd4Z4y6cQ25EsWvMJSAlKRA==","mode":420,"size":718},"lib/compiler.js":{"checkedAt":1678883672268,"integrity":"sha512-FGWs8pT8VFiovpHSm1eP5Wbp+yCwj8xowcWqy8oJRPVY2ydmzWPJFfZnffKpH3ol+ukJc9ZLn+1GKCTUFgkyzg==","mode":420,"size":2308},"lib/events.js":{"checkedAt":1678883672274,"integrity":"sha512-w0EBHkqmssWcGsNryemea76r7RZiRK8Gw9NYTz+YQnVFQd+ydUle/F9EDVrTPXmo6dnREwJOlelxFBp3u2kISg==","mode":420,"size":28143},"lib/filesystem.js":{"checkedAt":1678883672274,"integrity":"sha512-7mmiT7Ppif6EoRPq7oH7FrEBN+2sL5P++1Yl2QPdL2uvxQLUtNBNNTYhbBnTKZ2DQH2M7Y1AuWlfVXgBQ5vRkA==","mode":420,"size":1299},"index.js":{"checkedAt":1678883672274,"integrity":"sha512-z1/kihIsBfkDJajqKgZvFbD0tLnT7c64sEh75v76cjakoPzrdshz4u7Jt5akEylWw4Ar8p9JUiV7QGAVHW0abg==","mode":420,"size":157},"lib/main.js":{"checkedAt":1678883672274,"integrity":"sha512-MBp8uMucd0Aj6Vqx7XOI2yWNmnNy32dpAX/V+5Y6JPNOtlmgZ0LbcdPxE2fB0xRRRLj+5irc/fTf16E84JlYHw==","mode":420,"size":361},"lib/nodevm.js":{"checkedAt":1678883672276,"integrity":"sha512-D8ygLdiL68OmEY3SZHnMV8rH+P6s1lnfSt+W+y2eqcSiEZjjVLg8wN0cjoF8wUPUfdYzMpAFP4h/ktK1E4LM4A==","mode":420,"size":16877},"lib/resolver-compat.js":{"checkedAt":1678883672278,"integrity":"sha512-du5GAHrFTCxYdm/wUEIzTotlZxaFcFcxVu+U2WwKO3eJvq0grKVylUabq9cDP7nSUk2AGgY7kCjJfVxX/+SChA==","mode":420,"size":11427},"lib/resolver.js":{"checkedAt":1678883672287,"integrity":"sha512-WGjdfQtkSk02/tA+jvxiZaAi/UqxD0ahM3xkZKT2/j/gQeAmYV2KJsHa7pMcbVCF7PpNmLvB8bVqi2RHTOXBGw==","mode":420,"size":33633},"lib/script.js":{"checkedAt":1678883672287,"integrity":"sha512-My4iHcbo0NK6IoaE5cEHxGmYuhFppsFo6TX5D6W2P186cpYxxK0dzdNQIp6AT1jbA/aviQL/e3WKM8z7+CeUVw==","mode":420,"size":9082},"lib/setup-node-sandbox.js":{"checkedAt":1678883672291,"integrity":"sha512-Lqcbccr28mBtSU4FnVZiU2TjEiRNh3gaG5hrDF02ZAdGZ/1PR1xQj1r8s0yQ1Lc3XHp5XdHwHzPiUj/G0eaIiw==","mode":420,"size":11477},"lib/setup-sandbox.js":{"checkedAt":1678883672300,"integrity":"sha512-8oQjx6vysCO9nrdeAZslNhSpbww3R/P91rXEc4nPgyw4BheDFh+CFC4di2yoD4/KZIIWLrz8bBwgmOTocwx/vA==","mode":420,"size":12441},"lib/transformer.js":{"checkedAt":1678883672300,"integrity":"sha512-i67vTs+jM4aQKhUlK+xhlWOutHeTgs3cpKzb0DdJg0tR/g9lZPEdQcqIBGPA0kgZjTLZ5apz4u45+Q4XEA810Q==","mode":420,"size":6072},"lib/vm.js":{"checkedAt":1678883672321,"integrity":"sha512-afgj6O/d/Qrn35lfDTdB+GecxtRY4FiPSJLnopbwYc/INeIZ8facvtBcf0ePp1FuX72m/4Tbhw927LwhBcnAtQ==","mode":420,"size":14760},"package.json":{"checkedAt":1678883672321,"integrity":"sha512-vmCBvIxLpLdqQe21u5oIw1oUe9EQNa6LJGGjyhRrw8O2IsF/MjNsumOMUkJNUriH8ix/SYF2zI9yPSL/P6CAjA==","mode":420,"size":824},"CHANGELOG.md":{"checkedAt":1678883672331,"integrity":"sha512-ZsHPD6RvgBk56BojKc74CNp7/HeYcqvylKyu65YUuJRnc4gRoDTv9mlfn1VjIGxAUIwyQyg6imR3bDSJOXMgXA==","mode":420,"size":5745},"LICENSE.md":{"checkedAt":1678883672331,"integrity":"sha512-qFpWsK+EvPT1+fyP1yMzV/GoZXpi7KpbS1dYFGETA4kwjZZ2gBT3lxYnZ94PQ3ZWzNH85cfezI7Folmc/cHNlw==","mode":420,"size":1090},"README.md":{"checkedAt":1678883672340,"integrity":"sha512-ZvQNzKaw9v59SX3r+y6dTltJl3mISN6sxbuG8+GZZbaskmq+SokWUCVqjSUn9rIxISKdO1Qz5XgsWfHwWy1Vfg==","mode":420,"size":16141},"index.d.ts":{"checkedAt":1678883672347,"integrity":"sha512-srbiuk3bRwp0miMGgxnwZSsv9VKyuwKp6E+0004KTT7pHBS0QrssgXZDj59bygDfdg50rdai1QeFq4b401nSjQ==","mode":420,"size":10191}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SubscriptionLog.js","sourceRoot":"","sources":["../../../../src/internal/testing/SubscriptionLog.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAe;IAC1B,YAAmB,eAAuB,EACvB,oBAA4B,QAAQ;QADpC,oBAAe,GAAf,eAAe,CAAQ;QACvB,sBAAiB,GAAjB,iBAAiB,CAAmB;IACvD,CAAC;CACF"}
|
||||
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
|
||||
// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js
|
||||
|
||||
// == UTF16-BE codec. ==========================================================
|
||||
|
||||
exports.utf16be = Utf16BECodec;
|
||||
function Utf16BECodec() {
|
||||
}
|
||||
|
||||
Utf16BECodec.prototype.encoder = Utf16BEEncoder;
|
||||
Utf16BECodec.prototype.decoder = Utf16BEDecoder;
|
||||
Utf16BECodec.prototype.bomAware = true;
|
||||
|
||||
|
||||
// -- Encoding
|
||||
|
||||
function Utf16BEEncoder() {
|
||||
}
|
||||
|
||||
Utf16BEEncoder.prototype.write = function(str) {
|
||||
var buf = Buffer.from(str, 'ucs2');
|
||||
for (var i = 0; i < buf.length; i += 2) {
|
||||
var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
Utf16BEEncoder.prototype.end = function() {
|
||||
}
|
||||
|
||||
|
||||
// -- Decoding
|
||||
|
||||
function Utf16BEDecoder() {
|
||||
this.overflowByte = -1;
|
||||
}
|
||||
|
||||
Utf16BEDecoder.prototype.write = function(buf) {
|
||||
if (buf.length == 0)
|
||||
return '';
|
||||
|
||||
var buf2 = Buffer.alloc(buf.length + 1),
|
||||
i = 0, j = 0;
|
||||
|
||||
if (this.overflowByte !== -1) {
|
||||
buf2[0] = buf[0];
|
||||
buf2[1] = this.overflowByte;
|
||||
i = 1; j = 2;
|
||||
}
|
||||
|
||||
for (; i < buf.length-1; i += 2, j+= 2) {
|
||||
buf2[j] = buf[i+1];
|
||||
buf2[j+1] = buf[i];
|
||||
}
|
||||
|
||||
this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;
|
||||
|
||||
return buf2.slice(0, j).toString('ucs2');
|
||||
}
|
||||
|
||||
Utf16BEDecoder.prototype.end = function() {
|
||||
}
|
||||
|
||||
|
||||
// == UTF-16 codec =============================================================
|
||||
// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.
|
||||
// Defaults to UTF-16LE, as it's prevalent and default in Node.
|
||||
// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le
|
||||
// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});
|
||||
|
||||
// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).
|
||||
|
||||
exports.utf16 = Utf16Codec;
|
||||
function Utf16Codec(codecOptions, iconv) {
|
||||
this.iconv = iconv;
|
||||
}
|
||||
|
||||
Utf16Codec.prototype.encoder = Utf16Encoder;
|
||||
Utf16Codec.prototype.decoder = Utf16Decoder;
|
||||
|
||||
|
||||
// -- Encoding (pass-through)
|
||||
|
||||
function Utf16Encoder(options, codec) {
|
||||
options = options || {};
|
||||
if (options.addBOM === undefined)
|
||||
options.addBOM = true;
|
||||
this.encoder = codec.iconv.getEncoder('utf-16le', options);
|
||||
}
|
||||
|
||||
Utf16Encoder.prototype.write = function(str) {
|
||||
return this.encoder.write(str);
|
||||
}
|
||||
|
||||
Utf16Encoder.prototype.end = function() {
|
||||
return this.encoder.end();
|
||||
}
|
||||
|
||||
|
||||
// -- Decoding
|
||||
|
||||
function Utf16Decoder(options, codec) {
|
||||
this.decoder = null;
|
||||
this.initialBytes = [];
|
||||
this.initialBytesLen = 0;
|
||||
|
||||
this.options = options || {};
|
||||
this.iconv = codec.iconv;
|
||||
}
|
||||
|
||||
Utf16Decoder.prototype.write = function(buf) {
|
||||
if (!this.decoder) {
|
||||
// Codec is not chosen yet. Accumulate initial bytes.
|
||||
this.initialBytes.push(buf);
|
||||
this.initialBytesLen += buf.length;
|
||||
|
||||
if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)
|
||||
return '';
|
||||
|
||||
// We have enough bytes -> detect endianness.
|
||||
var buf = Buffer.concat(this.initialBytes),
|
||||
encoding = detectEncoding(buf, this.options.defaultEncoding);
|
||||
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
||||
this.initialBytes.length = this.initialBytesLen = 0;
|
||||
}
|
||||
|
||||
return this.decoder.write(buf);
|
||||
}
|
||||
|
||||
Utf16Decoder.prototype.end = function() {
|
||||
if (!this.decoder) {
|
||||
var buf = Buffer.concat(this.initialBytes),
|
||||
encoding = detectEncoding(buf, this.options.defaultEncoding);
|
||||
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
||||
|
||||
var res = this.decoder.write(buf),
|
||||
trail = this.decoder.end();
|
||||
|
||||
return trail ? (res + trail) : res;
|
||||
}
|
||||
return this.decoder.end();
|
||||
}
|
||||
|
||||
function detectEncoding(buf, defaultEncoding) {
|
||||
var enc = defaultEncoding || 'utf-16le';
|
||||
|
||||
if (buf.length >= 2) {
|
||||
// Check BOM.
|
||||
if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM
|
||||
enc = 'utf-16be';
|
||||
else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM
|
||||
enc = 'utf-16le';
|
||||
else {
|
||||
// No BOM found. Try to deduce encoding from initial content.
|
||||
// Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
|
||||
// So, we count ASCII as if it was LE or BE, and decide from that.
|
||||
var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions
|
||||
_len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.
|
||||
|
||||
for (var i = 0; i < _len; i += 2) {
|
||||
if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;
|
||||
if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;
|
||||
}
|
||||
|
||||
if (asciiCharsBE > asciiCharsLE)
|
||||
enc = 'utf-16be';
|
||||
else if (asciiCharsBE < asciiCharsLE)
|
||||
enc = 'utf-16le';
|
||||
}
|
||||
}
|
||||
|
||||
return enc;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copies the values of `source` to `array`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} source The array to copy values from.
|
||||
* @param {Array} [array=[]] The array to copy values to.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function copyArray(source, array) {
|
||||
var index = -1,
|
||||
length = source.length;
|
||||
|
||||
array || (array = Array(length));
|
||||
while (++index < length) {
|
||||
array[index] = source[index];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = copyArray;
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, is = require("./is");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
if (is(value)) return value;
|
||||
return resolveException(value, "%v is not a promise", arguments[1]);
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = extend
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function extend() {
|
||||
var target = {}
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var source = arguments[i]
|
||||
|
||||
for (var key in source) {
|
||||
if (hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
# socks examples
|
||||
|
||||
## Example for SOCKS 'connect' command
|
||||
|
||||
The connect command is the most common use-case for a SOCKS proxy. This establishes a direct connection to a destination host through a proxy server. The destination host only has knowledge of the proxy server connecting to it and does not know about the origin client (you).
|
||||
|
||||
**Origin Client (you) <-> Proxy Server <-> Destination Server**
|
||||
|
||||
In this example, we are connecting to a web server on port 80, and sending a very basic HTTP request to receive a response. It's worth noting that there are many socks-http-agents that can be used with the node http module (and libraries such as request.js) to make this easier. This HTTP request is used as a simple example.
|
||||
|
||||
The 'connect' command can be used via the SocksClient.createConnection() factory function as well as by creating a SocksClient instance and using event handlers.
|
||||
|
||||
### Using createConnection with async/await
|
||||
|
||||
Since SocksClient.createConnection returns a Promise, we can easily use async/await for flow control.
|
||||
|
||||
```typescript
|
||||
const SocksClient = require('socks').SocksClient;
|
||||
|
||||
const options = {
|
||||
proxy: {
|
||||
host: '104.131.124.203',
|
||||
port: 1081,
|
||||
type: 5
|
||||
},
|
||||
|
||||
destination: {
|
||||
host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5.
|
||||
port: 80
|
||||
},
|
||||
|
||||
command: 'connect'
|
||||
};
|
||||
|
||||
async function start() {
|
||||
try {
|
||||
const info = await SocksClient.createConnection(options);
|
||||
|
||||
console.log(info.socket);
|
||||
// <Socket ...> (this is a raw net.Socket that is established to the destination host through the given proxy servers)
|
||||
|
||||
info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n');
|
||||
info.socket.on('data', (data) => {
|
||||
console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you).
|
||||
/*
|
||||
HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Content-Type: application/json; charset=utf-8
|
||||
Date: Sun, 24 Dec 2017 03:47:51 GMT
|
||||
Content-Length: 300
|
||||
|
||||
{
|
||||
"as":"AS14061 Digital Ocean, Inc.",
|
||||
"city":"Clifton",
|
||||
"country":"United States",
|
||||
"countryCode":"US",
|
||||
"isp":"Digital Ocean",
|
||||
"lat":40.8326,
|
||||
"lon":-74.1307,
|
||||
"org":"Digital Ocean",
|
||||
"query":"104.131.124.203",
|
||||
"region":"NJ",
|
||||
"regionName":"New Jersey",
|
||||
"status":"success",
|
||||
"timezone":"America/New_York",
|
||||
"zip":"07014"
|
||||
}
|
||||
*/
|
||||
} catch (err) {
|
||||
// Handle errors
|
||||
}
|
||||
}
|
||||
|
||||
start();
|
||||
```
|
||||
|
||||
### Using createConnection with Promises
|
||||
|
||||
```typescript
|
||||
const SocksClient = require('socks').SocksClient;
|
||||
|
||||
const options = {
|
||||
proxy: {
|
||||
ipaddress: '104.131.124.203',
|
||||
port: 1081,
|
||||
type: 5
|
||||
},
|
||||
|
||||
destination: {
|
||||
host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5.
|
||||
port: 80
|
||||
},
|
||||
|
||||
command: 'connect'
|
||||
};
|
||||
|
||||
SocksClient.createConnection(options)
|
||||
.then(info => {
|
||||
console.log(info.socket);
|
||||
// <Socket ...> (this is a raw net.Socket that is established to the destination host through the given proxy servers)
|
||||
|
||||
info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n');
|
||||
info.socket.on('data', (data) => {
|
||||
console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you).
|
||||
/*
|
||||
HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Content-Type: application/json; charset=utf-8
|
||||
Date: Sun, 24 Dec 2017 03:47:51 GMT
|
||||
Content-Length: 300
|
||||
|
||||
{
|
||||
"as":"AS14061 Digital Ocean, Inc.",
|
||||
"city":"Clifton",
|
||||
"country":"United States",
|
||||
"countryCode":"US",
|
||||
"isp":"Digital Ocean",
|
||||
"lat":40.8326,
|
||||
"lon":-74.1307,
|
||||
"org":"Digital Ocean",
|
||||
"query":"104.131.124.203",
|
||||
"region":"NJ",
|
||||
"regionName":"New Jersey",
|
||||
"status":"success",
|
||||
"timezone":"America/New_York",
|
||||
"zip":"07014"
|
||||
}
|
||||
*/
|
||||
})
|
||||
.catch(err => {
|
||||
// handle errors
|
||||
});
|
||||
```
|
||||
|
||||
### Using createConnection with callbacks
|
||||
|
||||
SocksClient.createConnection() optionally accepts a callback function as a second parameter.
|
||||
|
||||
**Note:** If a callback function is provided, a Promise is still returned from the function, but the promise will always resolve regardless of if there was en error. (tldr: Do not mix callbacks and Promises).
|
||||
|
||||
```typescript
|
||||
const SocksClient = require('socks').SocksClient;
|
||||
|
||||
const options = {
|
||||
proxy: {
|
||||
ipaddress: '104.131.124.203',
|
||||
port: 1081,
|
||||
type: 5
|
||||
},
|
||||
|
||||
destination: {
|
||||
host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5.
|
||||
port: 80
|
||||
},
|
||||
|
||||
command: 'connect'
|
||||
};
|
||||
|
||||
SocksClient.createConnection(options, (err, info) => {
|
||||
if (err) {
|
||||
// handle errors
|
||||
} else {
|
||||
console.log(info.socket);
|
||||
// <Socket ...> (this is a raw net.Socket that is established to the destination host through the given proxy servers)
|
||||
|
||||
info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n');
|
||||
info.socket.on('data', (data) => {
|
||||
console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you).
|
||||
/*
|
||||
HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Content-Type: application/json; charset=utf-8
|
||||
Date: Sun, 24 Dec 2017 03:47:51 GMT
|
||||
Content-Length: 300
|
||||
|
||||
{
|
||||
"as":"AS14061 Digital Ocean, Inc.",
|
||||
"city":"Clifton",
|
||||
"country":"United States",
|
||||
"countryCode":"US",
|
||||
"isp":"Digital Ocean",
|
||||
"lat":40.8326,
|
||||
"lon":-74.1307,
|
||||
"org":"Digital Ocean",
|
||||
"query":"104.131.124.203",
|
||||
"region":"NJ",
|
||||
"regionName":"New Jersey",
|
||||
"status":"success",
|
||||
"timezone":"America/New_York",
|
||||
"zip":"07014"
|
||||
}
|
||||
*/
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Using event handlers
|
||||
|
||||
SocksClient also supports instance creation of a SocksClient. This allows for event based flow control.
|
||||
|
||||
```typescript
|
||||
const SocksClient = require('socks').SocksClient;
|
||||
|
||||
const options = {
|
||||
proxy: {
|
||||
ipaddress: '104.131.124.203',
|
||||
port: 1081,
|
||||
type: 5
|
||||
},
|
||||
|
||||
destination: {
|
||||
host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5.
|
||||
port: 80
|
||||
},
|
||||
|
||||
command: 'connect'
|
||||
};
|
||||
|
||||
const client = new SocksClient(options);
|
||||
|
||||
client.on('established', (info) => {
|
||||
console.log(info.socket);
|
||||
// <Socket ...> (this is a raw net.Socket that is established to the destination host through the given proxy servers)
|
||||
|
||||
info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n');
|
||||
info.socket.on('data', (data) => {
|
||||
console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you).
|
||||
/*
|
||||
HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Content-Type: application/json; charset=utf-8
|
||||
Date: Sun, 24 Dec 2017 03:47:51 GMT
|
||||
Content-Length: 300
|
||||
|
||||
{
|
||||
"as":"AS14061 Digital Ocean, Inc.",
|
||||
"city":"Clifton",
|
||||
"country":"United States",
|
||||
"countryCode":"US",
|
||||
"isp":"Digital Ocean",
|
||||
"lat":40.8326,
|
||||
"lon":-74.1307,
|
||||
"org":"Digital Ocean",
|
||||
"query":"104.131.124.203",
|
||||
"region":"NJ",
|
||||
"regionName":"New Jersey",
|
||||
"status":"success",
|
||||
"timezone":"America/New_York",
|
||||
"zip":"07014"
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
// Failed to establish proxy connection to destination.
|
||||
client.on('error', () => {
|
||||
// Handle errors
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "dlv",
|
||||
"version": "1.1.3",
|
||||
"description": "Safely get a dot-notated property within an object.",
|
||||
"main": "dist/dlv.js",
|
||||
"browser": "dist/dlv.umd.js",
|
||||
"module": "dist/dlv.es.js",
|
||||
"scripts": {
|
||||
"dev": "microbundle watch",
|
||||
"build": "microbundle",
|
||||
"prepublish": "npm run build",
|
||||
"test": "node test",
|
||||
"release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
|
||||
},
|
||||
"keywords": [
|
||||
"delve",
|
||||
"dot notation",
|
||||
"dot"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
|
||||
"repository": "developit/dlv",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"microbundle": "^0.11.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
var iteratorSymbol = require("es6-symbol").iterator
|
||||
, Iterator = require("../");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var obj;
|
||||
a.throws(function () {
|
||||
t();
|
||||
}, TypeError, "Undefined");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, TypeError, "Plain object");
|
||||
a.throws(function () {
|
||||
t({ length: 0 });
|
||||
}, TypeError, "Array-like");
|
||||
obj = {};
|
||||
obj[iteratorSymbol] = function () {
|
||||
return new Iterator([]);
|
||||
};
|
||||
a(t(obj), obj, "Iterator");
|
||||
obj = [];
|
||||
a(t(obj), obj, "Array");
|
||||
obj = (function () {
|
||||
return arguments;
|
||||
}());
|
||||
a(t(obj), obj, "Arguments");
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
import { __assign } from "tslib";
|
||||
import { ErrorKind } from './error';
|
||||
import { Parser } from './parser';
|
||||
import { isDateElement, isDateTimeSkeleton, isNumberElement, isNumberSkeleton, isPluralElement, isSelectElement, isTagElement, isTimeElement, } from './types';
|
||||
function pruneLocation(els) {
|
||||
els.forEach(function (el) {
|
||||
delete el.location;
|
||||
if (isSelectElement(el) || isPluralElement(el)) {
|
||||
for (var k in el.options) {
|
||||
delete el.options[k].location;
|
||||
pruneLocation(el.options[k].value);
|
||||
}
|
||||
}
|
||||
else if (isNumberElement(el) && isNumberSkeleton(el.style)) {
|
||||
delete el.style.location;
|
||||
}
|
||||
else if ((isDateElement(el) || isTimeElement(el)) &&
|
||||
isDateTimeSkeleton(el.style)) {
|
||||
delete el.style.location;
|
||||
}
|
||||
else if (isTagElement(el)) {
|
||||
pruneLocation(el.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
export function parse(message, opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
|
||||
var result = new Parser(message, opts).parse();
|
||||
if (result.err) {
|
||||
var error = SyntaxError(ErrorKind[result.err.kind]);
|
||||
// @ts-expect-error Assign to error object
|
||||
error.location = result.err.location;
|
||||
// @ts-expect-error Assign to error object
|
||||
error.originalMessage = result.err.message;
|
||||
throw error;
|
||||
}
|
||||
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
|
||||
pruneLocation(result.val);
|
||||
}
|
||||
return result.val;
|
||||
}
|
||||
export * from './types';
|
||||
@@ -0,0 +1,9 @@
|
||||
import { BehaviorSubject } from '../BehaviorSubject';
|
||||
import { ConnectableObservable } from '../observable/ConnectableObservable';
|
||||
export function publishBehavior(initialValue) {
|
||||
return (source) => {
|
||||
const subject = new BehaviorSubject(initialValue);
|
||||
return new ConnectableObservable(source, () => subject);
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=publishBehavior.js.map
|
||||
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* The `diagnostics_channel` module provides an API to create named channels
|
||||
* to report arbitrary message data for diagnostics purposes.
|
||||
*
|
||||
* It can be accessed using:
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
* ```
|
||||
*
|
||||
* It is intended that a module writer wanting to report diagnostics messages
|
||||
* will create one or many top-level channels to report messages through.
|
||||
* Channels may also be acquired at runtime but it is not encouraged
|
||||
* due to the additional overhead of doing so. Channels may be exported for
|
||||
* convenience, but as long as the name is known it can be acquired anywhere.
|
||||
*
|
||||
* If you intend for your module to produce diagnostics data for others to
|
||||
* consume it is recommended that you include documentation of what named
|
||||
* channels are used along with the shape of the message data. Channel names
|
||||
* should generally include the module name to avoid collisions with data from
|
||||
* other modules.
|
||||
* @experimental
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
|
||||
*/
|
||||
declare module 'diagnostics_channel' {
|
||||
/**
|
||||
* Check if there are active subscribers to the named channel. This is helpful if
|
||||
* the message you want to send might be expensive to prepare.
|
||||
*
|
||||
* This API is optional but helpful when trying to publish messages from very
|
||||
* performance-sensitive code.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* if (diagnostics_channel.hasSubscribers('my-channel')) {
|
||||
* // There are subscribers, prepare and publish message
|
||||
* }
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
* @param name The channel name
|
||||
* @return If there are active subscribers
|
||||
*/
|
||||
function hasSubscribers(name: string | symbol): boolean;
|
||||
/**
|
||||
* This is the primary entry-point for anyone wanting to interact with a named
|
||||
* channel. It produces a channel object which is optimized to reduce overhead at
|
||||
* publish time as much as possible.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* const channel = diagnostics_channel.channel('my-channel');
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
* @param name The channel name
|
||||
* @return The named channel object
|
||||
*/
|
||||
function channel(name: string | symbol): Channel;
|
||||
type ChannelListener = (message: unknown, name: string | symbol) => void;
|
||||
/**
|
||||
* The class `Channel` represents an individual named channel within the data
|
||||
* pipeline. It is use to track subscribers and to publish messages when there
|
||||
* are subscribers present. It exists as a separate object to avoid channel
|
||||
* lookups at publish time, enabling very fast publish speeds and allowing
|
||||
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
|
||||
* with `new Channel(name)` is not supported.
|
||||
* @since v15.1.0, v14.17.0
|
||||
*/
|
||||
class Channel {
|
||||
readonly name: string | symbol;
|
||||
/**
|
||||
* Check if there are active subscribers to this channel. This is helpful if
|
||||
* the message you want to send might be expensive to prepare.
|
||||
*
|
||||
* This API is optional but helpful when trying to publish messages from very
|
||||
* performance-sensitive code.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* const channel = diagnostics_channel.channel('my-channel');
|
||||
*
|
||||
* if (channel.hasSubscribers) {
|
||||
* // There are subscribers, prepare and publish message
|
||||
* }
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
*/
|
||||
readonly hasSubscribers: boolean;
|
||||
private constructor(name: string | symbol);
|
||||
/**
|
||||
* Publish a message to any subscribers to the channel. This will
|
||||
* trigger message handlers synchronously so they will execute within
|
||||
* the same context.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* const channel = diagnostics_channel.channel('my-channel');
|
||||
*
|
||||
* channel.publish({
|
||||
* some: 'message'
|
||||
* });
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
* @param message The message to send to the channel subscribers
|
||||
*/
|
||||
publish(message: unknown): void;
|
||||
/**
|
||||
* Register a message handler to subscribe to this channel. This message handler
|
||||
* will be run synchronously whenever a message is published to the channel. Any
|
||||
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* const channel = diagnostics_channel.channel('my-channel');
|
||||
*
|
||||
* channel.subscribe((message, name) => {
|
||||
* // Received data
|
||||
* });
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
* @param onMessage The handler to receive channel messages
|
||||
*/
|
||||
subscribe(onMessage: ChannelListener): void;
|
||||
/**
|
||||
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
|
||||
*
|
||||
* ```js
|
||||
* import diagnostics_channel from 'diagnostics_channel';
|
||||
*
|
||||
* const channel = diagnostics_channel.channel('my-channel');
|
||||
*
|
||||
* function onMessage(message, name) {
|
||||
* // Received data
|
||||
* }
|
||||
*
|
||||
* channel.subscribe(onMessage);
|
||||
*
|
||||
* channel.unsubscribe(onMessage);
|
||||
* ```
|
||||
* @since v15.1.0, v14.17.0
|
||||
* @param onMessage The previous subscribed handler to remove
|
||||
* @return `true` if the handler was found, `false` otherwise.
|
||||
*/
|
||||
unsubscribe(onMessage: ChannelListener): void;
|
||||
}
|
||||
}
|
||||
declare module 'node:diagnostics_channel' {
|
||||
export * from 'diagnostics_channel';
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/delay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAInE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,GAAE,aAA8B,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAGnH"}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "resolve",
|
||||
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
|
||||
"version": "1.22.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/browserify/resolve.git"
|
||||
},
|
||||
"bin": {
|
||||
"resolve": "./bin/resolve"
|
||||
},
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"resolve",
|
||||
"require",
|
||||
"node",
|
||||
"module"
|
||||
],
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublishOnly": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
||||
"lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'",
|
||||
"pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
|
||||
"tests-only": "tape test/*.js",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "npm run test:multirepo && aud --production",
|
||||
"test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"array.prototype.map": "^1.0.4",
|
||||
"aud": "^2.0.0",
|
||||
"copy-dir": "^1.3.0",
|
||||
"eclint": "^2.8.1",
|
||||
"eslint": "=8.8.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"mkdirp": "^0.5.5",
|
||||
"mv": "^2.1.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"rimraf": "^2.7.1",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"semver": "^6.3.0",
|
||||
"tap": "0.4.13",
|
||||
"tape": "^5.5.3",
|
||||
"tmp": "^0.0.31"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows",
|
||||
"appveyor.yml"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
# globalThis <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][npm-url]
|
||||
|
||||
An ECMAScript spec-compliant polyfill/shim for `globalThis`. Invoke its "shim" method to shim `globalThis` if it is unavailable.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec proposal](https://github.com/tc39/proposal-global).
|
||||
|
||||
Most common usage:
|
||||
```js
|
||||
var globalThis = require('globalthis')(); // returns native globalThis if compliant
|
||||
/* or */
|
||||
var globalThis = require('globalthis/polyfill')(); // returns native globalThis if compliant
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var assert = require('assert');
|
||||
|
||||
// the below function is not CSP-compliant, but reliably gets the
|
||||
// global object in sloppy mode in every engine.
|
||||
var getGlobal = Function('return this');
|
||||
|
||||
assert.equal(globalThis, getGlobal());
|
||||
```
|
||||
|
||||
```js
|
||||
/* when `globalThis` is not present */
|
||||
var shimmedGlobal = require('globalthis').shim();
|
||||
/* or */
|
||||
var shimmedGlobal = require('globalthis/shim')();
|
||||
|
||||
assert.equal(shimmedGlobal, globalThis);
|
||||
assert.equal(shimmedGlobal, getGlobal());
|
||||
```
|
||||
|
||||
```js
|
||||
/* when `globalThis` is present */
|
||||
var shimmedGlobal = require('globalthis').shim();
|
||||
|
||||
assert.equal(shimmedGlobal, globalThis);
|
||||
assert.equal(shimmedGlobal, getGlobal());
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[npm-url]: https://npmjs.org/package/globalthis
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/globalThis.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/globalThis.svg?theme=shields.io
|
||||
[deps-url]: https://david-dm.org/ljharb/globalThis
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/globalThis/dev-status.svg?theme=shields.io
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/globalThis#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/globalthis.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/globalthis.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/globalthis.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=globalthis
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/globalThis/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/globalThis/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/globalThis
|
||||
[actions-url]: https://github.com/es-shims/globalThis/actions
|
||||
@@ -0,0 +1,42 @@
|
||||
var toInteger = require('./toInteger');
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/**
|
||||
* The opposite of `_.before`; this method creates a function that invokes
|
||||
* `func` once it's called `n` or more times.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Function
|
||||
* @param {number} n The number of calls before `func` is invoked.
|
||||
* @param {Function} func The function to restrict.
|
||||
* @returns {Function} Returns the new restricted function.
|
||||
* @example
|
||||
*
|
||||
* var saves = ['profile', 'settings'];
|
||||
*
|
||||
* var done = _.after(saves.length, function() {
|
||||
* console.log('done saving!');
|
||||
* });
|
||||
*
|
||||
* _.forEach(saves, function(type) {
|
||||
* asyncSave({ 'type': type, 'complete': done });
|
||||
* });
|
||||
* // => Logs 'done saving!' after the two async saves have completed.
|
||||
*/
|
||||
function after(n, func) {
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
n = toInteger(n);
|
||||
return function() {
|
||||
if (--n < 1) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = after;
|
||||
@@ -0,0 +1,21 @@
|
||||
var isSymbol = require('./isSymbol');
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var INFINITY = 1 / 0;
|
||||
|
||||
/**
|
||||
* Converts `value` to a string key if it's not a string or symbol.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {string|symbol} Returns the key.
|
||||
*/
|
||||
function toKey(value) {
|
||||
if (typeof value == 'string' || isSymbol(value)) {
|
||||
return value;
|
||||
}
|
||||
var result = (value + '');
|
||||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||||
}
|
||||
|
||||
module.exports = toKey;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { OperatorFunction, SchedulerLike, ValueFromArray } from '../types';
|
||||
export declare function startWith<T>(value: null): OperatorFunction<T, T | null>;
|
||||
export declare function startWith<T>(value: undefined): OperatorFunction<T, T | undefined>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export declare function startWith<T, A extends readonly unknown[] = T[]>(...valuesAndScheduler: [...A, SchedulerLike]): OperatorFunction<T, T | ValueFromArray<A>>;
|
||||
export declare function startWith<T, A extends readonly unknown[] = T[]>(...values: A): OperatorFunction<T, T | ValueFromArray<A>>;
|
||||
//# sourceMappingURL=startWith.d.ts.map
|
||||
@@ -0,0 +1,4 @@
|
||||
export type RunnerGroupNeededError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL, tryConvertToPromise,
|
||||
apiRejection, Proxyable) {
|
||||
var util = require("./util");
|
||||
var isArray = util.isArray;
|
||||
|
||||
function toResolutionValue(val) {
|
||||
switch(val) {
|
||||
case -2: return [];
|
||||
case -3: return {};
|
||||
case -6: return new Map();
|
||||
}
|
||||
}
|
||||
|
||||
function PromiseArray(values) {
|
||||
var promise = this._promise = new Promise(INTERNAL);
|
||||
if (values instanceof Promise) {
|
||||
promise._propagateFrom(values, 3);
|
||||
values.suppressUnhandledRejections();
|
||||
}
|
||||
promise._setOnCancel(this);
|
||||
this._values = values;
|
||||
this._length = 0;
|
||||
this._totalResolved = 0;
|
||||
this._init(undefined, -2);
|
||||
}
|
||||
util.inherits(PromiseArray, Proxyable);
|
||||
|
||||
PromiseArray.prototype.length = function () {
|
||||
return this._length;
|
||||
};
|
||||
|
||||
PromiseArray.prototype.promise = function () {
|
||||
return this._promise;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
|
||||
var values = tryConvertToPromise(this._values, this._promise);
|
||||
if (values instanceof Promise) {
|
||||
values = values._target();
|
||||
var bitField = values._bitField;
|
||||
;
|
||||
this._values = values;
|
||||
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
this._promise._setAsyncGuaranteed();
|
||||
return values._then(
|
||||
init,
|
||||
this._reject,
|
||||
undefined,
|
||||
this,
|
||||
resolveValueIfEmpty
|
||||
);
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
values = values._value();
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
return this._reject(values._reason());
|
||||
} else {
|
||||
return this._cancel();
|
||||
}
|
||||
}
|
||||
values = util.asArray(values);
|
||||
if (values === null) {
|
||||
var err = apiRejection(
|
||||
"expecting an array or an iterable object but got " + util.classString(values)).reason();
|
||||
this._promise._rejectCallback(err, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (values.length === 0) {
|
||||
if (resolveValueIfEmpty === -5) {
|
||||
this._resolveEmptyArray();
|
||||
}
|
||||
else {
|
||||
this._resolve(toResolutionValue(resolveValueIfEmpty));
|
||||
}
|
||||
return;
|
||||
}
|
||||
this._iterate(values);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._iterate = function(values) {
|
||||
var len = this.getActualLength(values.length);
|
||||
this._length = len;
|
||||
this._values = this.shouldCopyValues() ? new Array(len) : this._values;
|
||||
var result = this._promise;
|
||||
var isResolved = false;
|
||||
var bitField = null;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var maybePromise = tryConvertToPromise(values[i], result);
|
||||
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise = maybePromise._target();
|
||||
bitField = maybePromise._bitField;
|
||||
} else {
|
||||
bitField = null;
|
||||
}
|
||||
|
||||
if (isResolved) {
|
||||
if (bitField !== null) {
|
||||
maybePromise.suppressUnhandledRejections();
|
||||
}
|
||||
} else if (bitField !== null) {
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
maybePromise._proxy(this, i);
|
||||
this._values[i] = maybePromise;
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
isResolved = this._promiseFulfilled(maybePromise._value(), i);
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
isResolved = this._promiseRejected(maybePromise._reason(), i);
|
||||
} else {
|
||||
isResolved = this._promiseCancelled(i);
|
||||
}
|
||||
} else {
|
||||
isResolved = this._promiseFulfilled(maybePromise, i);
|
||||
}
|
||||
}
|
||||
if (!isResolved) result._setAsyncGuaranteed();
|
||||
};
|
||||
|
||||
PromiseArray.prototype._isResolved = function () {
|
||||
return this._values === null;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._resolve = function (value) {
|
||||
this._values = null;
|
||||
this._promise._fulfill(value);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._cancel = function() {
|
||||
if (this._isResolved() || !this._promise._isCancellable()) return;
|
||||
this._values = null;
|
||||
this._promise._cancel();
|
||||
};
|
||||
|
||||
PromiseArray.prototype._reject = function (reason) {
|
||||
this._values = null;
|
||||
this._promise._rejectCallback(reason, false);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||
this._values[index] = value;
|
||||
var totalResolved = ++this._totalResolved;
|
||||
if (totalResolved >= this._length) {
|
||||
this._resolve(this._values);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseCancelled = function() {
|
||||
this._cancel();
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseRejected = function (reason) {
|
||||
this._totalResolved++;
|
||||
this._reject(reason);
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._resultCancelled = function() {
|
||||
if (this._isResolved()) return;
|
||||
var values = this._values;
|
||||
this._cancel();
|
||||
if (values instanceof Promise) {
|
||||
values.cancel();
|
||||
} else {
|
||||
for (var i = 0; i < values.length; ++i) {
|
||||
if (values[i] instanceof Promise) {
|
||||
values[i].cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PromiseArray.prototype.shouldCopyValues = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype.getActualLength = function (len) {
|
||||
return len;
|
||||
};
|
||||
|
||||
return PromiseArray;
|
||||
};
|
||||
@@ -0,0 +1,161 @@
|
||||
# Container File Blobs
|
||||
|
||||
Pure JS implementation of various container file formats, including ZIP and CFB.
|
||||
|
||||
[](https://travis-ci.org/SheetJS/js-cfb)
|
||||
[](https://coveralls.io/r/SheetJS/js-cfb?branch=master)
|
||||
[](https://david-dm.org/sheetjs/js-cfb)
|
||||
[](https://npmjs.org/package/cfb)
|
||||
[](https://github.com/SheetJS/js-cfb)
|
||||
|
||||
## Installation
|
||||
|
||||
In the browser:
|
||||
|
||||
```html
|
||||
<script src="dist/cfb.min.js" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
With [npm](https://www.npmjs.org/package/cfb):
|
||||
|
||||
```bash
|
||||
$ npm install cfb
|
||||
```
|
||||
|
||||
The `xlscfb.js` file is designed to be embedded in [js-xlsx](http://git.io/xlsx)
|
||||
|
||||
|
||||
## Library Usage
|
||||
|
||||
In node:
|
||||
|
||||
```js
|
||||
var CFB = require('cfb');
|
||||
```
|
||||
|
||||
For example, to get the Workbook content from an Excel 2003 XLS file:
|
||||
|
||||
```js
|
||||
var cfb = CFB.read(filename, {type: 'file'});
|
||||
var workbook = CFB.find(cfb, 'Workbook');
|
||||
var data = workbook.content;
|
||||
```
|
||||
|
||||
|
||||
## Command-Line Utility Usage
|
||||
|
||||
The [`cfb-cli`](https://www.npmjs.com/package/cfb-cli) module ships with a CLI
|
||||
tool for manipulating and inspecting supported files.
|
||||
|
||||
|
||||
## JS API
|
||||
|
||||
TypeScript definitions are maintained in `types/index.d.ts`.
|
||||
|
||||
The CFB object exposes the following methods and properties:
|
||||
|
||||
`CFB.parse(blob)` takes a nodejs Buffer or an array of bytes and returns an
|
||||
parsed representation of the data.
|
||||
|
||||
`CFB.read(blob, opts)` wraps `parse`.
|
||||
|
||||
`CFB.find(cfb, path)` performs a case-insensitive match for the path (or file
|
||||
name, if there are no slashes) and returns an entry object or null if not found.
|
||||
|
||||
`CFB.write(cfb, opts)` generates a file based on the container.
|
||||
|
||||
`CFB.writeFile(cfb, filename, opts)` creates a file with the specified name.
|
||||
|
||||
### Parse Options
|
||||
|
||||
`CFB.read` takes an options argument. `opts.type` controls the behavior:
|
||||
|
||||
| `type` | expected input |
|
||||
|------------|:----------------------------------------------------------------|
|
||||
| `"base64"` | string: Base64 encoding of the file |
|
||||
| `"binary"` | string: binary string (byte `n` is `data.charCodeAt(n)`) |
|
||||
| `"buffer"` | nodejs Buffer |
|
||||
| `"file"` | string: path of file that will be read (nodejs only) |
|
||||
| (default) | buffer or array of 8-bit unsigned int (byte `n` is `data[n]`) |
|
||||
|
||||
|
||||
### Write Options
|
||||
|
||||
`CFB.write` and `CFB.writeFile` take options argument.
|
||||
|
||||
`opts.type` controls the behavior:
|
||||
|
||||
| `type` | output |
|
||||
|------------|:----------------------------------------------------------------|
|
||||
| `"base64"` | string: Base64 encoding of the file |
|
||||
| `"binary"` | string: binary string (byte `n` is `data.charCodeAt(n)`) |
|
||||
| `"buffer"` | nodejs Buffer |
|
||||
| `"file"` | string: path of file that will be created (nodejs only) |
|
||||
| (default) | buffer if available, array of 8-bit unsigned int otherwise |
|
||||
|
||||
`opts.fileType` controls the output file type:
|
||||
|
||||
| `fileType` | output |
|
||||
|:-------------------|:------------------------|
|
||||
| `'cfb'` (default) | CFB container |
|
||||
| `'zip'` | ZIP file |
|
||||
| `'mad'` | MIME aggregate document |
|
||||
|
||||
`opts.compression` enables DEFLATE compression for ZIP file type.
|
||||
|
||||
|
||||
## Utility Functions
|
||||
|
||||
The utility functions are available in the `CFB.utils` object. Functions that
|
||||
accept a `name` argument strictly deal with absolute file names:
|
||||
|
||||
- `.cfb_new(?opts)` creates a new container object.
|
||||
- `.cfb_add(cfb, name, ?content, ?opts)` adds a new file to the `cfb`.
|
||||
Set the option `{unsafe:true}` to skip existence checks (for bulk additions)
|
||||
- `.cfb_del(cfb, name)` deletes the specified file
|
||||
- `.cfb_mov(cfb, old_name, new_name)` moves the old file to new path and name
|
||||
- `.use_zlib(require("zlib"))` loads a nodejs `zlib` instance.
|
||||
|
||||
By default, the library uses a pure JS inflate/deflate implementation. NodeJS
|
||||
`zlib.InflateRaw` exposes the number of bytes read in versions after `8.11.0`.
|
||||
If a supplied `zlib` does not support the required features, a warning will be
|
||||
displayed in the console and the pure JS fallback will be used.
|
||||
|
||||
|
||||
## Container Object Description
|
||||
|
||||
The objects returned by `parse` and `read` have the following properties:
|
||||
|
||||
- `.FullPaths` is an array of the names of all of the streams (files) and
|
||||
storages (directories) in the container. The paths are properly prefixed from
|
||||
the root entry (so the entries are unique)
|
||||
|
||||
- `.FileIndex` is an array, in the same order as `.FullPaths`, whose values are
|
||||
objects following the schema:
|
||||
|
||||
```typescript
|
||||
interface CFBEntry {
|
||||
name: string; /** Case-sensitive internal name */
|
||||
type: number; /** 1 = dir, 2 = file, 5 = root ; see [MS-CFB] 2.6.1 */
|
||||
content: Buffer | number[] | Uint8Array; /** Raw Content */
|
||||
ct?: Date; /** Creation Time */
|
||||
mt?: Date; /** Modification Time */
|
||||
ctype?: String; /** Content-Type (for MAD) */
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Please consult the attached LICENSE file for details. All rights not explicitly
|
||||
granted by the Apache 2.0 License are reserved by the Original Author.
|
||||
|
||||
|
||||
## References
|
||||
|
||||
- `MS-CFB`: Compound File Binary File Format
|
||||
- ZIP `APPNOTE.TXT`: .ZIP File Format Specification
|
||||
- RFC1951: https://www.ietf.org/rfc/rfc1951.txt
|
||||
- RFC2045: https://www.ietf.org/rfc/rfc2045.txt
|
||||
- RFC2557: https://www.ietf.org/rfc/rfc2557.txt
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "he",
|
||||
"version": "1.2.0",
|
||||
"description": "A robust HTML entities encoder/decoder with full Unicode support.",
|
||||
"homepage": "https://mths.be/he",
|
||||
"main": "he.js",
|
||||
"bin": "bin/he",
|
||||
"keywords": [
|
||||
"string",
|
||||
"entities",
|
||||
"entity",
|
||||
"html",
|
||||
"encode",
|
||||
"decode",
|
||||
"unicode"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/he.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/he/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"he.js",
|
||||
"bin/",
|
||||
"man/"
|
||||
],
|
||||
"directories": {
|
||||
"bin": "bin",
|
||||
"man": "man",
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node tests/tests.js",
|
||||
"build": "grunt build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codecov.io": "^0.1.6",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^1.3.1",
|
||||
"grunt-shell": "^1.1.1",
|
||||
"grunt-template": "^0.2.3",
|
||||
"istanbul": "^0.4.2",
|
||||
"jsesc": "^1.0.0",
|
||||
"lodash": "^4.8.2",
|
||||
"qunit-extras": "^1.4.5",
|
||||
"qunitjs": "~1.11.0",
|
||||
"regenerate": "^1.2.1",
|
||||
"regexgen": "^1.3.0",
|
||||
"requirejs": "^2.1.22",
|
||||
"sort-object": "^3.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"toArray.js","sourceRoot":"","sources":["../../../../src/internal/operators/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,IAAM,UAAU,GAAG,UAAC,GAAU,EAAE,KAAU,IAAK,OAAA,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAtB,CAAsB,CAAC;AAgCtE,MAAM,UAAU,OAAO;IAIrB,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,MAAM,CAAC,UAAU,EAAE,EAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"string-width","version":"5.1.2","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"package.json":{"checkedAt":1678883671306,"integrity":"sha512-N76ToAj5ZM/dTJJAHoqbgVzlG2tcjHEeD7yrwRkjXR81KibJ0DxCA++C5pbChgZ2JHTf1e/JYOa23xr9R0ZXKQ==","mode":420,"size":1044},"readme.md":{"checkedAt":1678883671306,"integrity":"sha512-7FjjwrJBkYWuq1w8b6gQ38ViUBfxr/pUvf18lZyrKghmlQGCjV6KSnDl0Cal8833CJ6Qnba8yc7vMKcvIzSpLQ==","mode":420,"size":1733},"index.js":{"checkedAt":1678883671306,"integrity":"sha512-JYh4AJ4bvKfj+Ros7YxTHdRrqxncJqOeDIwAzqkv7aVmPi1lLzoh7th1k9L4h/Fvu3pqrAvz6RooQ+EC9ZIwWQ==","mode":420,"size":1064},"index.d.ts":{"checkedAt":1678883671306,"integrity":"sha512-M+JD1eYLBlBcSkiqp+qkcGyutVUB6fJxT+g5I4x6KE20nyAVKo6iLG30XkwRaCM1/WjOjE+5jqjm5ZBaAdg9Ag==","mode":420,"size":823}}}
|
||||
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isISIN;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; // this link details how the check digit is calculated:
|
||||
// https://www.isin.org/isin-format/. it is a little bit
|
||||
// odd in that it works with digits, not numbers. in order
|
||||
// to make only one pass through the ISIN characters, the
|
||||
// each alpha character is handled as 2 characters within
|
||||
// the loop.
|
||||
|
||||
function isISIN(str) {
|
||||
(0, _assertString.default)(str);
|
||||
|
||||
if (!isin.test(str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var double = true;
|
||||
var sum = 0; // convert values
|
||||
|
||||
for (var i = str.length - 2; i >= 0; i--) {
|
||||
if (str[i] >= 'A' && str[i] <= 'Z') {
|
||||
var value = str[i].charCodeAt(0) - 55;
|
||||
var lo = value % 10;
|
||||
var hi = Math.trunc(value / 10); // letters have two digits, so handle the low order
|
||||
// and high order digits separately.
|
||||
|
||||
for (var _i = 0, _arr = [lo, hi]; _i < _arr.length; _i++) {
|
||||
var digit = _arr[_i];
|
||||
|
||||
if (double) {
|
||||
if (digit >= 5) {
|
||||
sum += 1 + (digit - 5) * 2;
|
||||
} else {
|
||||
sum += digit * 2;
|
||||
}
|
||||
} else {
|
||||
sum += digit;
|
||||
}
|
||||
|
||||
double = !double;
|
||||
}
|
||||
} else {
|
||||
var _digit = str[i].charCodeAt(0) - '0'.charCodeAt(0);
|
||||
|
||||
if (double) {
|
||||
if (_digit >= 5) {
|
||||
sum += 1 + (_digit - 5) * 2;
|
||||
} else {
|
||||
sum += _digit * 2;
|
||||
}
|
||||
} else {
|
||||
sum += _digit;
|
||||
}
|
||||
|
||||
double = !double;
|
||||
}
|
||||
}
|
||||
|
||||
var check = Math.trunc((sum + 9) / 10) * 10 - sum;
|
||||
return +str[str.length - 1] === check;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, resolveErrorMessage = require("../lib/resolve-error-message")
|
||||
, toShortString = require("../lib/to-short-string")
|
||||
, ensurePlainFunction = require("../plain-function/ensure")
|
||||
, is = require("./is");
|
||||
|
||||
var objHasOwnProperty = Object.prototype.hasOwnProperty, invalidItemsLimit = 3;
|
||||
|
||||
module.exports = function (value /*, options*/) {
|
||||
var options = arguments[1];
|
||||
var mainErrorMessage =
|
||||
options && options.name ? "Expected an array for %n, received %v" : "%v is not an array";
|
||||
if (!is(value)) return resolveException(value, mainErrorMessage, options);
|
||||
if (!options) return value;
|
||||
|
||||
var ensureItem = ensurePlainFunction(options.ensureItem, { isOptional: true });
|
||||
if (ensureItem) {
|
||||
var coercedValue = [], invalidItems;
|
||||
for (var index = 0, length = value.length; index < length; ++index) {
|
||||
if (!objHasOwnProperty.call(value, index)) continue;
|
||||
var coercedItem;
|
||||
try {
|
||||
coercedItem = ensureItem(value[index]);
|
||||
} catch (error) {
|
||||
if (!invalidItems) invalidItems = [];
|
||||
if (invalidItems.push(toShortString(value[index])) === invalidItemsLimit) break;
|
||||
}
|
||||
if (invalidItems) continue;
|
||||
coercedValue[index] = coercedItem;
|
||||
}
|
||||
if (invalidItems) {
|
||||
throw new TypeError(
|
||||
resolveErrorMessage(mainErrorMessage, value, options) +
|
||||
".\n Following items are invalid: " +
|
||||
invalidItems.join(", ")
|
||||
);
|
||||
}
|
||||
return coercedValue;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "inquirer",
|
||||
"type": "module",
|
||||
"version": "9.1.4",
|
||||
"description": "A collection of common interactive command line user interfaces.",
|
||||
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md"
|
||||
],
|
||||
"main": "lib/inquirer.js",
|
||||
"keywords": [
|
||||
"answer",
|
||||
"answers",
|
||||
"ask",
|
||||
"base",
|
||||
"cli",
|
||||
"cli",
|
||||
"command",
|
||||
"command-line",
|
||||
"confirm",
|
||||
"enquirer",
|
||||
"generate",
|
||||
"generator",
|
||||
"hyper",
|
||||
"input",
|
||||
"inquire",
|
||||
"inquirer",
|
||||
"interface",
|
||||
"iterm",
|
||||
"javascript",
|
||||
"menu",
|
||||
"node",
|
||||
"nodejs",
|
||||
"prompt",
|
||||
"promptly",
|
||||
"prompts",
|
||||
"question",
|
||||
"readline",
|
||||
"scaffold",
|
||||
"scaffolder",
|
||||
"scaffolding",
|
||||
"stdin",
|
||||
"stdout",
|
||||
"terminal",
|
||||
"tty",
|
||||
"ui",
|
||||
"yeoman",
|
||||
"yo",
|
||||
"zsh"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"chai-string": "^1.5.0",
|
||||
"chalk-pipe": "^5.1.2",
|
||||
"cmdify": "^0.0.4",
|
||||
"mocha": "^10.1.0",
|
||||
"mockery": "^2.1.0",
|
||||
"nyc": "^15.0.0",
|
||||
"sinon": "^14.0.1",
|
||||
"terminal-link": "^3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nyc mocha --es-module-specifier-resolution=node test/**/* -r ./test/before",
|
||||
"posttest": "mkdir -p ../../coverage/ && nyc report --reporter=text-lcov > ../../coverage/nyc-report.lcov",
|
||||
"prepublishOnly": "cp ../../README.md .",
|
||||
"postpublish": "rm -f README.md"
|
||||
},
|
||||
"repository": "SBoudrias/Inquirer.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-escapes": "^6.0.0",
|
||||
"chalk": "^5.1.2",
|
||||
"cli-cursor": "^4.0.0",
|
||||
"cli-width": "^4.0.0",
|
||||
"external-editor": "^3.0.3",
|
||||
"figures": "^5.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mute-stream": "0.0.8",
|
||||
"ora": "^6.1.2",
|
||||
"run-async": "^2.4.0",
|
||||
"rxjs": "^7.5.7",
|
||||
"string-width": "^5.1.2",
|
||||
"strip-ansi": "^7.0.1",
|
||||
"through": "^2.3.6",
|
||||
"wrap-ansi": "^8.0.1"
|
||||
},
|
||||
"gitHead": "f532af8be2d622caa5e54adf4c084d588c9ffad6"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
var numberIsNaN = require("../../number/is-nan")
|
||||
, toPosInt = require("../../number/to-pos-integer")
|
||||
, value = require("../../object/valid-value")
|
||||
, indexOf = Array.prototype.indexOf
|
||||
, objHasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, abs = Math.abs
|
||||
, floor = Math.floor;
|
||||
|
||||
module.exports = function (searchElement /*, fromIndex*/) {
|
||||
var i, length, fromIndex, val;
|
||||
if (!numberIsNaN(searchElement)) return indexOf.apply(this, arguments);
|
||||
|
||||
length = toPosInt(value(this).length);
|
||||
fromIndex = arguments[1];
|
||||
if (isNaN(fromIndex)) fromIndex = 0;
|
||||
else if (fromIndex >= 0) fromIndex = floor(fromIndex);
|
||||
else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
|
||||
|
||||
for (i = fromIndex; i < length; ++i) {
|
||||
if (objHasOwnProperty.call(this, i)) {
|
||||
val = this[i];
|
||||
if (numberIsNaN(val)) return i; // Jslint: ignore
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors
|
||||
|
||||
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 at
|
||||
|
||||
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.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOlG,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACrI,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACnD,GAAG,qBAAqB,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAC7D,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtC,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACnD,GAAG,mBAAmB,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,GAClE,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtC,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACnD,GAAG,iCAAiC,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GACxF,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1,65 @@
|
||||
var arrayEach = require('./_arrayEach'),
|
||||
baseCreate = require('./_baseCreate'),
|
||||
baseForOwn = require('./_baseForOwn'),
|
||||
baseIteratee = require('./_baseIteratee'),
|
||||
getPrototype = require('./_getPrototype'),
|
||||
isArray = require('./isArray'),
|
||||
isBuffer = require('./isBuffer'),
|
||||
isFunction = require('./isFunction'),
|
||||
isObject = require('./isObject'),
|
||||
isTypedArray = require('./isTypedArray');
|
||||
|
||||
/**
|
||||
* An alternative to `_.reduce`; this method transforms `object` to a new
|
||||
* `accumulator` object which is the result of running each of its own
|
||||
* enumerable string keyed properties thru `iteratee`, with each invocation
|
||||
* potentially mutating the `accumulator` object. If `accumulator` is not
|
||||
* provided, a new object with the same `[[Prototype]]` will be used. The
|
||||
* iteratee is invoked with four arguments: (accumulator, value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 1.3.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||
* @param {*} [accumulator] The custom accumulator value.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
* @example
|
||||
*
|
||||
* _.transform([2, 3, 4], function(result, n) {
|
||||
* result.push(n *= n);
|
||||
* return n % 2 == 0;
|
||||
* }, []);
|
||||
* // => [4, 9]
|
||||
*
|
||||
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
||||
* (result[value] || (result[value] = [])).push(key);
|
||||
* }, {});
|
||||
* // => { '1': ['a', 'c'], '2': ['b'] }
|
||||
*/
|
||||
function transform(object, iteratee, accumulator) {
|
||||
var isArr = isArray(object),
|
||||
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
|
||||
|
||||
iteratee = baseIteratee(iteratee, 4);
|
||||
if (accumulator == null) {
|
||||
var Ctor = object && object.constructor;
|
||||
if (isArrLike) {
|
||||
accumulator = isArr ? new Ctor : [];
|
||||
}
|
||||
else if (isObject(object)) {
|
||||
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
|
||||
}
|
||||
else {
|
||||
accumulator = {};
|
||||
}
|
||||
}
|
||||
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
|
||||
return iteratee(accumulator, value, index, object);
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = transform;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsValidTimeZoneName.d.ts","sourceRoot":"","sources":["../../../../../packages/ecma402-abstract/IsValidTimeZoneName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,MAAM,EACV,EACE,MAAM,EACN,cAAc,GACf,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,GACA,OAAO,CAYT"}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { EventEmitter } from '../../util/eventEmitter';
|
||||
import Dispatcher from '../../util/dispatcher';
|
||||
interface BaseStoreEvents<STATE> {
|
||||
updated: (newState: STATE, prevState?: STATE) => void;
|
||||
}
|
||||
export default abstract class BaseStore<STATE, ACTIONS> extends EventEmitter<
|
||||
BaseStoreEvents<STATE>
|
||||
> {
|
||||
private _state;
|
||||
protected readonly dispatcher: Dispatcher<any>;
|
||||
constructor(dispatcher: Dispatcher<any>);
|
||||
abstract handle<K extends keyof ACTIONS>(type: K, payload: ACTIONS[K]): void;
|
||||
abstract getInitialState(): STATE;
|
||||
private _handle;
|
||||
setState(newState: STATE): void;
|
||||
get state(): STATE;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
const {PassThrough: PassThroughStream} = require('stream');
|
||||
|
||||
module.exports = options => {
|
||||
options = {...options};
|
||||
|
||||
const {array} = options;
|
||||
let {encoding} = options;
|
||||
const isBuffer = encoding === 'buffer';
|
||||
let objectMode = false;
|
||||
|
||||
if (array) {
|
||||
objectMode = !(encoding || isBuffer);
|
||||
} else {
|
||||
encoding = encoding || 'utf8';
|
||||
}
|
||||
|
||||
if (isBuffer) {
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
const stream = new PassThroughStream({objectMode});
|
||||
|
||||
if (encoding) {
|
||||
stream.setEncoding(encoding);
|
||||
}
|
||||
|
||||
let length = 0;
|
||||
const chunks = [];
|
||||
|
||||
stream.on('data', chunk => {
|
||||
chunks.push(chunk);
|
||||
|
||||
if (objectMode) {
|
||||
length = chunks.length;
|
||||
} else {
|
||||
length += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stream.getBufferedValue = () => {
|
||||
if (array) {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
|
||||
};
|
||||
|
||||
stream.getBufferedLength = () => length;
|
||||
|
||||
return stream;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"16":"CC","132":"J D E F A B"},B:{"1":"O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","132":"C K L G M N"},C:{"1":"WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","132":"0 1 2 3 4 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","260":"SB TB UB VB","772":"5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB"},D:{"1":"iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","132":"I v J D E F A B C K L G M N O w g x y z","260":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB","772":"0 1 2 3 4 5 6 7 8 9 AB BB CB DB"},E:{"1":"C K L G rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"I v HC zB","132":"J D E F A IC JC KC LC","260":"B 0B qB"},F:{"1":"XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","16":"F B C PC QC RC SC qB AC TC","132":"rB","260":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB","772":"0 G M N O w g x y z"},G:{"1":"cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB UC BC VC","132":"E WC XC YC ZC aC bC"},H:{"132":"oC"},I:{"1":"f","16":"tB pC qC rC","132":"I sC BC","772":"tC uC"},J:{"132":"D A"},K:{"1":"h","16":"A B C qB AC","132":"rB"},L:{"1":"H"},M:{"1":"H"},N:{"132":"A B"},O:{"1":"vC"},P:{"1":"g 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","260":"I wC xC yC zC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","132":"AD"}},B:6,C:"Date.prototype.toLocaleDateString"};
|
||||
@@ -0,0 +1,85 @@
|
||||
import {
|
||||
Component as PreactComponent,
|
||||
PreactContext,
|
||||
ErrorInfo,
|
||||
VNode as PreactVNode
|
||||
} from '../../src/internal';
|
||||
import { Reducer } from '.';
|
||||
|
||||
export { PreactContext };
|
||||
|
||||
/**
|
||||
* The type of arguments passed to a Hook function. While this type is not
|
||||
* strictly necessary, they are given a type name to make it easier to read
|
||||
* the following types and trace the flow of data.
|
||||
*/
|
||||
export type HookArgs = any;
|
||||
|
||||
/**
|
||||
* The return type of a Hook function. While this type is not
|
||||
* strictly necessary, they are given a type name to make it easier to read
|
||||
* the following types and trace the flow of data.
|
||||
*/
|
||||
export type HookReturnValue = any;
|
||||
|
||||
/** The public function a user invokes to use a Hook */
|
||||
export type Hook = (...args: HookArgs[]) => HookReturnValue;
|
||||
|
||||
// Hook tracking
|
||||
|
||||
export interface ComponentHooks {
|
||||
/** The list of hooks a component uses */
|
||||
_list: HookState[];
|
||||
/** List of Effects to be invoked after the next frame is rendered */
|
||||
_pendingEffects: EffectHookState[];
|
||||
}
|
||||
|
||||
export interface Component extends PreactComponent<any, any> {
|
||||
__hooks?: ComponentHooks;
|
||||
}
|
||||
|
||||
export interface VNode extends PreactVNode {
|
||||
_mask?: [number, number];
|
||||
}
|
||||
|
||||
export type HookState =
|
||||
| EffectHookState
|
||||
| MemoHookState
|
||||
| ReducerHookState
|
||||
| ContextHookState
|
||||
| ErrorBoundaryHookState;
|
||||
|
||||
export type Effect = () => void | Cleanup;
|
||||
export type Cleanup = () => void;
|
||||
|
||||
export interface EffectHookState {
|
||||
_value?: Effect;
|
||||
_args?: any[];
|
||||
_pendingArgs?: any[];
|
||||
_cleanup?: Cleanup | void;
|
||||
}
|
||||
|
||||
export interface MemoHookState {
|
||||
_value?: any;
|
||||
_pendingValue?: any;
|
||||
_args?: any[];
|
||||
_pendingArgs?: any[];
|
||||
_factory?: () => any;
|
||||
}
|
||||
|
||||
export interface ReducerHookState {
|
||||
_nextValue?: any;
|
||||
_value?: any;
|
||||
_component?: Component;
|
||||
_reducer?: Reducer<any, any>;
|
||||
}
|
||||
|
||||
export interface ContextHookState {
|
||||
/** Whether this hooks as subscribed to updates yet */
|
||||
_value?: boolean;
|
||||
_context?: PreactContext;
|
||||
}
|
||||
|
||||
export interface ErrorBoundaryHookState {
|
||||
_value?: (error: any, errorInfo: ErrorInfo) => void;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/9.0/#sec-thissymbolvalue
|
||||
|
||||
module.exports = function thisSymbolValue(value) {
|
||||
if (!$SymbolValueOf) {
|
||||
throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object');
|
||||
}
|
||||
if (Type(value) === 'Symbol') {
|
||||
return value;
|
||||
}
|
||||
return $SymbolValueOf(value);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BestAvailableLocale.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-localematcher/abstract/BestAvailableLocale.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,MAAM,EAAE,MAAM,sBAgBf"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"intervalProvider.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/intervalProvider.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IAGhD,WAAW,CAAC,OAAmB,EAAE,OAAgB,EAAE,GAAG,IAAI;QACxD,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;QACtC,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,EAAE;YACzB,OAAO,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;SACxD;QACD,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAChD,CAAC;IACD,aAAa,CAAC,MAAM;QAClB,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;QACtC,OAAO,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,KAAI,aAAa,CAAC,CAAC,MAAa,CAAC,CAAC;IACnE,CAAC;IACD,QAAQ,EAAE,SAAS;CACpB,CAAC"}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('takeWhile', require('../takeWhile'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').doWhilst;
|
||||
@@ -0,0 +1,191 @@
|
||||
var isObject = require('./isObject'),
|
||||
now = require('./now'),
|
||||
toNumber = require('./toNumber');
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max,
|
||||
nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a debounced function that delays invoking `func` until after `wait`
|
||||
* milliseconds have elapsed since the last time the debounced function was
|
||||
* invoked. The debounced function comes with a `cancel` method to cancel
|
||||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||||
* Provide `options` to indicate whether `func` should be invoked on the
|
||||
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
||||
* with the last arguments provided to the debounced function. Subsequent
|
||||
* calls to the debounced function return the result of the last `func`
|
||||
* invocation.
|
||||
*
|
||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||||
* invoked on the trailing edge of the timeout only if the debounced function
|
||||
* is invoked more than once during the `wait` timeout.
|
||||
*
|
||||
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||||
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||||
*
|
||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Function
|
||||
* @param {Function} func The function to debounce.
|
||||
* @param {number} [wait=0] The number of milliseconds to delay.
|
||||
* @param {Object} [options={}] The options object.
|
||||
* @param {boolean} [options.leading=false]
|
||||
* Specify invoking on the leading edge of the timeout.
|
||||
* @param {number} [options.maxWait]
|
||||
* The maximum time `func` is allowed to be delayed before it's invoked.
|
||||
* @param {boolean} [options.trailing=true]
|
||||
* Specify invoking on the trailing edge of the timeout.
|
||||
* @returns {Function} Returns the new debounced function.
|
||||
* @example
|
||||
*
|
||||
* // Avoid costly calculations while the window size is in flux.
|
||||
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
||||
*
|
||||
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
||||
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
||||
* 'leading': true,
|
||||
* 'trailing': false
|
||||
* }));
|
||||
*
|
||||
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
||||
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
||||
* var source = new EventSource('/stream');
|
||||
* jQuery(source).on('message', debounced);
|
||||
*
|
||||
* // Cancel the trailing debounced invocation.
|
||||
* jQuery(window).on('popstate', debounced.cancel);
|
||||
*/
|
||||
function debounce(func, wait, options) {
|
||||
var lastArgs,
|
||||
lastThis,
|
||||
maxWait,
|
||||
result,
|
||||
timerId,
|
||||
lastCallTime,
|
||||
lastInvokeTime = 0,
|
||||
leading = false,
|
||||
maxing = false,
|
||||
trailing = true;
|
||||
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
wait = toNumber(wait) || 0;
|
||||
if (isObject(options)) {
|
||||
leading = !!options.leading;
|
||||
maxing = 'maxWait' in options;
|
||||
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
||||
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
||||
}
|
||||
|
||||
function invokeFunc(time) {
|
||||
var args = lastArgs,
|
||||
thisArg = lastThis;
|
||||
|
||||
lastArgs = lastThis = undefined;
|
||||
lastInvokeTime = time;
|
||||
result = func.apply(thisArg, args);
|
||||
return result;
|
||||
}
|
||||
|
||||
function leadingEdge(time) {
|
||||
// Reset any `maxWait` timer.
|
||||
lastInvokeTime = time;
|
||||
// Start the timer for the trailing edge.
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
// Invoke the leading edge.
|
||||
return leading ? invokeFunc(time) : result;
|
||||
}
|
||||
|
||||
function remainingWait(time) {
|
||||
var timeSinceLastCall = time - lastCallTime,
|
||||
timeSinceLastInvoke = time - lastInvokeTime,
|
||||
timeWaiting = wait - timeSinceLastCall;
|
||||
|
||||
return maxing
|
||||
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
||||
: timeWaiting;
|
||||
}
|
||||
|
||||
function shouldInvoke(time) {
|
||||
var timeSinceLastCall = time - lastCallTime,
|
||||
timeSinceLastInvoke = time - lastInvokeTime;
|
||||
|
||||
// Either this is the first call, activity has stopped and we're at the
|
||||
// trailing edge, the system time has gone backwards and we're treating
|
||||
// it as the trailing edge, or we've hit the `maxWait` limit.
|
||||
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
||||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
||||
}
|
||||
|
||||
function timerExpired() {
|
||||
var time = now();
|
||||
if (shouldInvoke(time)) {
|
||||
return trailingEdge(time);
|
||||
}
|
||||
// Restart the timer.
|
||||
timerId = setTimeout(timerExpired, remainingWait(time));
|
||||
}
|
||||
|
||||
function trailingEdge(time) {
|
||||
timerId = undefined;
|
||||
|
||||
// Only invoke if we have `lastArgs` which means `func` has been
|
||||
// debounced at least once.
|
||||
if (trailing && lastArgs) {
|
||||
return invokeFunc(time);
|
||||
}
|
||||
lastArgs = lastThis = undefined;
|
||||
return result;
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
if (timerId !== undefined) {
|
||||
clearTimeout(timerId);
|
||||
}
|
||||
lastInvokeTime = 0;
|
||||
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
||||
}
|
||||
|
||||
function flush() {
|
||||
return timerId === undefined ? result : trailingEdge(now());
|
||||
}
|
||||
|
||||
function debounced() {
|
||||
var time = now(),
|
||||
isInvoking = shouldInvoke(time);
|
||||
|
||||
lastArgs = arguments;
|
||||
lastThis = this;
|
||||
lastCallTime = time;
|
||||
|
||||
if (isInvoking) {
|
||||
if (timerId === undefined) {
|
||||
return leadingEdge(lastCallTime);
|
||||
}
|
||||
if (maxing) {
|
||||
// Handle invocations in a tight loop.
|
||||
clearTimeout(timerId);
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
return invokeFunc(lastCallTime);
|
||||
}
|
||||
}
|
||||
if (timerId === undefined) {
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
debounced.cancel = cancel;
|
||||
debounced.flush = flush;
|
||||
return debounced;
|
||||
}
|
||||
|
||||
module.exports = debounce;
|
||||
@@ -0,0 +1,14 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TextEmphasisPosition extends Declaration {
|
||||
set(decl, prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '')
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
TextEmphasisPosition.names = ['text-emphasis-position']
|
||||
|
||||
module.exports = TextEmphasisPosition
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
|
||||
var arrayEach = require('./_arrayEach'),
|
||||
arrayIncludes = require('./_arrayIncludes');
|
||||
|
||||
/** Used to compose bitmasks for function metadata. */
|
||||
var WRAP_BIND_FLAG = 1,
|
||||
WRAP_BIND_KEY_FLAG = 2,
|
||||
WRAP_CURRY_FLAG = 8,
|
||||
WRAP_CURRY_RIGHT_FLAG = 16,
|
||||
WRAP_PARTIAL_FLAG = 32,
|
||||
WRAP_PARTIAL_RIGHT_FLAG = 64,
|
||||
WRAP_ARY_FLAG = 128,
|
||||
WRAP_REARG_FLAG = 256,
|
||||
WRAP_FLIP_FLAG = 512;
|
||||
|
||||
/** Used to associate wrap methods with their bit flags. */
|
||||
var wrapFlags = [
|
||||
['ary', WRAP_ARY_FLAG],
|
||||
['bind', WRAP_BIND_FLAG],
|
||||
['bindKey', WRAP_BIND_KEY_FLAG],
|
||||
['curry', WRAP_CURRY_FLAG],
|
||||
['curryRight', WRAP_CURRY_RIGHT_FLAG],
|
||||
['flip', WRAP_FLIP_FLAG],
|
||||
['partial', WRAP_PARTIAL_FLAG],
|
||||
['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
|
||||
['rearg', WRAP_REARG_FLAG]
|
||||
];
|
||||
|
||||
/**
|
||||
* Updates wrapper `details` based on `bitmask` flags.
|
||||
*
|
||||
* @private
|
||||
* @returns {Array} details The details to modify.
|
||||
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
||||
* @returns {Array} Returns `details`.
|
||||
*/
|
||||
function updateWrapDetails(details, bitmask) {
|
||||
arrayEach(wrapFlags, function(pair) {
|
||||
var value = '_.' + pair[0];
|
||||
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
||||
details.push(value);
|
||||
}
|
||||
});
|
||||
return details.sort();
|
||||
}
|
||||
|
||||
module.exports = updateWrapDetails;
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Get = require('./Get');
|
||||
var IsCallable = require('./IsCallable');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
|
||||
|
||||
module.exports = function OrdinaryHasInstance(C, O) {
|
||||
if (!IsCallable(C)) {
|
||||
return false;
|
||||
}
|
||||
if (Type(O) !== 'Object') {
|
||||
return false;
|
||||
}
|
||||
var P = Get(C, 'prototype');
|
||||
if (Type(P) !== 'Object') {
|
||||
throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
|
||||
}
|
||||
return O instanceof C;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const prepareContent_1 = require("../modules/prepareContent");
|
||||
const markup_1 = require("../modules/markup");
|
||||
exports.default = (options) => ({
|
||||
async markup({ content, filename }) {
|
||||
const { transformer } = await Promise.resolve().then(() => __importStar(require('../transformers/pug')));
|
||||
content = prepareContent_1.prepareContent({
|
||||
options: {
|
||||
...options,
|
||||
stripIndent: true,
|
||||
},
|
||||
content,
|
||||
});
|
||||
return markup_1.transformMarkup({ content, filename }, transformer, options);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import assertString from './util/assertString';
|
||||
export default function unescape(str) {
|
||||
assertString(str);
|
||||
return str.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`').replace(/&/g, '&'); // & replacement has to be the last one to prevent
|
||||
// bugs with intermediate strings containing escape sequences
|
||||
// See: https://github.com/validatorjs/validator.js/issues/1827
|
||||
}
|
||||
Reference in New Issue
Block a user