npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hero-page/hero-emoji-strings

v1.0.0

Published

A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis

Downloads

3

Readme

This entire repository was created completely with AI, using the hero-ai-package-creator, which is open-source, uses GPT-4, and is written & maintained by Sam Chahine ❣️🧞‍♀️

hero-emoji-strings

A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis.

Functions

emojiCount

Counts the number of emojis in a given string. Handles Unicode and shortcodes emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters, strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

replaceEmoji

Replaces all occurrences of a specific emoji in a string with another string (could be another emoji). Test cases: strings with single emoji, multiple emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid input emoji.

splitByEmoji

Splits a string into an array of strings divided by emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and strings with various delimiters. Extreme cases: strings with special characters and long strings with emojis. Ignored cases: malformed shortcodes.

emojiPositions

Returns an array of positions where emojis are found in a string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters and strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

removeEmoji

Removes all emojis from a given string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters and strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

emojify

Converts a string with shortcodes to a string with actual emojis. Test cases: strings with shortcodes, no shortcodes, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: malformed shortcodes.

shortcodeify

Converts a string with emojis to a string with shortcodes. Test cases: strings with emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: unrecognizable emoji shortcodes.

isValidEmoji

Checks if a given string is a valid emoji. Test cases: valid Unicode and shortcode emojis, invalid emojis, and mixed character types. Extreme cases: special characters. Ignored cases: malformed shortcodes.

getContainedEmojis

Returns an array of distinct emojis contained in a given string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters, strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

substringWithEmoji

Returns a substring of the given string while treating emojis as single characters. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid indices.

lengthWithEmoji

Returns the length of the given string treating emojis as single characters. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: malformed shortcodes.

indexOfEmoji

Returns the index of the first occurrence of the emoji in the given string or -1 if not present. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid input emoji.

Author

Sam Chahine, at Hero

Tests for emojiCount

emojiCount

Tests for emojify

emojify

Tests for lengthWithEmoji

lengthWithEmoji

Tests for removeEmoji

removeEmoji

Tests for replaceEmoji

replaceEmoji

Tests for shortcodeify

shortcodeify

Tests for substringWithEmoji

substringWithEmoji

Tests for indexOfEmoji

indexOfEmoji

Tests for isValidEmoji

isValidEmoji

Tests for getContainedEmojis

getContainedEmojis