transform-utils.js 498 B

1234567891011121314151617181920
  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.keys(cache).reduce((output, key) => {
  11. const item = cache[key];
  12. return Object.assign(output, {
  13. [item.file]: item.mappedCoverage
  14. });
  15. }, {});
  16. }
  17. module.exports = { getUniqueKey, getOutput };