worker-helpers
v1.0.0
Published
[![Build Status](https://travis-ci.org/grillorafael/worker-helpers.svg?branch=master)](https://travis-ci.org/grillorafael/worker-helpers)
Downloads
2
Readme
Web Worker Helpers
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