summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/source-map-util.js
blob: 0bb25b3df538db63b95755f9ddda7e4b366a4b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function originalToGeneratedId(originalId) {
  const match = originalId.match(/(.*)\/originalSource/);
  return match ? match[1] : "";
}

function generatedToOriginalId(generatedId, url) {
  return generatedId + "/originalSource-" + url.replace(/ \//, '-');
}

function isOriginalId(id) {
  return !!id.match(/\/originalSource/);
}

function isGeneratedId(id) {
  return !isOriginalId(id);
}

module.exports = {
  originalToGeneratedId, generatedToOriginalId, isOriginalId, isGeneratedId
};