Skip to content

Commit 5fb91ea

Browse files
committed
in now type checks
1 parent 7e61c7d commit 5fb91ea

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/modules/datasource/docker/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ export class DockerDatasource extends Datasource {
570570
// OCI image lists are not required to specify a mediaType
571571
if (
572572
manifest.mediaType === MediaType.ociManifestIndexV1 ||
573-
(!manifest.mediaType && hasKey('manifests', manifest))
573+
(!manifest.mediaType && 'manifests' in manifest)
574574
) {
575575
if (manifest.manifests.length) {
576576
logger.trace(
@@ -594,7 +594,7 @@ export class DockerDatasource extends Datasource {
594594
// OCI manifests are not required to specify a mediaType
595595
if (
596596
(manifest.mediaType === MediaType.ociManifestV1 ||
597-
(!manifest.mediaType && hasKey('config', manifest))) &&
597+
(!manifest.mediaType && 'config' in manifest)) &&
598598
is.string(manifest.config?.digest)
599599
) {
600600
return manifest.config?.digest;
@@ -1042,7 +1042,7 @@ export class DockerDatasource extends Datasource {
10421042
manifestList.schemaVersion === 2 &&
10431043
(manifestList.mediaType === MediaType.manifestListV2 ||
10441044
manifestList.mediaType === MediaType.ociManifestIndexV1 ||
1045-
(!manifestList.mediaType && hasKey('manifests', manifestList)))
1045+
(!manifestList.mediaType && 'manifests' in manifestList))
10461046
) {
10471047
for (const manifest of manifestList.manifests) {
10481048
if (manifest.platform['architecture'] === architecture) {

lib/modules/platform/github/massage-markdown-links.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Content } from 'mdast';
22
import remark from 'remark';
33
import type { Plugin, Transformer } from 'unified';
44
import { logger } from '../../../logger';
5-
import { hasKey } from '../../../util/object';
65
import { regEx } from '../../../util/regex';
76

87
interface UrlMatch {
@@ -44,7 +43,7 @@ function collectLinkPosition(input: string, matches: UrlMatch[]): Plugin {
4443
const newUrl = massageLink(url);
4544
matches.push({ start, end, replaceTo: `[${url}](${newUrl})` });
4645
}
47-
} else if (hasKey('children', tree)) {
46+
} else if ('children' in tree) {
4847
tree.children.forEach((child: Content) => {
4948
transformer(child);
5049
});

lib/util/object.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export function hasKey<K extends string, T>(
99
k: K,
1010
o: T
1111
): o is T & Record<K, unknown> {
12-
return typeof o === 'object' && k in o;
12+
return o && typeof o === 'object' && k in o;
1313
}

0 commit comments

Comments
 (0)