console-grid is a lightweight, zero-dependency utility for Node.js environments, designed to render highly customizable and formatted tables and grids directly in the console. Currently at version 2.2.4, it provides robust features such as tree-style rows for hierarchical data, precise column alignment (left, center, right), custom padding, and multi-line headers with automatic word wrapping. A key differentiator is its comprehensive support for colorful cells using ANSI escape codes, full Unicode character handling (including CJK and Emojis), and custom character width calculation via a `getCharLength` option. It offers dual support for both ESM and CommonJS modules and ships with TypeScript type definitions, making it suitable for modern JavaScript and TypeScript projects. While a specific release cadence isn't explicitly published, its stable nature as a core utility suggests infrequent but well-tested updates.
npm install console-gridVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic grid rendering, customizing header visibility, and configuring column widths, including support for multi-line headers.
Always use `import CG from 'console-grid';` for the default function in ESM, or `const CG = require('console-grid');` for CommonJS.If you require the `ConsoleGrid` class, your project must use ESM and import it with `import { ConsoleGrid } from 'console-grid';`.Ensure your terminal supports full Unicode and ANSI escape codes. For specific character width issues, utilize the `getCharLength` option to provide a custom character width calculation function in the grid options.
Always ensure ANSI escape codes are correctly formed and balanced. For debugging, try rendering the grid with `colorful: false` in the options to isolate the issue to color codes.
Change the import statement from `import { CG } from 'console-grid';` to `import CG from 'console-grid';`.If you need the `ConsoleGrid` class, convert your file to an ESM module (`.mjs` extension or `"type": "module"` in `package.json`) and use `import { ConsoleGrid } from 'console-grid';`.If `console-grid` is dual-packaged, ensure your project's `package.json` does not have `"type": "module"` if you intend to use `require()`. Otherwise, use `import CG from 'console-grid';` for ESM imports.
No dependency data recorded yet.