1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = getPlatformExtension;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | const SUPPORTED_PLATFORM_EXTS = new Set(['android', 'ios', 'native', 'web']);
|
15 |
|
16 | function getPlatformExtension(file, platforms) {
|
17 | const last = file.lastIndexOf('.');
|
18 | const secondToLast = file.lastIndexOf('.', last - 1);
|
19 |
|
20 | if (secondToLast === -1) {
|
21 | return null;
|
22 | }
|
23 |
|
24 | const platform = file.substring(secondToLast + 1, last);
|
25 |
|
26 | if (platforms && platforms.indexOf(platform) !== -1) {
|
27 | return platform;
|
28 | }
|
29 |
|
30 | return SUPPORTED_PLATFORM_EXTS.has(platform) ? platform : null;
|
31 | }
|