mirror of
https://github.com/iconify/iconify.git
synced 2024-12-12 13:47:49 +00:00
chore(utils): remove samples limit when converting info
This commit is contained in:
parent
412c8119b0
commit
431098304c
@ -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/",
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user