react / react/react-native

Set polyfill says it is [object Object] but should say [object Set]

Offen
#19,594 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bug JavaScript Priority: Low
Vorherrschende Sprache
C++
Sterne
127k
Forks
25.3k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Environment

Any - you can reproduce the issue using only file

https://github.com/facebook/react-native/blob/master/Libraries/vendor/core/Set.js

and any Javascript encironment.

EDIT: Just for the bot, it is completely irrelevant:

Environment:
OS: Windows 10
Node: 10.3.0
Yarn: Not Found
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.1.0.0 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

Description and Steps to Reproduce

Here is code that creates a simple Set object and then uses the spread operator to spread the Set's contents into a new array.

First, using an environment where the above file was executed/loaded (plus its own dependencies), and I also short-circuited the detection at the beginning that determines whether the polyfill is applied:

const s1 = new Set([1,2,3]);
console.log(Object.prototype.toString.call(s1));

Result:

[object Object]

Expected Behavior

Now for comparison a clean ES6+ environment without anything loaded, so we get a native Set implementation:

const s1 = new Set([1,2,3]);
console.log(Object.prototype.toString.call(s1));

Result:

[object Set]

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit Libraries/vendor/core/Set.js und reproduziere das gemeldete Verhalten in einer JavaScript-Umgebung anhand des bereitgestellten Beispiels für Object.prototype.toString.call. Vergleiche das Ergebnis des Set-Polyfills mit dem Ergebnis des nativen Set; abgeschlossen ist dies, wenn das Polyfill für eine Set-Instanz [object Set] meldet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
mobile
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.