feat(shared): Added nsMerge method to utils
This commit is contained in:
parent
08400fd523
commit
6ba43940b0
1 changed files with 11 additions and 0 deletions
|
@ -243,3 +243,14 @@ export const validateTld = (email) => {
|
|||
if (tlds.indexOf(tld) === -1) return tld
|
||||
else return true
|
||||
}
|
||||
|
||||
export const nsMerge = (...args) => {
|
||||
const ns = new Set()
|
||||
for (const arg of args) {
|
||||
if (typeof arg === 'string') ns.add(arg)
|
||||
else if (Array.isArray(arg)) ns.add(nsMerge(...arg))
|
||||
else console.log('Unexpected namespect type:', { arg })
|
||||
}
|
||||
|
||||
return [...ns]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue