Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hap-nodejs

Package Overview
Dependencies
Maintainers
1
Versions
550
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hap-nodejs - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

50

lib/Service.js

@@ -64,5 +64,5 @@ var inherits = require('util').inherits;

// of Characteristic. Coerce if necessary.
if (typeof characteristic === 'function')
characteristic = new (Function.prototype.bind.apply(characteristic, arguments));
if (typeof characteristic === 'function') {
characteristic = new (Function.prototype.bind.apply(characteristic, arguments));
}
// check for UUID conflict

@@ -86,10 +86,38 @@ for (var index in this.characteristics) {

Service.prototype.getCharacteristic = function(name) {
for (var index in this.characteristics) {
var characteristic = this.characteristics[index];
if (typeof name === 'string' && characteristic.displayName === name)
return characteristic;
else if (typeof name === 'function' && characteristic instanceof name)
return characteristic;
}
// returns a characteristic object from the service
// If Service.prototype.getCharacteristic(Characteristic.Type) does not find the characteristic,
// but the type is in optionalCharacteristics, it adds the characteristic.type to the service and returns it.
var index, characteristic;
for (index in this.characteristics) {
characteristic = this.characteristics[index];
if (typeof name === 'string' && characteristic.displayName === name) {
return characteristic;
}
else if (typeof name === 'function' && characteristic instanceof name) {
return characteristic;
}
}
if (typeof name === 'function') {
for (index in this.optionalCharacteristics) {
characteristic = this.optionalCharacteristics[index];
if (characteristic instanceof name) {
return this.addCharacteristic(name);
}
}
}
};
Service.prototype.testCharacteristic = function(name) {
// checks for the existence of a characteristic object in the service
var index, characteristic;
for (index in this.characteristics) {
characteristic = this.characteristics[index];
if (typeof name === 'string' && characteristic.displayName === name) {
return true;
}
else if (typeof name === 'function' && characteristic instanceof name) {
return true;
}
}
return false;
}

@@ -96,0 +124,0 @@

{
"name": "hap-nodejs",
"version": "0.0.2",
"version": "0.0.3",
"description": "HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.",

@@ -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