UNPKG

string.prototype.startswith

Version:

A robust & optimized `String.prototype.startsWith` polyfill, based on the ECMAScript 6 specification.

18 lines (11 loc) 359 B
/*! https://mths.be/startswith v1.0.0 by @mathias */ 'use strict'; var define = require('define-properties'); var getPolyfill = require('./polyfill'); module.exports = function shimStartsWith() { var polyfill = getPolyfill(); if (String.prototype.startsWith !== polyfill) { define(String.prototype, { startsWith: polyfill }); } return polyfill; }