Skip to content

Commit c38eba8

Browse files
v1.6.1 (#167)
## [Version 1.6.1](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v1.6.1) (2022-10-18) ## What's Changed - Fixed Issue where node-switchbot wouldn't be found. **Full Changelog**: v1.6.0...v1.6.1
1 parent 0358e40 commit c38eba8

17 files changed

+324
-450
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
44

5-
## [Version 1.6.0](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v1.5.0) (2022-10-18)
5+
## [Version 1.6.1](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v1.6.1) (2022-10-18)
6+
7+
## What's Changed
8+
9+
- Fixed Issue where node-switchbot wouldn't be found.
10+
11+
**Full Changelog**: https://github.com/OpenWonderLabs/node-switchbot/compare/v1.6.0...v1.6.1
12+
13+
## [Version 1.6.0](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v1.6.0) (2022-10-18)
614

715
## What's Changed
816

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ Monitoring the advertising packets, you can find your devices and know the lates
110110

111111
```JavaScript
112112
// Load the node-switchbot and get a `Switchbot` constructor object
113-
const Switchbot = require('node-switchbot');
113+
let Switchbot = require('node-switchbot');
114114
// Create an `Switchbot` object
115-
const switchbot = new Switchbot();
115+
let switchbot = new Switchbot();
116116

117117
(async () => {
118118
// Start to monitor advertisement packets
@@ -137,7 +137,7 @@ The [`startScan()`](#startscan-method) and [`wait()`](#Switchbot-wait-method) me
137137

138138
```javascript
139139
// Load the node-switchbot and get a `Switchbot` constructor object
140-
const Switchbot = require("node-switchbot");
140+
let Switchbot = require("node-switchbot");
141141
// Create an `Switchbot` object
142142
let switchbot = new Switchbot();
143143

@@ -213,13 +213,13 @@ This sample discovers a Bot (WoHand), then put the Bot's arm down, finally put i
213213

214214
```javascript
215215
// Load the node-switchbot and get a `Switchbot` constructor object
216-
const Switchbot = require("node-switchbot");
216+
let Switchbot = require("node-switchbot");
217217
// Create an `Switchbot` object
218-
const switchbot = new Switchbot();
218+
let switchbot = new Switchbot();
219219

220220
(async () => {
221221
// Find a Bot (WoHand)
222-
const bot_list = await switchbot.discover({ model: "H", quick: true });
222+
let bot_list = await switchbot.discover({ model: "H", quick: true });
223223
if (bot_list.length === 0) {
224224
throw new Error("No device was found.");
225225
}
@@ -246,13 +246,13 @@ In this code, you can get a [`SwitchbotDeviceWoHand`](#SwitchbotDeviceWoHand-obj
246246
In order to use the node-switchbot, you have to load the node-switchbot module as follows:
247247

248248
```JavaScript
249-
const Switchbot = require('node-switchbot');
249+
let Switchbot = require('node-switchbot');
250250
```
251251

252252
You can get an `Switchbot` constructor from the code above. Then you have to create an `Switchbot` object from the `Switchbot` constructor as follows:
253253

254254
```javascript
255-
const switchbot = new Switchbot();
255+
let switchbot = new Switchbot();
256256
```
257257

258258
The `Switchbot` constructor takes an argument optionally. It must be a hash object containing the properties as follows:
@@ -267,11 +267,11 @@ The sample code below shows how to pass a `Nobel` object to the `Switchbot` cons
267267

268268
```JavaScript
269269
// Create a Noble object
270-
const noble = require('@abandonware/noble');
270+
let noble = require('@abandonware/noble');
271271

272272
// Create a Switchbot object
273-
const Switchbot = require('node-switchbot');
274-
const switchbot = new Switchbot({'noble': noble});
273+
let Switchbot = require('node-switchbot');
274+
let switchbot = new Switchbot({'noble': noble});
275275
```
276276

277277
In the code snippet above, the variable `switchbot` is an `Switchbot` object. The `Switchbot` object has a lot of methods as described in sections below.

lib/parameter-checker.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ParameterChecker {
3737
* an `Error` object will be set to `this._error`.
3838
*
3939
* [Usage]
40-
* const valid = parameterChecker.check(params, {
40+
* let valid = parameterChecker.check(params, {
4141
* level: {
4242
* required: false,
4343
* type: 'integer',
@@ -50,7 +50,7 @@ class ParameterChecker {
5050
* }
5151
* });
5252
* if(!valid) {
53-
* const e = parameterChecker.error.message;
53+
* let e = parameterChecker.error.message;
5454
* throw new Error(message);
5555
* }
5656
* ---------------------------------------------------------------- */
@@ -78,13 +78,13 @@ class ParameterChecker {
7878
return false;
7979
}
8080

81-
const result = true;
82-
const name_list = Object.keys(rules);
81+
let result = true;
82+
let name_list = Object.keys(rules);
8383

84-
for (const i = 0; i < name_list.length; i++) {
85-
const name = name_list[i];
86-
const v = obj[name];
87-
const rule = rules[name];
84+
for (let i = 0; i < name_list.length; i++) {
85+
let name = name_list[i];
86+
let v = obj[name];
87+
let rule = rules[name];
8888

8989
if (!rule) {
9090
rule = {};
@@ -458,7 +458,7 @@ class ParameterChecker {
458458
}
459459
}
460460
if (typeof rule.minBytes === "number") {
461-
const blen = Buffer.from(value, "utf8").length;
461+
let blen = Buffer.from(value, "utf8").length;
462462
if (blen < rule.minBytes) {
463463
this._error = {
464464
code: "LENGTH_UNDERFLOW",
@@ -475,7 +475,7 @@ class ParameterChecker {
475475
}
476476
}
477477
if (typeof rule.maxBytes === "number") {
478-
const blen = Buffer.from(value, "utf8").length;
478+
let blen = Buffer.from(value, "utf8").length;
479479
if (blen > rule.maxBytes) {
480480
this._error = {
481481
code: "LENGTH_OVERFLOW",

0 commit comments

Comments
 (0)