Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return undefined instead of null in get-product-id files #387

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions web/app/components/doc/thumbnail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ export default class DocThumbnailComponent extends Component<DocThumbnailCompone
return this.args.size === "large";
}

protected get productShortName(): string | null {
if (this.args.product) {
return getProductId(this.args.product);
} else {
return null;
}
protected get productShortName(): string | undefined {
return getProductId(this.args.product);
}

protected get isApproved(): boolean {
Expand Down
4 changes: 2 additions & 2 deletions web/app/helpers/get-product-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export interface GetProductIDSignature {
Args: {
Positional: [string | undefined];
};
Return: string | null;
Return: string | undefined;
}

const getProductIDHelper = helper<GetProductIDSignature>(([productName]) => {
if (!productName) {
return null;
return;
}
return getProductId(productName);
});
Expand Down
8 changes: 3 additions & 5 deletions web/app/utils/get-product-id.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export default function getProductId(
productName: string | null
): string | null {
export default function getProductId(productName?: string) {
if (!productName) {
return null;
return;
}
let product = productName.toLowerCase();

Expand All @@ -19,6 +17,6 @@ export default function getProductId(
case "cloud platform":
return "hcp";
default:
return null;
return;
}
}