Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

string-trim.js 1.0KB

12345678910111213141516171819202122232425262728
  1. var requireObjectCoercible = require('../internals/require-object-coercible');
  2. var whitespaces = require('../internals/whitespaces');
  3. var whitespace = '[' + whitespaces + ']';
  4. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  5. var rtrim = RegExp(whitespace + whitespace + '*$');
  6. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  7. var createMethod = function (TYPE) {
  8. return function ($this) {
  9. var string = String(requireObjectCoercible($this));
  10. if (TYPE & 1) string = string.replace(ltrim, '');
  11. if (TYPE & 2) string = string.replace(rtrim, '');
  12. return string;
  13. };
  14. };
  15. module.exports = {
  16. // `String.prototype.{ trimLeft, trimStart }` methods
  17. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  18. start: createMethod(1),
  19. // `String.prototype.{ trimRight, trimEnd }` methods
  20. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  21. end: createMethod(2),
  22. // `String.prototype.trim` method
  23. // https://tc39.es/ecma262/#sec-string.prototype.trim
  24. trim: createMethod(3)
  25. };