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-multibyte.js 1.1KB

123456789101112131415161718192021222324252627
  1. var toInteger = require('../internals/to-integer');
  2. var requireObjectCoercible = require('../internals/require-object-coercible');
  3. // `String.prototype.{ codePointAt, at }` methods implementation
  4. var createMethod = function (CONVERT_TO_STRING) {
  5. return function ($this, pos) {
  6. var S = String(requireObjectCoercible($this));
  7. var position = toInteger(pos);
  8. var size = S.length;
  9. var first, second;
  10. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  11. first = S.charCodeAt(position);
  12. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  13. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  14. ? CONVERT_TO_STRING ? S.charAt(position) : first
  15. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  16. };
  17. };
  18. module.exports = {
  19. // `String.prototype.codePointAt` method
  20. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  21. codeAt: createMethod(false),
  22. // `String.prototype.at` method
  23. // https://github.com/mathiasbynens/String.prototype.at
  24. charAt: createMethod(true)
  25. };