# contains-emoji

> 👀 Checks if a string contains one or more emojis

Latest version **1.3.5** (published 2026-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install contains-emoji
pnpm add contains-emoji
yarn add contains-emoji
bun add contains-emoji
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.3.5 |
| Published | 2026-04-06 |
| First published | 2020-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | tuty |
| Maintainers | tutyamxx |
| Keywords | has-emoji, check-emoji, emoji, is-emoji |

## Links

- npm: https://www.npmjs.com/package/contains-emoji
- Repository: https://github.com/tutyamxx/contains-emoji
- Issues: https://github.com/tutyamxx/contains-emoji/issues
- npm.io page: https://npm.io/package/contains-emoji

## Dependencies (1)

- [emoji-regex](https://npm.io/package/emoji-regex.md) ^10.3.0

## Recent versions

- 1.3.5 (latest) — 2026-04-06
- 1.3.4 — 2026-03-15
- 1.3.3 — 2026-03-12
- 1.3.2 — 2026-03-04
- 1.3.1 — 2026-01-21
- 1.3.0 — 2026-01-21
- 1.2.9 — 2026-01-16
- 1.2.8 — 2026-01-16
- 1.2.7 — 2026-01-16
- 1.2.6 — 2026-01-13
- 1.2.5 — 2026-01-13
- 1.2.4 — 2025-04-30
- 1.2.3 — 2025-04-26
- 1.2.2 — 2025-04-25
- 1.2.1 — 2025-04-25
- … 16 more at https://npm.io/package/contains-emoji/versions

## README

# contains-emoji

<p align="center"><a href="https://nodei.co/npm/contains-emoji/"><img src="https://nodei.co/npm/contains-emoji.png"></a></a></p>
<p align="center">
  <img src="https://img.shields.io/badge/License-MIT-yellow.svg">
</p>

* 🚀 Simple NPM package that checks if a string contains one or more emojis 👀
* 📦 It uses [Emoji Regex](https://github.com/mathiasbynens/emoji-regex) NPM module
* ♻️ Works seamlessly with `CommonJS`, `ESM` and `TypeScript`

# 📦 Install via [NPM](https://www.npmjs.com/package/contains-emoji)

```bash
$ npm i contains-emoji
```

# 💻 Usage

- Returns a Boolean indicating whether `string` contains one or more emojis.
- See examples below

## CommonJS
```javascript
const containsEmoji = require('contains-emoji');

const textWithEmoji = 'I love pizza 🍕';

// --| Default usage: returns true/false
if (containsEmoji(textWithEmoji)) {
    console.log('Text contains one or more emojis!');
} else {
    console.log('No emojis found.');
}

// --| Using the optional returnCount parameter: returns the number of emojis
const emojiCount = containsEmoji(textWithEmoji, true);
console.log(`Number of emojis found: ${emojiCount}`);

/*
    // --| Expected output
    Text contains one or more emojis!
    Number of emojis found: 1
*/
```

## ESM
```javascript
import containsEmoji from 'contains-emoji';

const textWithEmoji = 'I love pizza 🍕 and burgers 🍔!';

// --| Default usage: returns true/false
if (containsEmoji(textWithEmoji)) {
    console.log('Text contains one or more emojis!');
} else {
    console.log('No emojis found.');
}

// --| Using the optional returnCount parameter: returns the number of emojis
const emojiCount = containsEmoji(textWithEmoji, true);
console.log(`Number of emojis found: ${emojiCount}`);

/*
    // --| Expected output
    Text contains one or more emojis!
    Number of emojis found: 2
*/
```

## TypeScript
```javascript
import containsEmoji from 'contains-emoji';

const textWithEmoji: string = 'I love pizza 🍕, burgers 🍔 and cakes 🍰!';

// --| Default usage: returns true/false
if (containsEmoji(textWithEmoji)) {
    console.log('Text contains one or more emojis!');
} else {
    console.log('No emojis found.');
}

// --| Using the optional returnCount parameter: returns the number of emojis
const emojiCount: number = containsEmoji(textWithEmoji, true);
console.log(`Number of emojis found: ${emojiCount}`);

/*
// --| Expected output
    Text contains one or more emojis!
    Number of emojis found: 3
*/
```

---
_Source: https://npm.io/package/contains-emoji · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
