-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: 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
- is related to
-
NODE-4715 Support mapping to `null`ish values in our cursors
- Closed