chore: lint related changes and packaging fixes (#6163)

* fix: lint related changes and packaging fixes

* adding color validations
This commit is contained in:
sriram veeraghanta 2024-12-06 14:56:49 +05:30 committed by GitHub
parent b1c340b199
commit 4b5a2bc4e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 1025 additions and 896 deletions

View file

@ -0,0 +1,40 @@
/**
* Converts a hyphen-separated hexadecimal emoji code to its decimal representation
* @param {string} emojiUnified - The unified emoji code in hexadecimal format (e.g., "1f600" or "1f1e6-1f1e8")
* @returns {string} The decimal representation of the emoji code (e.g., "128512" or "127462-127464")
* @example
* convertHexEmojiToDecimal("1f600") // returns "128512"
* convertHexEmojiToDecimal("1f1e6-1f1e8") // returns "127462-127464"
* convertHexEmojiToDecimal("") // returns ""
*/
export const convertHexEmojiToDecimal = (emojiUnified: string): string => {
if (!emojiUnified) return "";
return emojiUnified
.toString()
.split("-")
.map((e) => parseInt(e, 16))
.join("-");
};
/**
* Converts a hyphen-separated decimal emoji code back to its hexadecimal representation
* @param {string} emoji - The emoji code in decimal format (e.g., "128512" or "127462-127464")
* @returns {string} The hexadecimal representation of the emoji code (e.g., "1f600" or "1f1e6-1f1e8")
* @example
* emojiCodeToUnicode("128512") // returns "1f600"
* emojiCodeToUnicode("127462-127464") // returns "1f1e6-1f1e8"
* emojiCodeToUnicode("") // returns ""
*/
export const emojiCodeToUnicode = (emoji: string): string => {
if (!emoji) return "";
// convert emoji code to unicode
const uniCodeEmoji = emoji
.toString()
.split("-")
.map((emoji) => parseInt(emoji, 10).toString(16))
.join("-");
return uniCodeEmoji;
};