yoastseo
Version:
Yoast client-side content analysis
29 lines (27 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = processExactMatchRequest;
var _isDoubleQuoted = _interopRequireDefault(require("./isDoubleQuoted"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Checks if exact match functionality is requested by enclosing the keyphrase in double quotation marks.
*
* @param {string} keyphrase The keyphrase to check. This must be the keyphrase accessed directly from the Paper.
*
* @returns {{exactMatchRequested: boolean, keyphrase: string}} Whether the exact match functionality is requested and the keyword stripped from double quotes.
*/
function processExactMatchRequest(keyphrase) {
const exactMatchRequest = {
exactMatchRequested: false,
keyphrase: keyphrase
};
// Check if only exact match processing is requested by the user. If so, strip the quotation marks from the keyphrase.
if ((0, _isDoubleQuoted.default)(keyphrase)) {
exactMatchRequest.keyphrase = keyphrase.substring(1, keyphrase.length - 1);
exactMatchRequest.exactMatchRequested = true;
}
return exactMatchRequest;
}
//# sourceMappingURL=processExactMatchRequest.js.map