emojify-text
v2.0.0
Published
Convert boring text to wonderful emojis
Downloads
18
Readme
emojify-text
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