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",
|
"type": "module",
|
||||||
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
||||||
"author": "Vjacheslav Trushkin",
|
"author": "Vjacheslav Trushkin",
|
||||||
"version": "2.1.29",
|
"version": "2.1.30",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": "https://github.com/iconify/iconify/issues",
|
"bugs": "https://github.com/iconify/iconify/issues",
|
||||||
"homepage": "https://iconify.design/docs/libraries/utils/",
|
"homepage": "https://iconify.design/docs/libraries/utils/",
|
||||||
|
@ -2,7 +2,6 @@ import type { IconifyInfo } from '@iconify/types';
|
|||||||
|
|
||||||
const minDisplayHeight = 16;
|
const minDisplayHeight = 16;
|
||||||
const maxDisplayHeight = 24;
|
const maxDisplayHeight = 24;
|
||||||
const maxSamplesCount = 3;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item provided by API or loaded from collections.json, slightly different from IconifyInfo
|
* 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) {
|
if (source.samples instanceof Array) {
|
||||||
const samples: string[] = [];
|
const samples: string[] = [];
|
||||||
source.samples.forEach((item) => {
|
source.samples.forEach((item) => {
|
||||||
if (typeof item === 'string' && samples.length < maxSamplesCount) {
|
if (typeof item === 'string' && !samples.includes(item)) {
|
||||||
samples.push(item);
|
samples.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -55,7 +55,14 @@ describe('Testing convertIconSetInfo', () => {
|
|||||||
licenseID: 'MIT',
|
licenseID: 'MIT',
|
||||||
licenseURL: 'https://license.local/',
|
licenseURL: 'https://license.local/',
|
||||||
height: '24',
|
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,
|
palette: true,
|
||||||
});
|
});
|
||||||
expected = {
|
expected = {
|
||||||
@ -70,7 +77,7 @@ describe('Testing convertIconSetInfo', () => {
|
|||||||
url: 'https://license.local/',
|
url: 'https://license.local/',
|
||||||
},
|
},
|
||||||
height: 24,
|
height: 24,
|
||||||
samples: ['arrow-left', 'arrow-right', 'arrow-up'],
|
samples: ['arrow-left', 'arrow-right', 'arrow-up', 'arrow-down'],
|
||||||
palette: true,
|
palette: true,
|
||||||
};
|
};
|
||||||
expect(result).toEqual(expected);
|
expect(result).toEqual(expected);
|
||||||
|
Loading…
Reference in New Issue
Block a user