Returning lines for a given function from a JavaScript file
Inefficient Array.forEach

The current implementation will needlessly iterate until the end of the array even after the function was found.
It would be better replace the .forEach with a regular counting loop,
and break out of it after you found the end of the function.

Avoid flag variables

Using a single loop and the copying_lines flag variable to alternate between processing logic (find start of function, copy content, find end), is not very easy to read.
It would be easier to use a nested loop after you found the start.
Something like this:

for (let i = 0; i &lt; lines.length; i++) {
  if (lines[i].match(startPattern) !== null) {
    let function_lines = [];

    for (let j = i; j &lt; lines.length; j++) {
      function_lines.push(lines[j]);

      if (lines[j] === '}') return function_lines;
    }

    throw new Error('Could not find end of function before end of content');
  }
}

return [];


Too weak start pattern

This condition is too weak to match the declaration of a function:


if (line.match("function " + funShun)) {



For example, if there are functions named convert_custom and convert,
and you call load_function_text('convert'),
it will find the first one.
I suggest to use a stronger pattern, for example:

startPattern = new RegExp("\\s*function " + funShun + "\\s*\\(");