diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 19:48:37 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-15 20:40:13 -0400 |
commit | 5a7500688040fc19940adf0e2d0d96a0f75d014b (patch) | |
tree | f40f937756b6aeb03f84e323249d4a8efb474ff0 /src/util | |
parent | 9d91023e7c7827e640e8edcda3743cb0109f2170 (diff) |
wiki-data: combineWikiDataArrays
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/wiki-data.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 4855a7a2..f97ecd63 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -460,3 +460,16 @@ export class TupleMapForBabies { } } } + +const combinedWikiDataTupleMap = new TupleMapForBabies(); + +export function combineWikiDataArrays(arrays) { + const map = combinedWikiDataTupleMap; + if (map.has(...arrays)) { + return map.get(...arrays); + } else { + const combined = arrays.flat(); + map.set(...arrays, combined); + return combined; + } +} |