lib/api/properties.js
function queryProperties(props, nodeTypeStack, childIndexStack = [], text) {
  let stateId = 0
  for (let i = 0, {length} = nodeTypeStack; i < length; i++) {
    const nodeType = nodeTypeStack[i];
    const state = props.states[stateId];
    let found_transition = false;
    for (const transition of state.transitions) {
      if (
        (transition.type === nodeType) &&
        (transition.index == null || transition.index === childIndexStack[i]) &&
        (transition.text == null || new RegExp(transition.text).test(text))
      ) {
        stateId = transition.state_id;
        found_transition = true;
        break;
      }
    }
    if (!found_transition) {
      stateId = state.default_next_state_id
    }
    // console.log(
    //   nodeType, '->', stateId,
    //   props.property_sets[props.states[stateId].property_set_id]
    // );
  }
  return props.property_sets[props.states[stateId].property_set_id]
}
function queryProperties(props, nodeTypeStack, childIndexStack = [], text) {
  let stateId = 0
  for (let i = 0, {length} = nodeTypeStack; i < length; i++) {
    const nodeType = nodeTypeStack[i];
    const state = props.states[stateId];
    let found_transition = false;
    for (const transition of state.transitions) {
      if (
        (transition.type === nodeType) &&
        (transition.index == null || transition.index === childIndexStack[i]) &&
        (transition.text == null || new RegExp(transition.text).test(text))
      ) {
        stateId = transition.state_id;
        found_transition = true;
        break;
      }
    }
    if (!found_transition) {
      stateId = state.default_next_state_id
    }
    // console.log(
    //   nodeType, '->', stateId,
    //   props.property_sets[props.states[stateId].property_set_id]
    // );
  }
  return props.property_sets[props.states[stateId].property_set_id]
}
function queryProperties ( props , nodeTypeStack , childIndexStack = [ ] , text ) { let stateId = 0 for ( let i = 0 , { length } = nodeTypeStack ; i < length ; i ++ ) { const nodeType = nodeTypeStack [ i ] ; const state = props . states [ stateId ] ; let found_transition = false ; for ( const transition of state . transitions ) { if ( ( transition . type === nodeType ) && ( transition . index == null || transition . index === childIndexStack [ i ] ) && ( transition . text == null || new RegExp ( transition . text ) . test ( text ) ) ) { stateId = transition . state_id ; found_transition = true ; break ; } } if ( ! found_transition ) { stateId = state . default_next_state_id } // console.log( //   nodeType, '->', stateId, //   props.property_sets[props.states[stateId].property_set_id] // ); } return props . property_sets [ props . states [ stateId ] . property_set_id ] }
Test a property state machine against a node structure specified as an array of node types.
Test a property state machine against a node structure specified as an array of node types .