feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
26
packages/admin-ui/ui/src/utils/get-combinations.js
Normal file
26
packages/admin-ui/ui/src/utils/get-combinations.js
Normal file
@@ -0,0 +1,26 @@
|
||||
export const getCombinations = (options) => {
|
||||
if (options.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (options.length === 1) {
|
||||
const values = options.shift().values
|
||||
if (values.length > 0) {
|
||||
return values.map((v) => [v])
|
||||
}
|
||||
|
||||
return [""]
|
||||
}
|
||||
|
||||
const combinations = []
|
||||
const theseValues = options.shift().values
|
||||
|
||||
const lowerCombinations = getCombinations(options)
|
||||
for (const v of theseValues) {
|
||||
for (const second of lowerCombinations) {
|
||||
combinations.push([v, second].flat())
|
||||
}
|
||||
}
|
||||
|
||||
return combinations
|
||||
}
|
||||
Reference in New Issue
Block a user