Sha256: 17f86bf1ad75a90a3b062616d6e3c4cb783338edede918abc05a06d81d75c1fe

Contents?: true

Size: 1.44 KB

Versions: 13

Compression:

Stored size: 1.44 KB

Contents

'use strict';
var $ = require('../internals/export');
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
var toLength = require('../internals/to-length');
var notARegExp = require('../internals/not-a-regexp');
var requireObjectCoercible = require('../internals/require-object-coercible');
var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
var IS_PURE = require('../internals/is-pure');

var nativeStartsWith = ''.startsWith;
var min = Math.min;

var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
  var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
  return descriptor && !descriptor.writable;
}();

// `String.prototype.startsWith` method
// https://tc39.github.io/ecma262/#sec-string.prototype.startswith
$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  startsWith: function startsWith(searchString /* , position = 0 */) {
    var that = String(requireObjectCoercible(this));
    notARegExp(searchString);
    var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
    var search = String(searchString);
    return nativeStartsWith
      ? nativeStartsWith.call(that, search, index)
      : that.slice(index, index + search.length) === search;
  }
});

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/core-js/modules/es.string.starts-with.js
tang-0.2.1 spec/tang_app/node_modules/core-js/modules/es.string.starts-with.js
tang-0.2.0 spec/tang_app/node_modules/core-js/modules/es.string.starts-with.js
tang-0.1.0 spec/tang_app/node_modules/core-js/modules/es.string.starts-with.js
tang-0.0.9 spec/tang_app/node_modules/core-js/modules/es.string.starts-with.js
enju_library-0.3.8 spec/dummy/node_modules/core-js/modules/es.string.starts-with.js
condenser-0.3 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.2 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.1 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.0.12 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.0.11 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.0.10 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js
condenser-0.0.9 lib/condenser/processors/node_modules/core-js-pure/modules/es.string.starts-with.js