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.

clone.mjs 5.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Creates a deep copy of a process coverage.
  3. *
  4. * @param processCov Process coverage to clone.
  5. * @return Cloned process coverage.
  6. */
  7. export function cloneProcessCov(processCov) {
  8. const result = [];
  9. for (const scriptCov of processCov.result) {
  10. result.push(cloneScriptCov(scriptCov));
  11. }
  12. return {
  13. result,
  14. };
  15. }
  16. /**
  17. * Creates a deep copy of a script coverage.
  18. *
  19. * @param scriptCov Script coverage to clone.
  20. * @return Cloned script coverage.
  21. */
  22. export function cloneScriptCov(scriptCov) {
  23. const functions = [];
  24. for (const functionCov of scriptCov.functions) {
  25. functions.push(cloneFunctionCov(functionCov));
  26. }
  27. return {
  28. scriptId: scriptCov.scriptId,
  29. url: scriptCov.url,
  30. functions,
  31. };
  32. }
  33. /**
  34. * Creates a deep copy of a function coverage.
  35. *
  36. * @param functionCov Function coverage to clone.
  37. * @return Cloned function coverage.
  38. */
  39. export function cloneFunctionCov(functionCov) {
  40. const ranges = [];
  41. for (const rangeCov of functionCov.ranges) {
  42. ranges.push(cloneRangeCov(rangeCov));
  43. }
  44. return {
  45. functionName: functionCov.functionName,
  46. ranges,
  47. isBlockCoverage: functionCov.isBlockCoverage,
  48. };
  49. }
  50. /**
  51. * Creates a deep copy of a function coverage.
  52. *
  53. * @param rangeCov Range coverage to clone.
  54. * @return Cloned range coverage.
  55. */
  56. export function cloneRangeCov(rangeCov) {
  57. return {
  58. startOffset: rangeCov.startOffset,
  59. endOffset: rangeCov.endOffset,
  60. count: rangeCov.count,
  61. };
  62. }
  63. //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zcmMvY2xvbmUudHMiXSwibmFtZ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