mirror of https://github.com/renovatebot/renovate
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import is from '@sindresorhus/is';
|
|
import type {
|
|
GitlabInclude,
|
|
GitlabIncludeComponent,
|
|
GitlabIncludeLocal,
|
|
GitlabIncludeProject,
|
|
GitlabPipeline,
|
|
} from '../gitlabci/types';
|
|
|
|
export function isNonEmptyObject(obj: any): boolean {
|
|
return is.object(obj) && Object.keys(obj).length !== 0;
|
|
}
|
|
|
|
export function filterIncludeFromGitlabPipeline(
|
|
pipeline: GitlabPipeline,
|
|
): GitlabPipeline {
|
|
const pipeline_without_include: GitlabPipeline = {};
|
|
for (const key of Object.keys(pipeline).filter((key) => key !== 'include')) {
|
|
const pipeline_key = key as keyof typeof pipeline;
|
|
pipeline_without_include[pipeline_key] = pipeline[pipeline_key];
|
|
}
|
|
return pipeline_without_include;
|
|
}
|
|
|
|
export function isGitlabIncludeProject(
|
|
include: GitlabInclude,
|
|
): include is GitlabIncludeProject {
|
|
return !is.undefined((include as GitlabIncludeProject).project);
|
|
}
|
|
|
|
export function isGitlabIncludeLocal(
|
|
include: GitlabInclude,
|
|
): include is GitlabIncludeLocal {
|
|
return !is.undefined((include as GitlabIncludeLocal).local);
|
|
}
|
|
|
|
export function isGitlabIncludeComponent(
|
|
include: GitlabInclude,
|
|
): include is GitlabIncludeComponent {
|
|
return is.string((include as GitlabIncludeComponent).component);
|
|
}
|