mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Switch _.isArray usage to native versions
Change-type: patch
This commit is contained in:
parent
3fe8a22fb0
commit
20df54668c
@ -170,7 +170,7 @@ export class Service {
|
||||
|
||||
// First process the networks correctly
|
||||
let networks: ServiceConfig['networks'] = {};
|
||||
if (_.isArray(config.networks)) {
|
||||
if (Array.isArray(config.networks)) {
|
||||
_.each(config.networks, (name) => {
|
||||
networks[name] = {};
|
||||
});
|
||||
@ -368,7 +368,7 @@ export class Service {
|
||||
config.tty = Boolean(config.tty);
|
||||
}
|
||||
|
||||
if (_.isArray(config.sysctls)) {
|
||||
if (Array.isArray(config.sysctls)) {
|
||||
config.sysctls = _.fromPairs(
|
||||
_.map(config.sysctls, (v) => _.split(v, '=')),
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ export function camelCaseConfig(
|
||||
|
||||
// Networks can either be an object or array, but given _.isObject
|
||||
// returns true for an array, we check the other way
|
||||
if (!_.isArray(config.networks)) {
|
||||
if (!Array.isArray(config.networks)) {
|
||||
const networksTmp = structuredClone(config.networks);
|
||||
_.each(networksTmp, (v, k) => {
|
||||
config.networks[k] = _.mapKeys(v, (_v, key) => _.camelCase(key));
|
||||
|
@ -43,7 +43,7 @@ export function bootConfigToEnv(
|
||||
return _(configOptions)
|
||||
.mapKeys((_val, key) => configBackend.createConfigVarName(key))
|
||||
.mapValues((val) => {
|
||||
if (_.isArray(val)) {
|
||||
if (Array.isArray(val)) {
|
||||
return JSON.stringify(val).replace(/^\[(.*)\]$/, '$1');
|
||||
}
|
||||
return val;
|
||||
|
@ -61,7 +61,7 @@ export async function loadTargetFromFile(appsPath: string): Promise<boolean> {
|
||||
throw new AppsJsonParseError(e);
|
||||
}
|
||||
|
||||
if (_.isArray(stateFromFile)) {
|
||||
if (Array.isArray(stateFromFile)) {
|
||||
log.debug('Detected a legacy apps.json, converting...');
|
||||
stateFromFile = fromLegacyAppsJson(stateFromFile as any[]);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ async function setProxy(maybeConf: ProxyConfig | null): Promise<void> {
|
||||
// but the compiler doesn't
|
||||
const conf = maybeConf as ProxyConfig;
|
||||
await mkdirp(proxyBasePath);
|
||||
if (_.isArray(conf.noProxy)) {
|
||||
if (Array.isArray(conf.noProxy)) {
|
||||
await writeToBoot(noProxyPath, conf.noProxy.join('\n'));
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class FakeRuleAdaptor {
|
||||
return '';
|
||||
};
|
||||
|
||||
if (_.isArray(rules)) {
|
||||
if (Array.isArray(rules)) {
|
||||
for (const rule of rules) {
|
||||
await handleRule(rule);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user