mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
21ff27d5ab
Co-authored-by: Fred Rondina <fred.rondina@daveramsey.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Rhys Arkins <rhys@arkins.net>
35 lines
1008 B
TypeScript
35 lines
1008 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type {
|
|
GitlabInclude,
|
|
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 = {} as 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);
|
|
}
|