*Add utility function ensureUniqueRecords to ensure there are no duplicate records
This commit is contained in:
parent
07dcd78261
commit
c0b6384fa5
|
@ -61,3 +61,9 @@ export function isPromise(obj: Promise<any>) {
|
|||
typeof obj.then === "function"
|
||||
);
|
||||
}
|
||||
|
||||
export function ensureUniqueRecords(records: DNSRecord[]) {
|
||||
return [
|
||||
...new Set(records.map((item: DNSRecord) => JSON.stringify(item))),
|
||||
].map((item) => JSON.parse(item));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue