inf

Quickprint variable information

Usage no npm install needed!

<script type="module">
  import inf from 'https://cdn.skypack.dev/inf';
</script>

README

inf

JavaScript's quick-print for variable information


npm version npm download count XO code style

Linux & OSX Windows

Install

Node

npm install --save inf

Web

<script src="https://rawgit.com/dawsonbotsford/inf/master/bundle.js"></script>

Alternatively, you can install the npm module and reference the bundle within node_modules

<script src="<path to node_modules>/inf/bundle.js"></script>

// Remove this require line if you're using the web bundle (it's already bundled as "inf")
const inf = require('inf');

inf('JavaScript');
//=>'Value: JavaScript
//=>Type: string
//=>Length: 10'

inf([1, 2, 3]);
//=>'Value: 1,2,3
//=>Type: array
//=>Length: 3'

inf(new Boolean(true));
//=>'Value: true
//=>Type: boolean'

inf(new Date());
//=>'Value: Fri Mar 11 2016 23:52:58 GMT-0600 (CST)
//=>Type: date;



API

inf(target)


target

Type: all types


returns

Type: string

The alternative is to console.log your value. inf gives you so much more useful info about any type of variable!

info includes:

  • Value
  • Type (using to-type)
  • Length (if applicable)

:zap: Put inf into a console.log for lightning fast debugging. :zap:.


License

MIT © Dawson Botsford