mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-15 06:56:36 +00:00
Switch some _.includes usage to native versions
Change-type: patch
This commit is contained in:
parent
a4a9a17c1a
commit
e15205301c
@ -91,7 +91,7 @@ export function createRestartPolicy(name?: string): string {
|
||||
}
|
||||
|
||||
name = name.toLowerCase().trim();
|
||||
if (!_.includes(validRestartPolicies, name)) {
|
||||
if (!validRestartPolicies.includes(name)) {
|
||||
return 'always';
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ export function formatConfigKeys(conf: {
|
||||
|
||||
return _.pickBy(
|
||||
confWithoutNamespace,
|
||||
(_v, k) => _.includes(validKeys, k) || matchesAnyBootConfig(k),
|
||||
(_v, k) => validKeys.includes(k) || matchesAnyBootConfig(k),
|
||||
);
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ export function executeStepAction(
|
||||
}
|
||||
|
||||
export function isValidAction(action: string): boolean {
|
||||
return _.includes(_.keys(actionExecutors), action);
|
||||
return _.keys(actionExecutors).includes(action);
|
||||
}
|
||||
|
||||
export async function getBootConfig(
|
||||
@ -697,7 +697,7 @@ export async function setBootConfig(
|
||||
async function isVPNEnabled(): Promise<boolean> {
|
||||
try {
|
||||
const activeState = await dbus.serviceActiveState(vpnServiceName);
|
||||
return !_.includes(['inactive', 'deactivating'], activeState);
|
||||
return !['inactive', 'deactivating'].includes(activeState);
|
||||
} catch (e: any) {
|
||||
if (UnitNotLoadedError(e)) {
|
||||
return false;
|
||||
|
@ -581,7 +581,7 @@ export async function executeStepAction(
|
||||
await deviceConfig.executeStepAction(step as deviceConfig.ConfigStep, {
|
||||
initial,
|
||||
});
|
||||
} else if (_.includes(applicationManager.validActions, step.action)) {
|
||||
} else if (applicationManager.validActions.includes(step.action)) {
|
||||
return applicationManager.executeStep(step as any, {
|
||||
force,
|
||||
skipLock,
|
||||
|
@ -50,7 +50,7 @@ interface HostConfig {
|
||||
}
|
||||
|
||||
const isAuthField = (field: string): boolean =>
|
||||
_.includes(['login', 'password'], field);
|
||||
['login', 'password'].includes(field);
|
||||
|
||||
const memoizedAuthRegex = _.memoize(
|
||||
(proxyField: string) => new RegExp(proxyField + '\\s*=\\s*"(.*)"\\s*;'),
|
||||
|
@ -124,7 +124,7 @@ export async function fetchDeltaWithProgress(
|
||||
const logFn = (str: string) =>
|
||||
log.debug(`delta([${serviceName}] ${deltaOpts.deltaSource}): ${str}`);
|
||||
|
||||
if (!_.includes([2, 3], deltaOpts.deltaVersion)) {
|
||||
if (![2, 3].includes(deltaOpts.deltaVersion)) {
|
||||
logFn(
|
||||
`Unsupported delta version: ${deltaOpts.deltaVersion}. Falling back to regular pull`,
|
||||
);
|
||||
|
@ -46,7 +46,7 @@ export function checkString(s: unknown): string | undefined {
|
||||
if (
|
||||
s == null ||
|
||||
typeof s !== 'string' ||
|
||||
_.includes(['null', 'undefined', ''], s)
|
||||
['null', 'undefined', ''].includes(s)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user