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

Function getRequiredValue

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

Source from the content-addressed store, hash-verified

294}
295
296const getRequiredValue = <T,>(
297 value: T | null | undefined,
298 message: string,
299): T => {
300 if (value == null) {
301 throw new Error(message);
302 }
303
304 return value;
305};
306
307const getPostTitle = (post: Pick<Post, 'title'>, label: string): string =>
308 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