easy-table is a JavaScript utility for rendering plain text tables primarily for command-line interfaces. It allows for highly customizable table structures, including dynamic cell content formatting via 'printer' functions, column sorting with specific syntax, and aggregation features like totaling and averaging. The package is currently at version 1.2.0. Its last known activity on npm was 5 years ago, and the GitHub repository shows an 8-year inactivity period, suggesting it is in an abandoned state rather than actively maintained. It ships with TypeScript type definitions, enabling type-safe usage in modern TypeScript projects. Key differentiators include its flexible cell rendering pipeline and built-in aggregation capabilities for simple CLI reporting.
npm install easy-tableVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic table creation, custom cell formatting, static `Table.print` usage with options, and sorting and totaling features.
Consider migrating to a more actively maintained library for text table rendering if new features, bug fixes, or security updates are required.
Use `import Table from 'easy-table'` for ESM projects to correctly import the default export. For CommonJS, `const Table = require('easy-table')` is correct.Ensure custom printer functions accept both `value` and `width` parameters and use `Table.padLeft` or `Table.padRight` with `width` if alignment is desired, as shown in the documentation example for `currency`.
Carefully check column names and use the exact `|asc` or `|des` suffixes. For complex sorting, consider providing a custom comparator function to `t.sort()`.
For ESM, use `import Table from 'easy-table'`. For CommonJS, ensure you're doing `const Table = require('easy-table')` if `Table` is the default/module.exports object.Ensure `let t = new Table()` is called after correctly importing `Table`.
Switch to ESM import syntax: `import Table from 'easy-table'`. If you must use `require` in an ESM file, Node.js v22+ has some experimental support, or consider `await import('easy-table')` for older versions, or explicitly configure `type: 'commonjs'` in your `package.json`.Verify that the column name string passed to `t.sort()` is an exact match for one of the column headers used in `t.cell()`. Ensure sort order suffixes are strictly `|asc` or `|des`.
No dependency data recorded yet.