src/stage-impl.js
function defineSetStageValue(parts) {
  let body = `var cb2 = cb && function() { cb(this.stageValue); }.bind(this);`;

  switch (parts.length) {
    case 0:
      body += "\nthis.setState(value, cb2);";
      break;

    case 1:
      body += `\nthis.setState({${parts[0]}: value}, cb2);`;
      break;

    default:
      const lastIndex = parts.length - 1;
      body += `\nvar tmp0 = this.state || {};`;
      for (let i = 0; i < lastIndex; ++i) {
        body += `
var tmp${i + 1} = tmp${i}.${parts[i]};
if (tmp${i + 1} == null) {
  tmp${i + 1} = tmp${i}.${parts[i]} = {};
}`;
      }
      body += `
tmp${lastIndex}.${parts[lastIndex]} = value;
this.setState(tmp0, cb2);`;
      break;
  }

  return Function("value", "cb", body);
}
function defineSetStageValue(parts) {
  let body = `var cb2 = cb && function() { cb(this.stageValue); }.bind(this);`;

  switch (parts.length) {
    case 0:
      body += "\nthis.setState(value, cb2);";
      break;

    case 1:
      body += `\nthis.setState({${parts[0]}: value}, cb2);`;
      break;

    default:
      const lastIndex = parts.length - 1;
      body += `\nvar tmp0 = this.state || {};`;
      for (let i = 0; i < lastIndex; ++i) {
        body += `
var tmp${i + 1} = tmp${i}.${parts[i]};
if (tmp${i + 1} == null) {
  tmp${i + 1} = tmp${i}.${parts[i]} = {};
}`;
      }
      body += `
tmp${lastIndex}.${parts[lastIndex]} = value;
this.setState(tmp0, cb2);`;
      break;
  }

  return Function("value", "cb", body);
}
function defineSetStageValue ( parts ) { let body = ` ` ; switch ( parts . length ) { case 0 : body += "\nthis.setState(value, cb2);" ; break ; case 1 : body += ` \n ${ parts [ 0 ] } ` ; break ; default : const lastIndex = parts . length - 1 ; body += ` \n ` ; for ( let i = 0 ; i < lastIndex ; ++ i ) { body += ` ${ i + 1 } ${ i } ${ parts [ i ] } ${ i + 1 } ${ i + 1 } ${ i } ${ parts [ i ] } ` ; } body += ` ${ lastIndex } ${ parts [ lastIndex ] } ` ; break ; } return Function ( "value" , "cb" , body ) ; }
------------------------------------------------------------------------------
------------------------------------------------------------------------------