title: RangeError: Invalid array length NodeJS
body: <p>I have some code, where I am trying to chart stock data. The values are being successfully pulled in but I am getting an error when trying to chart. </p>
  
  <p>Looking specifically at the chart function. when I use console.log(hist); and console.log(q) I am able to get the respective values from them. </p>
  
  <pre><code>const asciichart = require("asciichart");
  const ora = require("ora");
  const chalk = require("chalk");
  const fetch = require("node-fetch");
  const { IEXCloudClient } = require("node-iex-cloud");
  const { history } = require("yahoo-stocks"); //Special Thanks to: Fabian Beuke aka Madnight (https://github.com/madnight)
  const { interpolateArray } = require("array-interpolatejs");
  const { toHumanString } = require("human-readable-numbers");
  const { identity, defaultTo, pipe } = require("lodash/fp");
  const { tail, flatMap } = require("lodash/fp");
  const { compact, map } = require("lodash/fp");
  
  module.exports = args =&gt; {
    let symbol = args.symbol || args.s;
  
    const throbber = ora().start();
    const width = defaultTo(14);
    const height = defaultTo(80);
    const range = defaultTo("5y");
    const humanString = i =&gt; (i ? toHumanString(i).replace("G", "B") : null);
  
    const iex = new IEXCloudClient(fetch, {
      publishable: "pk_abcxyzdedfg"
    });
  
    const errorHandler = () =&gt; {
      console.log(chalk.red("Error. Could not find symbol: " + symbol));
      process.exit(1);
    };
  
    const getHist = async () =&gt; {
      return await history(symbol.toUpperCase(), {
        interval: "1m",
        range: range
      }).catch(errorHandler);
    };
  
    const getQuote = async i =&gt; {
      return await iex
        .symbols(i)
        .batch("quote")
        .catch(errorHandler);
    };
  
    const chart = async () =&gt; {
      try {
        const [hist, qt] = await Promise.all([getHist(), getQuote(symbol)]);
        const chart = pipe(
          map(identity),
          tail,
          flatMap(map("close")),
          interpolateArray(width),
          compact,
          x =&gt; asciichart.plot(x, { height: height })
        )(hist);
        console.log(hist);
        const q = map("quote")(qt)[0];
        console.log(q);
        console.log(chart);
        console.log(q.companyName)
        console.log(
          " ".repeat(15) +
            (q.companyName +
              " " +
              " chart. Latest Price: $" +
              q.latestPrice +
              " | MktCap: " +
              humanString(q.marketCap))
        );
      } catch (error) {
        console.error(error);
      }
    };
  
    chart();
  
    throbber.succeed(`${chalk.green("All Done")}`);
  };
  </code></pre>
  
  <p>but when I use console.log(chart); I end up with this error:</p>
  
  <pre><code>RangeError: Invalid array length
      at Object.exports.plot (C:\Users\Saksham\Projects\stock-cli\node_modules\asciichart\asciichart.js:29:22) 
      at x (C:\Users\Saksham\Projects\stock-cli\cmds\chart.js:54:25)
      at C:\Users\Saksham\Projects\stock-cli\node_modules\lodash\lodash.min.js:49:144
      at chart (C:\Users\Saksham\Projects\stock-cli\cmds\chart.js:55:8)
      at process._tickCallback (internal/process/next_tick.js:68:7)
  </code></pre>