MCPcopy Create free account
hub / github.com/dailydotdev/apps / getRequiredValue

Function getRequiredValue

packages/shared/src/components/Feed.spec.tsx:352–361  ·  view source on GitHub ↗
(
  value: T | null | undefined,
  message: string,
)

Source from the content-addressed store, hash-verified

350}
351
352const getRequiredValue = <T,>(
353 value: T | null | undefined,
354 message: string,
355): T => {
356 if (value == null) {
357 throw new Error(message);
358 }
359
360 return value;
361};
362
363const getPostTitle = (post: Pick<Post, 'title'>, label: string): string =>
364 getRequiredValue(post.title, `Expected ${label} post title`);

Callers 3

getPostTitleFunction · 0.85
getPostCreatedAtFunction · 0.85
Feed.spec.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected