lib/threaded-actor-worker.js
function compileDefinition(def) {
  if (_.isArray(def)) {
    return _.map(def, compileDefinition);
  }

  try {
    if (def[0] == '{') {
      // Plain object defined behaviour => wrap in braces.
      return eval(`(${def})`);
    }
    else if (def[0] == '[') {
      // Definition array => first deserialize array, then definitions inside.
      let behArr = eval(`(${def})`);

      return _.map(behArr, item => compileDefinition(item));
    }

    return eval(def);
  }
  catch (err) {
    parentPort.postMessage({ error: 'Compilation error: ' + err });

    process.exit(1);
  }
}
function compileDefinition(def) {
  if (_.isArray(def)) {
    return _.map(def, compileDefinition);
  }

  try {
    if (def[0] == '{') {
      // Plain object defined behaviour => wrap in braces.
      return eval(`(${def})`);
    }
    else if (def[0] == '[') {
      // Definition array => first deserialize array, then definitions inside.
      let behArr = eval(`(${def})`);

      return _.map(behArr, item => compileDefinition(item));
    }

    return eval(def);
  }
  catch (err) {
    parentPort.postMessage({ error: 'Compilation error: ' + err });

    process.exit(1);
  }
}
function compileDefinition ( def ) { if ( _ . isArray ( def ) ) { return _ . map ( def , compileDefinition ) ; } try { if ( def [ 0 ] == '{' ) { // Plain object defined behaviour => wrap in braces. return eval ( ` ${ def } ` ) ; } else if ( def [ 0 ] == '[' ) { // Definition array => first deserialize array, then definitions inside. let behArr = eval ( ` ${ def } ` ) ; return _ . map ( behArr , item => compileDefinition ( item ) ) ; } return eval ( def ) ; } catch ( err ) { parentPort . postMessage ( { error : 'Compilation error: ' + err } ) ; process . exit ( 1 ) ; } }
Compiles a serialized actor definition.

@param {String|String[]} def Serialized definition.
@returns {*} Compiled actor definition.
Compiles a serialized actor definition .