Skip to content

Conversation

@IvanSanchez
Copy link
Contributor

In serialport v4, port.isOpen is a function; but this behaviour changed in v5, where it's a boolean. See serialport/node-serialport#899

My local build is running serialport v6 due to NordicSemiconductor/pc-nrfconnect-launcher#155, and we might decide to go ahead with updating serialport around. Hence this pull req.

export function close() {
return dispatch => {
if (port && port.isOpen()) {
if (port && port.isOpen && (typeof (port.isOpen) !== 'function' || port.isOpen())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though correct, it's not grouped logically. I'd suggest a condition that doesn't make you stop reading:
port && (typeof (port.isOpen) === 'function' ? port.isOpen() : port.isOpen)

bencefr
bencefr previously approved these changes Jan 15, 2018
@mrodem mrodem merged commit bd3e317 into master Feb 6, 2018
@mrodem mrodem deleted the is-open branch February 6, 2018 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants