worker-helpers

1.0.0 • Public • Published

Web Worker Helpers

Build Status

Modules

http

The idea is to provide a basic usage of HTTP request to use inside WebWorkers so you don't have to code it in a raw way every time

utils

Provide a few Object handy methods

Copy

Provide a way to deep clone your objects

importScripts('modules/utils.js');
var array = [{a: 1}, {a: 2}];
const copy = utils.copy(array);

getProperty

Provides a handy way to fetch an object property by a given path

importScripts('modules/utils.js');
var array = [{a: 1}, {a: { b: 1 }}];
var object = {
    c: {
        d: 5,
        j: {
            k: 1
        }
    }
}
const value = utils.getProperty(object, 'c.j.k'); // 1
const arrayValue = utils.getProperty(object, '0.a'); // 1 it works on arrays as well

Readme

Keywords

none

Package Sidebar

Install

npm i worker-helpers

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • grillorafael