Skip to content

Commit dde7be9

Browse files
authored
Merge pull request #43 from TizenTeam/sandbox/rzr/devel/review/master
gpio: Support boolean as set value
2 parents cfc2e21 + a4987ce commit dde7be9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/gpio.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ GPIO.prototype._get = function(fn) {
229229
GPIO.prototype.set = function(v, fn) {
230230
var self = this;
231231
var callback = typeof v === 'function' ? v : fn;
232-
if(typeof v !== "number" || v !== 0) v = 1;
232+
if (typeof v === "boolean" || ) v = v ? 1 : 0;
233+
if (typeof v !== "number" || v !== 0) v = 1;
233234

234235
// if direction is out, just emit change event since we can reliably predict
235236
// if the value has changed; we don't have to rely on watching a file

0 commit comments

Comments
 (0)