Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1751

Clean up Collection APIs

      THIS ISSUE IS STILL A DRAFT

      The idea is that Realm.Collection is supposed to emulate Array, and in order to have fewer surprises, the Array methods are added to Realm.Collection. Prior to v10.5.0, we had two classes, Realm.Results and Realm.List, behaving like Array by inheriting from Realm.Collection. In v10.5.0 we expanded our collection classes with Realm.Set and Realm.Directory.

      Today, we rely on the Array prototype chain, and adding the methods from Array to our classes.

      Method Realm.Results Realm.List Realm.Set Realm.Dictionary
      [] ✅ (index) ✅ (index) ❌ (unordered) ✅ (string keys)
      toString
      toLocaleString
      concat
      join
      slice
      lastIndexOf
      every
      some
      forEach
      find
      findIndex
      map
      filter
      reduce
      reduceRight
      entries
      keys
      values

      Related to https://github.com/realm/realm-js/issues/4627

            Assignee:
            Unassigned Unassigned
            Reporter:
            kenneth.geisshirt@mongodb.com Kenneth Geisshirt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: