2
0
mirror of https://github.com/iconify/iconify.git synced 2024-09-19 16:59:02 +00:00

chore(utils): remove samples limit when converting info

This commit is contained in:
Vjacheslav Trushkin 2024-08-04 20:32:26 +03:00
parent 412c8119b0
commit 431098304c
3 changed files with 11 additions and 5 deletions

View File

@ -3,7 +3,7 @@
"type": "module",
"description": "Common functions for working with Iconify icon sets used by various packages.",
"author": "Vjacheslav Trushkin",
"version": "2.1.29",
"version": "2.1.30",
"license": "MIT",
"bugs": "https://github.com/iconify/iconify/issues",
"homepage": "https://iconify.design/docs/libraries/utils/",

View File

@ -2,7 +2,6 @@ import type { IconifyInfo } from '@iconify/types';
const minDisplayHeight = 16;
const maxDisplayHeight = 24;
const maxSamplesCount = 3;
/**
* Item provided by API or loaded from collections.json, slightly different from IconifyInfo
@ -167,7 +166,7 @@ export function convertIconSetInfo(
if (source.samples instanceof Array) {
const samples: string[] = [];
source.samples.forEach((item) => {
if (typeof item === 'string' && samples.length < maxSamplesCount) {
if (typeof item === 'string' && !samples.includes(item)) {
samples.push(item);
}
});

View File

@ -55,7 +55,14 @@ describe('Testing convertIconSetInfo', () => {
licenseID: 'MIT',
licenseURL: 'https://license.local/',
height: '24',
samples: ['arrow-left', 'arrow-right', 'arrow-up', 'arrow-down'],
samples: [
'arrow-left',
'arrow-right',
'arrow-up',
'arrow-down',
// duplicate
'arrow-up',
],
palette: true,
});
expected = {
@ -70,7 +77,7 @@ describe('Testing convertIconSetInfo', () => {
url: 'https://license.local/',
},
height: 24,
samples: ['arrow-left', 'arrow-right', 'arrow-up'],
samples: ['arrow-left', 'arrow-right', 'arrow-up', 'arrow-down'],
palette: true,
};
expect(result).toEqual(expected);