Socket
Book a DemoInstallSign in
Socket

ascii-heart

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ascii-heart

Create ASCII hearts using Node.js.

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
9
Maintainers
2
Weekly downloads
 
Created
Source

ascii-heart Version Downloads

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): If false, 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:

License

MIT © Nuvi Pannu

Keywords

heart

FAQs

Package last updated on 20 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.