workerpool-functions
v0.0.3
Published
Functions with workerpool
Downloads
83
Readme
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: '[email protected]'}])
Functions
|Name|Description|Arguments|Return| |----|----|----|----| |workerValueFromPath<T, R>|Reduces the object to get the value for a given path|obj: Tpath: Leaves<T, 3> | Array<string>|R | Array<R>| |workerContainsValue<T>|Check existence of a value inside an object|obj: Tsearch: string | RegExpexcludedPaths: Array<Leaves<T, 3> | Array<string>> | undefined|boolean| |workerSort<T>|...|...|...| |workerFilter<T>|...|...|...| |workerSearch<T>|...|...|...|