_string-context.js 314 B

123456789
  1. // helper for String#{startsWith, endsWith, includes}
  2. var isRegExp = require('./_is-regexp');
  3. var defined = require('./_defined');
  4. module.exports = function (that, searchString, NAME) {
  5. if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
  6. return String(defined(that));
  7. };