MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / checkForDuplicate

Function checkForDuplicate

src/lib/item-input/array.ts:67–73  ·  view source on GitHub ↗
(list: T[], value: T, index: number)

Source from the content-addressed store, hash-verified

65 const minItems = options?.minItems ?? 1
66
67 const checkForDuplicate = (list: T[], value: T, index: number): boolean => {
68 if (!options?.allowDuplicates && list.includes(value) && (index === -1 || list[index] !== value)) {
69 console.log('Duplicate values are not allowed.')
70 return false
71 }
72 return true
73 }
74
75 const itemSummary = (item: T): string => {
76 const summary = itemDef.summarizeForEdit(item)

Callers 2

editItemFunction · 0.85
editListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected