Skip to content

map_to_object/1 produce valid javascript objects #362

Description

@vans163

"An object property name can be any valid JavaScript string, or anything that can be converted to a string, including the empty string. However, any property name that is not a valid JavaScript identifier (for example, a property name that has a space or a hyphen, or that starts with a number) can only be accessed using the square bracket notation."

Currently if we do something like map_to_object(%{1=> :fail, :atom=> :fail}), we will produce an object like this, but in many cases we want a valid javascript object that will transform numbers and atoms to strings. Perhaps add a map_to_object/2 ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions