es.string.trim-start.js 682 B

12345678910111213141516171819
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $trimStart = require('../internals/string-trim').start;
  4. var forcedStringTrimMethod = require('../internals/string-trim-forced');
  5. var FORCED = forcedStringTrimMethod('trimStart');
  6. var trimStart = FORCED ? function trimStart() {
  7. return $trimStart(this);
  8. // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
  9. } : ''.trimStart;
  10. // `String.prototype.{ trimStart, trimLeft }` methods
  11. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  12. // https://tc39.es/ecma262/#String.prototype.trimleft
  13. $({ target: 'String', proto: true, forced: FORCED }, {
  14. trimStart: trimStart,
  15. trimLeft: trimStart
  16. });