From e1aa949a764f55b78667d3d5362cc7e92e1ff12f Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Mon, 20 Dec 2021 23:45:07 -0600 Subject: [PATCH] chore: var to let/const and audit dev dependencies (#1374) * fix: audit dev dependencies * add changes * timeout * add timeout * remove aftereach * fixes --- README.md | 20 +- benchmarks/bombing.js | 8 +- benchmarks/throughputCounter.js | 8 +- bin/mqtt.js | 6 +- bin/pub.js | 24 +- bin/sub.js | 12 +- example.js | 4 +- examples/client/secure-client.js | 16 +- examples/client/simple-both.js | 6 +- examples/client/simple-publish.js | 4 +- examples/client/simple-subscribe.js | 4 +- examples/tls client/mqttclient.js | 20 +- examples/ws/client.js | 10 +- examples/wss/client_with_proxy.js | 24 +- lib/client.js | 308 +++++---- lib/connect/ali.js | 28 +- lib/connect/index.js | 21 +- lib/connect/tcp.js | 9 +- lib/connect/tls.js | 11 +- lib/connect/ws.js | 28 +- lib/connect/wx.js | 24 +- lib/default-message-id-provider.js | 2 +- lib/store.js | 18 +- lib/topic-alias-send.js | 6 +- lib/unique-message-id-provider.js | 2 +- lib/validations.js | 6 +- mqtt.js | 10 +- package.json | 19 +- test/abstract_client.js | 807 +++++++++++----------- test/abstract_store.js | 19 +- test/browser/server.js | 43 +- test/browser/test.js | 24 +- test/client.js | 116 ++-- test/client_mqtt5.js | 244 +++---- test/helpers/port_list.js | 48 +- test/helpers/server.js | 18 +- test/helpers/server_process.js | 2 +- test/message-id-provider.js | 33 +- test/mqtt.js | 57 +- test/mqtt_store.js | 2 +- test/secure_client.js | 47 +- test/server.js | 20 +- test/server_helpers_for_client_tests.js | 86 +-- test/store.js | 4 +- test/unique_message_id_provider_client.js | 12 +- test/util.js | 4 +- test/websocket_client.js | 63 +- 47 files changed, 1173 insertions(+), 1134 deletions(-) diff --git a/README.md b/README.md index 5c0570c48..1ac0970c8 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ npm install mqtt --save For the sake of simplicity, let's put the subscriber and the publisher in the same file: ```js -var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://test.mosquitto.org') +const mqtt = require('mqtt') +const client = mqtt.connect('mqtt://test.mosquitto.org') client.on('connect', function () { client.subscribe('presence', function (err) { @@ -121,8 +121,8 @@ to use MQTT.js in the browser see the [browserify](#browserify) section ## Import styles ### CommonJS (Require) ```js -var mqtt = require('mqtt') // require mqtt -var client = mqtt.connect('est.mosquitto.org') // create a client +const mqtt = require('mqtt') // require mqtt +const client = mqtt.connect('est.mosquitto.org') // create a client ``` ### ES6 Modules (Import) #### Aliased wildcard import @@ -695,7 +695,7 @@ gzip ### Webpack -Just like browserify, export MQTT.js as library. The exported module would be `var mqtt = xxx` and it will add an object in the global space. You could also export module in other [formats (AMD/CommonJS/others)](http://webpack.github.io/docs/configuration.html#output-librarytarget) by setting **output.libraryTarget** in webpack configuration. +Just like browserify, export MQTT.js as library. The exported module would be `const mqtt = xxx` and it will add an object in the global space. You could also export module in other [formats (AMD/CommonJS/others)](http://webpack.github.io/docs/configuration.html#output-librarytarget) by setting **output.libraryTarget** in webpack configuration. ```javascript npm install -g webpack // install webpack @@ -715,7 +715,7 @@ you can then use mqtt.js in the browser with the same api than node's one.