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

Method add

lib/source-node.js:188–204  ·  view source on GitHub ↗

* Add a chunk of generated JS to this source node. * * @param aChunk A string snippet of generated JS code, another instance of * SourceNode, or an array where each member is one of those things.

(aChunk)

Source from the content-addressed store, hash-verified

186 * SourceNode, or an array where each member is one of those things.
187 */
188 add(aChunk) {
189 if (Array.isArray(aChunk)) {
190 aChunk.forEach(function (chunk) {
191 this.add(chunk);
192 }, this);
193 } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
194 if (aChunk) {
195 this.children.push(aChunk);
196 }
197 } else {
198 throw new TypeError(
199 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " +
200 aChunk
201 );
202 }
203 return this;
204 }
205
206 /**
207 * Add a chunk of generated JS to the beginning of this source node.

Callers 4

constructorMethod · 0.95
testFunction · 0.95
addMappingWithCodeMethod · 0.45

Calls

no outgoing calls

Tested by 1

testFunction · 0.76