Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Node.js versions older than 8.0 #427

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ image: Visual Studio 2015

environment:
matrix:
- nodejs_version: 6
- nodejs_version: 8
- nodejs_version: 10
- nodejs_version: 12

platform:
- x86
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js

node_js:
- 6
- 8
- 10
- 12

os:
- linux
Expand Down
2 changes: 1 addition & 1 deletion benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function outputResults(benchTimeHR) {

const sum = results.reduce(
(previous, current) =>
previous + Math.pow(current[1], 2) + Math.pow(current[0] - mean, 2),
previous + current[1] ** 2 + (current[0] - mean) ** 2,
0
);
const stdev = Math.sqrt(sum / workersAmount);
Expand Down
6 changes: 3 additions & 3 deletions benchmark/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const stdev = (sample, meanValue) => {
if (len === 0 || len === 1) return 0;
let sum = 0;
for (let i = 0; i < len; i++) {
sum += Math.pow(sample[i] - meanValue, 2);
sum += (sample[i] - meanValue) ** 2;
}
const variance = sum / len;
return Math.sqrt(variance);
Expand Down Expand Up @@ -43,8 +43,8 @@ const combineStdev = (samples, mean, count) => {
for (let i = 0; i < samples.length; i++) {
const sample = samples[i];
sum +=
sample.count * Math.pow(sample.stdev, 2) +
sample.count * Math.pow(sample.mean - mean, 2);
sample.count * sample.stdev ** 2 +
sample.count * (sample.mean - mean) ** 2;
}
return Math.sqrt(sum / count);
};
Expand Down
2 changes: 1 addition & 1 deletion lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Session extends Map {
// for Session objects when exporting the Session objects.
//
toString() {
const copy = Object.assign({}, this);
const copy = { ...this };
copy.storage = Array.from(this);
function replacer(key, value) {
switch (key) {
Expand Down
5 changes: 3 additions & 2 deletions lib/ws-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ const allowAllOriginCheckStrategy = function(/* origin */) {
};

const initServer = function(options, httpServer) {
options = Object.assign({}, options, {
options = {
...options,
httpServer,
autoAcceptConnections: false,
maxReceivedFrameSize: constants.MAX_MESSAGE_SIZE,
maxReceivedMessageSize: constants.MAX_MESSAGE_SIZE,
});
};

httpServer.isOriginAllowed =
options.originCheckStrategy || allowAllOriginCheckStrategy;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"prepublish": "npm run -s build-browser"
},
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},
"readmeFilename": "README.md"
}
11 changes: 2 additions & 9 deletions test/node/application-async-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@ const jstp = require('../..');

const app = require('../fixtures/application');

const makeFakeAsyncFn = fn => {
fn[Symbol.toStringTag] = 'AsyncFunction';
return fn;
};

const application = new jstp.Application(app.name, {
someInterface: {
getSessionId: makeFakeAsyncFn(connection =>
Promise.resolve(connection.session.id)
),
sum: makeFakeAsyncFn((connection, a, b) => Promise.resolve(a + b)),
getSessionId: async connection => connection.session.id,
sum: async (connection, a, b) => a + b,
},
});
const server = jstp.net.createServer([application]);
Expand Down
10 changes: 4 additions & 6 deletions tools/prepare-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ function getSemverTag(repo, id) {
}

function httpsGetJson(options) {
options = Object.assign(
{
headers: { 'User-Agent': 'metarhia-jstp-release-tool' },
},
options
);
options = {
headers: { 'User-Agent': 'metarhia-jstp-release-tool' },
...options,
};
if (token) {
options.headers['Authorization'] = `token ${token}`;
}
Expand Down