1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function getAppFromConfig(apps, nameOrIndex) {
|
4 | let app = apps[0];
|
5 | if (nameOrIndex) {
|
6 | if (nameOrIndex.match(/^[0-9]+$/)) {
|
7 | const index = parseInt(nameOrIndex.toString(), 10);
|
8 | app = apps[index];
|
9 | }
|
10 | else {
|
11 | const filtered = apps.filter((currentApp) => currentApp.name === nameOrIndex);
|
12 | if (filtered.length > 0) {
|
13 | app = filtered[0];
|
14 | }
|
15 | }
|
16 | }
|
17 | return app;
|
18 | }
|
19 | exports.getAppFromConfig = getAppFromConfig;
|
20 |
|
\ | No newline at end of file |