1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | const ALLOWED_SCALES = {
|
16 | ios: [1, 2, 3]
|
17 | };
|
18 |
|
19 | function filterPlatformAssetScales(platform, scales) {
|
20 | const whitelist = ALLOWED_SCALES[platform];
|
21 |
|
22 | if (!whitelist) {
|
23 | return scales;
|
24 | }
|
25 |
|
26 | const result = scales.filter(scale => whitelist.indexOf(scale) > -1);
|
27 |
|
28 | if (result.length === 0 && scales.length > 0) {
|
29 |
|
30 |
|
31 |
|
32 | const maxScale = whitelist[whitelist.length - 1];
|
33 |
|
34 | for (const scale of scales) {
|
35 | if (scale > maxScale) {
|
36 | result.push(scale);
|
37 | break;
|
38 | }
|
39 | }
|
40 |
|
41 |
|
42 | if (result.length === 0) {
|
43 | result.push(scales[scales.length - 1]);
|
44 | }
|
45 | }
|
46 |
|
47 | return result;
|
48 | }
|
49 |
|
50 | var _default = filterPlatformAssetScales;
|
51 | exports.default = _default; |
\ | No newline at end of file |