Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Create a map from a map #229

Open
matthew-dean opened this issue Jan 8, 2025 · 1 comment
Open

[Feature request] Create a map from a map #229

matthew-dean opened this issue Jan 8, 2025 · 1 comment

Comments

@matthew-dean
Copy link

In JS / TS, it's trivial to create a map from another map. That is:

let original = new Map()
let clone = new Map(original)

I didn't see this in the BiMap documentation, so I'm assuming this capability does not exist? I was going to use this library, but it looks like map cloning is non-trivial without spreading through an iterator, whereas JS map cloning is theoretically lower-cost in a JS engine. Can you add this capability?

let original = new BiMap()
let clone = new BiMap(original)
@Yomguithereal
Copy link
Owner

Most of mnemonist structures have a from static function to create them from other structures. Doesn’t BiMap.from(map) achieve what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants