Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Do we want to use the javascript .keys() method? #48

Open
@jbrownson

Description

@jbrownson

There are several places we iterate over keys, and we're using the for/in method with hasOwnProperty. This is correct, but might it be better to use the .keys() method (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)?

It would remove the need for the hasOwnProperty check so it seems like it could only be faster, but it would have less browser support. I'm not sure what browsers we try to support?

Or maybe if it ain't broke don't fix it?

Activity

michaelficarra

michaelficarra commented on Sep 21, 2015

@michaelficarra

Right now, it appears the library was written with deliberate ES3 support (for instance, using exports["new"] instead of exports.new), so Object.keys would be a no-go. I'm also not sure Object.keys would be faster than for-in, so you should use jsperf to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @michaelficarra@jbrownson

        Issue actions

          Do we want to use the javascript .keys() method? · Issue #48 · purescript-deprecated/purescript-maps