MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / checkUniqueCol

Function checkUniqueCol

web/pgadmin/static/js/validators.js:62–71  ·  view source on GitHub ↗
(rows, uniqueCols)

Source from the content-addressed store, hash-verified

60
61/* Validate rows to check for any duplicate rows based on uniqueCols-columns array */
62export function checkUniqueCol(rows, uniqueCols) {
63 if(uniqueCols) {
64 for(const [i, row] of rows.entries()) {
65 for(const checkRow of rows.slice(0, i)) {
66 if(_.isEqual(_.pick(checkRow, uniqueCols), _.pick(row, uniqueCols))) return i;
67 }
68 }
69 }
70 return -1;
71}

Callers 1

validateCollectionSchemaFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected