MCPcopy
hub / github.com/mozilla/source-map / toJSON

Method toJSON

lib/source-map-generator.js:407–428  ·  view source on GitHub ↗

* Externalize the source map.

()

Source from the content-addressed store, hash-verified

405 * Externalize the source map.
406 */
407 toJSON() {
408 const map = {
409 version: this._version,
410 sources: this._sources.toArray(),
411 names: this._names.toArray(),
412 mappings: this._serializeMappings(),
413 };
414 if (this._file != null) {
415 map.file = this._file;
416 }
417 if (this._sourceRoot != null) {
418 map.sourceRoot = this._sourceRoot;
419 }
420 if (this._sourcesContents) {
421 map.sourcesContent = this._generateSourcesContent(
422 map.sources,
423 map.sourceRoot
424 );
425 }
426
427 return map;
428 }
429
430 /**
431 * Render the source map being generated to a string.

Callers 8

toStringMethod · 0.95
expectedMapFunction · 0.95
assertNameFunction · 0.95
composeSourceMapsFunction · 0.95
actualMapFunction · 0.80

Calls 3

_serializeMappingsMethod · 0.95
toArrayMethod · 0.45

Tested by

no test coverage detected