versatica / pick-port

Get a free TCP or UDP port for the given IP address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't use spread operator for Objects

ibc opened this issue · comments

const _options = { ...defaultOptions, ...options };
/xxxx/node_modules/pick-port/index.js:51
	const _options = { ...defaultOptions, ...options };
	                   ^^^

SyntaxError: Unexpected token ...

Spread operators it's not defined inES6 and it fails in Node 6 and 8:

Instead, use Object.assign. Also, let's avoid creating a ugly _options variable:

options = Object.assign({}, defaultOptions, options);

Addressed in 0.0.3. Thanks @ibc!