emojify-text

2.0.0 • Public • Published

image

emojify-text

NPM version Build Status Coveralls Status Dependency Status

Convert boring text to wonderful emojis

This package was made just for fun. Мe and Serhiy Boreyko were build that funny utility in the train while we were going home after LvivJS'2016 conference. Actually, that was cool timekiller.

Install

npm install --save emojify-text

Usage

import emojifyText from 'emojify-text';
 
emojifyText({ bg: '⭐️', fg: '💙' }, 'yay') //>
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
// ⭐️💙⭐️⭐️⭐️💙⭐️
// ⭐️⭐️💙⭐️💙⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️💙⭐️💙⭐️⭐️
// ⭐️💙⭐️⭐️⭐️💙⭐️
// ⭐️💙💙💙💙💙⭐️
// ⭐️💙⭐️⭐️⭐️💙⭐️
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
// ⭐️💙⭐️⭐️⭐️💙⭐️
// ⭐️⭐️💙⭐️💙⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️💙⭐️⭐️⭐️
// ⭐️⭐️⭐️⭐️⭐️⭐️⭐️

The function is curried as default. That means you could prepare settings and use the result function like this:

import emojifyText from 'emojify-text'
 
const emojify = emojifyText({
  background: '🍏',
  foreground: '🍎',
  row: true
})
 
emojify('yay!') //>
// 🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏
// 🍏🍎🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏
// 🍏🍏🍎🍏🍎🍏🍏🍏🍏🍎🍏🍎🍏🍏🍏🍏🍎🍏🍎🍏🍏🍏🍏🍏🍎🍏🍏🍏
// 🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍏🍏🍏🍎🍏🍏🍏
// 🍏🍏🍏🍎🍏🍏🍏🍏🍎🍎🍎🍎🍎🍏🍏🍏🍏🍎🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏
// 🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍎🍏🍏🍏🍏🍎🍏🍏🍏🍏🍏🍏🍎🍏🍏🍏
// 🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏🍏

API

emojifyText(options, input)

Return a string which is generated based on input and provided options. If input is not provided, then it will return a function that takes input.

options

Required
Object with options.

background

Type: String
Default: 0

A character to be a background for text.
Alias: bg (background has higher priority than bg).

foreground

Type: String
Default: 1

A character to be a background as text.
Alias: fg (foreground has higher priority than fg).

row

Type: Boolean
Default: false

Render text in row or not.

dictionary

Type: Object
Default: embedded dictionary

input

Required
Type: String

Text which will be rendered as emojis.

License

MIT © Denys Dovhan

Package Sidebar

Install

npm i emojify-text

Weekly Downloads

7

Version

2.0.0

License

MIT

Last publish

Collaborators

  • denysdovhan