2.0.0 • Published 8 years ago
ascii-heart v2.0.0
ascii-heart
Create ASCII hearts using Node.js.
Installation
$ npm i --save ascii-heart
Example
var asciiHeart = require("ascii-heart");
// Default behavior
console.log(asciiHeart());
// =>
// * * * * * * * * * * * *
// * * * * * * * * * * * *
// * * * * * * * * * *
// * * * * * *
// * * * *
// * * * * * * *
// * * *
// * * *
// * *
// * *
// * *
// * * * *
// * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * * *
// * * *
// *
// *
// Display a small heart (width x height) <3
console.log(asciiHeart(10, 10));
// =>
// * * * * * *
// * * * * * * *
// * * *
// * * * *
// * * * *
// * * * *
// * * *
// *
// Display a small heart,
console.log(asciiHeart(40, 40, {
fill: "❤"
}));
// =>
// * * * * * * * * * * * *
// * * * ❤ ❤ ❤ ❤ * * * * * * ❤ ❤ ❤ ❤ * * *
// * * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * * * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * * *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * * * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ ❤ ❤ * *
// * * ❤ ❤ ❤ * *
// * * ❤ * *
// * * *
// *
// *
Documentation
asciiHeart(width, height, options)
Generates a beautiful heart in ASCII art. :sparkling_heart:
Params
- Number
width
: The heart width (default:40
). - Number
height
: The heart height (default:40
). - Object
options
: An object containing the following fields: fill
(String): The character used to fill the heart (default:" "
).trim
(Boolean): Iffalse
, the trailing spaces on the right side will not be removed (default:true
).k
(Number): A magic number used in the graph generating (default:100
).step
(Number): The step precision (default:0.01
).
Return
- String The stringified heart.
How to contribute
Have an idea? Found a bug? See how to contribute.
Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles: