1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

First pass at linting lib dir

This commit is contained in:
Laurent Cozic
2019-07-29 15:43:53 +02:00
parent 64b7bc3d62
commit 86dc72b204
170 changed files with 4140 additions and 3119 deletions

View File

@ -5,12 +5,12 @@ const netUtils = {};
netUtils.ip = async () => {
let response = await shim.fetch('https://api.ipify.org/?format=json');
if (!response.ok) {
throw new Error('Could not retrieve IP: ' + await response.text());
throw new Error('Could not retrieve IP: ' + (await response.text()));
}
let ip = await response.json();
return ip.ip;
}
};
netUtils.findAvailablePort = async (possiblePorts, extraRandomPortsToTry = 20) => {
const tcpPortUsed = require('tcp-port-used');
@ -28,13 +28,13 @@ netUtils.findAvailablePort = async (possiblePorts, extraRandomPortsToTry = 20) =
}
}
return port;
}
};
netUtils.mimeTypeFromHeaders = headers => {
if (!headers || !headers['content-type']) return null;
const splitted = headers['content-type'].split(';');
return splitted[0].trim().toLowerCase();
}
};
module.exports = { netUtils };
module.exports = { netUtils };