MCPcopy
hub / github.com/vercel/next.js / prepend

Method prepend

packages/next/src/compiled/source-map08/source-map.js:2130–2143  ·  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

2128 * SourceNode, or an array where each member is one of those things.
2129 */
2130 prepend(aChunk) {
2131 if (Array.isArray(aChunk)) {
2132 for (let i = aChunk.length - 1; i >= 0; i--) {
2133 this.prepend(aChunk[i]);
2134 }
2135 } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
2136 this.children.unshift(aChunk);
2137 } else {
2138 throw new TypeError(
2139 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
2140 );
2141 }
2142 return this;
2143 }
2144
2145 /**
2146 * Walk over the tree of JS snippets in this node and its children. The

Callers 3

updateElementsFunction · 0.45
source-map.jsFile · 0.45
OnceExitFunction · 0.45

Calls 2

isArrayMethod · 0.80
unshiftMethod · 0.45

Tested by

no test coverage detected