transform-utils.js 478 B

123456789101112131415161718192021
  1. /*
  2. Copyright 2015, Yahoo Inc.
  3. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  4. */
  5. 'use strict';
  6. function getUniqueKey(pathname) {
  7. return pathname.replace(/[\\/]/g, '_');
  8. }
  9. function getOutput(cache) {
  10. return Object.values(cache).reduce(
  11. (output, { file, mappedCoverage }) => ({
  12. ...output,
  13. [file]: mappedCoverage
  14. }),
  15. {}
  16. );
  17. }
  18. module.exports = { getUniqueKey, getOutput };