Registry / testing / cornsol

cornsol

JSON →
library1.1.5jsnpmunverified

Pretty console formatter for Node.js with optional line numbers, spinners, and colored output. Current stable version is 1.1.5 (2024). Provides overloads for standard console methods (log, warn, error, group, table) and adds structured helpers like array, step, chunk, and divider. Key differentiator: lightweight alternative to consola or signale with explicit sync/async variants for each operation. Ships TypeScript type definitions. Low download count (niche utility). Note: requires manual registration via corn.register() to patch global console.

npm install cornsol
INSTALL
IMPORT
SIG · CORNSOL
C
cornsol
testingjavascriptv1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cornsol (default import)
import corn from 'cornsol'
const corn = require('cornsol')
Package is ESM-only. CJS require() works in Node but TypeScript may complain without esModuleInterop.
register()
import corn from 'cornsol'; corn.register();
import { register } from 'cornsol'; register();
register is not a named export; it's a method on the default export.
printArraySync
import corn from 'cornsol'; corn.printArraySync(console.log, ['a', 'b']);
import { printArraySync } from 'cornsol';
All functions are properties of the default export, not separate named exports.
cornsol (require)
const corn = require('cornsol');
const { printArray } = require('cornsol');
CJS destructuring works but discouraged for TypeScript users.

Shows registration, enhanced console methods, step/array usage, and direct API without registration.

import corn from 'cornsol'; // Register to patch console globally corn.register(); // Use enhanced console methods console.log('Hello, world!'); // Prefixed with line number // Sync step const result = console.step('Calculate', () => { console.log('Step 1'); return 42; }); console.log('Result:', result); // Array output console.array(['Apple', 'Banana', 'Cherry']); // Unregister to restore original console corn.unregister(); // Without registration, use explicit methods corn.printArraySync(console.log, ['X', 'Y']);
Debug
Known issues
gotchaGlobal console is modified after corn.register() — all console.log calls will have formatted output. Unregister with corn.unregister() if needed.
fix
Call corn.unregister() when done, or use explicit API (e.g., corn.print*) to avoid side effects.
affects: >=0.0.0
gotchaNo type augmentation for global console — TypeScript users must cast or use `console.log` directly; types for step, array, etc. are not declared on Console globally.
fix
Use corn-specific methods (e.g., corn.printStepSync) instead of console.step for type safety, or extend the Console interface manually.
affects: >=0.0.0
gotchaAsynchronous functions require .async suffix (e.g., console.step.async, console.array.async) — using sync methods on promises may cause unexpected behavior.
fix
Use .async variant when dealing with Promise-based operations.
affects: >=0.0.0
gotchaLine numbers reset after unregister/register cycle — not persistent across calls.
fix
Manage line numbering manually if cross-session consistency is required.
affects: >=0.0.0
Errors
Common errors & fixes
Uncaught TypeError: corn.register is not a function
Incorrect import style (e.g., named import instead of default).
fix
Use default import: import corn from 'cornsol' then corn.register().
Module '"cornsol"' has no exported member 'printArraySync'.
Trying to destructure functions from the package; they are properties of the default export.
fix
Use import corn from 'cornsol' and then access corn.printArraySync().
TypeError: console.step is not a function
Forgot to call corn.register() first.
fix
Call corn.register() before using console.step, or use corn.printStepSync() directly.
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
cornsol — npm install cornsol · libregistry