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.

19 lines
545 B

4 years ago
  1. /*
  2. * MIT License http://opensource.org/licenses/MIT
  3. * Author: Ben Holloway @bholloway
  4. */
  5. 'use strict';
  6. var path = require('path');
  7. /**
  8. * Convert the given array of absolute URIs to relative URIs (in place).
  9. * @param {Array} sources The source map sources array
  10. * @param {string} basePath The base path to make relative to
  11. */
  12. module.exports = function sourcesAbsoluteToRelative(sources, basePath) {
  13. sources.forEach(sourceToRelative);
  14. function sourceToRelative(value, i, array) {
  15. array[i] = path.relative(basePath, value);
  16. }
  17. };