0.1.1 β€’ Published 8 months ago

tdz-tools v0.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

tdz-tools

Goal

This project is a set of tools to have with me my personal tool library. But actually, it's also for me a way to learn how to create and maintain an npm package.

Installation

Installez tdz-tools en utilisant npm :

npm install tdz-tools

Or with Yarn:

yarn add tdz-tools

Or with pnpm:

pnpm add tdz-tools

Usage

isoToFlagEmoji

A brilliant idea from Grafikart

Here's how you can use the isoToFlagEmoji function from tdz-tools:

import { isoToFlagEmoji } from 'tdz-tools';

const emojiFlags = isoToFlagEmoji('FR');
console.log(emojiFlags);  // Outputs: πŸ‡«πŸ‡·

note: on Chromium browsers on Windows, the emoji flags are not displayed correctly. This is due to the system font (Sego UI) which is not supporting flag emojis. Have a look on the grafikart website link above for more details.

API Documentation

isoToFlagEmoji(code: string, modulo?: number, offset?: number): string

Converts a string to a sequence of emojis based on their Unicode character codes.

  • code (string): The string to convert.
  • modulo (number, optional): The modulo value to use for calculating the character code of the emoji. Default is 32.
  • offset (number, optional): The offset value to add to the character code. Default is 0x1F1E5.

const emojiFlags = isoToFlagEmoji('US'); console.log(emojiFlags); // Outputs: πŸ‡ΊπŸ‡Έ

0.1.1

8 months ago

0.1.0

8 months ago