packages/mangojuice-core/src/classes/Process.js
function bindComputedFieldCmd(proc, model, key, computeVal) {
  const { logger } = proc;

  // Create getter function
  const isMemoized = computeVal instanceof MemoizedFieldCmd;
  const computeFn = isMemoized ? computeVal.computeFn : computeVal;
  const safeComputeValue = () => safeExecFunction(logger, computeFn)
  const getter = isMemoized ? memoize(safeComputeValue) : safeComputeValue;

  // Register memoized field in the process to be able to reset
  // when the model changed
  if (isMemoized) {
    proc.computedFields[key] = getter;
  }

  // Set the getter in the model
  Object.defineProperty(model, key, {
    enumerable: true,
    configurable: true,
    set: noop,
    get: getter
  });
}
function bindComputedFieldCmd(proc, model, key, computeVal) {
  const { logger } = proc;

  // Create getter function
  const isMemoized = computeVal instanceof MemoizedFieldCmd;
  const computeFn = isMemoized ? computeVal.computeFn : computeVal;
  const safeComputeValue = () => safeExecFunction(logger, computeFn)
  const getter = isMemoized ? memoize(safeComputeValue) : safeComputeValue;

  // Register memoized field in the process to be able to reset
  // when the model changed
  if (isMemoized) {
    proc.computedFields[key] = getter;
  }

  // Set the getter in the model
  Object.defineProperty(model, key, {
    enumerable: true,
    configurable: true,
    set: noop,
    get: getter
  });
}
function bindComputedFieldCmd ( proc , model , key , computeVal ) { const { logger } = proc ; // Create getter function const isMemoized = computeVal instanceof MemoizedFieldCmd ; const computeFn = isMemoized ? computeVal . computeFn : computeVal ; const safeComputeValue = ( ) => safeExecFunction ( logger , computeFn ) const getter = isMemoized ? memoize ( safeComputeValue ) : safeComputeValue ; // Register memoized field in the process to be able to reset // when the model changed if ( isMemoized ) { proc . computedFields [ key ] = getter ; } // Set the getter in the model Object . defineProperty ( model , key , { enumerable : true , configurable : true , set : noop , get : getter } ) ; }
Bind field in the model with given computed function or dependency
object.

@private
@param  {Process} proc
@param  {string} fieldName
@param  {function} computeVal
Bind field in the model with given computed function or dependency object .