getName.js 462 B

123456789101112131415161718192021
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
  7. /**
  8. * @param {RawSourceMap} sourceMap source map
  9. * @param {number} index index
  10. * @returns {string | undefined | null} name
  11. */
  12. const getName = (sourceMap, index) => {
  13. if (index < 0) return null;
  14. const { names } = sourceMap;
  15. return names[index];
  16. };
  17. module.exports = getName;