Innovenergy_trunk/frontend/node_modules/testcafe/lib/utils/string-ends-with.js

20 lines
3.3 KiB
JavaScript
Raw Normal View History

"use strict";
// -------------------------------------------------------------
// WARNING: this file is used by both the client and the server.
// Do not use any browser or node-specific API!
// -------------------------------------------------------------
Object.defineProperty(exports, "__esModule", { value: true });
const objectToString = Object.prototype.toString;
const stringIndexOf = String.prototype.indexOf;
const stringEndsWith = String.prototype.endsWith
|| function (searchString, position) {
const subjectString = objectToString.call(this);
if (position === void 0 || position > subjectString.length)
position = subjectString.length;
position -= searchString.length;
const lastIndex = stringIndexOf.call(subjectString, searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
exports.default = stringEndsWith;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLWVuZHMtd2l0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9zdHJpbmctZW5kcy13aXRoLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxnRUFBZ0U7QUFDaEUsZ0VBQWdFO0FBQ2hFLCtDQUErQztBQUMvQyxnRUFBZ0U7O0FBRWhFLE1BQU0sY0FBYyxHQUFHLE1BQU0sQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDO0FBQ2pELE1BQU0sYUFBYSxHQUFJLE1BQU0sQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDO0FBRWhELE1BQU0sY0FBYyxHQUFHLE1BQU0sQ0FBQyxTQUFTLENBQUMsUUFBUTtPQUNmLFVBQVUsWUFBWSxFQUFFLFFBQVE7UUFDL0IsTUFBTSxhQUFhLEdBQUcsY0FBYyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUVoRCxJQUFJLFFBQVEsS0FBSyxLQUFLLENBQUMsSUFBSSxRQUFRLEdBQUcsYUFBYSxDQUFDLE1BQU07WUFDdEQsUUFBUSxHQUFH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XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gPT09IHZvaWQgMCB8fCBwb3NpdGlvbiA+IHN1YmplY3RTdHJpbmcubGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbiA9IHN1YmplY3RTdHJpbmcubGVuZ3RoO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zaXRpb24gLT0gc2VhcmNoU3RyaW5nLmxlbmd0aDtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGxhc3RJbmRleCA9IHN0cmluZ0luZGV4T2YuY2FsbChzdWJqZWN0U3RyaW5nLCBzZWFyY2hTdHJpbmcsIHBvc2l0aW9uKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsYXN0SW5kZXggIT09IC0xICYmIGxhc3RJbmRleCA9PT0gcG9zaXRpb247XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXG5leHBvcnQgZGVmYXVsdCBzdHJpbmdFbmRzV2l0aDtcbiJdfQ==