Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions lib/gpio.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
var fs = require('fs');
var util = require('util');
var path = require('path');
var EventEmitter = require('events').EventEmitter;
var exists = fs.exists || path.exists;
const fs = require('fs');
const util = require('util');
const path = require('path');
const EventEmitter = require('events').EventEmitter;

var defaultGpioBasePath = '/sys/class/gpio/';
const defaultGpioBasePath = '/sys/class/gpio/';

var logError = function (e) {
function logError(e) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is fine,

if (e) console.log(e.code, e.action, e.path);
};
var logMessage = function () {
}

function logMessage() {
if (exports.logging) console.log.apply(console, arguments);
};
}

var _write = function (str, file, fn, override) {
if (typeof fn !== "function") fn = logError;
Expand Down Expand Up @@ -45,7 +45,7 @@ var _unexport = function (_gpioBasePath, number, fn) {
}, 1);
};
var _export = function (_gpioBasePath, n, fn) {
if (exists(path.join(_gpioBasePath, 'gpio' + n))) {
if (fs.existsSync(path.join(_gpioBasePath, 'gpio' + n))) {
// already exported, unexport and export again
logMessage('Header already exported');
_unexport(_gpioBasePath, n, function () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gpio",
"version": "0.3.1",
"version": "0.4.0",
"author": {
"name": "Sebastian Alkemade",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to change author ? here

"email": "sa@linetco.com"
Expand Down