source-map-util.js 491 B

123456789101112131415161718192021
  1. function originalToGeneratedId(originalId) {
  2. const match = originalId.match(/(.*)\/originalSource/);
  3. return match ? match[1] : "";
  4. }
  5. function generatedToOriginalId(generatedId, url) {
  6. return generatedId + "/originalSource-" + url.replace(/ \//, '-');
  7. }
  8. function isOriginalId(id) {
  9. return !!id.match(/\/originalSource/);
  10. }
  11. function isGeneratedId(id) {
  12. return !isOriginalId(id);
  13. }
  14. module.exports = {
  15. originalToGeneratedId, generatedToOriginalId, isOriginalId, isGeneratedId
  16. };