From 1b8ba9cf25e48a465c7c0d224b95680e71ce63eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Mon, 13 Feb 2023 20:09:56 -0300 Subject: [PATCH] feat: add childrenIsAnImage util --- src/utils/childrenIsAnImage.ts | 3 +++ src/utils/index.ts | 1 + 2 files changed, 4 insertions(+) create mode 100644 src/utils/childrenIsAnImage.ts diff --git a/src/utils/childrenIsAnImage.ts b/src/utils/childrenIsAnImage.ts new file mode 100644 index 0000000000..ca884100da --- /dev/null +++ b/src/utils/childrenIsAnImage.ts @@ -0,0 +1,3 @@ +export const childrenIsAnImage = (children: any) => { + return typeof children[0] === 'object' && children[0].props.hasOwnProperty('src'); +}; diff --git a/src/utils/index.ts b/src/utils/index.ts index 4133683a06..8dcb56e76b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,5 @@ export { checkNavLinks } from './checkNavLinks'; +export { childrenIsAnImage } from './childrenIsAnImage'; export { compareReleasesFn } from './compareReleasesFn'; export { fetchLatestReleaseCommit } from './fetchLatestReleaseCommit'; export { fetchLatestReleaseVersionAndName } from './fetchLatestReleaseVersionAndName';