polyfill.js 547 B

12345678910111213141516171819
  1. 'use strict';
  2. var implementation = require('./implementation');
  3. var zeroWidthSpace = '\u200b';
  4. var mongolianVowelSeparator = '\u180E';
  5. module.exports = function getPolyfill() {
  6. if (
  7. String.prototype.trim
  8. && zeroWidthSpace.trim() === zeroWidthSpace
  9. && mongolianVowelSeparator.trim() === mongolianVowelSeparator
  10. && ('_' + mongolianVowelSeparator).trim() === ('_' + mongolianVowelSeparator)
  11. && (mongolianVowelSeparator + '_').trim() === (mongolianVowelSeparator + '_')
  12. ) {
  13. return String.prototype.trim;
  14. }
  15. return implementation;
  16. };