MCPcopy Create free account
hub / github.com/deta/surf / conditionalArrayItem

Function conditionalArrayItem

packages/utils/src/data/array.ts:1–7  ·  view source on GitHub ↗
(condition: boolean, item: T | Array<T>)

Source from the content-addressed store, hash-verified

1export const conditionalArrayItem = <T>(condition: boolean, item: T | Array<T>): T[] => {
2 if (condition) {
3 return Array.isArray(item) ? item : [item]
4 }
5
6 return []
7}

Callers 8

NonHiddenDefaultTagsMethod · 0.90
getResourceCtxItemsFunction · 0.90
createCodeResourceMethod · 0.90
getResourcePreviewFunction · 0.90
mentionItemsFetcherFunction · 0.90
createNodeMethod · 0.90
createEditorExtensionsFunction · 0.90
createSpaceActionsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected