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

Adding multiple sinks #9

Closed
tpluscode opened this issue Feb 4, 2020 · 2 comments
Closed

Adding multiple sinks #9

tpluscode opened this issue Feb 4, 2020 · 2 comments

Comments

@tpluscode
Copy link

tpluscode commented Feb 4, 2020

It would be nice to have shorthand method(s) to add multiple sinks at once.

Accepting another map

import { parsers } from '@rdfjs/formats-common'
import existingMap from './parsers'

existingMap.addAll(parsers)

Accepting a JS hashmap

import N3Parser from '@rdfjs/parser-n3'
import existingMap from './parsers'

existingMap.addAll({
  'text/turtle': new N3Parser()
})

And maybe an array to align with Map ctor

import N3Parser from '@rdfjs/parser-n3'
import existingMap from './parsers'

existingMap.addAll([
  ['text/turtle': new N3Parser()]
])
@bergos
Copy link
Contributor

bergos commented Sep 8, 2020

@tpluscode Is there any proposal for the plain JS Map that would add the functionality? I would like to keep it as close as possible in sync with the standard Map class. If there is nothing coming, I would propose to use a chain of .set(). Otherwise we could add it to our code, so we don't need to rely on the Map implementation.

@bergos
Copy link
Contributor

bergos commented Feb 20, 2022

It looks like Map.prototype.merge would be the correct method in the proposal for new methods for collections. But since there have been no updates for about four years, I will close this issue. Once the TC39 proposal status changes, we can open this issue again.

@bergos bergos closed this as completed Feb 20, 2022
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