UNPKG

arvo-xstate

Version:

This package allows you to use xstate Actors and State Machines to act as orchestrators in an Arvo Event Driven System

19 lines (18 loc) 596 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJsonSize = getJsonSize; var arvo_core_1 = require("arvo-core"); function getJsonSize(obj) { try { var jsonString = JSON.stringify(obj); // Use TextEncoder to get actual UTF-8 byte length return new TextEncoder().encode(jsonString).length; } catch (e) { (0, arvo_core_1.logToSpan)({ level: 'WARNING', message: "Error while calculating the size of the machine memory record. Error: ".concat(e.message), }); return -1; } }