Nessuna descrizione

scanner.js 583B

1234567891011121314151617181920
  1. (function() {
  2. var OPEN_BRACE = '{';
  3. var SEMICOLON = ';';
  4. var COLON = ':';
  5. var PropertyScanner = function PropertyScanner(data) {
  6. this.data = data;
  7. };
  8. PropertyScanner.prototype.nextAt = function(cursor) {
  9. var lastColon = this.data.lastIndexOf(COLON, cursor);
  10. var lastOpenBrace = this.data.lastIndexOf(OPEN_BRACE, cursor);
  11. var lastSemicolon = this.data.lastIndexOf(SEMICOLON, cursor);
  12. var startAt = Math.max(lastOpenBrace, lastSemicolon);
  13. return this.data.substring(startAt + 1, lastColon).trim();
  14. };
  15. module.exports = PropertyScanner;
  16. })();