new license file version [CI SKIP]
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
# slash [](https://travis-ci.org/sindresorhus/slash)
|
||||
|
||||
> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`
|
||||
|
||||
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
|
||||
|
||||
This was created since the `path` methods in Node.js outputs `\\` paths on Windows.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install slash
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const path = require('path');
|
||||
const slash = require('slash');
|
||||
|
||||
const string = path.join('foo', 'bar');
|
||||
// Unix => foo/bar
|
||||
// Windows => foo\\bar
|
||||
|
||||
slash(string);
|
||||
// Unix => foo/bar
|
||||
// Windows => foo/bar
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### slash(path)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Accepts a Windows backslash path and returns a path with forward slashes.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
@@ -0,0 +1,223 @@
|
||||
# update-notifier
|
||||
|
||||
> Update notifications for your CLI app
|
||||
|
||||

|
||||
|
||||
Inform users of your package of updates in a non-intrusive way.
|
||||
|
||||
#### Contents
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [How](#how)
|
||||
- [API](#api)
|
||||
- [About](#about)
|
||||
- [Users](#users)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install update-notifier
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple
|
||||
|
||||
```js
|
||||
import updateNotifier from 'update-notifier';
|
||||
import packageJson from './package.json' assert {type: 'json'};
|
||||
|
||||
updateNotifier({pkg: packageJson}).notify();
|
||||
```
|
||||
|
||||
### Comprehensive
|
||||
|
||||
```js
|
||||
import updateNotifier from 'update-notifier';
|
||||
import packageJson from './package.json' assert {type: 'json'};
|
||||
|
||||
// Checks for available update and returns an instance
|
||||
const notifier = updateNotifier({pkg: packageJson});
|
||||
|
||||
// Notify using the built-in convenience method
|
||||
notifier.notify();
|
||||
|
||||
// `notifier.update` contains some useful info about the update
|
||||
console.log(notifier.update);
|
||||
/*
|
||||
{
|
||||
latest: '1.0.1',
|
||||
current: '1.0.0',
|
||||
type: 'patch', // Possible values: latest, major, minor, patch, prerelease, build
|
||||
name: 'pageres'
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
### Options and custom message
|
||||
|
||||
```js
|
||||
const notifier = updateNotifier({
|
||||
pkg,
|
||||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
|
||||
});
|
||||
|
||||
if (notifier.update) {
|
||||
console.log(`Update available: ${notifier.update.latest}`);
|
||||
}
|
||||
```
|
||||
|
||||
## How
|
||||
|
||||
Whenever you initiate the update notifier and it's not within the interval threshold, it will asynchronously check with npm in the background for available updates, then persist the result. The next time the notifier is initiated, the result will be loaded into the `.update` property. This prevents any impact on your package startup performance.
|
||||
The update check is done in a unref'ed [child process](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). This means that if you call `process.exit`, the check will still be performed in its own process.
|
||||
|
||||
The first time the user runs your app, it will check for an update, and even if an update is available, it will wait the specified `updateCheckInterval` before notifying the user. This is done to not be annoying to the user, but might surprise you as an implementer if you're testing whether it works. Check out [`example.js`](example.js) to quickly test out `update-notifier` and see how you can test that it works in your app.
|
||||
|
||||
## API
|
||||
|
||||
### notifier = updateNotifier(options)
|
||||
|
||||
Checks if there is an available update. Accepts options defined below. Returns an instance with an `.update` property if there is an available update, otherwise `undefined`.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
#### pkg
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### name
|
||||
|
||||
*Required*\
|
||||
Type: `string`
|
||||
|
||||
##### version
|
||||
|
||||
*Required*\
|
||||
Type: `string`
|
||||
|
||||
#### updateCheckInterval
|
||||
|
||||
Type: `number`\
|
||||
Default: `1000 * 60 * 60 * 24` *(1 day)*
|
||||
|
||||
How often to check for updates.
|
||||
|
||||
#### shouldNotifyInNpmScript
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Allows notification to be shown when running as an npm script.
|
||||
|
||||
#### distTag
|
||||
|
||||
Type: `string`\
|
||||
Default: `'latest'`
|
||||
|
||||
Which [dist-tag](https://docs.npmjs.com/adding-dist-tags-to-packages) to use to find the latest version.
|
||||
|
||||
### notifier.fetchInfo()
|
||||
|
||||
Check update information.
|
||||
|
||||
Returns an `object` with:
|
||||
|
||||
- `latest` _(String)_ - Latest version.
|
||||
- `current` _(String)_ - Current version.
|
||||
- `type` _(String)_ - Type of current update. Possible values: `latest`, `major`, `minor`, `patch`, `prerelease`, `build`.
|
||||
- `name` _(String)_ - Package name.
|
||||
|
||||
### notifier.notify(options?)
|
||||
|
||||
Convenience method to display a notification message. *(See screenshot)*
|
||||
|
||||
Only notifies if there is an update and the process is [TTY](https://nodejs.org/api/process.html#process_a_note_on_process_i_o).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### defer
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Defer showing the notification to after the process has exited.
|
||||
|
||||
##### message
|
||||
|
||||
Type: `string`\
|
||||
Default: [See above screenshot](https://github.com/yeoman/update-notifier#update-notifier-)
|
||||
|
||||
Message that will be shown when an update is available.
|
||||
|
||||
Available placeholders:
|
||||
|
||||
- `{packageName}` - Package name.
|
||||
- `{currentVersion}` - Current version.
|
||||
- `{latestVersion}` - Latest version.
|
||||
- `{updateCommand}` - Update command.
|
||||
|
||||
```js
|
||||
notifier.notify({message: 'Run `{updateCommand}` to update.'});
|
||||
|
||||
// Output:
|
||||
// Run `npm install update-notifier-tester@1.0.0` to update.
|
||||
```
|
||||
|
||||
##### isGlobal
|
||||
|
||||
Type: `boolean`\
|
||||
Default: Auto-detect
|
||||
|
||||
Include the `-g` argument in the default message's `npm i` recommendation. You may want to change this if your CLI package can be installed as a dependency of another project, and don't want to recommend a global installation. This option is ignored if you supply your own `message` (see above).
|
||||
|
||||
##### boxenOptions
|
||||
|
||||
Type: `object`\
|
||||
Default: `{padding: 1, margin: 1, textAlignment: 'center', borderColor: 'yellow', borderStyle: 'round'}` *(See screenshot)*
|
||||
|
||||
Options object that will be passed to [`boxen`](https://github.com/sindresorhus/boxen).
|
||||
|
||||
### User settings
|
||||
|
||||
Users of your module have the ability to opt-out of the update notifier by changing the `optOut` property to `true` in `~/.config/configstore/update-notifier-[your-module-name].json`. The path is available in `notifier.config.path`.
|
||||
|
||||
Users can also opt-out by [setting the environment variable](https://github.com/sindresorhus/guides/blob/main/set-environment-variables.md) `NO_UPDATE_NOTIFIER` with any value or by using the `--no-update-notifier` flag on a per run basis.
|
||||
|
||||
The check is also skipped automatically:
|
||||
- on CI
|
||||
- in unit tests (when the `NODE_ENV` environment variable is `test`)
|
||||
|
||||
## About
|
||||
|
||||
The idea for this module came from the desire to apply the browser update strategy to CLI tools, where everyone is always on the latest version. We first tried automatic updating, which we discovered wasn't popular. This is the second iteration of that idea, but limited to just update notifications.
|
||||
|
||||
## Users
|
||||
|
||||
There are a bunch projects using it:
|
||||
|
||||
- [npm](https://github.com/npm/npm) - Package manager for JavaScript
|
||||
- [Yeoman](https://yeoman.io) - Modern workflows for modern webapps
|
||||
- [AVA](https://avajs.dev) - Simple concurrent test runner
|
||||
- [XO](https://github.com/xojs/xo) - JavaScript happiness style linter
|
||||
- [Node GH](https://github.com/node-gh/gh) - GitHub command line tool
|
||||
|
||||
[And 2700+ more…](https://www.npmjs.org/browse/depended/update-notifier)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-update_notifier?utm_source=npm-update-notifier&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $RangeError = GetIntrinsic('%RangeError%');
|
||||
|
||||
var ToInteger = require('./ToInteger');
|
||||
var ToLength = require('./ToLength');
|
||||
var SameValueZero = require('./SameValueZero');
|
||||
|
||||
// https://262.ecma-international.org/8.0/#sec-toindex
|
||||
|
||||
module.exports = function ToIndex(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return 0;
|
||||
}
|
||||
var integerIndex = ToInteger(value);
|
||||
if (integerIndex < 0) {
|
||||
throw new $RangeError('index must be >= 0');
|
||||
}
|
||||
var index = ToLength(integerIndex);
|
||||
if (!SameValueZero(integerIndex, index)) {
|
||||
throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1');
|
||||
}
|
||||
return index;
|
||||
};
|
||||
@@ -0,0 +1,486 @@
|
||||
import { options } from 'preact';
|
||||
|
||||
/** @type {number} */
|
||||
let currentIndex;
|
||||
|
||||
/** @type {import('./internal').Component} */
|
||||
let currentComponent;
|
||||
|
||||
/** @type {import('./internal').Component} */
|
||||
let previousComponent;
|
||||
|
||||
/** @type {number} */
|
||||
let currentHook = 0;
|
||||
|
||||
/** @type {Array<import('./internal').Component>} */
|
||||
let afterPaintEffects = [];
|
||||
|
||||
let EMPTY = [];
|
||||
|
||||
let oldBeforeDiff = options._diff;
|
||||
let oldBeforeRender = options._render;
|
||||
let oldAfterDiff = options.diffed;
|
||||
let oldCommit = options._commit;
|
||||
let oldBeforeUnmount = options.unmount;
|
||||
|
||||
const RAF_TIMEOUT = 100;
|
||||
let prevRaf;
|
||||
|
||||
options._diff = vnode => {
|
||||
currentComponent = null;
|
||||
if (oldBeforeDiff) oldBeforeDiff(vnode);
|
||||
};
|
||||
|
||||
options._render = vnode => {
|
||||
if (oldBeforeRender) oldBeforeRender(vnode);
|
||||
|
||||
currentComponent = vnode._component;
|
||||
currentIndex = 0;
|
||||
|
||||
const hooks = currentComponent.__hooks;
|
||||
if (hooks) {
|
||||
if (previousComponent === currentComponent) {
|
||||
hooks._pendingEffects = [];
|
||||
currentComponent._renderCallbacks = [];
|
||||
hooks._list.forEach(hookItem => {
|
||||
if (hookItem._nextValue) {
|
||||
hookItem._value = hookItem._nextValue;
|
||||
}
|
||||
hookItem._pendingValue = EMPTY;
|
||||
hookItem._nextValue = hookItem._pendingArgs = undefined;
|
||||
});
|
||||
} else {
|
||||
hooks._pendingEffects.forEach(invokeCleanup);
|
||||
hooks._pendingEffects.forEach(invokeEffect);
|
||||
hooks._pendingEffects = [];
|
||||
}
|
||||
}
|
||||
previousComponent = currentComponent;
|
||||
};
|
||||
|
||||
options.diffed = vnode => {
|
||||
if (oldAfterDiff) oldAfterDiff(vnode);
|
||||
|
||||
const c = vnode._component;
|
||||
if (c && c.__hooks) {
|
||||
if (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));
|
||||
c.__hooks._list.forEach(hookItem => {
|
||||
if (hookItem._pendingArgs) {
|
||||
hookItem._args = hookItem._pendingArgs;
|
||||
}
|
||||
if (hookItem._pendingValue !== EMPTY) {
|
||||
hookItem._value = hookItem._pendingValue;
|
||||
}
|
||||
hookItem._pendingArgs = undefined;
|
||||
hookItem._pendingValue = EMPTY;
|
||||
});
|
||||
}
|
||||
previousComponent = currentComponent = null;
|
||||
};
|
||||
|
||||
options._commit = (vnode, commitQueue) => {
|
||||
commitQueue.some(component => {
|
||||
try {
|
||||
component._renderCallbacks.forEach(invokeCleanup);
|
||||
component._renderCallbacks = component._renderCallbacks.filter(cb =>
|
||||
cb._value ? invokeEffect(cb) : true
|
||||
);
|
||||
} catch (e) {
|
||||
commitQueue.some(c => {
|
||||
if (c._renderCallbacks) c._renderCallbacks = [];
|
||||
});
|
||||
commitQueue = [];
|
||||
options._catchError(e, component._vnode);
|
||||
}
|
||||
});
|
||||
|
||||
if (oldCommit) oldCommit(vnode, commitQueue);
|
||||
};
|
||||
|
||||
options.unmount = vnode => {
|
||||
if (oldBeforeUnmount) oldBeforeUnmount(vnode);
|
||||
|
||||
const c = vnode._component;
|
||||
if (c && c.__hooks) {
|
||||
let hasErrored;
|
||||
c.__hooks._list.forEach(s => {
|
||||
try {
|
||||
invokeCleanup(s);
|
||||
} catch (e) {
|
||||
hasErrored = e;
|
||||
}
|
||||
});
|
||||
c.__hooks = undefined;
|
||||
if (hasErrored) options._catchError(hasErrored, c._vnode);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a hook's state from the currentComponent
|
||||
* @param {number} index The index of the hook to get
|
||||
* @param {number} type The index of the hook to get
|
||||
* @returns {any}
|
||||
*/
|
||||
function getHookState(index, type) {
|
||||
if (options._hook) {
|
||||
options._hook(currentComponent, index, currentHook || type);
|
||||
}
|
||||
currentHook = 0;
|
||||
|
||||
// Largely inspired by:
|
||||
// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs
|
||||
// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs
|
||||
// Other implementations to look at:
|
||||
// * https://codesandbox.io/s/mnox05qp8
|
||||
const hooks =
|
||||
currentComponent.__hooks ||
|
||||
(currentComponent.__hooks = {
|
||||
_list: [],
|
||||
_pendingEffects: []
|
||||
});
|
||||
|
||||
if (index >= hooks._list.length) {
|
||||
hooks._list.push({ _pendingValue: EMPTY });
|
||||
}
|
||||
return hooks._list[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./index').StateUpdater<any>} [initialState]
|
||||
*/
|
||||
export function useState(initialState) {
|
||||
currentHook = 1;
|
||||
return useReducer(invokeOrReturn, initialState);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./index').Reducer<any, any>} reducer
|
||||
* @param {import('./index').StateUpdater<any>} initialState
|
||||
* @param {(initialState: any) => void} [init]
|
||||
* @returns {[ any, (state: any) => void ]}
|
||||
*/
|
||||
export function useReducer(reducer, initialState, init) {
|
||||
/** @type {import('./internal').ReducerHookState} */
|
||||
const hookState = getHookState(currentIndex++, 2);
|
||||
hookState._reducer = reducer;
|
||||
if (!hookState._component) {
|
||||
hookState._value = [
|
||||
!init ? invokeOrReturn(undefined, initialState) : init(initialState),
|
||||
|
||||
action => {
|
||||
const currentValue = hookState._nextValue
|
||||
? hookState._nextValue[0]
|
||||
: hookState._value[0];
|
||||
const nextValue = hookState._reducer(currentValue, action);
|
||||
|
||||
if (currentValue !== nextValue) {
|
||||
hookState._nextValue = [nextValue, hookState._value[1]];
|
||||
hookState._component.setState({});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
hookState._component = currentComponent;
|
||||
|
||||
if (!currentComponent._hasScuFromHooks) {
|
||||
currentComponent._hasScuFromHooks = true;
|
||||
const prevScu = currentComponent.shouldComponentUpdate;
|
||||
|
||||
// This SCU has the purpose of bailing out after repeated updates
|
||||
// to stateful hooks.
|
||||
// we store the next value in _nextValue[0] and keep doing that for all
|
||||
// state setters, if we have next states and
|
||||
// all next states within a component end up being equal to their original state
|
||||
// we are safe to bail out for this specific component.
|
||||
currentComponent.shouldComponentUpdate = function(p, s, c) {
|
||||
if (!hookState._component.__hooks) return true;
|
||||
|
||||
const stateHooks = hookState._component.__hooks._list.filter(
|
||||
x => x._component
|
||||
);
|
||||
const allHooksEmpty = stateHooks.every(x => !x._nextValue);
|
||||
// When we have no updated hooks in the component we invoke the previous SCU or
|
||||
// traverse the VDOM tree further.
|
||||
if (allHooksEmpty) {
|
||||
return prevScu ? prevScu.call(this, p, s, c) : true;
|
||||
}
|
||||
|
||||
// We check whether we have components with a nextValue set that
|
||||
// have values that aren't equal to one another this pushes
|
||||
// us to update further down the tree
|
||||
let shouldUpdate = false;
|
||||
stateHooks.forEach(hookItem => {
|
||||
if (hookItem._nextValue) {
|
||||
const currentValue = hookItem._value[0];
|
||||
hookItem._value = hookItem._nextValue;
|
||||
hookItem._nextValue = undefined;
|
||||
if (currentValue !== hookItem._value[0]) shouldUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
return shouldUpdate || hookState._component.props !== p
|
||||
? prevScu
|
||||
? prevScu.call(this, p, s, c)
|
||||
: true
|
||||
: false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return hookState._nextValue || hookState._value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./internal').Effect} callback
|
||||
* @param {any[]} args
|
||||
*/
|
||||
export function useEffect(callback, args) {
|
||||
/** @type {import('./internal').EffectHookState} */
|
||||
const state = getHookState(currentIndex++, 3);
|
||||
if (!options._skipEffects && argsChanged(state._args, args)) {
|
||||
state._value = callback;
|
||||
state._pendingArgs = args;
|
||||
|
||||
currentComponent.__hooks._pendingEffects.push(state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./internal').Effect} callback
|
||||
* @param {any[]} args
|
||||
*/
|
||||
export function useLayoutEffect(callback, args) {
|
||||
/** @type {import('./internal').EffectHookState} */
|
||||
const state = getHookState(currentIndex++, 4);
|
||||
if (!options._skipEffects && argsChanged(state._args, args)) {
|
||||
state._value = callback;
|
||||
state._pendingArgs = args;
|
||||
|
||||
currentComponent._renderCallbacks.push(state);
|
||||
}
|
||||
}
|
||||
|
||||
export function useRef(initialValue) {
|
||||
currentHook = 5;
|
||||
return useMemo(() => ({ current: initialValue }), []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} ref
|
||||
* @param {() => object} createHandle
|
||||
* @param {any[]} args
|
||||
*/
|
||||
export function useImperativeHandle(ref, createHandle, args) {
|
||||
currentHook = 6;
|
||||
useLayoutEffect(
|
||||
() => {
|
||||
if (typeof ref == 'function') {
|
||||
ref(createHandle());
|
||||
return () => ref(null);
|
||||
} else if (ref) {
|
||||
ref.current = createHandle();
|
||||
return () => (ref.current = null);
|
||||
}
|
||||
},
|
||||
args == null ? args : args.concat(ref)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {() => any} factory
|
||||
* @param {any[]} args
|
||||
*/
|
||||
export function useMemo(factory, args) {
|
||||
/** @type {import('./internal').MemoHookState} */
|
||||
const state = getHookState(currentIndex++, 7);
|
||||
if (argsChanged(state._args, args)) {
|
||||
state._pendingValue = factory();
|
||||
state._pendingArgs = args;
|
||||
state._factory = factory;
|
||||
return state._pendingValue;
|
||||
}
|
||||
|
||||
return state._value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {() => void} callback
|
||||
* @param {any[]} args
|
||||
*/
|
||||
export function useCallback(callback, args) {
|
||||
currentHook = 8;
|
||||
return useMemo(() => callback, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./internal').PreactContext} context
|
||||
*/
|
||||
export function useContext(context) {
|
||||
const provider = currentComponent.context[context._id];
|
||||
// We could skip this call here, but than we'd not call
|
||||
// `options._hook`. We need to do that in order to make
|
||||
// the devtools aware of this hook.
|
||||
/** @type {import('./internal').ContextHookState} */
|
||||
const state = getHookState(currentIndex++, 9);
|
||||
// The devtools needs access to the context object to
|
||||
// be able to pull of the default value when no provider
|
||||
// is present in the tree.
|
||||
state._context = context;
|
||||
if (!provider) return context._defaultValue;
|
||||
// This is probably not safe to convert to "!"
|
||||
if (state._value == null) {
|
||||
state._value = true;
|
||||
provider.sub(currentComponent);
|
||||
}
|
||||
return provider.props.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a custom label for a custom hook for the devtools panel
|
||||
* @type {<T>(value: T, cb?: (value: T) => string | number) => void}
|
||||
*/
|
||||
export function useDebugValue(value, formatter) {
|
||||
if (options.useDebugValue) {
|
||||
options.useDebugValue(formatter ? formatter(value) : value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(error: any, errorInfo: import('preact').ErrorInfo) => void} cb
|
||||
*/
|
||||
export function useErrorBoundary(cb) {
|
||||
/** @type {import('./internal').ErrorBoundaryHookState} */
|
||||
const state = getHookState(currentIndex++, 10);
|
||||
const errState = useState();
|
||||
state._value = cb;
|
||||
if (!currentComponent.componentDidCatch) {
|
||||
currentComponent.componentDidCatch = (err, errorInfo) => {
|
||||
if (state._value) state._value(err, errorInfo);
|
||||
errState[1](err);
|
||||
};
|
||||
}
|
||||
return [
|
||||
errState[0],
|
||||
() => {
|
||||
errState[1](undefined);
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export function useId() {
|
||||
const state = getHookState(currentIndex++, 11);
|
||||
if (!state._value) {
|
||||
// Grab either the root node or the nearest async boundary node.
|
||||
/** @type {import('./internal.d').VNode} */
|
||||
let root = currentComponent._vnode;
|
||||
while (root !== null && !root._mask && root._parent !== null) {
|
||||
root = root._parent;
|
||||
}
|
||||
|
||||
let mask = root._mask || (root._mask = [0, 0]);
|
||||
state._value = 'P' + mask[0] + '-' + mask[1]++;
|
||||
}
|
||||
|
||||
return state._value;
|
||||
}
|
||||
/**
|
||||
* After paint effects consumer.
|
||||
*/
|
||||
function flushAfterPaintEffects() {
|
||||
let component;
|
||||
while ((component = afterPaintEffects.shift())) {
|
||||
if (!component._parentDom || !component.__hooks) continue;
|
||||
try {
|
||||
component.__hooks._pendingEffects.forEach(invokeCleanup);
|
||||
component.__hooks._pendingEffects.forEach(invokeEffect);
|
||||
component.__hooks._pendingEffects = [];
|
||||
} catch (e) {
|
||||
component.__hooks._pendingEffects = [];
|
||||
options._catchError(e, component._vnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let HAS_RAF = typeof requestAnimationFrame == 'function';
|
||||
|
||||
/**
|
||||
* Schedule a callback to be invoked after the browser has a chance to paint a new frame.
|
||||
* Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after
|
||||
* the next browser frame.
|
||||
*
|
||||
* Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked
|
||||
* even if RAF doesn't fire (for example if the browser tab is not visible)
|
||||
*
|
||||
* @param {() => void} callback
|
||||
*/
|
||||
function afterNextFrame(callback) {
|
||||
const done = () => {
|
||||
clearTimeout(timeout);
|
||||
if (HAS_RAF) cancelAnimationFrame(raf);
|
||||
setTimeout(callback);
|
||||
};
|
||||
const timeout = setTimeout(done, RAF_TIMEOUT);
|
||||
|
||||
let raf;
|
||||
if (HAS_RAF) {
|
||||
raf = requestAnimationFrame(done);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: if someone used options.debounceRendering = requestAnimationFrame,
|
||||
// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.
|
||||
// Perhaps this is not such a big deal.
|
||||
/**
|
||||
* Schedule afterPaintEffects flush after the browser paints
|
||||
* @param {number} newQueueLength
|
||||
*/
|
||||
function afterPaint(newQueueLength) {
|
||||
if (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {
|
||||
prevRaf = options.requestAnimationFrame;
|
||||
(prevRaf || afterNextFrame)(flushAfterPaintEffects);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./internal').EffectHookState} hook
|
||||
*/
|
||||
function invokeCleanup(hook) {
|
||||
// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode
|
||||
// and move the currentComponent away.
|
||||
const comp = currentComponent;
|
||||
let cleanup = hook._cleanup;
|
||||
if (typeof cleanup == 'function') {
|
||||
hook._cleanup = undefined;
|
||||
cleanup();
|
||||
}
|
||||
|
||||
currentComponent = comp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke a Hook's effect
|
||||
* @param {import('./internal').EffectHookState} hook
|
||||
*/
|
||||
function invokeEffect(hook) {
|
||||
// A hook call can introduce a call to render which creates a new root, this will call options.vnode
|
||||
// and move the currentComponent away.
|
||||
const comp = currentComponent;
|
||||
hook._cleanup = hook._value();
|
||||
currentComponent = comp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} oldArgs
|
||||
* @param {any[]} newArgs
|
||||
*/
|
||||
function argsChanged(oldArgs, newArgs) {
|
||||
return (
|
||||
!oldArgs ||
|
||||
oldArgs.length !== newArgs.length ||
|
||||
newArgs.some((arg, index) => arg !== oldArgs[index])
|
||||
);
|
||||
}
|
||||
|
||||
function invokeOrReturn(arg, f) {
|
||||
return typeof f == 'function' ? f(arg) : f;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
|
||||
var root = require('./_root');
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = root.Symbol;
|
||||
|
||||
module.exports = Symbol;
|
||||
@@ -0,0 +1,128 @@
|
||||
import { Operator } from './Operator';
|
||||
import { Subscriber } from './Subscriber';
|
||||
import { Subscription } from './Subscription';
|
||||
import { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';
|
||||
/**
|
||||
* A representation of any set of values over any amount of time. This is the most basic building block
|
||||
* of RxJS.
|
||||
*
|
||||
* @class Observable<T>
|
||||
*/
|
||||
export declare class Observable<T> implements Subscribable<T> {
|
||||
/**
|
||||
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
||||
*/
|
||||
source: Observable<any> | undefined;
|
||||
/**
|
||||
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
||||
*/
|
||||
operator: Operator<any, T> | undefined;
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Function} subscribe the function that is called when the Observable is
|
||||
* initially subscribed to. This function is given a Subscriber, to which new values
|
||||
* can be `next`ed, or an `error` method can be called to raise an error, or
|
||||
* `complete` can be called to notify of a successful completion.
|
||||
*/
|
||||
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic);
|
||||
/**
|
||||
* Creates a new Observable by calling the Observable constructor
|
||||
* @owner Observable
|
||||
* @method create
|
||||
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
|
||||
* @return {Observable} a new observable
|
||||
* @nocollapse
|
||||
* @deprecated Use `new Observable()` instead. Will be removed in v8.
|
||||
*/
|
||||
static create: (...args: any[]) => any;
|
||||
/**
|
||||
* Creates a new Observable, with this Observable instance as the source, and the passed
|
||||
* operator defined as the new observable's operator.
|
||||
* @method lift
|
||||
* @param operator the operator defining the operation to take on the observable
|
||||
* @return a new observable with the Operator applied
|
||||
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
||||
* If you have implemented an operator using `lift`, it is recommended that you create an
|
||||
* operator by simply returning `new Observable()` directly. See "Creating new operators from
|
||||
* scratch" section here: https://rxjs.dev/guide/operators
|
||||
*/
|
||||
lift<R>(operator?: Operator<T, R>): Observable<R>;
|
||||
subscribe(observerOrNext?: Partial<Observer<T>> | ((value: T) => void)): Subscription;
|
||||
/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */
|
||||
subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;
|
||||
/**
|
||||
* Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
|
||||
* APIs that expect promises, like `async/await`. You cannot unsubscribe from this.
|
||||
*
|
||||
* **WARNING**: Only use this with observables you *know* will complete. If the source
|
||||
* observable does not complete, you will end up with a promise that is hung up, and
|
||||
* potentially all of the state of an async function hanging out in memory. To avoid
|
||||
* this situation, look into adding something like {@link timeout}, {@link take},
|
||||
* {@link takeWhile}, or {@link takeUntil} amongst others.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take } from 'rxjs';
|
||||
*
|
||||
* const source$ = interval(1000).pipe(take(4));
|
||||
*
|
||||
* async function getTotal() {
|
||||
* let total = 0;
|
||||
*
|
||||
* await source$.forEach(value => {
|
||||
* total += value;
|
||||
* console.log('observable -> ' + value);
|
||||
* });
|
||||
*
|
||||
* return total;
|
||||
* }
|
||||
*
|
||||
* getTotal().then(
|
||||
* total => console.log('Total: ' + total)
|
||||
* );
|
||||
*
|
||||
* // Expected:
|
||||
* // 'observable -> 0'
|
||||
* // 'observable -> 1'
|
||||
* // 'observable -> 2'
|
||||
* // 'observable -> 3'
|
||||
* // 'Total: 6'
|
||||
* ```
|
||||
*
|
||||
* @param next a handler for each value emitted by the observable
|
||||
* @return a promise that either resolves on observable completion or
|
||||
* rejects with the handled error
|
||||
*/
|
||||
forEach(next: (value: T) => void): Promise<void>;
|
||||
/**
|
||||
* @param next a handler for each value emitted by the observable
|
||||
* @param promiseCtor a constructor function used to instantiate the Promise
|
||||
* @return a promise that either resolves on observable completion or
|
||||
* rejects with the handled error
|
||||
* @deprecated Passing a Promise constructor will no longer be available
|
||||
* in upcoming versions of RxJS. This is because it adds weight to the library, for very
|
||||
* little benefit. If you need this functionality, it is recommended that you either
|
||||
* polyfill Promise, or you create an adapter to convert the returned native promise
|
||||
* to whatever promise implementation you wanted. Will be removed in v8.
|
||||
*/
|
||||
forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
|
||||
pipe(): Observable<T>;
|
||||
pipe<A>(op1: OperatorFunction<T, A>): Observable<A>;
|
||||
pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>;
|
||||
pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;
|
||||
pipe<A, B, C, D>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>;
|
||||
pipe<A, B, C, D, E>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>;
|
||||
pipe<A, B, C, D, E, F>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>;
|
||||
pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>;
|
||||
pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>;
|
||||
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>;
|
||||
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<unknown>;
|
||||
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
||||
toPromise(): Promise<T | undefined>;
|
||||
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
||||
toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;
|
||||
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
||||
toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
|
||||
}
|
||||
//# sourceMappingURL=Observable.d.ts.map
|
||||
@@ -0,0 +1,914 @@
|
||||
[](https://travis-ci.org/Keyang/node-csvtojson)
|
||||
|
||||
# CSVTOJSON
|
||||
All you need nodejs csv to json converter.
|
||||
* Large CSV data
|
||||
* Command Line Tool and Node.JS Lib
|
||||
* Complex/nested JSON
|
||||
* Easy Customised Parser
|
||||
* Stream based
|
||||
* multi CPU core support
|
||||
* Easy Usage
|
||||
* more!
|
||||
|
||||
# Demo
|
||||
|
||||
[Here](http://keyangxiang.com/csvtojson/) is a free online csv to json service ultilising latest csvtojson module.
|
||||
|
||||
## Menu
|
||||
* [Installation](#installation)
|
||||
* [Usage](#usage)
|
||||
* [Library](#library)
|
||||
* [Convert from a file](#from-file)
|
||||
* [Convert from a web resource / Readable stream](#from-web)
|
||||
* [Convert from CSV string](#from-string)
|
||||
* [Parameters](#params)
|
||||
* [Result Transform](#result-transform)
|
||||
* [Synchronouse Transformer](#synchronouse-transformer)
|
||||
* [Asynchronouse Transformer](#asynchronouse-transformer)
|
||||
* [Convert to other data type](#convert-to-other-data-type)
|
||||
* [Hooks](#hooks)
|
||||
* [Events](#events)
|
||||
* [Flags](#flags)
|
||||
* [Big CSV File Streaming](#big-csv-file)
|
||||
* [Process Big CSV File in CLI](#convert-big-csv-file-with-command-line-tool)
|
||||
* [Parse String](#parse-string)
|
||||
* [Empowered JSON Parser](#empowered-json-parser)
|
||||
* [Field Type](#field-type)
|
||||
* [Multi-Core / Fork Process](#multi-cpu-core)
|
||||
* [Header Configuration](#header-configuration)
|
||||
* [Error Handling](#error-handling)
|
||||
* [Customised Parser](#parser)
|
||||
* [Stream Options](#stream-options)
|
||||
* [Change Log](#change-log)
|
||||
|
||||
GitHub: https://github.com/Keyang/node-csvtojson
|
||||
|
||||
## Installation
|
||||
|
||||
>npm install -g csvtojson
|
||||
|
||||
>npm install csvtojson --save
|
||||
|
||||
## Usage
|
||||
|
||||
### library
|
||||
|
||||
#### From File
|
||||
|
||||
You can use File stream
|
||||
|
||||
```js
|
||||
//Converter Class
|
||||
var Converter = require("csvtojson").Converter;
|
||||
var converter = new Converter({});
|
||||
|
||||
//end_parsed will be emitted once parsing finished
|
||||
converter.on("end_parsed", function (jsonArray) {
|
||||
console.log(jsonArray); //here is your result jsonarray
|
||||
});
|
||||
|
||||
//read from file
|
||||
require("fs").createReadStream("./file.csv").pipe(converter);
|
||||
```
|
||||
|
||||
Or use fromFile convenient function
|
||||
|
||||
```js
|
||||
//Converter Class
|
||||
var Converter = require("csvtojson").Converter;
|
||||
var converter = new Converter({});
|
||||
converter.fromFile("./file.csv",function(err,result){
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
#### From Web
|
||||
|
||||
To convert any CSV data from readable stream just simply pipe in the data.
|
||||
|
||||
```js
|
||||
//Converter Class
|
||||
var Converter = require("csvtojson").Converter;
|
||||
var converter = new Converter({constructResult:false}); //for big csv data
|
||||
|
||||
//record_parsed will be emitted each csv row being processed
|
||||
converter.on("record_parsed", function (jsonObj) {
|
||||
console.log(jsonObj); //here is your result json object
|
||||
});
|
||||
|
||||
require("request").get("http://csvwebserver").pipe(converter);
|
||||
|
||||
```
|
||||
|
||||
#### From String
|
||||
|
||||
```js
|
||||
var Converter = require("csvtojson").Converter;
|
||||
var converter = new Converter({});
|
||||
converter.fromString(csvString, function(err,result){
|
||||
//your code here
|
||||
});
|
||||
```
|
||||
|
||||
### Command Line Tools
|
||||
|
||||
>csvtojson <csv file path>
|
||||
|
||||
Example
|
||||
|
||||
>csvtojson ./myCSVFile <option1=value>
|
||||
|
||||
Or use pipe:
|
||||
|
||||
>cat myCSVFile | csvtojson
|
||||
|
||||
Check current version:
|
||||
|
||||
>csvtojson version
|
||||
|
||||
Advanced usage with parameters support, check help:
|
||||
|
||||
>csvtojson --help
|
||||
|
||||
# Params
|
||||
|
||||
The constructor of csv Converter allows parameters:
|
||||
|
||||
```js
|
||||
var converter=new require("csvtojson").Converter({
|
||||
constructResult:false,
|
||||
workerNum:4,
|
||||
noheader:true
|
||||
});
|
||||
```
|
||||
|
||||
Following parameters are supported:
|
||||
|
||||
* **constructResult**: true/false. Whether to construct final json object in memory which will be populated in "end_parsed" event. Set to false if deal with huge csv data. default: true.
|
||||
* **delimiter**: delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance, in this case, delimiter will be auto-detected (by best attempt). Use an array to give a list of potential delimiters e.g. [",","|","$"]. default: ","
|
||||
* **quote**: If a column contains delimiter, it is able to use quote character to surround the column content. e.g. "hello, world" wont be split into two columns while parsing. Set to "off" will ignore all quotes. default: " (double quote)
|
||||
* **trim**: Indicate if parser trim off spaces surrounding column content. e.g. " content " will be trimmed to "content". Default: true
|
||||
* **checkType**: This parameter turns on and off weather check field type. default is true. See [Field type](#field-type)
|
||||
* **toArrayString**: Stringify the stream output to JSON array. This is useful when pipe output to a file which expects stringified JSON array. default is false and only stringified JSON (without []) will be pushed to downstream.
|
||||
* **ignoreEmpty**: Ignore the empty value in CSV columns. If a column value is not giving, set this to true to skip them. Defalut: false.
|
||||
* **workerNum**: Number of worker processes. The worker process will use multi-cores to help process CSV data. Set to number of Core to improve the performance of processing large csv file. Keep 1 for small csv files. Default 1.
|
||||
* **fork(Deprecated, same as workerNum=2)**: Use another CPU core to process the CSV stream.
|
||||
* **noheader**:Indicating csv data has no header row and first row is data row. Default is false. See [header configuration](#header-configuration)
|
||||
* **headers**: An array to specify the headers of CSV data. If --noheader is false, this value will override CSV header row. Default: null. Example: ["my field","name"]. See [header configuration](#header-configuration)
|
||||
* **flatKeys**: Don't interpret dots (.) and square brackets in header fields as nested object or array identifiers at all (treat them like regular characters for JSON field identifiers). Default: false.
|
||||
* **maxRowLength**: the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit "error" of "row_exceed". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 0
|
||||
* **checkColumn**: whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
|
||||
* **eol**: End of line character. If omitted, parser will attempt retrieve it from first chunk of CSV data. If no valid eol found, then operation system eol will be used.
|
||||
* **escape**: escape character used in quoted column. Default is double quote (") according to RFC4108. Change to back slash (\) or other chars for your own case.
|
||||
|
||||
All parameters can be used in Command Line tool. see
|
||||
|
||||
```
|
||||
csvtojson --help
|
||||
```
|
||||
|
||||
# Result Transform
|
||||
|
||||
To transform JSON result, (e.g. change value of one column), just simply add 'transform handler'.
|
||||
|
||||
## Synchronouse transformer
|
||||
|
||||
```js
|
||||
var Converter=require("csvtojson").Converter;
|
||||
var csvConverter=new Converter({});
|
||||
csvConverter.transform=function(json,row,index){
|
||||
json["rowIndex"]=index;
|
||||
/* some other examples:
|
||||
delete json["myfield"]; //remove a field
|
||||
json["dateOfBirth"]=new Date(json["dateOfBirth"]); // convert a field type
|
||||
*/
|
||||
};
|
||||
csvConverter.fromString(csvString,function(err,result){
|
||||
//all result rows will add a field 'rowIndex' indicating the row number of the csv data:
|
||||
/*
|
||||
[{
|
||||
field1:value1,
|
||||
rowIndex: 0
|
||||
}]
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
As shown in example above, it is able to apply any changes to the result json which will be pushed to down stream and "record_parsed" event.
|
||||
|
||||
## Asynchronouse Transformer
|
||||
|
||||
Asynchronouse transformation can be achieve either through "record_parsed" event or creating a Writable stream.
|
||||
|
||||
### Use record_parsed
|
||||
|
||||
To transform data asynchronously, it is suggested to use csvtojson with [Async Queue](https://github.com/caolan/async#queue).
|
||||
|
||||
This mainly is used when transformation of each csv row needs be mashed with data retrieved from external such as database / server / file system.
|
||||
|
||||
However this approach will **not** change the json result pushed to downstream.
|
||||
|
||||
Here is an example:
|
||||
|
||||
```js
|
||||
var Conv=require("csvtojson").Converter;
|
||||
var async=require("async");
|
||||
var rs=require("fs").createReadStream("path/to/csv"); // or any readable stream to csv data.
|
||||
var q=async.queue(function(json,callback){
|
||||
//process the json asynchronously.
|
||||
require("request").get("http://myserver/user/"+json.userId,function(err,user){
|
||||
//do the data mash here
|
||||
json.user=user;
|
||||
callback();
|
||||
});
|
||||
},10);//10 concurrent worker same time
|
||||
q.saturated=function(){
|
||||
rs.pause(); //if queue is full, it is suggested to pause the readstream so csvtojson will suspend populating json data. It is ok to not to do so if CSV data is not very large.
|
||||
}
|
||||
q.empty=function(){
|
||||
rs.resume();//Resume the paused readable stream. you may need check if the readable stream isPaused() (this is since node 0.12) or finished.
|
||||
}
|
||||
var conv=new Conv({construct:false});
|
||||
conv.transform=function(json){
|
||||
q.push(json);
|
||||
};
|
||||
conv.on("end_parsed",function(){
|
||||
q.drain=function(){
|
||||
//code when Queue process finished.
|
||||
}
|
||||
})
|
||||
rs.pipe(conv);
|
||||
```
|
||||
|
||||
In example above, the transformation will happen if one csv rown being processed. The related user info will be pulled from a web server and mashed into json result.
|
||||
|
||||
There will be at most 10 data transformation woker working concurrently with the help of Async Queue.
|
||||
|
||||
### Use Stream
|
||||
|
||||
It is able to create a Writable stream (or Transform) which process data asynchronously. See [Here](https://nodejs.org/dist/latest-v4.x/docs/api/stream.html#stream_class_stream_transform) for more details.
|
||||
|
||||
## Convert to other data type
|
||||
|
||||
Below is an example of result tranformation which converts csv data to a column array rather than a JSON.
|
||||
|
||||
```js
|
||||
var Converter=require("csvtojson").Converter;
|
||||
var columArrData=__dirname+"/data/columnArray";
|
||||
var rs=fs.createReadStream(columArrData);
|
||||
var result = {}
|
||||
var csvConverter=new Converter();
|
||||
//end_parsed will be emitted once parsing finished
|
||||
csvConverter.on("end_parsed", function(jsonObj) {
|
||||
console.log(result);
|
||||
console.log("Finished parsing");
|
||||
done();
|
||||
});
|
||||
|
||||
//record_parsed will be emitted each time a row has been parsed.
|
||||
csvConverter.on("record_parsed", function(resultRow, rawRow, rowIndex) {
|
||||
|
||||
for (var key in resultRow) {
|
||||
if (!result[key] || !result[key] instanceof Array) {
|
||||
result[key] = [];
|
||||
}
|
||||
result[key][rowIndex] = resultRow[key];
|
||||
}
|
||||
|
||||
});
|
||||
rs.pipe(csvConverter);
|
||||
```
|
||||
|
||||
Here is an example:
|
||||
|
||||
```csv
|
||||
TIMESTAMP,UPDATE,UID,BYTES SENT,BYTES RCVED
|
||||
1395426422,n,10028,1213,5461
|
||||
1395426422,n,10013,9954,13560
|
||||
1395426422,n,10109,221391500,141836
|
||||
1395426422,n,10007,53448,308549
|
||||
1395426422,n,10022,15506,72125
|
||||
```
|
||||
|
||||
It will be converted to:
|
||||
|
||||
```json
|
||||
{
|
||||
"TIMESTAMP": ["1395426422", "1395426422", "1395426422", "1395426422", "1395426422"],
|
||||
"UPDATE": ["n", "n", "n", "n", "n"],
|
||||
"UID": ["10028", "10013", "10109", "10007", "10022"],
|
||||
"BYTES SENT": ["1213", "9954", "221391500", "53448", "15506"],
|
||||
"BYTES RCVED": ["5461", "13560", "141836", "308549", "72125"]
|
||||
}
|
||||
```
|
||||
|
||||
# Hooks
|
||||
## preProcessRaw
|
||||
This hook is called when parser received any data from upper stream and allow developers to change it. e.g.
|
||||
```js
|
||||
/*
|
||||
CSV data:
|
||||
a,b,c,d,e
|
||||
12,e3,fb,w2,dd
|
||||
*/
|
||||
|
||||
var conv=new Converter();
|
||||
conv.preProcessRaw=function(data,cb){
|
||||
//change all 12 to 23
|
||||
cb(data.replace("12","23"));
|
||||
}
|
||||
conv.fromString(csv,function(err,json){
|
||||
//json:{a:23 ....}
|
||||
})
|
||||
```
|
||||
By default, the preProcessRaw just returns the data from the source
|
||||
```js
|
||||
Converter.prototype.preProcessRaw=function(data,cb){
|
||||
cb(data);
|
||||
}
|
||||
```
|
||||
It is also very good to sanitise/prepare the CSV data stream.
|
||||
```js
|
||||
var headWhiteSpaceRemoved=false;
|
||||
conv.preProcessRaw=function(data,cb){
|
||||
if (!headWhiteSpaceRemoved){
|
||||
data=data.replace(/^\s+/,"");
|
||||
cb(data);
|
||||
}else{
|
||||
cb(data);
|
||||
}
|
||||
}
|
||||
```
|
||||
## preProcessLine
|
||||
this hook is called when a file line is emitted. It is called with two parameters `fileLineData,lineNumber`. The `lineNumber` is starting from 1.
|
||||
```js
|
||||
/*
|
||||
CSV data:
|
||||
a,b,c,d,e
|
||||
12,e3,fb,w2,dd
|
||||
*/
|
||||
|
||||
var conv=new Converter();
|
||||
conv.preProcessLine=function(line,lineNumber){
|
||||
//only change 12 to 23 for line 2
|
||||
if (lineNumber === 2){
|
||||
line=line.replace("12","23");
|
||||
}
|
||||
return line;
|
||||
}
|
||||
conv.fromString(csv,function(err,json){
|
||||
//json:{a:23 ....}
|
||||
})
|
||||
```
|
||||
Notice that preProcessLine does not support async changes not like preProcessRaw hook.
|
||||
|
||||
|
||||
# Events
|
||||
|
||||
Following events are used for Converter class:
|
||||
|
||||
* end_parsed: It is emitted when parsing finished. the callback function will contain the JSON object if constructResult is set to true.
|
||||
* record_parsed: it is emitted each time a row has been parsed. The callback function has following parameters: result row JSON object reference, Original row array object reference, row index of current row in csv (header row does not count, first row content will start from 0)
|
||||
|
||||
To subscribe the event:
|
||||
|
||||
```js
|
||||
//Converter Class
|
||||
var Converter=require("csvtojson").Converter;
|
||||
|
||||
//end_parsed will be emitted once parsing finished
|
||||
csvConverter.on("end_parsed",function(jsonObj){
|
||||
console.log(jsonObj); //here is your result json object
|
||||
});
|
||||
|
||||
//record_parsed will be emitted each time a row has been parsed.
|
||||
csvConverter.on("record_parsed",function(resultRow,rawRow,rowIndex){
|
||||
console.log(resultRow); //here is your result json object
|
||||
});
|
||||
```
|
||||
|
||||
# Flags
|
||||
|
||||
There are flags in the library:
|
||||
|
||||
\*omit\*: Omit a column. The values in the column will not be built into JSON result.
|
||||
|
||||
\*flat\*: Mark a head column as is the key of its JSON result.
|
||||
|
||||
Example:
|
||||
|
||||
```csv
|
||||
*flat*user.name, user.age, *omit*user.gender
|
||||
Joe , 40, Male
|
||||
```
|
||||
|
||||
It will be converted to:
|
||||
|
||||
```js
|
||||
[{
|
||||
"user.name":"Joe",
|
||||
"user":{
|
||||
"age":40
|
||||
}
|
||||
}]
|
||||
```
|
||||
|
||||
# Big CSV File
|
||||
csvtojson library was designed to accept big csv file converting. To avoid memory consumption, it is recommending to use read stream and write stream.
|
||||
|
||||
```js
|
||||
var Converter=require("csvtojson").Converter;
|
||||
var csvConverter=new Converter({constructResult:false}); // The parameter false will turn off final result construction. It can avoid huge memory consumption while parsing. The trade off is final result will not be populated to end_parsed event.
|
||||
|
||||
var readStream=require("fs").createReadStream("inputData.csv");
|
||||
|
||||
var writeStream=require("fs").createWriteStream("outpuData.json");
|
||||
|
||||
readStream.pipe(csvConverter).pipe(writeStream);
|
||||
```
|
||||
|
||||
The constructResult:false will tell the constructor not to combine the final result which would drain the memory as progressing. The output is piped directly to writeStream.
|
||||
|
||||
# Convert Big CSV File with Command line tool
|
||||
csvtojson command line tool supports streaming in big csv file and stream out json file.
|
||||
|
||||
It is very convenient to process any kind of big csv file. It's proved having no issue to proceed csv files over 3,000,000 lines (over 500MB) with memory usage under 30MB.
|
||||
|
||||
Once you have installed [csvtojson](#installation), you could use the tool with command:
|
||||
|
||||
```
|
||||
csvtojson [path to bigcsvdata] > converted.json
|
||||
```
|
||||
|
||||
Or if you prefer streaming data in from another application:
|
||||
|
||||
```
|
||||
cat [path to bigcsvdata] | csvtojson > converted.json
|
||||
```
|
||||
|
||||
They will do the same job.
|
||||
|
||||
|
||||
|
||||
# Parse String
|
||||
To parse a string, simply call fromString(csvString,callback) method. The callback parameter is optional.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
var testData=__dirname+"/data/testData";
|
||||
var data=fs.readFileSync(testData).toString();
|
||||
var csvConverter=new CSVConverter();
|
||||
|
||||
//end_parsed will be emitted once parsing finished
|
||||
csvConverter.on("end_parsed", function(jsonObj) {
|
||||
//final result poped here as normal.
|
||||
});
|
||||
csvConverter.fromString(data,function(err,jsonObj){
|
||||
if (err){
|
||||
//err handle
|
||||
}
|
||||
console.log(jsonObj);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
# Empowered JSON Parser
|
||||
|
||||
*Note: If you want to maintain the original CSV data header values as JSON keys "as is" without being
|
||||
interpreted as (complex) JSON structures you can set the option `--flatKeys=true`.*
|
||||
|
||||
Since version 0.3.8, csvtojson now can replicate any complex JSON structure.
|
||||
As we know, JSON object represents a graph while CSV is only 2-dimension data structure (table).
|
||||
To make JSON and CSV containing same amount information, we need "flatten" some information in JSON.
|
||||
|
||||
Here is an example. Original CSV:
|
||||
|
||||
```csv
|
||||
fieldA.title, fieldA.children[0].name, fieldA.children[0].id,fieldA.children[1].name, fieldA.children[1].employee[].name,fieldA.children[1].employee[].name, fieldA.address[],fieldA.address[], description
|
||||
Food Factory, Oscar, 0023, Tikka, Tim, Joe, 3 Lame Road, Grantstown, A fresh new food factory
|
||||
Kindom Garden, Ceil, 54, Pillow, Amst, Tom, 24 Shaker Street, HelloTown, Awesome castle
|
||||
|
||||
```
|
||||
The data above contains nested JSON including nested array of JSON objects and plain texts.
|
||||
|
||||
Using csvtojson to convert, the result would be like:
|
||||
|
||||
```json
|
||||
[{
|
||||
"fieldA": {
|
||||
"title": "Food Factory",
|
||||
"children": [{
|
||||
"name": "Oscar",
|
||||
"id": "0023"
|
||||
}, {
|
||||
"name": "Tikka",
|
||||
"employee": [{
|
||||
"name": "Tim"
|
||||
}, {
|
||||
"name": "Joe"
|
||||
}]
|
||||
}],
|
||||
"address": ["3 Lame Road", "Grantstown"]
|
||||
},
|
||||
"description": "A fresh new food factory"
|
||||
}, {
|
||||
"fieldA": {
|
||||
"title": "Kindom Garden",
|
||||
"children": [{
|
||||
"name": "Ceil",
|
||||
"id": "54"
|
||||
}, {
|
||||
"name": "Pillow",
|
||||
"employee": [{
|
||||
"name": "Amst"
|
||||
}, {
|
||||
"name": "Tom"
|
||||
}]
|
||||
}],
|
||||
"address": ["24 Shaker Street", "HelloTown"]
|
||||
},
|
||||
"description": "Awesome castle"
|
||||
}]
|
||||
```
|
||||
|
||||
Here is the rule for CSV data headers:
|
||||
|
||||
* Use dot(.) to represent nested JSON. e.g. field1.field2.field3 will be converted to {field1:{field2:{field3:< value >}}}
|
||||
* Use square brackets([]) to represent an Array. e.g. field1.field2[< index >] will be converted to {field1:{field2:[< values >]}}. Different column with same header name will be added to same array.
|
||||
* Array could contain nested JSON object. e.g. field1.field2[< index >].name will be converted to {field1:{field2:[{name:< value >}]}}
|
||||
* The index could be omitted in some situation. However it causes information lost. Therefore Index should **NOT** be omitted if array contains JSON objects with more than 1 field (See example above fieldA.children[1].employee field, it is still ok if child JSON contains only 1 field).
|
||||
|
||||
Since 0.3.8, JSON parser is the default parser. It does not need to add "\*json\*" to column titles. Theoretically, the JSON parser now should have functionality of "Array" parser, "JSONArray" parser, and old "JSON" parser.
|
||||
|
||||
This mainly purposes on the next few versions where csvtojson could convert a JSON object back to CSV format without losing information.
|
||||
It can be used to process JSON data exported from no-sql database like MongoDB.
|
||||
|
||||
# Field Type
|
||||
|
||||
From version 0.3.14, type of fields are supported by csvtojson.
|
||||
The parameter checkType is used to whether to check and convert the field type.
|
||||
See [here](#params) for the parameter usage.
|
||||
|
||||
Thank all who have contributed to ticket [#20](https://github.com/Keyang/node-csvtojson/issues/20).
|
||||
|
||||
## Implict Type
|
||||
|
||||
When checkType is turned on, parser will try to convert value to its implicit type if it is not explicitly specified.
|
||||
|
||||
For example, csv data:
|
||||
```csv
|
||||
name, age, married, msg
|
||||
Tom, 12, false, {"hello":"world","total":23}
|
||||
|
||||
```
|
||||
Will be converted into:
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"Tom",
|
||||
"age":12,
|
||||
"married":false,
|
||||
"msg":{
|
||||
"hello":"world",
|
||||
"total":"23"
|
||||
}
|
||||
}
|
||||
```
|
||||
If checkType is turned **OFF**, it will be converted to:
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"Tom",
|
||||
"age":"12",
|
||||
"married":"false",
|
||||
"msg":"{\"hello\":\"world\",\"total\":23}"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Explicit Type
|
||||
CSV header column can explicitly define the type of the field.
|
||||
Simply add type before column name with a hash and exclaimation (#!).
|
||||
|
||||
### Supported types:
|
||||
* string
|
||||
* number
|
||||
|
||||
### Define Type
|
||||
To define the field type, see following example
|
||||
|
||||
```csv
|
||||
string#!appNumber, string#!finished, *flat*string#!user.msg, unknown#!msg
|
||||
201401010002, true, {"hello":"world","total":23},a message
|
||||
```
|
||||
The data will be converted to:
|
||||
|
||||
```json
|
||||
{
|
||||
"appNumber":"201401010002",
|
||||
"finished":"true",
|
||||
"user.msg":"{\"hello\":\"world\",\"total\":23}"
|
||||
}
|
||||
```
|
||||
|
||||
## Multi-CPU (Core)
|
||||
Since version 0.4.0, csvtojson supports multiple CPU cores to process large csv files.
|
||||
The implementation and benchmark result can be found [here](http://keyangxiang.com/2015/06/11/node-js-multi-core-programming-pracitse/).
|
||||
|
||||
To enable multi-core, just pass the worker number as parameter of constructor:
|
||||
|
||||
```js
|
||||
var Converter=require("csvtojson").Converter;
|
||||
var converter=new Converter({
|
||||
workerNum:2 //use two cores
|
||||
});
|
||||
```
|
||||
The minimum worker number is 1. When worker number is larger than 1, the parser will balance the job load among workers.
|
||||
|
||||
For command line, to use worker just use ```--workerNum``` argument:
|
||||
|
||||
```
|
||||
csvtojson --workerNum=3 ./myfile.csv
|
||||
```
|
||||
|
||||
It is worth to mention that for small size of CSV file it actually costs more time to create processes and keep the communication between them. Therefore, use less workers for small CSV files.
|
||||
|
||||
### Fork Process (Deprecated since 0.5.0)
|
||||
*Node.JS is running on single thread. You will not want to convert a large csv file on the same process where your node.js webserver is running. csvtojson gives an option to fork the whole conversion process to a new system process while the origin process will only pipe the input and result in and out. It very simple to enable this feature:
|
||||
|
||||
```js
|
||||
var Converter=require("csvtojson").Converter;
|
||||
var converter=new Converter({
|
||||
fork:true //use child process to convert
|
||||
});
|
||||
```
|
||||
Same as multi-workers, fork a new process will cause extra cost on process communication and life cycle management. Use it wisely.*
|
||||
|
||||
Since 0.5.0, fork=true is the same as workerNum=2.
|
||||
|
||||
### Header configuration
|
||||
|
||||
CSV header row can be configured programmatically.
|
||||
|
||||
the *noheader* parameter indicate if first row of csv is header row or not. e.g. CSV data:
|
||||
|
||||
```
|
||||
CC102-PDMI-001,eClass_5.1.3,10/3/2014,12,40,green,40
|
||||
CC200-009-001,eClass_5.1.3,11/3/2014,5,3,blue,38,extra field!
|
||||
```
|
||||
|
||||
With noheader=true
|
||||
|
||||
```
|
||||
csvtojson ./test/data/noheadercsv --noheader=true
|
||||
```
|
||||
|
||||
we can get following result:
|
||||
|
||||
```json
|
||||
[
|
||||
{"field1":"CC102-PDMI-001","field2":"eClass_5.1.3","field3":"10/3/2014","field4":"12","field5":"40","field6":"green","field7":"40"},
|
||||
{"field1":"CC200-009-001","field2":"eClass_5.1.3","field3":"11/3/2014","field4":"5","field5":"3","field6":"blue","field7":"38","field8":"extra field!"}
|
||||
]
|
||||
```
|
||||
|
||||
or we can use it in code:
|
||||
|
||||
```js
|
||||
var converter=new require("csvtojson").Converter({noheader:true});
|
||||
```
|
||||
|
||||
the *headers* parameter specify the header row in an array. If *noheader* is false, this value will override csv header row. With csv data above, run command:
|
||||
|
||||
```
|
||||
csvtojson ./test/data/noheadercsv --noheader=true --headers='["hell","csv"]'
|
||||
```
|
||||
|
||||
we get following results:
|
||||
|
||||
```json
|
||||
[
|
||||
{"hell":"CC102-PDMI-001","csv":"eClass_5.1.3","field3":"10/3/2014","field4":"12","field5":"40","field6":"green","field7":"40"},
|
||||
{"hell":"CC200-009-001","csv":"eClass_5.1.3","field3":"11/3/2014","field4":"5","field5":"3","field6":"blue","field7":"38","field8":"extra field!"}
|
||||
]
|
||||
```
|
||||
|
||||
If length of headers array is smaller than the column of csv, converter will automatically fill the column with "field*". where * is current column index starting from 1.
|
||||
|
||||
Also we can use it in code:
|
||||
|
||||
```js
|
||||
var converter=new require("csvtojson").Converter({headers:["my header1","hello world"]});
|
||||
```
|
||||
|
||||
# Error handling
|
||||
|
||||
Since version 0.4.4, parser detects CSV data corruption. It is important to catch those erros if CSV data is not guranteed correct. Just simply register a listener to error event:
|
||||
|
||||
```js
|
||||
var converter=new require("csvtojson").Converter();
|
||||
converter.on("error",function(errMsg,errData){
|
||||
//do error handling here
|
||||
});
|
||||
```
|
||||
|
||||
Once an error is emitted, the parser will continously parse csv data if up stream is still populating data. Therefore, a general practise is to close / destroy up stream once error is captured.
|
||||
|
||||
Here are built-in error messages and corresponding error data:
|
||||
|
||||
* unclosed_quote: If quote in csv is not closed, this error will be populated. The error data is a string which contains un-closed csv row.
|
||||
* row_exceed: If maxRowLength is given a number larger than 0 and a row is longer than the value, this error will be populated. The error data is a string which contains the csv row exceeding the length.
|
||||
* row_process: Any error happened while parser processing a csv row will populate this error message. The error data is detailed error message (e.g. checkColumn is true and column size of a row does not match that of header).
|
||||
|
||||
|
||||
# Parser
|
||||
|
||||
** Parser will be replaced by [Result Transform](#result-transform) and [Flags](#flags) **
|
||||
|
||||
This feature will be disabled in future.
|
||||
|
||||
CSVTOJSON allows adding customised parsers which concentrating on what to parse and how to parse.
|
||||
It is the main power of the tool that developer only needs to concentrate on how to deal with the data and other concerns like streaming, memory, web, cli etc are done automatically.
|
||||
|
||||
How to add a customised parser:
|
||||
|
||||
```js
|
||||
//Parser Manager
|
||||
var parserMgr=require("csvtojson").parserMgr;
|
||||
|
||||
parserMgr.addParser("myParserName",/^\*parserRegExp\*/,function (params){
|
||||
var columnTitle=params.head; //params.head be like: *parserRegExp*ColumnName;
|
||||
var fieldName=columnTitle.replace(this.regExp, ""); //this.regExp is the regular expression above.
|
||||
params.resultRow[fieldName]="Hello my parser"+params.item;
|
||||
});
|
||||
```
|
||||
|
||||
parserMgr's addParser function take three parameters:
|
||||
|
||||
1. parser name: the name of your parser. It should be unique.
|
||||
|
||||
2. Regular Expression: It is used to test if a column of CSV data is using this parser. In the example above any column's first row starting with *parserRegExp* will be using it.
|
||||
|
||||
3. Parse function call back: It is where the parse happens. The converter works row by row and therefore the function will be called each time needs to parse a cell in CSV data.
|
||||
|
||||
The parameter of Parse function is a JSON object. It contains following fields:
|
||||
|
||||
**head**: The column's first row's data. It generally contains field information. e.g. *array*items
|
||||
|
||||
**item**: The data inside current cell. e.g. item1
|
||||
|
||||
**itemIndex**: the index of current cell of a row. e.g. 0
|
||||
|
||||
**rawRow**: the reference of current row in array format. e.g. ["item1", 23 ,"hello"]
|
||||
|
||||
**resultRow**: the reference of result row in JSON format. e.g. {"name":"Joe"}
|
||||
|
||||
**rowIndex**: the index of current row in CSV data. start from 1 since 0 is the head. e.g. 1
|
||||
|
||||
**resultObject**: the reference of result object in JSON format. It always has a field called csvRows which is in Array format. It changes as parsing going on. e.g.
|
||||
|
||||
```json
|
||||
{
|
||||
"csvRows":[
|
||||
{
|
||||
"itemName":"item1",
|
||||
"number":10
|
||||
},
|
||||
{
|
||||
"itemName":"item2",
|
||||
"number":4
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
#Stream Options
|
||||
Since version 1.0.0, the Converter constructor takes stream options as second parameter.
|
||||
|
||||
```js
|
||||
const conv=new Converter(params,{
|
||||
objectMode:true, // stream down JSON object instead of JSON array
|
||||
highWaterMark:65535 //Buffer level
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
See more detailed information [here](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
|
||||
#Change Log
|
||||
|
||||
## 1.1.0
|
||||
|
||||
* Remove support of `new Converter(true)`
|
||||
|
||||
## 1.0.2
|
||||
* supported ndjson format as per #113 and #87
|
||||
* issue: #120
|
||||
|
||||
## 1.0.0
|
||||
* Add [Stream Options](#stream-options)
|
||||
* Change version syntax to follow x.y.z
|
||||
|
||||
## 0.5.12
|
||||
* Added support for scientific notation number support (#100)
|
||||
* Added "off" option to quote parameter
|
||||
|
||||
## 0.5.4
|
||||
* Added new feature: accept special delimiter "auto" and array
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Changed type separator from # to #!
|
||||
* Fixed bugs
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Fixed some bugs
|
||||
* Performance improvement
|
||||
* **Implicity type for numbers now use RegExp:/^[-+]?[0-9]*\.?[0-9]+$/. Previously 00131 is a string now will be recognised as number type**
|
||||
* **If a column has no head, now it will use current column index as column name: 'field*'. previously parser uses a fixed index starting from 1. e.g. csv data: 'aa,bb,cc' with head 'a,b'. previously it will convert to {'a':'aa','b':'bb','field1':'cc'} and now it is {'a':'aa','b':'bb','field3':'cc'}**
|
||||
|
||||
## 0.4.7
|
||||
* ignoreEmpty now ignores empty rows as well
|
||||
* optimised performance
|
||||
* added fromFile method
|
||||
|
||||
## 0.4.4
|
||||
* Add error handling for corrupted CSV data
|
||||
* Exposed "eol" param
|
||||
|
||||
## 0.4.3
|
||||
* Added header configuration
|
||||
* Refactored worker code
|
||||
* **Number type field now returns 0 if parseFloat returns NaN with the value of the field. Previously it returns original value in string.**
|
||||
|
||||
## 0.4.0
|
||||
* Added Multi-core CPU support to increase performance
|
||||
* Added "fork" option to delegate csv converting work to another process.
|
||||
* Refactoring general flow
|
||||
|
||||
## 0.3.21
|
||||
* Refactored Command Line Tool.
|
||||
* Added ignoreEmpty parameter.
|
||||
|
||||
## 0.3.18
|
||||
* Fixed double qoute parse as per CSV standard.
|
||||
|
||||
## 0.3.14
|
||||
* Added field type support
|
||||
* Fixed some minor bugs
|
||||
|
||||
## 0.3.8
|
||||
* Empowered built-in JSON parser.
|
||||
* Change: Use JSON parser as default parser.
|
||||
* Added parameter trim in constructor. default: true. trim will trim content spaces.
|
||||
|
||||
## 0.3.5
|
||||
* Added fromString method to support direct string input
|
||||
|
||||
## 0.3.4
|
||||
* Added more parameters to command line tool.
|
||||
|
||||
## 0.3.2
|
||||
* Added quote in parameter to support quoted column content containing delimiters
|
||||
* Changed row index starting from 0 instead of 1 when populated from record_parsed event
|
||||
|
||||
## 0.3
|
||||
* Removed all dependencies
|
||||
* Deprecated applyWebServer
|
||||
* Added construct parameter for Converter Class
|
||||
* Converter Class now works as a proper stream object
|
||||
|
||||
# IMPORTANT!!
|
||||
Since version 0.3, the core class of csvtojson has been inheriting from stream.Transform class. Therefore, it will behave like a normal Stream object and CSV features will not be available any more. Now the usage is like:
|
||||
```js
|
||||
//Converter Class
|
||||
var fs = require("fs");
|
||||
var Converter = require("csvtojson").Converter;
|
||||
var fileStream = fs.createReadStream("./file.csv");
|
||||
//new converter instance
|
||||
var converter = new Converter({constructResult:true});
|
||||
//end_parsed will be emitted once parsing finished
|
||||
converter.on("end_parsed", function (jsonObj) {
|
||||
console.log(jsonObj); //here is your result json object
|
||||
});
|
||||
//read from file
|
||||
fileStream.pipe(converter);
|
||||
```
|
||||
|
||||
To convert from a string, previously the code was:
|
||||
```js
|
||||
csvConverter.from(csvString);
|
||||
```
|
||||
|
||||
Now it is:
|
||||
```js
|
||||
csvConverter.fromString(csvString, callback);
|
||||
```
|
||||
|
||||
The callback function above is optional. see [Parse String](#parse-string).
|
||||
|
||||
After version 0.3, csvtojson requires node 0.10 and above.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../../src/internal/observable/concat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AA4G9B,MAAM,UAAU,MAAM,CAAC,GAAG,IAAW;IACnC,OAAO,SAAS,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E F CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB EC FC","33":"B C K L G M N O w g x y","164":"I v J D E F A"},D:{"1":"0 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 XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v J D E F","33":"y z","164":"O w g x","420":"A B C K L G M N"},E:{"1":"D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC","33":"J"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB 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","2":"F B C PC QC RC SC qB AC TC rB"},G:{"1":"E XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC","33":"WC"},H:{"2":"oC"},I:{"1":"f tC uC","2":"tB I pC qC rC sC BC"},J:{"1":"A","2":"D"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"requestAnimationFrame"};
|
||||
@@ -0,0 +1,6 @@
|
||||
export declare function transform(patterns: string[]): string[];
|
||||
/**
|
||||
* This package only works with forward slashes as a path separator.
|
||||
* Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
|
||||
*/
|
||||
export declare function removeDuplicateSlashes(pattern: string): string;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
type Resolver<T> = () => Promise<T>;
|
||||
type Headers = Record<string, string>;
|
||||
type Config = {
|
||||
BASE: string;
|
||||
VERSION: string;
|
||||
WITH_CREDENTIALS: boolean;
|
||||
TOKEN?: string | Resolver<string>;
|
||||
USERNAME?: string | Resolver<string>;
|
||||
PASSWORD?: string | Resolver<string>;
|
||||
HEADERS?: Headers | Resolver<Headers>;
|
||||
};
|
||||
export declare const OpenAPI: Config;
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"source-map","version":"0.6.1","files":{"package.json":{"checkedAt":1678883669900,"integrity":"sha512-8OpaUBxEIbj+aSdkZaFL6URPcewJ6yBHfmeFXgPQIZtWT5SNJ3BPXbdgyp70PXZEAln7lzGTYiZBqWIKeBx8Tw==","mode":420,"size":2579},"README.md":{"checkedAt":1678883669901,"integrity":"sha512-YMg8xgVBbN/qs2GD1w3nq8mprjgdVl3yGGLSeH7WyH/UxcIjmNiNI8kFXM1bvwKZGwIDIGsUqxuqpcpD3i0BTA==","mode":420,"size":24072},"LICENSE":{"checkedAt":1678883669496,"integrity":"sha512-a4quda6qIVBUjYbx8AJc7J3bx9+jwfUeh96Hch7GTvMbYNorBIcYOMqVHOobuDrw3FGKsW0I5TNBGdEq703iew==","mode":420,"size":1526},"source-map.js":{"checkedAt":1678883669588,"integrity":"sha512-C+oUuncUn7WIh8JI4Kvc24krlT3unZRwf7QZT7rsPmr6E7qcWEblKXbDRE/dEqJqepjNjH+r3BZv+MmOKUw6TQ==","mode":420,"size":405},"lib/array-set.js":{"checkedAt":1678883669579,"integrity":"sha512-/Ou0vVc0wZWT/wWuMPXJbSv3GHGF6gsYKDtzs/ej89xwTeuExiZakM8lbyeM9qXo4Vw+j3nyjQOLbVoTqBKr6g==","mode":420,"size":3197},"lib/base64-vlq.js":{"checkedAt":1678883669579,"integrity":"sha512-4iW04DK4voFlS0PnPjjRYsxEn4D16ha5f4d1mAgxfAIsm2DNwMEZ7WvX5p23u4NZt0K/APdoGXtbiMRhnowm4g==","mode":420,"size":4714},"lib/base64.js":{"checkedAt":1678883669579,"integrity":"sha512-+JZQPKYAvOuuLKlL9dQZPekes34WSJ3fPddKQ6ljF2muTTs8W5UvvmkgSOk/hHSAlD7C0wDum6T5OCh+uDoBIQ==","mode":420,"size":1540},"lib/binary-search.js":{"checkedAt":1678883669581,"integrity":"sha512-rJG62wV+zBLl+zcBJBTbBRyNnDU4npBQeZEfibzxIokkn241CAyLp7MjCGXFG9YhB8ggUROfm7xcsN8FkjtuDA==","mode":420,"size":4249},"lib/mapping-list.js":{"checkedAt":1678883669581,"integrity":"sha512-IGMtpwSL9QukmC3s3uaNHg7NHaUql5+bXdCJHPutUrs0tLyS30Zsbbf6WMnAEbnner0g5oA+LuG4TPuP0JnHew==","mode":420,"size":2339},"lib/quick-sort.js":{"checkedAt":1678883669901,"integrity":"sha512-R/zhtorikAAALM/ShyeSLBOKPyFrH7QRUorMli/shQSS47G8jHs2N0skejQnZ+1JmBYg3AsGX2k9zeyWF8S+bQ==","mode":420,"size":3616},"lib/source-map-consumer.js":{"checkedAt":1678883669902,"integrity":"sha512-Sb77Z6Xcii7GGFiOCdlFcDi+pAs+jXRT0wvvcgpjj12sEUlheHkdHX+sLEb+v3YfxYo1Qztxzr9KvHqbUsofaw==","mode":420,"size":40562},"lib/source-map-generator.js":{"checkedAt":1678883669588,"integrity":"sha512-cGHpiluhtBGOcYpA3Z2Xc/2KzfeDtCKnwiRlEnPm1QUOK5frhPFa9VigNlvrF83AZC/TGVb+Yetv12GI6KvWbA==","mode":420,"size":14356},"lib/source-node.js":{"checkedAt":1678883669589,"integrity":"sha512-p+PQSP1b8COp/v3bAS9K1KLCSWu0vnfaV+So4LF9LkRyzuaO7hk0x1Mbg1uS+kKVU7WAbrl5A4MNCxyqyoQjng==","mode":420,"size":13808},"lib/util.js":{"checkedAt":1678883669902,"integrity":"sha512-fOOF3165Yhu7O12OGsDTs1tCyDbaWOE005nSqk3seAB1KE9JiJPtkeVsmPyTW3g60yIJN3Gb2ckhcnyrz1fCSw==","mode":420,"size":12950},"CHANGELOG.md":{"checkedAt":1678883669902,"integrity":"sha512-6I6dkJk40cTYYZCGqR30R8Xc+LGIUgU37p9PShUBfUfJMMnd4PsA1HgS+d0F7qxmdPKrchPlfzWe9BV1Iydz+A==","mode":420,"size":7884},"source-map.d.ts":{"checkedAt":1678883669902,"integrity":"sha512-0l7X8qZ4mCnSaS85hIxgq3DSOL/sBEq94ztue5PAC90iQQaIfC6y/TFmA3tIHbP1Fn1WGn59lkC3vqNF1/1hEw==","mode":420,"size":3060},"dist/source-map.debug.js":{"checkedAt":1678883669929,"integrity":"sha512-mcJqVD4kUF6QxGC0z3OyZ6JbFrKJtbXbmpAySOSbdCf1BSuC23TyYcOOVLUMIrkq7CmvpujRLcB4x+USiCIAMw==","mode":420,"size":272874},"dist/source-map.js":{"checkedAt":1678883669932,"integrity":"sha512-i3+PCaIZTWUVEh0bPVCmUFpAXrP3BfsrFpUGYA6h+EVB8db1h/fAjNYJ9UP/hyVcaL2h/2muNiWCpwVxF8q+SA==","mode":420,"size":106973},"dist/source-map.min.js":{"checkedAt":1678883669932,"integrity":"sha512-pLEMGlEhsjRLxAmse76JKNLF+57ZEAuKaL4tANXVTcDrF8be8pwCZblLPY2PnbAWc9UTScXPtve2REpcs8NlIg==","mode":420,"size":27111},"dist/source-map.min.js.map":{"checkedAt":1678883669937,"integrity":"sha512-jk/fkBFXgdt0c+FCMaN3riB9+3YqGaUeg42OME0Sqdwymr3fgi8g8P7JRo3KRWy5xDnH3a5ADL8qcFLe/uDw3w==","mode":420,"size":257409}}}
|
||||
@@ -0,0 +1,61 @@
|
||||
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
|
||||
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
|
||||
|
||||
# The files that need updating when incrementing the version number.
|
||||
VERSIONED_FILES := *.js *.json README*
|
||||
|
||||
|
||||
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
|
||||
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
|
||||
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
|
||||
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
|
||||
UTILS := semver
|
||||
# Make sure that all required utilities can be located.
|
||||
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
|
||||
|
||||
# Default target (by virtue of being the first non '.'-prefixed in the file).
|
||||
.PHONY: _no-target-specified
|
||||
_no-target-specified:
|
||||
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
|
||||
|
||||
# Lists all targets defined in this makefile.
|
||||
.PHONY: list
|
||||
list:
|
||||
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
|
||||
|
||||
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
|
||||
.PHONY: test
|
||||
test:
|
||||
@npm test
|
||||
|
||||
.PHONY: _ensure-tag
|
||||
_ensure-tag:
|
||||
ifndef TAG
|
||||
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
|
||||
endif
|
||||
|
||||
CHANGELOG_ERROR = $(error No CHANGELOG specified)
|
||||
.PHONY: _ensure-changelog
|
||||
_ensure-changelog:
|
||||
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
|
||||
|
||||
# Ensures that the git workspace is clean.
|
||||
.PHONY: _ensure-clean
|
||||
_ensure-clean:
|
||||
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
|
||||
|
||||
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
|
||||
.PHONY: release
|
||||
release: _ensure-tag _ensure-changelog _ensure-clean
|
||||
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
|
||||
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
|
||||
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
|
||||
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
|
||||
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
|
||||
else \
|
||||
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
|
||||
fi; \
|
||||
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
|
||||
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
|
||||
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
|
||||
git tag -a -m "v$$new_ver" "v$$new_ver"
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (value) {
|
||||
value = Number(value);
|
||||
if (isNaN(value) || value === 0) return value;
|
||||
return value > 0 ? 1 : -1;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export declare function clone(val: any): any;
|
||||
@@ -0,0 +1,11 @@
|
||||
import assertString from './util/assertString';
|
||||
var magnetURIComponent = /(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i;
|
||||
export default function isMagnetURI(url) {
|
||||
assertString(url);
|
||||
|
||||
if (url.indexOf('magnet:?') !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return magnetURIComponent.test(url);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"timerHandle.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduler/timerHandle.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./xorWith');
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Octokit as Octokit$1 } from '@octokit/core';
|
||||
import { requestLog } from '@octokit/plugin-request-log';
|
||||
import { paginateRest } from '@octokit/plugin-paginate-rest';
|
||||
import { legacyRestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods';
|
||||
|
||||
const VERSION = "19.0.7";
|
||||
|
||||
const Octokit = Octokit$1.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults({
|
||||
userAgent: `octokit-rest.js/${VERSION}`,
|
||||
});
|
||||
|
||||
export { Octokit };
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"id-length": "off",
|
||||
"no-shadow": "off"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concatWith.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/concatWith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACxD,GAAG,YAAY,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAC5C,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAEpC"}
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.immediate=e()}}(function(){return function e(n,t,o){function r(f,u){if(!t[f]){if(!n[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(i)return i(f,!0);var d=new Error("Cannot find module '"+f+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[f]={exports:{}};n[f][0].call(s.exports,function(e){var t=n[f][1][e];return r(t?t:e)},s,s.exports,e,n,t,o)}return t[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)r(o[f]);return r}({1:[function(e,n,t){(function(e){"use strict";function t(){s=!0;for(var e,n,t=c.length;t;){for(n=c,c=[],e=-1;++e<t;)n[e]();t=c.length}s=!1}function o(e){1!==c.push(e)||s||r()}var r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var f=0,u=new i(t),a=e.document.createTextNode("");u.observe(a,{characterData:!0}),r=function(){a.data=f=++f%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var n=e.document.createElement("script");n.onreadystatechange=function(){t(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},e.document.documentElement.appendChild(n)}:function(){setTimeout(t,0)};else{var d=new e.MessageChannel;d.port1.onmessage=t,r=function(){d.port2.postMessage(0)}}var s,c=[];n.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
||||
@@ -0,0 +1,415 @@
|
||||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
/**
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
type Level = 0 | 1 | 2 | 3;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
type Instance = new (options?: Options) => Chalk;
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: chalk.Level;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
if (typeof globalThis !== "object") return false;
|
||||
if (!globalThis) return false;
|
||||
return globalThis.Array === Array;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
PipelineProcessor,
|
||||
PipelineProcessorProps,
|
||||
ProcessorType,
|
||||
} from '../processor';
|
||||
import { StorageResponse } from '../../storage/storage';
|
||||
import { TCell, TwoDArray } from '../../types';
|
||||
import Header from '../../header';
|
||||
export interface ArrayResponse {
|
||||
data: TwoDArray<TCell>;
|
||||
total: number;
|
||||
}
|
||||
interface StorageResponseToArrayTransformerProps
|
||||
extends PipelineProcessorProps {
|
||||
header: Header;
|
||||
}
|
||||
declare class StorageResponseToArrayTransformer extends PipelineProcessor<
|
||||
ArrayResponse,
|
||||
StorageResponseToArrayTransformerProps
|
||||
> {
|
||||
get type(): ProcessorType;
|
||||
private castData;
|
||||
_process(storageResponse: StorageResponse): ArrayResponse;
|
||||
}
|
||||
export default StorageResponseToArrayTransformer;
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
const stream = require('stream');
|
||||
const tls = require('tls');
|
||||
|
||||
// Really awesome hack.
|
||||
const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor;
|
||||
|
||||
module.exports = JSStreamSocket;
|
||||
@@ -0,0 +1,44 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import { Octokit } from ".";
|
||||
export declare type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export interface OctokitOptions {
|
||||
authStrategy?: any;
|
||||
auth?: any;
|
||||
userAgent?: string;
|
||||
previews?: string[];
|
||||
baseUrl?: string;
|
||||
log?: {
|
||||
debug: (message: string) => unknown;
|
||||
info: (message: string) => unknown;
|
||||
warn: (message: string) => unknown;
|
||||
error: (message: string) => unknown;
|
||||
};
|
||||
request?: OctokitTypes.RequestRequestOptions;
|
||||
timeZone?: string;
|
||||
[option: string]: any;
|
||||
}
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export declare type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> = T extends AnyFunction ? ReturnType<T> : T extends AnyFunction[] ? UnionToIntersection<Exclude<ReturnType<T[number]>, void>> : never;
|
||||
/**
|
||||
* @author https://stackoverflow.com/users/2887218/jcalz
|
||||
* @see https://stackoverflow.com/a/50375286/10325032
|
||||
*/
|
||||
export declare type UnionToIntersection<Union> = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never;
|
||||
declare type AnyFunction = (...args: any) => any;
|
||||
export declare type OctokitPlugin = (octokit: Octokit, options: OctokitOptions) => {
|
||||
[key: string]: any;
|
||||
} | void;
|
||||
export declare type Hooks = {
|
||||
request: {
|
||||
Options: Required<OctokitTypes.EndpointDefaults>;
|
||||
Result: OctokitTypes.OctokitResponse<any>;
|
||||
Error: RequestError | Error;
|
||||
};
|
||||
[key: string]: {
|
||||
Options: unknown;
|
||||
Result: unknown;
|
||||
Error: unknown;
|
||||
};
|
||||
};
|
||||
export {};
|
||||
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = contains;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
var _toString = _interopRequireDefault(require("./util/toString"));
|
||||
|
||||
var _merge = _interopRequireDefault(require("./util/merge"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var defaulContainsOptions = {
|
||||
ignoreCase: false,
|
||||
minOccurrences: 1
|
||||
};
|
||||
|
||||
function contains(str, elem, options) {
|
||||
(0, _assertString.default)(str);
|
||||
options = (0, _merge.default)(options, defaulContainsOptions);
|
||||
|
||||
if (options.ignoreCase) {
|
||||
return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences;
|
||||
}
|
||||
|
||||
return str.split((0, _toString.default)(elem)).length > options.minOccurrences;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,55 @@
|
||||
// YAML error class. http://stackoverflow.com/questions/8458984
|
||||
//
|
||||
'use strict';
|
||||
|
||||
|
||||
function formatError(exception, compact) {
|
||||
var where = '', message = exception.reason || '(unknown reason)';
|
||||
|
||||
if (!exception.mark) return message;
|
||||
|
||||
if (exception.mark.name) {
|
||||
where += 'in "' + exception.mark.name + '" ';
|
||||
}
|
||||
|
||||
where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
|
||||
|
||||
if (!compact && exception.mark.snippet) {
|
||||
where += '\n\n' + exception.mark.snippet;
|
||||
}
|
||||
|
||||
return message + ' ' + where;
|
||||
}
|
||||
|
||||
|
||||
function YAMLException(reason, mark) {
|
||||
// Super constructor
|
||||
Error.call(this);
|
||||
|
||||
this.name = 'YAMLException';
|
||||
this.reason = reason;
|
||||
this.mark = mark;
|
||||
this.message = formatError(this, false);
|
||||
|
||||
// Include stack trace in error object
|
||||
if (Error.captureStackTrace) {
|
||||
// Chrome and NodeJS
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
// FF, IE 10+ and Safari 6+. Fallback for others
|
||||
this.stack = (new Error()).stack || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Inherit from Error
|
||||
YAMLException.prototype = Object.create(Error.prototype);
|
||||
YAMLException.prototype.constructor = YAMLException;
|
||||
|
||||
|
||||
YAMLException.prototype.toString = function toString(compact) {
|
||||
return this.name + ': ' + formatError(this, compact);
|
||||
};
|
||||
|
||||
|
||||
module.exports = YAMLException;
|
||||
@@ -0,0 +1,40 @@
|
||||
import { isFunction } from '../util/isFunction';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { identity } from '../util/identity';
|
||||
export function tap(observerOrNext, error, complete) {
|
||||
const tapObserver = isFunction(observerOrNext) || error || complete
|
||||
?
|
||||
{ next: observerOrNext, error, complete }
|
||||
: observerOrNext;
|
||||
return tapObserver
|
||||
? operate((source, subscriber) => {
|
||||
var _a;
|
||||
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
let isUnsub = true;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
var _a;
|
||||
(_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
|
||||
subscriber.next(value);
|
||||
}, () => {
|
||||
var _a;
|
||||
isUnsub = false;
|
||||
(_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
subscriber.complete();
|
||||
}, (err) => {
|
||||
var _a;
|
||||
isUnsub = false;
|
||||
(_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
|
||||
subscriber.error(err);
|
||||
}, () => {
|
||||
var _a, _b;
|
||||
if (isUnsub) {
|
||||
(_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
}
|
||||
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
||||
}));
|
||||
})
|
||||
:
|
||||
identity;
|
||||
}
|
||||
//# sourceMappingURL=tap.js.map
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transformer = void 0;
|
||||
const coffeescript_1 = __importDefault(require("coffeescript"));
|
||||
const transformer = ({ content, filename, options, }) => {
|
||||
const coffeeOptions = {
|
||||
filename,
|
||||
/*
|
||||
* Since `coffeescript` transpiles variables to `var` definitions, it uses a safety mechanism to prevent variables from bleeding to outside contexts. This mechanism consists of wrapping your `coffeescript` code inside an IIFE which, unfortunately, prevents `svelte` from finding your variables. To bypass this behavior, `svelte-preprocess` sets the [`bare` coffeescript compiler option](https://coffeescript.org/#lexical-scope) to `true`.
|
||||
*/
|
||||
bare: true,
|
||||
...options,
|
||||
};
|
||||
if (coffeeOptions.sourceMap) {
|
||||
const { js: code, sourceMap: map } = coffeescript_1.default.compile(content, coffeeOptions);
|
||||
return { code, map };
|
||||
}
|
||||
return { code: coffeescript_1.default.compile(content, coffeeOptions) };
|
||||
};
|
||||
exports.transformer = transformer;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC rB"},G:{"2":"zB UC BC VC","129":"E WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"tB I f sC BC tC uC","2":"pC","257":"qC rC"},J:{"1":"A","16":"D"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"516":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"16":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:2,C:"HTML Media Capture"};
|
||||
@@ -0,0 +1 @@
|
||||
export declare function isPlainObject(value: unknown): value is object;
|
||||
@@ -0,0 +1,19 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Filter extends Declaration {
|
||||
/**
|
||||
* Check is it Internet Explorer filter
|
||||
*/
|
||||
check(decl) {
|
||||
let v = decl.value
|
||||
return (
|
||||
!v.toLowerCase().includes('alpha(') &&
|
||||
!v.includes('DXImageTransform.Microsoft') &&
|
||||
!v.includes('data:image/svg+xml')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Filter.names = ['filter']
|
||||
|
||||
module.exports = Filter
|
||||
@@ -0,0 +1,7 @@
|
||||
interface Options {
|
||||
throwNotFound?: boolean;
|
||||
}
|
||||
declare function readFile(filepath: string, options?: Options): Promise<string | null>;
|
||||
declare function readFileSync(filepath: string, options?: Options): string | null;
|
||||
export { readFile, readFileSync };
|
||||
//# sourceMappingURL=readFile.d.ts.map
|
||||
@@ -0,0 +1,25 @@
|
||||
var basePick = require('./_basePick'),
|
||||
flatRest = require('./_flatRest');
|
||||
|
||||
/**
|
||||
* Creates an object composed of the picked `object` properties.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The source object.
|
||||
* @param {...(string|string[])} [paths] The property paths to pick.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
||||
*
|
||||
* _.pick(object, ['a', 'c']);
|
||||
* // => { 'a': 1, 'c': 3 }
|
||||
*/
|
||||
var pick = flatRest(function(object, paths) {
|
||||
return object == null ? {} : basePick(object, paths);
|
||||
});
|
||||
|
||||
module.exports = pick;
|
||||
@@ -0,0 +1,24 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* REQUIREMENT: This definition is dependent on the @types/node definition.
|
||||
* Install with `npm install @types/node --save-dev`
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'iconv-lite' {
|
||||
export function decode(buffer: Buffer, encoding: string, options?: Options): string;
|
||||
|
||||
export function encode(content: string, encoding: string, options?: Options): Buffer;
|
||||
|
||||
export function encodingExists(encoding: string): boolean;
|
||||
|
||||
export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
stripBOM?: boolean;
|
||||
addBOM?: boolean;
|
||||
defaultEncoding?: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./client/socksclient"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { run } = require('./run')
|
||||
|
||||
run(process.argv).catch(error => {
|
||||
console.log('\n')
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import is from '@sindresorhus/is';
|
||||
export default function urlToOptions(url) {
|
||||
// Cast to URL
|
||||
url = url;
|
||||
const options = {
|
||||
protocol: url.protocol,
|
||||
hostname: is.string(url.hostname) && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname,
|
||||
host: url.host,
|
||||
hash: url.hash,
|
||||
search: url.search,
|
||||
pathname: url.pathname,
|
||||
href: url.href,
|
||||
path: `${url.pathname || ''}${url.search || ''}`,
|
||||
};
|
||||
if (is.string(url.port) && url.port.length > 0) {
|
||||
options.port = Number(url.port);
|
||||
}
|
||||
if (url.username || url.password) {
|
||||
options.auth = `${url.username || ''}:${url.password || ''}`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
(function(N,O){"object"===typeof exports&&"undefined"!==typeof module?O(exports):"function"===typeof define&&define.amd?define(["exports"],O):N.async?O(N.neo_async=N.neo_async||{}):O(N.async=N.async||{})})(this,function(N){function O(a){var c=function(a){var d=J(arguments,1);setTimeout(function(){a.apply(null,d)})};T="function"===typeof setImmediate?setImmediate:c;"object"===typeof process&&"function"===typeof process.nextTick?(D=/^v0.10/.test(process.version)?T:process.nextTick,ba=/^v0/.test(process.version)?
|
||||
T:process.nextTick):ba=D=T;!1===a&&(D=function(a){a()})}function H(a){for(var c=-1,b=a.length,d=Array(b);++c<b;)d[c]=a[c];return d}function J(a,c){var b=-1,d=a.length-c;if(0>=d)return[];for(var e=Array(d);++b<d;)e[b]=a[b+c];return e}function L(a){for(var c=F(a),b=c.length,d=-1,e={};++d<b;){var f=c[d];e[f]=a[f]}return e}function U(a){for(var c=-1,b=a.length,d=[];++c<b;){var e=a[c];e&&(d[d.length]=e)}return d}function Za(a){for(var c=-1,b=a.length,d=Array(b),e=b;++c<b;)d[--e]=a[c];return d}function $a(a,
|
||||
c){for(var b=-1,d=a.length;++b<d;)if(a[b]===c)return!1;return!0}function Q(a,c){for(var b=-1,d=a.length;++b<d;)c(a[b],b);return a}function W(a,c,b){for(var d=-1,e=b.length;++d<e;){var f=b[d];c(a[f],f)}return a}function K(a,c){for(var b=-1;++b<a;)c(b)}function P(a,c){var b=a.length,d=Array(b),e;for(e=0;e<b;e++)d[e]=e;ca(c,0,b-1,d);for(var f=Array(b),g=0;g<b;g++)e=d[g],f[g]=void 0===e?a[g]:a[e];return f}function ca(a,c,b,d){if(c!==b){for(var e=c;++e<=b&&a[c]===a[e];){var f=e-1;if(d[f]>d[e]){var g=d[f];
|
||||
d[f]=d[e];d[e]=g}}if(!(e>b)){for(var l,e=a[a[c]>a[e]?c:e],f=c,g=b;f<=g;){for(l=f;f<g&&a[f]<e;)f++;for(;g>=l&&a[g]>=e;)g--;if(f>g)break;var q=a;l=d;var s=f++,h=g--,k=q[s];q[s]=q[h];q[h]=k;q=l[s];l[s]=l[h];l[h]=q}e=f;ca(a,c,e-1,d);ca(a,e,b,d)}}}function S(a){var c=[];Q(a,function(a){a!==w&&(C(a)?X.apply(c,a):c.push(a))});return c}function da(a,c,b){var d=-1,e=a.length;if(3===c.length)for(;++d<e;)c(a[d],d,b(d));else for(;++d<e;)c(a[d],b(d))}function ra(a,c,b,d){var e,f=-1,g=d.length;if(3===c.length)for(;++f<
|
||||
g;)e=d[f],c(a[e],e,b(f));else for(;++f<g;)c(a[d[f]],b(f))}function sa(a,c,b){var d=0,e=a[z]();if(3===c.length)for(;!1===(a=e.next()).done;)c(a.value,d,b(d++));else for(;!1===(a=e.next()).done;)c(a.value,b(d++));return d}function ea(a,c,b){var d,e=-1,f=a.length;if(3===c.length)for(;++e<f;)d=a[e],c(d,e,b(d));else for(;++e<f;)d=a[e],c(d,b(d))}function fa(a,c,b,d){var e,f,g=-1,l=d.length;if(3===c.length)for(;++g<l;)e=d[g],f=a[e],c(f,e,b(f));else for(;++g<l;)f=a[d[g]],c(f,b(f))}function ga(a,c,b){var d,
|
||||
e=0;a=a[z]();if(3===c.length)for(;!1===(d=a.next()).done;)d=d.value,c(d,e++,b(d));else for(;!1===(d=a.next()).done;)e++,d=d.value,c(d,b(d));return e}function V(a,c,b){var d,e=-1,f=a.length;if(3===c.length)for(;++e<f;)d=a[e],c(d,e,b(e,d));else for(;++e<f;)d=a[e],c(d,b(e,d))}function ha(a,c,b,d){var e,f,g=-1,l=d.length;if(3===c.length)for(;++g<l;)e=d[g],f=a[e],c(f,e,b(g,f));else for(;++g<l;)f=a[d[g]],c(f,b(g,f))}function ia(a,c,b){var d,e=0;a=a[z]();if(3===c.length)for(;!1===(d=a.next()).done;)d=d.value,
|
||||
c(d,e,b(e++,d));else for(;!1===(d=a.next()).done;)d=d.value,c(d,b(e++,d));return e}function ta(a,c,b,d){var e,f,g=-1,l=d.length;if(3===c.length)for(;++g<l;)e=d[g],f=a[e],c(f,e,b(e,f));else for(;++g<l;)e=d[g],f=a[e],c(f,b(e,f))}function ua(a,c,b){var d,e=0;a=a[z]();if(3===c.length)for(;!1===(d=a.next()).done;)d=d.value,c(d,e,b(e++,d));else for(;!1===(d=a.next()).done;)d=d.value,c(d,b(e++,d));return e}function E(a){return function(c,b){var d=a;a=A;d(c,b)}}function I(a){return function(c,b){var d=a;
|
||||
a=w;d(c,b)}}function va(a,c,b,d){var e,f;d?(e=Array,f=H):(e=function(){return{}},f=L);return function(d,l,q){function s(a){return function(b,d){null===a&&A();b?(a=null,q=I(q),q(b,f(m))):(m[a]=d,a=null,++r===h&&q(null,m))}}q=q||w;var h,k,m,r=0;C(d)?(h=d.length,m=e(h),a(d,l,s)):d&&(z&&d[z]?(m=e(0),(h=b(d,l,s))&&h===r&&q(null,m)):"object"===typeof d&&(k=F(d),h=k.length,m=e(h),c(d,l,s,k)));h||q(null,e())}}function wa(a,c,b,d){return function(e,f,g){function l(a,b){return function(c,e){null===a&&A();c?
|
||||
(a=null,g=I(g),g(c)):(!!e===d&&(h[a]=b),a=null,++k===q&&g(null,U(h)))}}g=g||w;var q,s,h,k=0;C(e)?(q=e.length,h=Array(q),a(e,f,l)):e&&(z&&e[z]?(h=[],(q=b(e,f,l))&&q===k&&g(null,U(h))):"object"===typeof e&&(s=F(e),q=s.length,h=Array(q),c(e,f,l,s)));if(!q)return g(null,[])}}function xa(a){return function(c,b,d){function e(){r=c[x];b(r,h)}function f(){r=c[x];b(r,x,h)}function g(){u=p.next();r=u.value;u.done?d(null,y):b(r,h)}function l(){u=p.next();r=u.value;u.done?d(null,y):b(r,x,h)}function q(){m=n[x];
|
||||
r=c[m];b(r,h)}function s(){m=n[x];r=c[m];b(r,m,h)}function h(b,c){b?d(b):(!!c===a&&(y[y.length]=r),++x===k?(v=A,d(null,y)):t?D(v):(t=!0,v()),t=!1)}d=E(d||w);var k,m,r,n,p,u,v,t=!1,x=0,y=[];C(c)?(k=c.length,v=3===b.length?f:e):c&&(z&&c[z]?(k=Infinity,p=c[z](),v=3===b.length?l:g):"object"===typeof c&&(n=F(c),k=n.length,v=3===b.length?s:q));if(!k)return d(null,[]);v()}}function ya(a){return function(c,b,d,e){function f(){r=B++;r<m&&(p=c[r],d(p,k(p,r)))}function g(){r=B++;r<m&&(p=c[r],d(p,r,k(p,r)))}
|
||||
function l(){t=v.next();!1===t.done?(p=t.value,d(p,k(p,B++))):R===B&&d!==w&&(d=w,e(null,U(y)))}function q(){t=v.next();!1===t.done?(p=t.value,d(p,B,k(p,B++))):R===B&&d!==w&&(d=w,e(null,U(y)))}function s(){r=B++;r<m&&(p=c[u[r]],d(p,k(p,r)))}function h(){r=B++;r<m&&(n=u[r],p=c[n],d(p,n,k(p,r)))}function k(b,d){return function(c,f){null===d&&A();c?(d=null,x=w,e=I(e),e(c)):(!!f===a&&(y[d]=b),d=null,++R===m?(e=E(e),e(null,U(y))):G?D(x):(G=!0,x()),G=!1)}}e=e||w;var m,r,n,p,u,v,t,x,y,G=!1,B=0,R=0;C(c)?(m=
|
||||
c.length,x=3===d.length?g:f):c&&(z&&c[z]?(m=Infinity,y=[],v=c[z](),x=3===d.length?q:l):"object"===typeof c&&(u=F(c),m=u.length,x=3===d.length?h:s));if(!m||isNaN(b)||1>b)return e(null,[]);y=y||Array(m);K(b>m?m:b,x)}}function Y(a,c,b){function d(){c(a[v],s)}function e(){c(a[v],v,s)}function f(){n=r.next();n.done?b(null):c(n.value,s)}function g(){n=r.next();n.done?b(null):c(n.value,v,s)}function l(){c(a[m[v]],s)}function q(){k=m[v];c(a[k],k,s)}function s(a,d){a?b(a):++v===h||!1===d?(p=A,b(null)):u?D(p):
|
||||
(u=!0,p());u=!1}b=E(b||w);var h,k,m,r,n,p,u=!1,v=0;C(a)?(h=a.length,p=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,r=a[z](),p=3===c.length?g:f):"object"===typeof a&&(m=F(a),h=m.length,p=3===c.length?q:l));if(!h)return b(null);p()}function Z(a,c,b,d){function e(){x<k&&b(a[x++],h)}function f(){m=x++;m<k&&b(a[m],m,h)}function g(){u=p.next();!1===u.done?(x++,b(u.value,h)):y===x&&b!==w&&(b=w,d(null))}function l(){u=p.next();!1===u.done?b(u.value,x++,h):y===x&&b!==w&&(b=w,d(null))}function q(){x<k&&b(a[n[x++]],
|
||||
h)}function s(){m=x++;m<k&&(r=n[m],b(a[r],r,h))}function h(a,c){a||!1===c?(v=w,d=I(d),d(a)):++y===k?(b=w,v=A,d=E(d),d(null)):t?D(v):(t=!0,v());t=!1}d=d||w;var k,m,r,n,p,u,v,t=!1,x=0,y=0;if(C(a))k=a.length,v=3===b.length?f:e;else if(a)if(z&&a[z])k=Infinity,p=a[z](),v=3===b.length?l:g;else if("object"===typeof a)n=F(a),k=n.length,v=3===b.length?s:q;else return d(null);if(!k||isNaN(c)||1>c)return d(null);K(c>k?k:c,v)}function za(a,c,b){function d(){c(a[t],s)}function e(){c(a[t],t,s)}function f(){n=r.next();
|
||||
n.done?b(null,p):c(n.value,s)}function g(){n=r.next();n.done?b(null,p):c(n.value,t,s)}function l(){c(a[m[t]],s)}function q(){k=m[t];c(a[k],k,s)}function s(a,d){a?(u=A,b=E(b),b(a,H(p))):(p[t]=d,++t===h?(u=A,b(null,p),b=A):v?D(u):(v=!0,u()),v=!1)}b=b||w;var h,k,m,r,n,p,u,v=!1,t=0;C(a)?(h=a.length,u=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,p=[],r=a[z](),u=3===c.length?g:f):"object"===typeof a&&(m=F(a),h=m.length,u=3===c.length?q:l));if(!h)return b(null,[]);p=p||Array(h);u()}function Aa(a,c,b,d){return function(e,
|
||||
f,g){function l(a){var b=!1;return function(c,e){b&&A();b=!0;c?(g=I(g),g(c)):!!e===d?(g=I(g),g(null,a)):++h===q&&g(null)}}g=g||w;var q,s,h=0;C(e)?(q=e.length,a(e,f,l)):e&&(z&&e[z]?(q=b(e,f,l))&&q===h&&g(null):"object"===typeof e&&(s=F(e),q=s.length,c(e,f,l,s)));q||g(null)}}function Ba(a){return function(c,b,d){function e(){r=c[x];b(r,h)}function f(){r=c[x];b(r,x,h)}function g(){u=p.next();r=u.value;u.done?d(null):b(r,h)}function l(){u=p.next();r=u.value;u.done?d(null):b(r,x,h)}function q(){r=c[n[x]];
|
||||
b(r,h)}function s(){m=n[x];r=c[m];b(r,m,h)}function h(b,c){b?d(b):!!c===a?(v=A,d(null,r)):++x===k?(v=A,d(null)):t?D(v):(t=!0,v());t=!1}d=E(d||w);var k,m,r,n,p,u,v,t=!1,x=0;C(c)?(k=c.length,v=3===b.length?f:e):c&&(z&&c[z]?(k=Infinity,p=c[z](),v=3===b.length?l:g):"object"===typeof c&&(n=F(c),k=n.length,v=3===b.length?s:q));if(!k)return d(null);v()}}function Ca(a){return function(c,b,d,e){function f(){r=G++;r<m&&(p=c[r],d(p,k(p)))}function g(){r=G++;r<m&&(p=c[r],d(p,r,k(p)))}function l(){t=v.next();
|
||||
!1===t.done?(G++,p=t.value,d(p,k(p))):B===G&&d!==w&&(d=w,e(null))}function q(){t=v.next();!1===t.done?(p=t.value,d(p,G++,k(p))):B===G&&d!==w&&(d=w,e(null))}function s(){r=G++;r<m&&(p=c[u[r]],d(p,k(p)))}function h(){G<m&&(n=u[G++],p=c[n],d(p,n,k(p)))}function k(b){var d=!1;return function(c,f){d&&A();d=!0;c?(x=w,e=I(e),e(c)):!!f===a?(x=w,e=I(e),e(null,b)):++B===m?e(null):y?D(x):(y=!0,x());y=!1}}e=e||w;var m,r,n,p,u,v,t,x,y=!1,G=0,B=0;C(c)?(m=c.length,x=3===d.length?g:f):c&&(z&&c[z]?(m=Infinity,v=c[z](),
|
||||
x=3===d.length?q:l):"object"===typeof c&&(u=F(c),m=u.length,x=3===d.length?h:s));if(!m||isNaN(b)||1>b)return e(null);K(b>m?m:b,x)}}function Da(a,c,b,d){return function(e,f,g){function l(a,b){return function(c,e){null===a&&A();c?(a=null,g=I(g),g(c,L(k))):(!!e===d&&(k[a]=b),a=null,++h===q&&g(null,k))}}g=g||w;var q,s,h=0,k={};C(e)?(q=e.length,a(e,f,l)):e&&(z&&e[z]?(q=b(e,f,l))&&q===h&&g(null,k):"object"===typeof e&&(s=F(e),q=s.length,c(e,f,l,s)));if(!q)return g(null,{})}}function Ea(a){return function(c,
|
||||
b,d){function e(){m=y;r=c[y];b(r,h)}function f(){m=y;r=c[y];b(r,y,h)}function g(){m=y;u=p.next();r=u.value;u.done?d(null,x):b(r,h)}function l(){m=y;u=p.next();r=u.value;u.done?d(null,x):b(r,m,h)}function q(){m=n[y];r=c[m];b(r,h)}function s(){m=n[y];r=c[m];b(r,m,h)}function h(b,c){b?d(b,x):(!!c===a&&(x[m]=r),++y===k?(v=A,d(null,x)):t?D(v):(t=!0,v()),t=!1)}d=E(d||w);var k,m,r,n,p,u,v,t=!1,x={},y=0;C(c)?(k=c.length,v=3===b.length?f:e):c&&(z&&c[z]?(k=Infinity,p=c[z](),v=3===b.length?l:g):"object"===typeof c&&
|
||||
(n=F(c),k=n.length,v=3===b.length?s:q));if(!k)return d(null,{});v()}}function Fa(a){return function(c,b,d,e){function f(){r=B++;r<m&&(p=c[r],d(p,k(p,r)))}function g(){r=B++;r<m&&(p=c[r],d(p,r,k(p,r)))}function l(){t=v.next();!1===t.done?(p=t.value,d(p,k(p,B++))):R===B&&d!==w&&(d=w,e(null,G))}function q(){t=v.next();!1===t.done?(p=t.value,d(p,B,k(p,B++))):R===B&&d!==w&&(d=w,e(null,G))}function s(){B<m&&(n=u[B++],p=c[n],d(p,k(p,n)))}function h(){B<m&&(n=u[B++],p=c[n],d(p,n,k(p,n)))}function k(b,d){return function(c,
|
||||
f){null===d&&A();c?(d=null,x=w,e=I(e),e(c,L(G))):(!!f===a&&(G[d]=b),d=null,++R===m?(x=A,e=E(e),e(null,G)):y?D(x):(y=!0,x()),y=!1)}}e=e||w;var m,r,n,p,u,v,t,x,y=!1,G={},B=0,R=0;C(c)?(m=c.length,x=3===d.length?g:f):c&&(z&&c[z]?(m=Infinity,v=c[z](),x=3===d.length?q:l):"object"===typeof c&&(u=F(c),m=u.length,x=3===d.length?h:s));if(!m||isNaN(b)||1>b)return e(null,{});K(b>m?m:b,x)}}function $(a,c,b,d){function e(d){b(d,a[t],h)}function f(d){b(d,a[t],t,h)}function g(a){p=n.next();p.done?d(null,a):b(a,p.value,
|
||||
h)}function l(a){p=n.next();p.done?d(null,a):b(a,p.value,t,h)}function q(d){b(d,a[r[t]],h)}function s(d){m=r[t];b(d,a[m],m,h)}function h(a,c){a?d(a,c):++t===k?(b=A,d(null,c)):v?D(function(){u(c)}):(v=!0,u(c));v=!1}d=E(d||w);var k,m,r,n,p,u,v=!1,t=0;C(a)?(k=a.length,u=4===b.length?f:e):a&&(z&&a[z]?(k=Infinity,n=a[z](),u=4===b.length?l:g):"object"===typeof a&&(r=F(a),k=r.length,u=4===b.length?s:q));if(!k)return d(null,c);u(c)}function Ga(a,c,b,d){function e(d){b(d,a[--s],q)}function f(d){b(d,a[--s],
|
||||
s,q)}function g(d){b(d,a[m[--s]],q)}function l(d){k=m[--s];b(d,a[k],k,q)}function q(a,b){a?d(a,b):0===s?(u=A,d(null,b)):v?D(function(){u(b)}):(v=!0,u(b));v=!1}d=E(d||w);var s,h,k,m,r,n,p,u,v=!1;if(C(a))s=a.length,u=4===b.length?f:e;else if(a)if(z&&a[z]){p=[];r=a[z]();for(h=-1;!1===(n=r.next()).done;)p[++h]=n.value;a=p;s=p.length;u=4===b.length?f:e}else"object"===typeof a&&(m=F(a),s=m.length,u=4===b.length?l:g);if(!s)return d(null,c);u(c)}function Ha(a,c,b){b=b||w;ja(a,c,function(a,c){if(a)return b(a);
|
||||
b(null,!!c)})}function Ia(a,c,b){b=b||w;ka(a,c,function(a,c){if(a)return b(a);b(null,!!c)})}function Ja(a,c,b,d){d=d||w;la(a,c,b,function(a,b){if(a)return d(a);d(null,!!b)})}function Ka(a,c){return C(a)?0===a.length?(c(null),!1):!0:(c(Error("First argument to waterfall must be an array of functions")),!1)}function ma(a,c,b){switch(c.length){case 0:case 1:return a(b);case 2:return a(c[1],b);case 3:return a(c[1],c[2],b);case 4:return a(c[1],c[2],c[3],b);case 5:return a(c[1],c[2],c[3],c[4],b);case 6:return a(c[1],
|
||||
c[2],c[3],c[4],c[5],b);default:return c=J(c,1),c.push(b),a.apply(null,c)}}function La(a,c){function b(b,h){if(b)q=A,c=E(c),c(b);else if(++d===f){q=A;var k=c;c=A;2===arguments.length?k(b,h):k.apply(null,H(arguments))}else g=a[d],l=arguments,e?D(q):(e=!0,q()),e=!1}c=c||w;if(Ka(a,c)){var d=0,e=!1,f=a.length,g=a[d],l=[],q=function(){switch(g.length){case 0:try{b(null,g())}catch(a){b(a)}break;case 1:return g(b);case 2:return g(l[1],b);case 3:return g(l[1],l[2],b);case 4:return g(l[1],l[2],l[3],b);case 5:return g(l[1],
|
||||
l[2],l[3],l[4],b);default:return l=J(l,1),l[g.length-1]=b,g.apply(null,l)}};q()}}function Ma(){var a=H(arguments);return function(){var c=this,b=H(arguments),d=b[b.length-1];"function"===typeof d?b.pop():d=w;$(a,b,function(a,b,d){a.push(function(a){var b=J(arguments,1);d(a,b)});b.apply(c,a)},function(a,b){b=C(b)?b:[b];b.unshift(a);d.apply(c,b)})}}function Na(a){return function(c){var b=function(){var b=this,d=H(arguments),g=d.pop()||w;return a(c,function(a,c){a.apply(b,d.concat([c]))},g)};if(1<arguments.length){var d=
|
||||
J(arguments,1);return b.apply(this,d)}return b}}function M(){this.tail=this.head=null;this.length=0}function na(a,c,b,d){function e(a){a={data:a,callback:m};r?n._tasks.unshift(a):n._tasks.push(a);D(n.process)}function f(a,b,d){if(null==b)b=w;else if("function"!==typeof b)throw Error("task callback must be a function");n.started=!0;var c=C(a)?a:[a];void 0!==a&&c.length?(r=d,m=b,Q(c,e),m=void 0):n.idle()&&D(n.drain)}function g(a,b){var d=!1;return function(c,e){d&&A();d=!0;h--;for(var f,g=-1,m=k.length,
|
||||
q=-1,l=b.length,n=2<arguments.length,r=n&&H(arguments);++q<l;){for(f=b[q];++g<m;)k[g]===f&&(0===g?k.shift():k.splice(g,1),g=m,m--);g=-1;n?f.callback.apply(f,r):f.callback(c,e);c&&a.error(c,f.data)}h<=a.concurrency-a.buffer&&a.unsaturated();0===a._tasks.length+h&&a.drain();a.process()}}function l(){for(;!n.paused&&h<n.concurrency&&n._tasks.length;){var a=n._tasks.shift();h++;k.push(a);0===n._tasks.length&&n.empty();h===n.concurrency&&n.saturated();var b=g(n,[a]);c(a.data,b)}}function q(){for(;!n.paused&&
|
||||
h<n.concurrency&&n._tasks.length;){for(var a=n._tasks.splice(n.payload||n._tasks.length),b=-1,d=a.length,e=Array(d);++b<d;)e[b]=a[b].data;h++;X.apply(k,a);0===n._tasks.length&&n.empty();h===n.concurrency&&n.saturated();a=g(n,a);c(e,a)}}function s(){D(n.process)}if(void 0===b)b=1;else if(isNaN(b)||1>b)throw Error("Concurrency must not be zero");var h=0,k=[],m,r,n={_tasks:new M,concurrency:b,payload:d,saturated:w,unsaturated:w,buffer:b/4,empty:w,drain:w,error:w,started:!1,paused:!1,push:function(a,
|
||||
b){f(a,b)},kill:function(){n.drain=w;n._tasks.empty()},unshift:function(a,b){f(a,b,!0)},remove:function(a){n._tasks.remove(a)},process:a?l:q,length:function(){return n._tasks.length},running:function(){return h},workersList:function(){return k},idle:function(){return 0===n.length()+h},pause:function(){n.paused=!0},resume:function(){!1!==n.paused&&(n.paused=!1,K(n.concurrency<n._tasks.length?n.concurrency:n._tasks.length,s))},_worker:c};return n}function Oa(a,c,b){function d(){if(0===s.length&&0===
|
||||
q){if(0!==g)throw Error("async.auto task has cyclic dependencies");return b(null,l)}for(;s.length&&q<c&&b!==w;){q++;var a=s.shift();if(0===a[1])a[0](a[2]);else a[0](l,a[2])}}function e(a){Q(h[a]||[],function(a){a()});d()}"function"===typeof c&&(b=c,c=null);var f=F(a),g=f.length,l={};if(0===g)return b(null,l);var q=0,s=new M,h=Object.create(null);b=E(b||w);c=c||g;W(a,function(a,d){function c(a,f){null===d&&A();f=2>=arguments.length?f:J(arguments,1);if(a){q=g=0;s.length=0;var k=L(l);k[d]=f;d=null;var h=
|
||||
b;b=w;h(a,k)}else q--,g--,l[d]=f,e(d),d=null}function n(){0===--v&&s.push([p,u,c])}var p,u;if(C(a)){var v=a.length-1;p=a[v];u=v;if(0===v)s.push([p,u,c]);else for(var t=-1;++t<v;){var x=a[t];if($a(f,x))throw t="async.auto task `"+d+"` has non-existent dependency `"+x+"` in "+a.join(", "),Error(t);var y=h[x];y||(y=h[x]=[]);y.push(n)}}else p=a,u=0,s.push([p,u,c])},f);d()}function ab(a){a=a.toString().replace(bb,"");a=(a=a.match(cb)[2].replace(" ",""))?a.split(db):[];return a=a.map(function(a){return a.replace(eb,
|
||||
"").trim()})}function oa(a,c,b){function d(a,e){if(++s===g||!a||q&&!q(a)){if(2>=arguments.length)return b(a,e);var f=H(arguments);return b.apply(null,f)}c(d)}function e(){c(f)}function f(a,d){if(++s===g||!a||q&&!q(a)){if(2>=arguments.length)return b(a,d);var c=H(arguments);return b.apply(null,c)}setTimeout(e,l(s))}var g,l,q,s=0;if(3>arguments.length&&"function"===typeof a)b=c||w,c=a,a=null,g=5;else switch(b=b||w,typeof a){case "object":"function"===typeof a.errorFilter&&(q=a.errorFilter);var h=a.interval;
|
||||
switch(typeof h){case "function":l=h;break;case "string":case "number":l=(h=+h)?function(){return h}:function(){return 0}}g=+a.times||5;break;case "number":g=a||5;break;case "string":g=+a||5;break;default:throw Error("Invalid arguments for async.retry");}if("function"!==typeof c)throw Error("Invalid arguments for async.retry");l?c(f):c(d)}function Pa(a){return function(){var c=H(arguments),b=c.pop(),d;try{d=a.apply(this,c)}catch(e){return b(e)}d&&"function"===typeof d.then?d.then(function(a){try{b(null,
|
||||
a)}catch(d){D(Qa,d)}},function(a){a=a&&a.message?a:Error(a);try{b(a,void 0)}catch(d){D(Qa,d)}}):b(null,d)}}function Qa(a){throw a;}function Ra(a){return function(){function c(a,d){if(a)return b(null,{error:a});2<arguments.length&&(d=J(arguments,1));b(null,{value:d})}var b;switch(arguments.length){case 1:return b=arguments[0],a(c);case 2:return b=arguments[1],a(arguments[0],c);default:var d=H(arguments),e=d.length-1;b=d[e];d[e]=c;a.apply(this,d)}}}function pa(a){function c(b){if("object"===typeof console)if(b)console.error&&
|
||||
console.error(b);else if(console[a]){var d=J(arguments,1);Q(d,function(b){console[a](b)})}}return function(a){var d=J(arguments,1);d.push(c);a.apply(null,d)}}var w=function(){},A=function(){throw Error("Callback was already called.");},C=Array.isArray,F=Object.keys,X=Array.prototype.push,z="function"===typeof Symbol&&Symbol.iterator,D,ba,T;O();var aa=function(a,c,b){return function(d,e,f){function g(a,b){a?(f=I(f),f(a)):++s===l?f(null):!1===b&&(f=I(f),f(null))}f=I(f||w);var l,q,s=0;C(d)?(l=d.length,
|
||||
a(d,e,g)):d&&(z&&d[z]?(l=b(d,e,g))&&l===s&&f(null):"object"===typeof d&&(q=F(d),l=q.length,c(d,e,g,q)));l||f(null)}}(function(a,c,b){var d=-1,e=a.length;if(3===c.length)for(;++d<e;)c(a[d],d,E(b));else for(;++d<e;)c(a[d],E(b))},function(a,c,b,d){var e,f=-1,g=d.length;if(3===c.length)for(;++f<g;)e=d[f],c(a[e],e,E(b));else for(;++f<g;)c(a[d[f]],E(b))},function(a,c,b){a=a[z]();var d=0,e;if(3===c.length)for(;!1===(e=a.next()).done;)c(e.value,d++,E(b));else for(;!1===(e=a.next()).done;)d++,c(e.value,E(b));
|
||||
return d}),Sa=va(da,ra,sa,!0),fb=va(da,function(a,c,b,d){var e,f=-1,g=d.length;if(3===c.length)for(;++f<g;)e=d[f],c(a[e],e,b(e));else for(;++f<g;)e=d[f],c(a[e],b(e))},function(a,c,b){var d=0,e=a[z]();if(3===c.length)for(;!1===(a=e.next()).done;)c(a.value,d,b(d++));else for(;!1===(a=e.next()).done;)c(a.value,b(d++));return d},!1),Ta=wa(V,ha,ia,!0),Ua=xa(!0),Va=ya(!0),gb=wa(V,ha,ia,!1),hb=xa(!1),ib=ya(!1),ja=Aa(ea,fa,ga,!0),ka=Ba(!0),la=Ca(!0),Wa=function(a,c,b){var d=Aa(a,c,b,!1);return function(a,
|
||||
b,c){c=c||w;d(a,b,function(a,b){if(a)return c(a);c(null,!b)})}}(ea,fa,ga),Xa=function(){var a=Ba(!1);return function(c,b,d){d=d||w;a(c,b,function(a,b){if(a)return d(a);d(null,!b)})}}(),Ya=function(){var a=Ca(!1);return function(c,b,d,e){e=e||w;a(c,b,d,function(a,b){if(a)return e(a);e(null,!b)})}}(),jb=Da(V,ta,ua,!0),kb=Ea(!0),lb=Fa(!0),mb=Da(V,ta,ua,!1),nb=Ea(!1),ob=Fa(!1),pb=function(a,c,b){return function(d,e,f,g){function l(a,b){a?(g=I(g),g(a,C(h)?H(h):L(h))):++k===q?g(null,h):!1===b&&(g=I(g),
|
||||
g(null,C(h)?H(h):L(h)))}3===arguments.length&&(g=f,f=e,e=void 0);g=g||w;var q,s,h,k=0;C(d)?(q=d.length,h=void 0!==e?e:[],a(d,h,f,l)):d&&(z&&d[z]?(h=void 0!==e?e:{},(q=b(d,h,f,l))&&q===k&&g(null,h)):"object"===typeof d&&(s=F(d),q=s.length,h=void 0!==e?e:{},c(d,h,f,l,s)));q||g(null,void 0!==e?e:h||{})}}(function(a,c,b,d){var e=-1,f=a.length;if(4===b.length)for(;++e<f;)b(c,a[e],e,E(d));else for(;++e<f;)b(c,a[e],E(d))},function(a,c,b,d,e){var f,g=-1,l=e.length;if(4===b.length)for(;++g<l;)f=e[g],b(c,a[f],
|
||||
f,E(d));else for(;++g<l;)b(c,a[e[g]],E(d))},function(a,c,b,d){var e=0,f=a[z]();if(4===b.length)for(;!1===(a=f.next()).done;)b(c,a.value,e++,E(d));else for(;!1===(a=f.next()).done;)e++,b(c,a.value,E(d));return e}),qb=function(a,c,b){return function(d,e,f){function g(a,b){var d=!1;q[a]=b;return function(b,c){d&&A();d=!0;s[a]=c;b?(f=I(f),f(b)):++h===l&&f(null,P(q,s))}}f=f||w;var l,q,s,h=0;if(C(d))l=d.length,q=Array(l),s=Array(l),a(d,e,g);else if(d)if(z&&d[z])q=[],s=[],(l=b(d,e,g))&&l===h&&f(null,P(q,
|
||||
s));else if("object"===typeof d){var k=F(d);l=k.length;q=Array(l);s=Array(l);c(d,e,g,k)}l||f(null,[])}}(V,ha,ia),rb=function(a,c,b){return function(d,e,f){function g(a){return function(b,d){null===a&&A();if(b)a=null,f=I(f),Q(q,function(a,b){void 0===a&&(q[b]=w)}),f(b,S(q));else{switch(arguments.length){case 0:case 1:q[a]=w;break;case 2:q[a]=d;break;default:q[a]=J(arguments,1)}a=null;++s===l&&f(null,S(q))}}}f=f||w;var l,q,s=0;if(C(d))l=d.length,q=Array(l),a(d,e,g);else if(d)if(z&&d[z])q=[],(l=b(d,
|
||||
e,g))&&l===s&&f(null,q);else if("object"===typeof d){var h=F(d);l=h.length;q=Array(l);c(d,e,g,h)}l||f(null,[])}}(da,ra,sa),sb=function(a,c,b){return function(d,e,f){function g(a){var b=!1;return function(d,c){b&&A();b=!0;if(d)f=I(f),f(d,L(s));else{var e=s[c];e?e.push(a):s[c]=[a];++q===l&&f(null,s)}}}f=f||w;var l,q=0,s={};if(C(d))l=d.length,a(d,e,g);else if(d)if(z&&d[z])(l=b(d,e,g))&&l===q&&f(null,s);else if("object"===typeof d){var h=F(d);l=h.length;c(d,e,g,h)}l||f(null,{})}}(ea,fa,ga),tb=function(a,
|
||||
c){return function(b,d){function e(a){return function(b,c){null===a&&A();b?(a=null,d=I(d),d(b,l)):(l[a]=2>=arguments.length?c:J(arguments,1),a=null,++q===f&&d(null,l))}}d=d||w;var f,g,l,q=0;C(b)?(f=b.length,l=Array(f),a(b,e)):b&&"object"===typeof b&&(g=F(b),f=g.length,l={},c(b,e,g));f||d(null,l)}}(function(a,c){for(var b=-1,d=a.length;++b<d;)a[b](c(b))},function(a,c,b){for(var d,e=-1,f=b.length;++e<f;)d=b[e],a[d](c(d))}),ub=Na(Sa),vb=Na(za),wb=pa("log"),xb=pa("dir"),qa={VERSION:"2.6.2",each:aa,eachSeries:Y,
|
||||
eachLimit:Z,forEach:aa,forEachSeries:Y,forEachLimit:Z,eachOf:aa,eachOfSeries:Y,eachOfLimit:Z,forEachOf:aa,forEachOfSeries:Y,forEachOfLimit:Z,map:Sa,mapSeries:za,mapLimit:function(a,c,b,d){function e(){m=y++;m<k&&b(a[m],h(m))}function f(){m=y++;m<k&&b(a[m],m,h(m))}function g(){u=p.next();!1===u.done?b(u.value,h(y++)):G===y&&b!==w&&(b=w,d(null,v))}function l(){u=p.next();!1===u.done?b(u.value,y,h(y++)):G===y&&b!==w&&(b=w,d(null,v))}function q(){m=y++;m<k&&b(a[n[m]],h(m))}function s(){m=y++;m<k&&(r=
|
||||
n[m],b(a[r],r,h(m)))}function h(a){return function(b,c){null===a&&A();b?(a=null,t=w,d=I(d),d(b,H(v))):(v[a]=c,a=null,++G===k?(t=A,d(null,v),d=A):x?D(t):(x=!0,t()),x=!1)}}d=d||w;var k,m,r,n,p,u,v,t,x=!1,y=0,G=0;C(a)?(k=a.length,t=3===b.length?f:e):a&&(z&&a[z]?(k=Infinity,v=[],p=a[z](),t=3===b.length?l:g):"object"===typeof a&&(n=F(a),k=n.length,t=3===b.length?s:q));if(!k||isNaN(c)||1>c)return d(null,[]);v=v||Array(k);K(c>k?k:c,t)},mapValues:fb,mapValuesSeries:function(a,c,b){function d(){k=t;c(a[t],
|
||||
s)}function e(){k=t;c(a[t],t,s)}function f(){k=t;n=r.next();n.done?b(null,v):c(n.value,s)}function g(){k=t;n=r.next();n.done?b(null,v):c(n.value,t,s)}function l(){k=m[t];c(a[k],s)}function q(){k=m[t];c(a[k],k,s)}function s(a,d){a?(p=A,b=E(b),b(a,L(v))):(v[k]=d,++t===h?(p=A,b(null,v),b=A):u?D(p):(u=!0,p()),u=!1)}b=b||w;var h,k,m,r,n,p,u=!1,v={},t=0;C(a)?(h=a.length,p=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,r=a[z](),p=3===c.length?g:f):"object"===typeof a&&(m=F(a),h=m.length,p=3===c.length?q:l));
|
||||
if(!h)return b(null,v);p()},mapValuesLimit:function(a,c,b,d){function e(){m=y++;m<k&&b(a[m],h(m))}function f(){m=y++;m<k&&b(a[m],m,h(m))}function g(){u=p.next();!1===u.done?b(u.value,h(y++)):G===y&&b!==w&&(b=w,d(null,x))}function l(){u=p.next();!1===u.done?b(u.value,y,h(y++)):G===y&&b!==w&&(b=w,d(null,x))}function q(){m=y++;m<k&&(r=n[m],b(a[r],h(r)))}function s(){m=y++;m<k&&(r=n[m],b(a[r],r,h(r)))}function h(a){return function(b,c){null===a&&A();b?(a=null,v=w,d=I(d),d(b,L(x))):(x[a]=c,a=null,++G===
|
||||
k?d(null,x):t?D(v):(t=!0,v()),t=!1)}}d=d||w;var k,m,r,n,p,u,v,t=!1,x={},y=0,G=0;C(a)?(k=a.length,v=3===b.length?f:e):a&&(z&&a[z]?(k=Infinity,p=a[z](),v=3===b.length?l:g):"object"===typeof a&&(n=F(a),k=n.length,v=3===b.length?s:q));if(!k||isNaN(c)||1>c)return d(null,x);K(c>k?k:c,v)},filter:Ta,filterSeries:Ua,filterLimit:Va,select:Ta,selectSeries:Ua,selectLimit:Va,reject:gb,rejectSeries:hb,rejectLimit:ib,detect:ja,detectSeries:ka,detectLimit:la,find:ja,findSeries:ka,findLimit:la,pick:jb,pickSeries:kb,
|
||||
pickLimit:lb,omit:mb,omitSeries:nb,omitLimit:ob,reduce:$,inject:$,foldl:$,reduceRight:Ga,foldr:Ga,transform:pb,transformSeries:function(a,c,b,d){function e(){b(v,a[x],h)}function f(){b(v,a[x],x,h)}function g(){p=n.next();p.done?d(null,v):b(v,p.value,h)}function l(){p=n.next();p.done?d(null,v):b(v,p.value,x,h)}function q(){b(v,a[r[x]],h)}function s(){m=r[x];b(v,a[m],m,h)}function h(a,b){a?d(a,v):++x===k||!1===b?(u=A,d(null,v)):t?D(u):(t=!0,u());t=!1}3===arguments.length&&(d=b,b=c,c=void 0);d=E(d||
|
||||
w);var k,m,r,n,p,u,v,t=!1,x=0;C(a)?(k=a.length,v=void 0!==c?c:[],u=4===b.length?f:e):a&&(z&&a[z]?(k=Infinity,n=a[z](),v=void 0!==c?c:{},u=4===b.length?l:g):"object"===typeof a&&(r=F(a),k=r.length,v=void 0!==c?c:{},u=4===b.length?s:q));if(!k)return d(null,void 0!==c?c:v||{});u()},transformLimit:function(a,c,b,d,e){function f(){r=A++;r<m&&d(x,a[r],E(k))}function g(){r=A++;r<m&&d(x,a[r],r,E(k))}function l(){v=u.next();!1===v.done?(A++,d(x,v.value,E(k))):B===A&&d!==w&&(d=w,e(null,x))}function q(){v=u.next();
|
||||
!1===v.done?d(x,v.value,A++,E(k)):B===A&&d!==w&&(d=w,e(null,x))}function s(){r=A++;r<m&&d(x,a[p[r]],E(k))}function h(){r=A++;r<m&&(n=p[r],d(x,a[n],n,E(k)))}function k(a,b){a||!1===b?(t=w,e(a||null,C(x)?H(x):L(x)),e=w):++B===m?(d=w,e(null,x)):y?D(t):(y=!0,t());y=!1}4===arguments.length&&(e=d,d=b,b=void 0);e=e||w;var m,r,n,p,u,v,t,x,y=!1,A=0,B=0;C(a)?(m=a.length,x=void 0!==b?b:[],t=4===d.length?g:f):a&&(z&&a[z]?(m=Infinity,u=a[z](),x=void 0!==b?b:{},t=4===d.length?q:l):"object"===typeof a&&(p=F(a),
|
||||
m=p.length,x=void 0!==b?b:{},t=4===d.length?h:s));if(!m||isNaN(c)||1>c)return e(null,void 0!==b?b:x||{});K(c>m?m:c,t)},sortBy:qb,sortBySeries:function(a,c,b){function d(){m=a[y];c(m,s)}function e(){m=a[y];c(m,y,s)}function f(){p=n.next();if(p.done)return b(null,P(u,v));m=p.value;u[y]=m;c(m,s)}function g(){p=n.next();if(p.done)return b(null,P(u,v));m=p.value;u[y]=m;c(m,y,s)}function l(){m=a[r[y]];u[y]=m;c(m,s)}function q(){k=r[y];m=a[k];u[y]=m;c(m,k,s)}function s(a,d){v[y]=d;a?b(a):++y===h?(t=A,b(null,
|
||||
P(u,v))):x?D(t):(x=!0,t());x=!1}b=E(b||w);var h,k,m,r,n,p,u,v,t,x=!1,y=0;C(a)?(h=a.length,u=a,v=Array(h),t=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,u=[],v=[],n=a[z](),t=3===c.length?g:f):"object"===typeof a&&(r=F(a),h=r.length,u=Array(h),v=Array(h),t=3===c.length?q:l));if(!h)return b(null,[]);t()},sortByLimit:function(a,c,b,d){function e(){B<k&&(n=a[B],b(n,h(n,B++)))}function f(){m=B++;m<k&&(n=a[m],b(n,m,h(n,m)))}function g(){t=v.next();!1===t.done?(n=t.value,p[B]=n,b(n,h(n,B++))):E===B&&b!==w&&
|
||||
(b=w,d(null,P(p,x)))}function l(){t=v.next();!1===t.done?(n=t.value,p[B]=n,b(n,B,h(n,B++))):E===B&&b!==w&&(b=w,d(null,P(p,x)))}function q(){B<k&&(n=a[u[B]],p[B]=n,b(n,h(n,B++)))}function s(){B<k&&(r=u[B],n=a[r],p[B]=n,b(n,r,h(n,B++)))}function h(a,b){var c=!1;return function(a,e){c&&A();c=!0;x[b]=e;a?(y=w,d(a),d=w):++E===k?d(null,P(p,x)):G?D(y):(G=!0,y());G=!1}}d=d||w;var k,m,r,n,p,u,v,t,x,y,G=!1,B=0,E=0;C(a)?(k=a.length,p=a,y=3===b.length?f:e):a&&(z&&a[z]?(k=Infinity,v=a[z](),p=[],x=[],y=3===b.length?
|
||||
l:g):"object"===typeof a&&(u=F(a),k=u.length,p=Array(k),y=3===b.length?s:q));if(!k||isNaN(c)||1>c)return d(null,[]);x=x||Array(k);K(c>k?k:c,y)},some:Ha,someSeries:Ia,someLimit:Ja,any:Ha,anySeries:Ia,anyLimit:Ja,every:Wa,everySeries:Xa,everyLimit:Ya,all:Wa,allSeries:Xa,allLimit:Ya,concat:rb,concatSeries:function(a,c,b){function d(){c(a[t],s)}function e(){c(a[t],t,s)}function f(){n=r.next();n.done?b(null,v):c(n.value,s)}function g(){n=r.next();n.done?b(null,v):c(n.value,t,s)}function l(){c(a[m[t]],
|
||||
s)}function q(){k=m[t];c(a[k],k,s)}function s(a,d){C(d)?X.apply(v,d):2<=arguments.length&&X.apply(v,J(arguments,1));a?b(a,v):++t===h?(p=A,b(null,v)):u?D(p):(u=!0,p());u=!1}b=E(b||w);var h,k,m,r,n,p,u=!1,v=[],t=0;C(a)?(h=a.length,p=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,r=a[z](),p=3===c.length?g:f):"object"===typeof a&&(m=F(a),h=m.length,p=3===c.length?q:l));if(!h)return b(null,v);p()},concatLimit:function(a,c,b,d){function e(){t<k&&b(a[t],h(t++))}function f(){t<k&&b(a[t],t,h(t++))}function g(){n=
|
||||
r.next();!1===n.done?b(n.value,h(t++)):x===t&&b!==w&&(b=w,d(null,S(u)))}function l(){n=r.next();!1===n.done?b(n.value,t,h(t++)):x===t&&b!==w&&(b=w,d(null,S(u)))}function q(){t<k&&b(a[y[t]],h(t++))}function s(){t<k&&(m=y[t],b(a[m],m,h(t++)))}function h(a){return function(b,c){null===a&&A();if(b)a=null,p=w,d=I(d),Q(u,function(a,b){void 0===a&&(u[b]=w)}),d(b,S(u));else{switch(arguments.length){case 0:case 1:u[a]=w;break;case 2:u[a]=c;break;default:u[a]=J(arguments,1)}a=null;++x===k?(p=A,d(null,S(u)),
|
||||
d=A):v?D(p):(v=!0,p());v=!1}}}d=d||w;var k,m,r,n,p,u,v=!1,t=0,x=0;if(C(a))k=a.length,p=3===b.length?f:e;else if(a)if(z&&a[z])k=Infinity,u=[],r=a[z](),p=3===b.length?l:g;else if("object"===typeof a){var y=F(a);k=y.length;p=3===b.length?s:q}if(!k||isNaN(c)||1>c)return d(null,[]);u=u||Array(k);K(c>k?k:c,p)},groupBy:sb,groupBySeries:function(a,c,b){function d(){m=a[t];c(m,s)}function e(){m=a[t];c(m,t,s)}function f(){p=n.next();m=p.value;p.done?b(null,x):c(m,s)}function g(){p=n.next();m=p.value;p.done?
|
||||
b(null,x):c(m,t,s)}function l(){m=a[r[t]];c(m,s)}function q(){k=r[t];m=a[k];c(m,k,s)}function s(a,d){if(a)u=A,b=E(b),b(a,L(x));else{var c=x[d];c?c.push(m):x[d]=[m];++t===h?(u=A,b(null,x)):v?D(u):(v=!0,u());v=!1}}b=E(b||w);var h,k,m,r,n,p,u,v=!1,t=0,x={};C(a)?(h=a.length,u=3===c.length?e:d):a&&(z&&a[z]?(h=Infinity,n=a[z](),u=3===c.length?g:f):"object"===typeof a&&(r=F(a),h=r.length,u=3===c.length?q:l));if(!h)return b(null,x);u()},groupByLimit:function(a,c,b,d){function e(){y<k&&(n=a[y++],b(n,h(n)))}
|
||||
function f(){m=y++;m<k&&(n=a[m],b(n,m,h(n)))}function g(){v=u.next();!1===v.done?(y++,n=v.value,b(n,h(n))):E===y&&b!==w&&(b=w,d(null,B))}function l(){v=u.next();!1===v.done?(n=v.value,b(n,y++,h(n))):E===y&&b!==w&&(b=w,d(null,B))}function q(){y<k&&(n=a[p[y++]],b(n,h(n)))}function s(){y<k&&(r=p[y++],n=a[r],b(n,r,h(n)))}function h(a){var b=!1;return function(c,e){b&&A();b=!0;if(c)t=w,d=I(d),d(c,L(B));else{var f=B[e];f?f.push(a):B[e]=[a];++E===k?d(null,B):x?D(t):(x=!0,t());x=!1}}}d=d||w;var k,m,r,n,p,
|
||||
u,v,t,x=!1,y=0,E=0,B={};C(a)?(k=a.length,t=3===b.length?f:e):a&&(z&&a[z]?(k=Infinity,u=a[z](),t=3===b.length?l:g):"object"===typeof a&&(p=F(a),k=p.length,t=3===b.length?s:q));if(!k||isNaN(c)||1>c)return d(null,B);K(c>k?k:c,t)},parallel:tb,series:function(a,c){function b(){g=k;a[k](e)}function d(){g=l[k];a[g](e)}function e(a,b){a?(s=A,c=E(c),c(a,q)):(q[g]=2>=arguments.length?b:J(arguments,1),++k===f?(s=A,c(null,q)):h?D(s):(h=!0,s()),h=!1)}c=c||w;var f,g,l,q,s,h=!1,k=0;if(C(a))f=a.length,q=Array(f),
|
||||
s=b;else if(a&&"object"===typeof a)l=F(a),f=l.length,q={},s=d;else return c(null);if(!f)return c(null,q);s()},parallelLimit:function(a,c,b){function d(){l=r++;if(l<g)a[l](f(l))}function e(){r<g&&(q=s[r++],a[q](f(q)))}function f(a){return function(d,c){null===a&&A();d?(a=null,k=w,b=I(b),b(d,h)):(h[a]=2>=arguments.length?c:J(arguments,1),a=null,++n===g?b(null,h):m?D(k):(m=!0,k()),m=!1)}}b=b||w;var g,l,q,s,h,k,m=!1,r=0,n=0;C(a)?(g=a.length,h=Array(g),k=d):a&&"object"===typeof a&&(s=F(a),g=s.length,h=
|
||||
{},k=e);if(!g||isNaN(c)||1>c)return b(null,h);K(c>g?g:c,k)},tryEach:function(a,c){function b(){a[q](e)}function d(){a[g[q]](e)}function e(a,b){a?++q===f?c(a):l():2>=arguments.length?c(null,b):c(null,J(arguments,1))}c=c||w;var f,g,l,q=0;C(a)?(f=a.length,l=b):a&&"object"===typeof a&&(g=F(a),f=g.length,l=d);if(!f)return c(null);l()},waterfall:function(a,c){function b(){ma(e,f,d(e))}function d(h){return function(k,m){void 0===h&&(c=w,A());h=void 0;k?(g=c,c=A,g(k)):++q===s?(g=c,c=A,2>=arguments.length?
|
||||
g(k,m):g.apply(null,H(arguments))):(l?(f=arguments,e=a[q]||A,D(b)):(l=!0,ma(a[q]||A,arguments,d(q))),l=!1)}}c=c||w;if(Ka(a,c)){var e,f,g,l,q=0,s=a.length;ma(a[0],[],d(0))}},angelFall:La,angelfall:La,whilst:function(a,c,b){function d(){g?D(e):(g=!0,c(f));g=!1}function e(){c(f)}function f(c,e){if(c)return b(c);2>=arguments.length?a(e)?d():b(null,e):(e=J(arguments,1),a.apply(null,e)?d():b.apply(null,[null].concat(e)))}b=b||w;var g=!1;a()?d():b(null)},doWhilst:function(a,c,b){function d(){g?D(e):(g=!0,
|
||||
a(f));g=!1}function e(){a(f)}function f(a,e){if(a)return b(a);2>=arguments.length?c(e)?d():b(null,e):(e=J(arguments,1),c.apply(null,e)?d():b.apply(null,[null].concat(e)))}b=b||w;var g=!1;e()},until:function(a,c,b){function d(){g?D(e):(g=!0,c(f));g=!1}function e(){c(f)}function f(c,e){if(c)return b(c);2>=arguments.length?a(e)?b(null,e):d():(e=J(arguments,1),a.apply(null,e)?b.apply(null,[null].concat(e)):d())}b=b||w;var g=!1;a()?b(null):d()},doUntil:function(a,c,b){function d(){g?D(e):(g=!0,a(f));g=
|
||||
!1}function e(){a(f)}function f(a,e){if(a)return b(a);2>=arguments.length?c(e)?b(null,e):d():(e=J(arguments,1),c.apply(null,e)?b.apply(null,[null].concat(e)):d())}b=b||w;var g=!1;e()},during:function(a,c,b){function d(a,d){if(a)return b(a);d?c(e):b(null)}function e(c){if(c)return b(c);a(d)}b=b||w;a(d)},doDuring:function(a,c,b){function d(d,c){if(d)return b(d);c?a(e):b(null)}function e(a,e){if(a)return b(a);switch(arguments.length){case 0:case 1:c(d);break;case 2:c(e,d);break;default:var l=J(arguments,
|
||||
1);l.push(d);c.apply(null,l)}}b=b||w;d(null,!0)},forever:function(a,c){function b(){a(d)}function d(a){if(a){if(c)return c(a);throw a;}e?D(b):(e=!0,b());e=!1}var e=!1;b()},compose:function(){return Ma.apply(null,Za(arguments))},seq:Ma,applyEach:ub,applyEachSeries:vb,queue:function(a,c){return na(!0,a,c)},priorityQueue:function(a,c){var b=na(!0,a,c);b.push=function(a,c,f){b.started=!0;c=c||0;var g=C(a)?a:[a],l=g.length;if(void 0===a||0===l)b.idle()&&D(b.drain);else{f="function"===typeof f?f:w;for(a=
|
||||
b._tasks.head;a&&c>=a.priority;)a=a.next;for(;l--;){var q={data:g[l],priority:c,callback:f};a?b._tasks.insertBefore(a,q):b._tasks.push(q);D(b.process)}}};delete b.unshift;return b},cargo:function(a,c){return na(!1,a,1,c)},auto:Oa,autoInject:function(a,c,b){var d={};W(a,function(a,b){var c,l=a.length;if(C(a)){if(0===l)throw Error("autoInject task functions require explicit parameters.");c=H(a);l=c.length-1;a=c[l];if(0===l){d[b]=a;return}}else{if(1===l){d[b]=a;return}c=ab(a);if(0===l&&0===c.length)throw Error("autoInject task functions require explicit parameters.");
|
||||
l=c.length-1}c[l]=function(b,d){switch(l){case 1:a(b[c[0]],d);break;case 2:a(b[c[0]],b[c[1]],d);break;case 3:a(b[c[0]],b[c[1]],b[c[2]],d);break;default:for(var f=-1;++f<l;)c[f]=b[c[f]];c[f]=d;a.apply(null,c)}};d[b]=c},F(a));Oa(d,c,b)},retry:oa,retryable:function(a,c){c||(c=a,a=null);return function(){function b(a){c(a)}function d(a){c(g[0],a)}function e(a){c(g[0],g[1],a)}var f,g=H(arguments),l=g.length-1,q=g[l];switch(c.length){case 1:f=b;break;case 2:f=d;break;case 3:f=e;break;default:f=function(a){g[l]=
|
||||
a;c.apply(null,g)}}a?oa(a,f,q):oa(f,q)}},iterator:function(a){function c(e){var f=function(){b&&a[d[e]||e].apply(null,H(arguments));return f.next()};f.next=function(){return e<b-1?c(e+1):null};return f}var b=0,d=[];C(a)?b=a.length:(d=F(a),b=d.length);return c(0)},times:function(a,c,b){function d(c){return function(d,l){null===c&&A();e[c]=l;c=null;d?(b(d),b=w):0===--a&&b(null,e)}}b=b||w;a=+a;if(isNaN(a)||1>a)return b(null,[]);var e=Array(a);K(a,function(a){c(a,d(a))})},timesSeries:function(a,c,b){function d(){c(l,
|
||||
e)}function e(c,e){f[l]=e;c?(b(c),b=A):++l>=a?(b(null,f),b=A):g?D(d):(g=!0,d());g=!1}b=b||w;a=+a;if(isNaN(a)||1>a)return b(null,[]);var f=Array(a),g=!1,l=0;d()},timesLimit:function(a,c,b,d){function e(){var c=q++;c<a&&b(c,f(c))}function f(b){return function(c,f){null===b&&A();g[b]=f;b=null;c?(d(c),d=w):++s>=a?(d(null,g),d=A):l?D(e):(l=!0,e());l=!1}}d=d||w;a=+a;if(isNaN(a)||1>a||isNaN(c)||1>c)return d(null,[]);var g=Array(a),l=!1,q=0,s=0;K(c>a?a:c,e)},race:function(a,c){c=I(c||w);var b,d,e=-1;if(C(a))for(b=
|
||||
a.length;++e<b;)a[e](c);else if(a&&"object"===typeof a)for(d=F(a),b=d.length;++e<b;)a[d[e]](c);else return c(new TypeError("First argument to race must be a collection of functions"));b||c(null)},apply:function(a){switch(arguments.length){case 0:case 1:return a;case 2:return a.bind(null,arguments[1]);case 3:return a.bind(null,arguments[1],arguments[2]);case 4:return a.bind(null,arguments[1],arguments[2],arguments[3]);case 5:return a.bind(null,arguments[1],arguments[2],arguments[3],arguments[4]);default:var c=
|
||||
arguments.length,b=0,d=Array(c);for(d[b]=null;++b<c;)d[b]=arguments[b];return a.bind.apply(a,d)}},nextTick:ba,setImmediate:T,memoize:function(a,c){c=c||function(a){return a};var b={},d={},e=function(){function e(a){var c=H(arguments);a||(b[q]=c);var f=d[q];delete d[q];for(var g=-1,l=f.length;++g<l;)f[g].apply(null,c)}var g=H(arguments),l=g.pop(),q=c.apply(null,g);if(b.hasOwnProperty(q))D(function(){l.apply(null,b[q])});else{if(d.hasOwnProperty(q))return d[q].push(l);d[q]=[l];g.push(e);a.apply(null,
|
||||
g)}};e.memo=b;e.unmemoized=a;return e},unmemoize:function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}},ensureAsync:function(a){return function(){var c=H(arguments),b=c.length-1,d=c[b],e=!0;c[b]=function(){var a=H(arguments);e?D(function(){d.apply(null,a)}):d.apply(null,a)};a.apply(this,c);e=!1}},constant:function(){var a=[null].concat(H(arguments));return function(c){c=arguments[arguments.length-1];c.apply(this,a)}},asyncify:Pa,wrapSync:Pa,log:wb,dir:xb,reflect:Ra,reflectAll:function(a){function c(a,
|
||||
c){b[c]=Ra(a)}var b,d;C(a)?(b=Array(a.length),Q(a,c)):a&&"object"===typeof a&&(d=F(a),b={},W(a,c,d));return b},timeout:function(a,c,b){function d(){var c=Error('Callback function "'+(a.name||"anonymous")+'" timed out.');c.code="ETIMEDOUT";b&&(c.info=b);l=null;g(c)}function e(){null!==l&&(f(g,H(arguments)),clearTimeout(l))}function f(a,b){switch(b.length){case 0:a();break;case 1:a(b[0]);break;case 2:a(b[0],b[1]);break;default:a.apply(null,b)}}var g,l;return function(){l=setTimeout(d,c);var b=H(arguments),
|
||||
s=b.length-1;g=b[s];b[s]=e;f(a,b)}},createLogger:pa,safe:function(){O();return N},fast:function(){O(!1);return N}};N["default"]=qa;W(qa,function(a,c){N[c]=a},F(qa));M.prototype._removeLink=function(a){var c=a.prev,b=a.next;c?c.next=b:this.head=b;b?b.prev=c:this.tail=c;a.prev=null;a.next=null;this.length--;return a};M.prototype.empty=M;M.prototype._setInitial=function(a){this.length=1;this.head=this.tail=a};M.prototype.insertBefore=function(a,c){c.prev=a.prev;c.next=a;a.prev?a.prev.next=c:this.head=
|
||||
c;a.prev=c;this.length++};M.prototype.unshift=function(a){this.head?this.insertBefore(this.head,a):this._setInitial(a)};M.prototype.push=function(a){var c=this.tail;c?(a.prev=c,a.next=c.next,this.tail=a,c.next=a,this.length++):this._setInitial(a)};M.prototype.shift=function(){return this.head&&this._removeLink(this.head)};M.prototype.splice=function(a){for(var c,b=[];a--&&(c=this.shift());)b.push(c);return b};M.prototype.remove=function(a){for(var c=this.head;c;)a(c)&&this._removeLink(c),c=c.next;
|
||||
return this};var cb=/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,db=/,/,eb=/(=.+)?(\s*)$/,bb=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scheduleIterable.js","sourceRoot":"","sources":["../../../../src/internal/scheduled/scheduleIterable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO1D,MAAM,UAAU,gBAAgB,CAAI,KAAkB,EAAE,SAAwB;IAC9E,OAAO,IAAI,UAAU,CAAI,UAAC,UAAU;QAClC,IAAI,QAAwB,CAAC;QAK7B,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE;YAErC,QAAQ,GAAI,KAAa,CAAC,eAAe,CAAC,EAAE,CAAC;YAE7C,eAAe,CACb,UAAU,EACV,SAAS,EACT;;gBACE,IAAI,KAAQ,CAAC;gBACb,IAAI,IAAyB,CAAC;gBAC9B,IAAI;oBAEF,CAAC,KAAkB,QAAQ,CAAC,IAAI,EAAE,EAA/B,KAAK,WAAA,EAAE,IAAI,UAAA,CAAqB,CAAC;iBACrC;gBAAC,OAAO,GAAG,EAAE;oBAEZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACtB,OAAO;iBACR;gBAED,IAAI,IAAI,EAAE;oBAKR,UAAU,CAAC,QAAQ,EAAE,CAAC;iBACvB;qBAAM;oBAEL,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACxB;YACH,CAAC,EACD,CAAC,EACD,IAAI,CACL,CAAC;QACJ,CAAC,CAAC,CAAC;QAMH,OAAO,cAAM,OAAA,UAAU,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAjD,CAAiD,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
Reference in New Issue
Block a user