Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Fix: Enums.is() with an array value should always be false #327

Merged

Conversation

phorsuedzie
Copy link
Contributor

Javascript oddity: true === {p: 'v'}.hasOwnProperty(['p']).

In ancient times, the checked value was also ensured to be a String.
This was removed with #94 (Enums supports numbers).

Note: With this fix, valid Enums values are restricted to the
officially supported types Number and String. The previous
implementation could have worked also for Symbol.

Javascript oddity: `true === {p: 'v'}.hasOwnProperty(['p'])`.

In ancient times, the checked value was also ensured to be a String.
This was removed with gcanti#94 (`Enums` supports numbers).

Note: With this fix, valid `Enums` values are restricted to the
officially supported types `Number` and `String`. The previous
implementation could have worked also for `Symbol`.
@gcanti gcanti merged commit 8e971a6 into gcanti:master Nov 7, 2018
@gcanti
Copy link
Owner

gcanti commented Nov 7, 2018

Thanks @phorsuedzie

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants