Skip to content

Commit f5cc42f

Browse files
committed
doc: clarify sourceMap.payload behavior and immutability
1 parent 73ffd8a commit f5cc42f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

doc/api/module.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,6 +1970,9 @@ generated code.
19701970
19711971
Getter for the payload used to construct the [`SourceMap`][] instance.
19721972
1973+
The returned object is frozen with [`Object.freeze()`][], and the same
1974+
reference is returned on every access. Do not mutate the returned object.
1975+
19731976
#### `sourceMap.findEntry(lineOffset, columnOffset)`
19741977
19751978
* `lineOffset` {number} The zero-indexed line number offset in
@@ -2054,6 +2057,7 @@ returned object contains the following keys:
20542057
[`NODE_COMPILE_CACHE_PORTABLE=1`]: cli.md#node_compile_cache_portable1
20552058
[`NODE_DISABLE_COMPILE_CACHE=1`]: cli.md#node_disable_compile_cache1
20562059
[`NODE_V8_COVERAGE=dir`]: cli.md#node_v8_coveragedir
2060+
[`Object.freeze()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
20572061
[`SourceMap`]: #class-modulesourcemap
20582062
[`initialize`]: #initialize
20592063
[`module.constants.compileCacheStatus`]: #moduleconstantscompilecachestatus

0 commit comments

Comments
 (0)