MCPcopy Create free account
hub / github.com/Lemoncode/fonk / safeArrayLength

Function safeArrayLength

src/helpers/helpers.ts:8–9  ·  view source on GitHub ↗
(collection: T[])

Source from the content-addressed store, hash-verified

6
7// TODO: Better naming for this?
8export const safeArrayLength = <T>(collection: T[]) =>
9 Array.isArray(collection) ? collection.length : 0;
10
11export const arrayContainsEntries = <T>(collection: T[]) =>
12 safeArrayLength(collection) > 0;

Callers 3

helpers.spec.tsFile · 0.90
arrayContainsEntriesFunction · 0.85
isLastIndexInArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…