@f1stnpm3/quis-voluptates-nostrum v1.0.0
@f1stnpm3/quis-voluptates-nostrum
Replacement for util.inspect and the console object.
var @f1stnpm3/quis-voluptates-nostrum = require('@f1stnpm3/quis-voluptates-nostrum');
var str = @f1stnpm3/quis-voluptates-nostrum.inspect({ foo: 'bar' }); // "{ foo: 'bar' }"
@f1stnpm3/quis-voluptates-nostrum.log('foo', { bar: /hey/ }); // { bar: /hey/ }
// Or use this shorthand:
@f1stnpm3/quis-voluptates-nostrum('foo', { bar: /hey/ }); // { bar: /hey/ }
The library also includes diffing support (powered by Unexpected's diffing engine):
@f1stnpm3/quis-voluptates-nostrum.diff({ foo: 'bar' }, { foo: 'baz' });
{
foo: 'bar'; // should be 'baz'
// -bar
// +baz
}
Or if you want to get the rendered diff as a string:
const diff = @f1stnpm3/quis-voluptates-nostrum.diffAsString({ foo: 'bar' }, { foo: 'baz' });
You can use the equal
function if you just want to compare two values for equality:
@f1stnpm3/quis-voluptates-nostrum.equal({ foo: 123 }, { foo: 123 }); // returns true
@f1stnpm3/quis-voluptates-nostrum.equal({ abc: 123 }, { def: 456 }); // returns false
You can also ask for the diff with ANSI codes, or in HTML format:
const ansiDiff = @f1stnpm3/quis-voluptates-nostrum.diffAsString(
{ foo: 'bar' },
{ foo: 'baz' },
{ format: 'ansi' }
);
const htmlDiff = @f1stnpm3/quis-voluptates-nostrum.diffAsString(
{ foo: 'bar' },
{ foo: 'baz' },
{ format: 'html' }
);
You can also use it instead of the console object:
var console = require('@f1stnpm3/quis-voluptates-nostrum');
console.log('...');
console.trace();
In the Chrome console this will produce colored output using this API.
The @f1stnpm3/quis-voluptates-nostrum
npm package includes a bookmarklet for doing the above, ie. replacing the console
object with @f1stnpm3/quis-voluptates-nostrum, see bookmarklet.html
at the root of the package. Unfortunately github doesn't permit putting it directly into this README.
RELEASES
See the changelog.
2 months ago