Let there be lines!
This commit is contained in:
parent
4b88dac1e7
commit
8d1546d99a
3 changed files with 67 additions and 1 deletions
41
README.md
41
README.md
|
@ -1,2 +1,41 @@
|
|||
# console-line
|
||||
I like lines in my console logs and I don't care who knows
|
||||
|
||||
Easily draw lines in your console logs.
|
||||
|
||||
## Why?
|
||||
|
||||
Because I got sick of typing out `console.log('---------...--')` when I wanted
|
||||
to have a visual indicator in my logs while debugging and stuff.
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
npm install console-line
|
||||
```
|
||||
|
||||
```shell
|
||||
yarn add console-line
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
// Require and [optionally] configure your line
|
||||
const line = require('console-line')(80, '-');
|
||||
|
||||
// Log a line to the console
|
||||
line.log();
|
||||
|
||||
// Fence some text between lines
|
||||
line.fence('Some fenced in text');
|
||||
|
||||
// Get the raw string for the line so you can do non-logging things with it
|
||||
const lineString = line.line;
|
||||
|
||||
// Add it to console object so the name of this package makes sense
|
||||
console.line = line.log;
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
|
17
index.js
Normal file
17
index.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (length = 80, character = '-') => {
|
||||
const line = Array(length).join(character[0]);
|
||||
|
||||
return {
|
||||
line,
|
||||
log: () => {
|
||||
console.log(line);
|
||||
},
|
||||
fence: (text) => {
|
||||
console.log(line);
|
||||
console.log(text);
|
||||
console.log(line);
|
||||
}
|
||||
};
|
||||
};
|
10
package.json
Normal file
10
package.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "console-line",
|
||||
"version": "1.0.0",
|
||||
"description": "Easily draw lines in your console logs.",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:fetchlogic/console-line.git",
|
||||
"author": "Josh Sherman <github@joshtronic.com>",
|
||||
"license": "MIT",
|
||||
"private": false
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue