MCPcopy Index your code
hub / github.com/mozilla/source-map / prepend

Method prepend

lib/source-node.js:212–226  ·  view source on GitHub ↗

* Add a chunk of generated JS to the beginning of 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

210 * SourceNode, or an array where each member is one of those things.
211 */
212 prepend(aChunk) {
213 if (Array.isArray(aChunk)) {
214 for (let i = aChunk.length - 1; i >= 0; i--) {
215 this.prepend(aChunk[i]);
216 }
217 } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
218 this.children.unshift(aChunk);
219 } else {
220 throw new TypeError(
221 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " +
222 aChunk
223 );
224 }
225 return this;
226 }
227
228 /**
229 * Walk over the tree of JS snippets in this node and its children. The

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected