Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum call stack size exceeded #52

Open
gibfahn opened this issue Jan 9, 2018 · 0 comments
Open

Maximum call stack size exceeded #52

gibfahn opened this issue Jan 9, 2018 · 0 comments

Comments

@gibfahn
Copy link

gibfahn commented Jan 9, 2018

See also nodejs/citgm#533

Download ibm_db.txt and run:

'use strict';
const fs = require('fs');
const columnify = require('columnify');

const message = fs.readFileSync('./ibm_db.txt', 'utf8');
const tag = ''

const msg = columnify(
  [{tag: tag, message: message}],
  {
    showHeaders: false,
    maxLineWidth: 'auto',
    minWidth: 20,
    maxWidth: Infinity,
    columnSplitter: '| ',
    preserveNewLines: true
  }
);

Gives this:

/Users/gib/wrk/com/citgm/node_modules/columnify/utils.js:13
  return Array.apply(null, {length: len + 1}).join(str).slice(0, len)
               ^

RangeError: Maximum call stack size exceeded
    at repeatString (/Users/gib/wrk/com/citgm/node_modules/columnify/utils.js:13:16)
    at padRight (/Users/gib/wrk/com/citgm/node_modules/columnify/utils.js:31:16)
    at /Users/gib/wrk/com/citgm/node_modules/columnify/columnify.js:229:227
    at Array.forEach (<anonymous>)
    at _loop (/Users/gib/wrk/com/citgm/node_modules/columnify/columnify.js:226:19)
    at /Users/gib/wrk/com/citgm/node_modules/columnify/columnify.js:234:7
    at Array.map (<anonymous>)
    at createRows (/Users/gib/wrk/com/citgm/node_modules/columnify/columnify.js:216:16)
    at module.exports (/Users/gib/wrk/com/citgm/node_modules/columnify/columnify.js:195:14)
    at Object.<anonymous> (/Users/gib/wrk/com/citgm/t.js:8:13)

Increasing the stack size (e.g. node --stack-size=5000 t.js) works.

Is there a way around this? I had a quick look through existing issues but didn't find anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant