{"size": 439, "ext": "js", "max_stars_repo_path": "www/html/bitrix/modules/landing/install/js/landing/history/src/internal/async-json-stringify.js", "max_stars_repo_name": "Evil1991/bitrixdock", "max_stars_repo_stars_event_min_datetime": "2020-10-05T04:28:40.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T04:28:40.000Z", "max_issues_repo_path": "www/html/bitrix/modules/landing/install/js/landing/history/src/internal/async-json-stringify.js", "max_issues_repo_name": "Evil1991/bitrixdock", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "www/html/bitrix/modules/landing/install/js/landing/history/src/internal/async-json-stringify.js", "max_forks_repo_name": "Evil1991/bitrixdock", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.3888888889, "max_line_length": 100, "alphanum_fraction": 0.6697038724}
const worker = new Worker(
	'/bitrix/js/landing/history/src/worker/json-stringify-worker.js',
);

/**
 * Serializes object
 * @param {Object|array} obj
 * @return {Promise<?String>}
 */
export default function asyncJsonStringify(obj: {[key: string]: any} | Array<any>): Promise<?string>
{
	return new Promise(((resolve) => {
		worker.postMessage(obj);
		worker.addEventListener('message', (event) => {
			resolve(event.data);
		});
	}));
}