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

tuyapi

Package Overview
Dependencies
Maintainers
2
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 1.0.1 to 1.0.2

4

docs/API.md

@@ -21,5 +21,5 @@ Docs

- `options.port` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** port of device (optional, default `6668`)
- `options.id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of device (called `devId` or `gwId`)
- `options.id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of device
- `options.uid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** UID of device
- `options.key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** encryption key of device (called `localKey`)
- `options.key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** encryption key of device
- `options.version` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** protocol version (optional, default `3.1`)

@@ -26,0 +26,0 @@

@@ -17,5 +17,5 @@ 'use strict';

* @param {number} [options.port=6668] - port of device
* @param {string} options.id - ID of device (called `devId` or `gwId`)
* @param {string} options.id - ID of device
* @param {string} options.uid - UID of device
* @param {string} options.key - encryption key of device (called `localKey`)
* @param {string} options.key - encryption key of device
* @param {number} [options.version=3.1] - protocol version

@@ -60,6 +60,10 @@ */

// Extract returned JSON
result = result.toString();
result = result.slice(result.indexOf('{'), result.lastIndexOf('}') + 1);
result = JSON.parse(result);
return callback(null, result.dps['1']);
try {
result = result.toString();
result = result.slice(result.indexOf('{'), result.lastIndexOf('}') + 1);
result = JSON.parse(result);
return callback(null, result.dps['1']);
} catch (err) {
return callback(err, null);
}
});

@@ -109,3 +113,3 @@ };

// Send request to change status
this._send(buffer, (error, result) => {
this._send(buffer, error => {
if (error) {

@@ -115,3 +119,3 @@ return callback(error, null);

return callback(null, result);
return callback(null, true);
});

@@ -118,0 +122,0 @@ };

{
"name": "tuyapi",
"version": "1.0.1",
"version": "1.0.2",
"description": "An easy-to-use API for devices that use Tuya's cloud services (currently only supports smart plugs)",
"main": "index.js",
"scripts": {
"test": "xo --space",
"test": "xo --space --fix",
"document": "documentation build index.js -f md | (echo 'Docs \n=========' && cat) > docs/API.md",

@@ -9,0 +9,0 @@ "pushtags": "git push origin master --tags"

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