Skip to content

Commit a1763a2

Browse files
committed
rename isTruthy util to isNotNil
1 parent c60383b commit a1763a2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/components/docPage/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {getCurrentGuide, getCurrentPlatform, nodeForPath} from 'sentry-docs/docT
44
import {serverContext} from 'sentry-docs/serverContext';
55
import {FrontMatter} from 'sentry-docs/types';
66
import {PaginationNavNode} from 'sentry-docs/types/paginationNavNode';
7-
import {isTruthy} from 'sentry-docs/utils';
7+
import {isNotNil} from 'sentry-docs/utils';
88
import {getUnversionedPath} from 'sentry-docs/versioning';
99

1010
import './type.scss';
@@ -50,7 +50,7 @@ export function DocPage({
5050

5151
const pathname = serverContext().path.join('/');
5252

53-
const searchPlatforms = [currentPlatform?.name, currentGuide?.name].filter(isTruthy);
53+
const searchPlatforms = [currentPlatform?.name, currentGuide?.name].filter(isNotNil);
5454

5555
const unversionedPath = getUnversionedPath(path, false);
5656

src/components/pageGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Link from 'next/link';
44

55
import {DocNode, nodeForPath} from 'sentry-docs/docTree';
66
import {serverContext} from 'sentry-docs/serverContext';
7-
import {isTruthy, sortPages} from 'sentry-docs/utils';
7+
import {isNotNil, sortPages} from 'sentry-docs/utils';
88

99
type Props = {
1010
exclude?: string[];
@@ -22,7 +22,7 @@ export function PageGrid({header, exclude}: Props) {
2222
const children: DocNode[] = parentNode.frontmatter.next_steps?.length
2323
? (parentNode.frontmatter.next_steps
2424
.map(p => nodeForPath(rootNode, path.join(parentNode.path, p)))
25-
.filter(isTruthy) ?? [])
25+
.filter(isNotNil) ?? [])
2626
: parentNode.children;
2727

2828
return (

src/components/tableOfContents/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {useEffect, useState} from 'react';
44

5-
import {isTruthy} from 'sentry-docs/utils';
5+
import {isNotNil} from 'sentry-docs/utils';
66

77
import styles from './style.module.scss';
88

@@ -104,7 +104,7 @@ export function TableOfContents() {
104104
isActive: false,
105105
};
106106
})
107-
.filter(isTruthy);
107+
.filter(isNotNil);
108108
setTocItems(tocItems_);
109109
}, []);
110110

src/mdx.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import remarkImageSize from './remark-image-size';
2828
import remarkTocHeadings, {TocNode} from './remark-toc-headings';
2929
import remarkVariables from './remark-variables';
3030
import {FrontMatter, Platform, PlatformConfig} from './types';
31-
import {isTruthy} from './utils';
31+
import {isNotNil} from './utils';
3232
import {isVersioned, VERSION_INDICATOR} from './versioning';
3333

3434
const root = process.cwd();
@@ -145,7 +145,7 @@ export function getDevDocsFrontMatter(): FrontMatter[] {
145145
sourcePath: path.join(folder, fileName),
146146
};
147147
})
148-
.filter(isTruthy);
148+
.filter(isNotNil);
149149
return fmts;
150150
}
151151

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import qs from 'query-string';
88
* let numbers: number[] = [1, undefined, 3, null, 5].filter(isTruthy);
99
* ```
1010
*/
11-
export const isTruthy = <T>(x?: T): x is Exclude<T, null | undefined> => {
11+
export const isNotNil = <T>(x?: T): x is Exclude<T, null | undefined> => {
1212
return x !== null && x !== undefined;
1313
};
1414

0 commit comments

Comments
 (0)