From f787bfc926263493847af34eb6545ca10d015b30 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 21 Dec 2018 14:39:57 +0100 Subject: [PATCH] Don't mutate the user-supplied object --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4a98fc4..c1d6585 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,9 @@ const isAvailable = options => new Promise((resolve, reject) => { }); }); -const getPort = (options = {}) => { +const getPort = options => { + options = Object.assign({}, options); + if (typeof options.port === 'number') { options.port = [options.port]; }