workerpool-functions
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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

Name Description Arguments Return
workerValueFromPath<T, R> Reduces the object to get the value for a given path
  • obj: T
  • path: Leaves<T, 3> | Array<string>
R | Array<R>
workerContainsValue<T> Check existence of a value inside an object
  • obj: T
  • search: string | RegExp
  • excludedPaths: Array<Leaves<T, 3> | Array<string>> | undefined
boolean
workerSort<T> ... ... ...
workerFilter<T> ... ... ...
workerSearch<T> ... ... ...

Package Sidebar

Install

npm i workerpool-functions

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

64 kB

Total Files

58

Last publish

Collaborators

  • ariemer