core-js
Version:
Standard library
10 lines (8 loc) • 398 B
JavaScript
// helper for String#{startsWith, endsWith, includes}
var isRegExp = require('../internals/is-regexp');
var requireObjectCoercible = require('../internals/require-object-coercible');
module.exports = function (that, searchString, NAME) {
if (isRegExp(searchString)) {
throw TypeError('String.prototype.' + NAME + " doesn't accept regex");
} return String(requireObjectCoercible(that));
};