mirror of
https://github.com/iconify/iconify.git
synced 2025-01-06 07:20:40 +00:00
chore(utils): rename function to get qualified emoji variations
This commit is contained in:
parent
5a78469fdb
commit
c25750a0e0
@ -1,6 +1,6 @@
|
||||
import { getEmojiSequenceFromString } from '../cleanup';
|
||||
import { convertEmojiSequenceToUTF32 } from '../convert';
|
||||
import { addOptionalEmojiVariations } from '../test/variations';
|
||||
import { addQualifiedEmojiVariations } from '../test/variations';
|
||||
import { createEmojisTree, parseEmojiTree } from './tree';
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ export function createOptimisedRegex(
|
||||
);
|
||||
|
||||
// Add variations
|
||||
sequences = addOptionalEmojiVariations(sequences, testData);
|
||||
sequences = addQualifiedEmojiVariations(sequences, testData);
|
||||
|
||||
// Parse
|
||||
return createOptimisedRegexForEmojiSequences(sequences);
|
||||
|
@ -10,7 +10,7 @@ type EmojiStatus =
|
||||
| 'fully-qualified'
|
||||
| 'minimally-qualified'
|
||||
| 'unqualified';
|
||||
const componentStatus: EmojiStatus = 'component';
|
||||
export const componentStatus: EmojiStatus = 'component';
|
||||
|
||||
// Allowed status values, in order of conversion
|
||||
const allowedStatus: Set<EmojiStatus> = new Set([
|
||||
|
@ -37,7 +37,7 @@ export function guessQualifiedEmojiSequence(sequence: number[]): number[] {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add optional variations to emojis
|
||||
* Add qualified variations to emojis
|
||||
*
|
||||
* Also converts list to UTF-32 as needed
|
||||
*
|
||||
@ -45,16 +45,16 @@ export function guessQualifiedEmojiSequence(sequence: number[]): number[] {
|
||||
* If missing or emoji is missing in test data, `FE0F` is added to every single code emoji.
|
||||
* It can also be an array of sequences.
|
||||
*/
|
||||
export function addOptionalEmojiVariations(
|
||||
export function addQualifiedEmojiVariations(
|
||||
sequences: number[][],
|
||||
testData?: (number[] | EmojiTestDataItem)[]
|
||||
): number[][];
|
||||
export function addOptionalEmojiVariations(
|
||||
export function addQualifiedEmojiVariations(
|
||||
sequences: number[][],
|
||||
testData: (number[] | EmojiTestDataItem)[],
|
||||
toString: (value: number[]) => string
|
||||
): string[];
|
||||
export function addOptionalEmojiVariations(
|
||||
export function addQualifiedEmojiVariations(
|
||||
sequences: number[][],
|
||||
testData: (number[] | EmojiTestDataItem)[] = [],
|
||||
toString?: (value: number[]) => string
|
||||
|
@ -105,7 +105,7 @@ export {
|
||||
parseEmojiTestFile,
|
||||
getQualifiedEmojiSequencesMap,
|
||||
} from './emoji/test/parse';
|
||||
export { addOptionalEmojiVariations } from './emoji/test/variations';
|
||||
export { addQualifiedEmojiVariations as addOptionalEmojiVariations } from './emoji/test/variations';
|
||||
export {
|
||||
createOptimisedRegex,
|
||||
createOptimisedRegexForEmojiSequences,
|
||||
|
@ -5,9 +5,9 @@ import {
|
||||
getQualifiedEmojiSequencesMap,
|
||||
parseEmojiTestFile,
|
||||
} from '../lib/emoji/test/parse';
|
||||
import { addOptionalEmojiVariations } from '../lib/emoji/test/variations';
|
||||
import { addQualifiedEmojiVariations } from '../lib/emoji/test/variations';
|
||||
|
||||
describe('Optional variations of emoji sequences', () => {
|
||||
describe('Qualified variations of emoji sequences', () => {
|
||||
it('Variations without data', () => {
|
||||
const sequences = [
|
||||
// simple emoji, twice to check duplicates
|
||||
@ -27,7 +27,7 @@ describe('Optional variations of emoji sequences', () => {
|
||||
'1F9D7 1F3FE 200D 2640 FE0F',
|
||||
'1F9D7 1F3FF 200D 2642 ',
|
||||
].map(getEmojiSequenceFromString);
|
||||
const results = addOptionalEmojiVariations(sequences);
|
||||
const results = addQualifiedEmojiVariations(sequences);
|
||||
expect(
|
||||
results.map((sequence) =>
|
||||
getEmojiSequenceString(sequence, {
|
||||
@ -124,7 +124,7 @@ describe('Optional variations of emoji sequences', () => {
|
||||
// fake keycap, not in test file
|
||||
'2345 20E3 200D 1235',
|
||||
].map(getEmojiSequenceFromString);
|
||||
const results = addOptionalEmojiVariations(
|
||||
const results = addQualifiedEmojiVariations(
|
||||
sequences,
|
||||
testDataSequences
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user