0.0.3 • Published 3 years ago

workerpool-functions v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Workerpool-Functions

workerpool-functions offers some basic operations with a dedicated worker created with workerpool.

Install

Install via npm:

npm install workerpool-functions

Configure:

We need to copy the "worker" files into our public directory and configure the path to these files. Copy at least workerpool-functions.full.min.js, workerpool-functions.worker.js and workerpool.min.js from node_modules\workerpool-functions\lib\worker to your public directory - e.g. public\libs\workerpool These 2 files should be in same directory. After that point the application to the path of the workerpool-functions.full.min.js file.

import { workerOptions } from 'workerpool-functions';
workerOptions.workerSrc = '/libs/workerpool/workerpool-functions.worker.js';

Sample Usage

Example to sort a list of user informations.

import { workerSort } from 'workerpool-functions';
await workerSort<{name: string; email: string}>('asc', ['email'], [{name: 'My Name', email: 'my@mail.de'}])

Functions

NameDescriptionArgumentsReturn
workerValueFromPath<T, R>Reduces the object to get the value for a given pathobj: Tpath: Leaves<T, 3> | Array<string>R | Array<R>
workerContainsValue<T>Check existence of a value inside an objectobj: Tsearch: string | RegExpexcludedPaths: Array<Leaves<T, 3> | Array<string>> | undefinedboolean
workerSort<T>.........
workerFilter<T>.........
workerSearch<T>.........
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago