MCPcopy Create free account
hub / github.com/Codehagen/Badget / hasOnlyOneValueForKey

Function hasOnlyOneValueForKey

src/lib/chartUtils.ts:122–140  ·  view source on GitHub ↗
(
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  array: any[],
  keyToCheck: string,
)

Source from the content-addressed store, hash-verified

120// Tremor hasOnlyOneValueForKey [v0.1.0]
121
122export function hasOnlyOneValueForKey(
123 // eslint-disable-next-line @typescript-eslint/no-explicit-any
124 array: any[],
125 keyToCheck: string,
126): boolean {
127 // eslint-disable-next-line @typescript-eslint/no-explicit-any
128 const val: any[] = []
129
130 for (const obj of array) {
131 if (Object.prototype.hasOwnProperty.call(obj, keyToCheck)) {
132 val.push(obj[keyToCheck])
133 if (val.length > 1) {
134 return false
135 }
136 }
137 }
138
139 return true
140}

Callers 5

onDotClickFunction · 0.90
ComboChart.tsxFile · 0.90
onDotClickFunction · 0.90
onCategoryClickFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected