Skip to content

Constructor parameters: ordered or options bag? #10

@js-choi

Description

@js-choi

Let’s assume that we make new classes rather than using Map and Set (see #8 and #5).
Given that, we now have two or three possible parameters:

There are several API choices that I can think of:

new CacheMap('lru', [ 256, 'purgeable' ], entries)
new CacheMap('lru', { maxSize: 256, purgeable: true }, entries)
new CacheMap('lru', entries, { maxSize: 256, purgeable: true })
new CacheMap('lru', { maxSize: 256, purgeable: true, entries })
new CacheMap({ policy: 'lru', maxSize: 256, purgeable: true, entries })

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions