source: frontend/node_modules/webpack-sources/lib/helpers/getSource.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 605 bytes
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8/** @typedef {import("../Source").RawSourceMap} RawSourceMap */
9
10/**
11 * @param {RawSourceMap} sourceMap source map
12 * @param {number} index index
13 * @returns {string | null} name
14 */
15const getSource = (sourceMap, index) => {
16 if (index < 0) return null;
17 const { sourceRoot, sources } = sourceMap;
18 const source = sources[index];
19 if (!sourceRoot) return source;
20 if (sourceRoot.endsWith("/")) return sourceRoot + source;
21 return `${sourceRoot}/${source}`;
22};
23
24module.exports = getSource;
Note: See TracBrowser for help on using the repository browser.