identity-log
v0.3.0
Published
A 400 bytes console.{log,info,warn,...} that return its last argument
Downloads
3
Maintainers
Readme
Table of Contents
Getting started
1. To use identity-log you need to download it thanks to your favorite JavaScript Package Manager.
yarn add identity-log
npm install --save identity-log
2. Then you are free to import all the exported logging functions.
import { error, log, warn } from 'identity-log'
3. You can use them directly by surrounding the returned value without worrying.
const add = (a, b) => log(a + b) add(1, 2) // => 3
Usage
Identity-log aim to be less impacting as possible on the function, less bytes and better perf ; and handle all the console api.
- assert
- dir
- error
- info
- log
- trace
- warn
tap
Identity-log also provide a tap
function that allow you to create your own transformation from a function that return void
to a function that return its last argument.
The tap function can be used for function composition too.
tap(console.log, 1, 2, 3) // => 3
const log = tap(console.log)
log(1, 2, 3) // => 3
Misc
- Identity-log follows the Compatible Versioning: major.minor only convention.
- Release notes are Keep a Changelog compliants.