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.

index.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. const os = require('os');
  3. const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/;
  4. const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
  5. const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir();
  6. module.exports = (stack, options) => {
  7. options = Object.assign({pretty: false}, options);
  8. return stack.replace(/\\/g, '/')
  9. .split('\n')
  10. .filter(line => {
  11. const pathMatches = line.match(extractPathRegex);
  12. if (pathMatches === null || !pathMatches[1]) {
  13. return true;
  14. }
  15. const match = pathMatches[1];
  16. // Electron
  17. if (
  18. match.includes('.app/Contents/Resources/electron.asar') ||
  19. match.includes('.app/Contents/Resources/default_app.asar')
  20. ) {
  21. return false;
  22. }
  23. return !pathRegex.test(match);
  24. })
  25. .filter(line => line.trim() !== '')
  26. .map(line => {
  27. if (options.pretty) {
  28. return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
  29. }
  30. return line;
  31. })
  32. .join('\n');
  33. };