Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"env": {
"node": true,
"commonjs": true
},
"extends": "eslint:recommended",
"rules": {
"no-console": 0
}
};
15 changes: 0 additions & 15 deletions .jshintrc

This file was deleted.

7 changes: 3 additions & 4 deletions lib/asn1ber.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ exports.encodeSequence = function (contents) {
// Encode an OctetString, which is a wrapper of type `04`.

exports.encodeOctetString = function (string) {
var buf, contents;
var contents;

if (typeof string === 'string') {
contents = new Buffer(string);
Expand Down Expand Up @@ -340,7 +340,7 @@ exports.encodeRequest = function (type, contents) {

// Parse and return type, data length and header length.
function typeAndLength(buf) {
var res, len, i;
var res, i;

res = { type: buf[0], len: 0, header: 1 };
if (buf[1] < 128) {
Expand Down Expand Up @@ -453,13 +453,12 @@ exports.parseOid = function (buf) {
// This is for example an IpAddress.

exports.parseArray = function (buf) {
var i, nelem, array;
var i, array;

if (buf[0] !== T.IpAddress) {
throw new Error('Buffer does not appear to be an array type.');
}

nelem = buf[1];
array = [];

for (i = 0; i < buf[1]; i++) {
Expand Down
10 changes: 4 additions & 6 deletions lib/snmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ function concatBuffers(buffers) {
// Clear a pending packet when it times out or is successfully received.

function clearRequest(reqs, reqid) {
var self = this;

var entry = reqs[reqid];
if (entry) {
if (entry.timeout) {
Expand Down Expand Up @@ -132,7 +130,7 @@ function parseOids(options) {
// Update targ with attributes from _defs.
// Any existing attributes on targ are untouched.

function defaults(targ, _defs) {
function defaults(targ) {
[].slice.call(arguments, 1).forEach(function (def) {
Object.keys(def).forEach(function (key) {
if (!targ.hasOwnProperty(key)) {
Expand Down Expand Up @@ -213,7 +211,7 @@ exports.encode = encode;
// make us blow up.

function parse(buf) {
var pkt, oid, bvb, vb, hdr, vbhdr;
var pkt, bvb, vb, hdr;

pkt = new Packet();

Expand Down Expand Up @@ -571,7 +569,7 @@ Session.prototype.sendMsg = function (pkt, options, callback) {
}

// Send the message.
self.socket.send(buf, 0, buf.length, options.port, options.host, function (err, bytes) {
self.socket.send(buf, 0, buf.length, options.port, options.host, function (err) {
var entry = self.reqs[reqid];

if (err) {
Expand Down Expand Up @@ -659,7 +657,7 @@ Session.prototype.getAll = function (options, callback) {
}

function getOne(c) {
var oid, pkt, m, vb;
var pkt, m, vb;

pkt = new Packet();
pkt.community = options.community;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"main": "lib/snmp.js",
"scripts": {
"test": "NODE_PATH=lib mocha -R spec",
"hint": "jshint *.js lib/*.js",
"lint": "eslint lib",
"doc": "docco lib/* example.js 2>/dev/null",
"cov": "jscoverage lib lib-cov && EXPRESS_COV=1 NODE_PATH=lib-cov mocha -R html-cov > docs/coverage.html"
},
"dependencies": {},
"devDependencies": {
"docco": "~0.6.2",
"eslint": "^3.13.1",
"jscoverage": "~0.3.6",
"jshint": "~1.1.0",
"mocha": "~1.9.0",
"should": "~1.2.2",
"snmpjs": "~0.1.3"
Expand Down