Skip to content

Expose Map #1072

@touilleMan

Description

@touilleMan

The Map object type seems to be missing from the bindings.

Given it requires the use of new to be instantiated (just like e.g. Promise), I guess it should be exposed in those bindings.

I'm currently trying to create an instance of Map with the bindings, but it seems rather complex since using new requires to to use the napi unsafe api... is there something I've missed here ?

My current solution is to use the eval function to create the Map, which is a bit wasteful ^^

        let new_map_code = cx.string("(function() { return new Map(); })");
        let js_map = neon::reflect::eval(cx, new_map_code)?.downcast_or_throw::<JsObject, _>(cx)?;

So would you accept a PR to add Map in the bindings ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions