Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bejavu committed Oct 11, 2015
2 parents 61ea8c3 + 55b04f9 commit 67ae407
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ before_script:
- npm install -g mocha
- npm install -g coveralls
after_script:
- npm run coverage
- npm run coveralls
services:
- redis-server
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "colu",
"version": "0.6.8",
"version": "0.6.9",
"description": "Colu SDK for engine and colored-coins api.",
"main": "colu.js",
"main": "src/colu.js",
"scripts": {
"test": "mocha",
"coverage": "istanbul cover _mocha -- -R spec",
"test": "istanbul cover _mocha -- -R spec",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"bin": {
Expand Down Expand Up @@ -52,6 +51,7 @@
},
"devDependencies": {
"chai": "^3.0.0",
"istanbul": "^0.3.22",
"mocha": "^2.2.4"
}
}
6 changes: 3 additions & 3 deletions src/colu.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Colu.prototype.buildTransaction = function (financeAddress, type, args, cb) {
request.post(path, {json: dataParams}, function (err, response, body) {
if (err) return cb(err)
if (!response || response.statusCode !== 200) return cb(body)
cb(null, body)
cb(null, body)
})
}

Expand Down Expand Up @@ -250,11 +250,11 @@ Colu.prototype.getTransactions = function (callback) {
var addressesInfo = body
var transactions = []
var txids = []

addressesInfo.forEach(function (addressInfo) {
if (addressInfo.transactions) {
addressInfo.transactions.forEach(function (transaction) {
if (txids.indexOf(transaction.txis) == -1) {
if (txids.indexOf(transaction.txis) === -1) {
transactions.push(transaction)
}
})
Expand Down
34 changes: 17 additions & 17 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ var events = require('events')
var io = require('socket.io-client')

function Events (args) {
var self = this

args = args || {}
self.host = args.host || ''
self.rooms = args.rooms || []
self.socket = io.connect(host+'/events')
self.socket.on('connect', function () {
self.rooms.forEach(function (room) {
self.socket.emit('join', room)
})
})
var self = this

self.rooms.forEach(function (room) {
self.socket.on(room, function (data) {
self.emit(room, data)
})
})
args = args || {}
self.host = args.host || ''
self.rooms = args.rooms || []
self.socket = io.connect(self.host + '/events')
self.socket.on('connect', function () {
self.rooms.forEach(function (room) {
self.socket.emit('join', room)
})
})

self.rooms.forEach(function (room) {
self.socket.on(room, function (data) {
self.emit(room, data)
})
})
}

util.inherits(Events, events.EventEmitter)
util.inherits(Events, events.EventEmitter)
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Colu = require(__dirname + '/../src/colu.js')
var Colu = require('..')
var assert = require('assert')
var expect = require('chai').expect

Expand Down

0 comments on commit 67ae407

Please sign in to comment.