yoastseo
Version:
Yoast client-side content analysis
33 lines (31 loc) • 999 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _languageProcessing = require("../../languageProcessing");
/**
* @typedef {import("./SourceCodeLocation").SourceCodeRange} SourceCodeRange
*/
/**
* A token representing a word, whitespace or punctuation in the sentence.
*/
class Token {
/**
* Creates a new token.
*
* @param {string} text The token's text.
* @param {SourceCodeRange} sourceCodeRange The start and end positions of the token in the source code.
*/
constructor(text, sourceCodeRange = {}) {
// Normalize single quotes so that tokens can be matched with strings regardless of single quote type.
this.text = (0, _languageProcessing.normalizeSingle)(text);
/**
* The start and end positions of the token in the source code.
* @type {SourceCodeRange}
*/
this.sourceCodeRange = sourceCodeRange;
}
}
var _default = exports.default = Token;
//# sourceMappingURL=Token.js.map