es.string.trim-end.js 533 B

1234567891011121314151617
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $trimEnd = require('../internals/string-trim').end;
  4. var forcedStringTrimMethod = require('../internals/string-trim-forced');
  5. var FORCED = forcedStringTrimMethod('trimEnd');
  6. var trimEnd = FORCED ? function trimEnd() {
  7. return $trimEnd(this);
  8. } : ''.trimEnd;
  9. // `String.prototype.{ trimEnd, trimRight }` methods
  10. // https://github.com/tc39/ecmascript-string-left-right-trim
  11. $({ target: 'String', proto: true, forced: FORCED }, {
  12. trimEnd: trimEnd,
  13. trimRight: trimEnd
  14. });