DailyJS

Node Roundup: 0.4.10, Geocoding, Bunker

2011-07-20 00:00:00 +0100 by Alex R. Young
You can send your node modules and articles in for review through our [contact form](/contact.html) or [@dailyjs](http://twitter.com/dailyjs).

Node 0.4.10

Node 0.4.10 has been released. This version mainly contains bug fixes:

Geocoder

Geocoder (GitHub: wyattdanger / geocoder,
License, npm: geocoder) by Stephen Wyatt Bush is a module for using Google's
geocoding and reverse geocoding services:

var geocoder = require('geocoder');

geocoder.geocode("Atlanta, GA", function(data) {
  // do stuff with data
});

// Reverse Geocoding
geocoder.reverseGeocode(33.7489, -84.3789, function(data) {
  // do stuff with data
});

He's planning to add error handling support, although I'd have expected
the callback signature to be err, data rather than
data, err.

Bunker

Bunker (npm: bunker, License: MIT/X11) by James Halliday generates code coverage reports
using the author's burrito
library.

There's a simple example that demonstrates the project's event-based
API:

var bunker = require('bunker');
var b = bunker('var x = 0; for (var i = 0; i < 30; i++) { x++ }');

var counts = {};

b.on('node', function (node) {
    if (!counts[node.id]) {
        counts[node.id] = { times : 0, node : node };
    }
    counts[node.id].times ++;
});

b.run();

Object.keys(counts).forEach(function (key) {
    var count = counts[key];
    console.log(count.times + ' : ' + count.node.source());
});

This is actually a native JavaScript parser based on AST data generated
by UglifyJS. Bunker doesn't
currently provide a generalised script for analysing your project's test
coverage; for something like that TJ Holowaychuk's
node-jscoverage can work in conjunction with a test framework like
Expresso.