UNPKG

dreamstate

Version:

Store management library based on react context and observers

25 lines (22 loc) 791 B
import { ComputedValue } from './ComputedValue.js'; /** * Processes computed values within the given context. * * This function mutates the provided context object, updating its computed values while maintaining * the original object reference. It ensures that computed properties are properly initialized * and reactive based on the current state. * * @template T - The type of the context object. * @param {T} context - The context object containing computed values to be processed. * @returns {T} The same context object with updated computed values. */ function processComputed(context) { for (var key in context) { var it_1 = context[key]; if (it_1 instanceof ComputedValue) { it_1.process(context); } } return context; } export { processComputed };