
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
@cheprasov/json-web-worker
Advanced tools
The library for parse / stringify JSON in different thread via Web Workers
The library for parse / stringify JSON in different thread via Web Workers.
Promise.catch
allows to receive an error thrown on json parse/stringify.> npm install @cheprasov/json-web-worker
import { jsonWebWorker } from '@cheprasov/json-web-worker';
import { jsonWebWorker } from '@cheprasov/json-web-worker';
// Parse via Web Worker
jsonWebWorker.parse('{"a": "b"}')
.then(result => {
console.log('Result:', result);
}).catch(e => {
console.log('Error:', e);
});
// Stringify via Web Worker
jsonWebWorker.stringify({ a: 10, b: [1, 2, 3] }, 2)
.then(result => {
console.log('Result:', result);
}).catch(e => {
console.log('Error:', e);
});
import { jsonWebWorker, parse, stringify } from '@cheprasov/json-web-worker';
jsonWebWorker.parse(text): Promise
or parse(text): Promise
The method executes JSON.parse
in a thread via Web Worker
See more here https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
arguments:
text
- string
- The string to parse as JSON.Promise
.Example:
import { jsonWebWorker, parse } from '@cheprasov/worker-thread';
jsonWebWorker.parse('{"a": "b"}')
.then(result => {
console.log('Result:', result);
}).catch(e => {
console.log('Error:', e);
});
jsonWebWorker.stringify(value, space): Promise
or stringify(value, space): Promise
The method executes JSON.stringify
in a thread via Web Worker
See more here https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
arguments:
value
- string
- The value to convert to a JSON string.space
- optional, string
or number
, object that's used to insert white space into the output JSON string for readability purposes.Promise
.Example:
import { jsonWebWorker, parse } from '@cheprasov/worker-thread';
jsonWebWorker.stringify({ a: 10, b: [1, 2, 3] }, 2)
.then(result => {
console.log('Result:', result);
}).catch(e => {
console.log('Error:', e);
});
Feel free to fork project, fix bugs, write tests and finally request for pull
FAQs
The library for parse / stringify JSON in different thread via Web Workers
The npm package @cheprasov/json-web-worker receives a total of 2 weekly downloads. As such, @cheprasov/json-web-worker popularity was classified as not popular.
We found that @cheprasov/json-web-worker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.