You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

polyfill.js 463B

123456789101112131415
  1. 'use strict';
  2. var implementation = require('./implementation');
  3. module.exports = function getPolyfill() {
  4. if (!String.prototype.trimStart && !String.prototype.trimLeft) {
  5. return implementation;
  6. }
  7. var zeroWidthSpace = '\u200b';
  8. var trimmed = zeroWidthSpace.trimStart ? zeroWidthSpace.trimStart() : zeroWidthSpace.trimLeft();
  9. if (trimmed !== zeroWidthSpace) {
  10. return implementation;
  11. }
  12. return String.prototype.trimStart || String.prototype.trimLeft;
  13. };