Deno.js Emoji Module to Validate,Trim & Extract Emoji From String Using TypeScript Full Project For Beginners

 

 

Simple emoji support for Deno 🦕 (validate, detect, trim, extract)

 

 

Import

 

import { isEmoji } from "https://deno.land/x/emoji/mod.ts";

or

 

import { isEmoji } from "https://raw.githubusercontent.com/s1mpson/emoji/master/mod.ts";

Methods

 

isEmoji (string)

 

Returns true if provided string is a valid emoji.

 

isEmoji('🤔'); // true
isEmoji('?'); // false

hasEmoji (string)

 

Returns true if there is at least one emoji in string.

 

hasEmoji('Sadly, no unicorns found..'); // false
hasEmoji('But we have one here: 🦄'); // true

trimEmoji (string)

 

Returns the string cleaned from emoji.

 

trimEmoji('Just 👏 Do 👏 It'); // "Just  Do  It"

extractEmoji (string)

 

Returns an array of emoji extracted from the string.

 

extractEmoji('🦕 ❤️ 🦄'); // ["🦕", "❤️", "🦄"]

Leave a Reply