Return null when indicating absence of an object

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None

      From the ECMAScript2015 spec

      4.3.10 undefined value
      primitive value used when a variable has not been assigned a value
      4.3.12 null value
      primitive value that represents the intentional absence of any object value

      AC

      • Audit usage of | undefined in return types, a function that "returns undefined" should actually be void.
      • If the API is supposed to return something or nothing it should always use null to indicate "nothing", ex. getWriteErrorAt
      • Investigate eslint rules to enforce this.

      Impact Considerations

      • null is serialized by JSON where undefined is not
      • undefined is (by default) ignored by our BSON library
      • undefined when deserialized from BSON is converted to null

              Assignee:
              Unassigned
              Reporter:
              Neal Beeken
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: