misfit-bolt
Advanced tools
Comparing version 1.0.4 to 1.0.5
'use strict'; | ||
var debug = require('debug')(require('./package').name); | ||
var noble = require('noble'); | ||
var noble = require('./noble'); | ||
var Peripheral = require('noble/lib/peripheral'); | ||
@@ -12,4 +12,4 @@ | ||
function isOn(value) { | ||
var str = ',100'; | ||
return value.substr(value.length - str.length, str.length) === str; | ||
var str = ',0'; | ||
return value.substr(value.length - str.length, str.length) !== str; | ||
} | ||
@@ -56,2 +56,3 @@ | ||
if (this._connected) { | ||
debug('already connected'); | ||
this.getLight(done); | ||
@@ -74,2 +75,3 @@ } else { | ||
if (!this._connected) { | ||
debug('already disconnected'); | ||
return done(); | ||
@@ -76,0 +78,0 @@ } |
@@ -501,2 +501,24 @@ /*jshint expr: true*/ | ||
describe('when light brightness is set', () => { | ||
before((done) => { | ||
spy = sinon.sandbox.stub(bolt, 'get', (cb) => { | ||
cb(undefined, '255,255,255,1'); | ||
}); | ||
bolt.getState((error, value) => { | ||
returnedValue = value; | ||
done(); | ||
}); | ||
}); | ||
it('calls #get method', () => { | ||
chai.expect(spy.called).to.be.true; | ||
}); | ||
it('return `true`', () => { | ||
chai.expect(returnedValue).to.be.true; | ||
}); | ||
}); | ||
}); | ||
@@ -503,0 +525,0 @@ |
{ | ||
"name": "misfit-bolt", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Misfit Bolt Javascript Interface", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,3 +0,4 @@ | ||
# Misfit Bolt Javascript Interface | ||
# Misfit Bolt Javascript Interface  | ||
Thin wrapper around [sandeepmistry/noble](https://github.com/sandeepmistry/noble), that helps [Misfit Bolt](https://misfit.com/products/bolt) bulbs discovery, and allows turning them on/off and changing their color and brightness, as well as reading their currently set values. | ||
@@ -255,3 +256,3 @@ Currently support setting color and brightness via [RGBA](https://en.wikipedia.org/wiki/RGBA_color_space). | ||
```javascript | ||
Bolt = require('misfit-bolt'); | ||
Bolt = require('.'); | ||
@@ -258,0 +259,0 @@ // Discover every nearby Bolt |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
289
27443
633
1