latysheff / node-sctp

SCTP userspace sockets for Node.js
MIT License
59 stars 10 forks source link

Error in udp_connect.js in Node 8 #7

Closed ibc closed 5 years ago

ibc commented 5 years ago

This line is supposed to check if Node version === 12 (BTW it should be ">= 12"):

if (process.version.slice(1, 3) === '12') {

However, in Node 8:

> process.version.slice(1, 3)
// => '8.'

> process.version.slice(1, 3) > '12'
// => true

So it fails. Better use this:

if (parseInt(process.version.slice(1, 3)) >= 12) {
latysheff commented 5 years ago

Changed to if (typeof udpSocket.connect === 'function') {