src/template.js
function getTagState(string) {
  for (let i = string.length - 1; i >= 0; i--) {
    const char = string[i];

    if (char === '>') {
      return 0;
    } else if (char === '<') {
      return 1;
    }
  }

  return -1;
}
function getTagState(string) {
  for (let i = string.length - 1; i >= 0; i--) {
    const char = string[i];

    if (char === '>') {
      return 0;
    } else if (char === '<') {
      return 1;
    }
  }

  return -1;
}
function getTagState ( string ) { for ( let i = string . length - 1 ; i >= 0 ; i -- ) { const char = string [ i ] ; if ( char === '>' ) { return 0 ; } else if ( char === '<' ) { return 1 ; } } return - 1 ; }
Determine if 'string' terminates with an opened or closed tag.

Iterating through all characters has at worst a time complexity of O(n),
and is better than the alternative (using "indexOf/lastIndexOf") which is potentially O(2n).

@param { string } string
@returns { number } - returns "-1" if no tag, "0" if closed tag, or "1" if open tag
Determine if string terminates with an opened or closed tag .