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.

es.escape.js 815B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var raw = /[\w*+\-./@]/;
  4. var hex = function (code, length) {
  5. var result = code.toString(16);
  6. while (result.length < length) result = '0' + result;
  7. return result;
  8. };
  9. // `escape` method
  10. // https://tc39.es/ecma262/#sec-escape-string
  11. $({ global: true }, {
  12. escape: function escape(string) {
  13. var str = String(string);
  14. var result = '';
  15. var length = str.length;
  16. var index = 0;
  17. var chr, code;
  18. while (index < length) {
  19. chr = str.charAt(index++);
  20. if (raw.test(chr)) {
  21. result += chr;
  22. } else {
  23. code = chr.charCodeAt(0);
  24. if (code < 256) {
  25. result += '%' + hex(code, 2);
  26. } else {
  27. result += '%u' + hex(code, 4).toUpperCase();
  28. }
  29. }
  30. } return result;
  31. }
  32. });