UUID constructor uses instanceof test

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... js-bson user
      I want... uuid constructor to verify types by name, not instanceof
      So that... my code can work correctly with bundlers

      User Experience

      • In latest nodeless tests, we need to change `new UUID(dataKey)` to `new UUID(dataKey.toHexString(true))`, because dataKey is not the exact same `UUID` type
      • We should be checking the inputs by name, like we do with buffer and other checks
      • In latest nodeless tests, we should be able to go back to `new UUID(dataKey)`

      Dependencies

      • None

      Risks/Unknowns

      • `instanceof` is a problematic keyword, so we're removing a source of bugs

      Acceptance Criteria

      Implementation Requirements

      • `instanceof` check is removed from UUID constructor

      Testing Requirements

      • In latest nodeless tests, we go back to `new UUID(dataKey)`

      Documentation Requirements

      • None

      Follow Up Requirements

      • None

            Assignee:
            Pavel Safronov
            Reporter:
            Pavel Safronov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: