New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tuyapi

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tuyapi - npm Package Compare versions

Comparing version 5.3.2 to 6.0.0

43

index.js

@@ -30,2 +30,4 @@ // Import packages

* @param {Number} [options.version=3.1] protocol version
* @param {Boolean} [options.nullPayloadOnJSONError=false] if true, emits a data event
* containing a payload of null values for on-device JSON parsing errors
* @example

@@ -36,3 +38,12 @@ * const tuya = new TuyaDevice({id: 'xxxxxxxxxxxxxxxxxxxx',

class TuyaDevice extends EventEmitter {
constructor({ip, port = 6668, id, gwID = id, key, productKey, version = 3.1} = {}) {
constructor({
ip,
port = 6668,
id,
gwID = id,
key,
productKey,
version = 3.1,
nullPayloadOnJSONError = false
} = {}) {
super();

@@ -42,2 +53,4 @@ // Set device to user-passed options

this.nullPayloadOnJSONError = nullPayloadOnJSONError;
// Check arguments

@@ -320,16 +333,18 @@ if (!(isValidString(id) ||

for (const packet of packets) {
if (packet.payload && packet.payload === 'json obj data unvalid') {
this.emit('error', packet.payload);
if (this.nullPayloadOnJSONError) {
for (const packet of packets) {
if (packet.payload && packet.payload === 'json obj data unvalid') {
this.emit('error', packet.payload);
packet.payload = {
dps: {
1: null,
2: null,
3: null,
101: null,
102: null,
103: null
}
};
packet.payload = {
dps: {
1: null,
2: null,
3: null,
101: null,
102: null,
103: null
}
};
}
}

@@ -336,0 +351,0 @@ }

{
"name": "tuyapi",
"version": "5.3.2",
"version": "6.0.0",
"description": "An easy-to-use API for devices that use Tuya's cloud services",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc