mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
The tests are probably overkill, but this way we will know if util.inspect changes dramatically.
8 lines
203 B
JavaScript
8 lines
203 B
JavaScript
import { inspect } from 'util';
|
|
|
|
export function format(x) {
|
|
// we're trying to mimic console.log, so we avoid wrapping strings in quotes:
|
|
if (typeof x === 'string') return x;
|
|
return inspect(x);
|
|
}
|