The JavaScript blog.


JSON web node modules xml urls

Node Roundup: 0.8.24, 0.10.10, speakingurl, node-xmljson

Posted on .

You can send in your Node projects for review through our contact form.

Node 0.8.24 and 0.10.10

Node 0.8.24 and Node 0.10.10 have been released. The 0.8 (maintenance) release gets an updated npm, and some fixes for the url and http core modules.

Meanwhile, 0.10.10 has a new version of the internal uv library, and unshift('') now behaves like a noop.


Sascha Droste sent in speakingurl (GitHub: pid / speakingurl, License: BSD, npm: speakingurl), a module for generating clean URL slugs:

slug = getSlug('Apple & Pear!');  
// Output: apple-and-pear

slug = getSlug('Foo ♥ Bar');  
// Output: foo-love-bar

It has tests, localisation support, and works in browsers.


node-xmljson (GitHub: ExactTarget / node-xmljson, License: MIT, npm: xmljson) from Adam Alexander and Benjamin Dean of ExactTarget was just released, providing quick and simple bi-directional translation between XML and JSON formats.

// Load the module
var to_json = require('xmljson').to_json;

// An XML string
var xml = '' +  
    '<data>' +
        '<prop1>val1</prop1>' +
        '<prop2>val2</prop2>' +
        '<prop3>val3</prop3>' +

to_json(xml, function (error, data) {  
    // Module returns a JS object
    // -> { prop1: 'val1', prop2: 'val2', prop3: 'val3' }

    // Format as a JSON string
    // -> {"prop1":"val1","prop2":"val2","prop3":"val3"}
// Load the module
var to_xml = require('xmljson').to_xml;

// A JSON string
var json = '' +  
    '{' +
        '"prop1":"val1",' +
        '"prop2":"val2",' +
        '"prop3":"val3"' +

to_xml(json, function (error, xml) {  
    // Module returns an XML string
    // -> <data><prop1>val1</prop1><prop2>val2</prop2><prop3>val3</prop3></data>

ExactTarget has also released Fuel UX (GitHub: ExactTarget / fuelux, License: MIT) a lightweight web UI library that extends Twitter Bootstrap with additional JavaScript controls.


libraries JSON books node modules pubsub xml

Node Roundup: 0.8.9, xmlson, Mubsub, Book on libuv

Posted on .

You can send in your Node projects for review through our contact form or @dailyjs.

Node 0.8.9

Node 0.8.9 is out, and this looks like a significant release judging by the long changelog. v8, npm, and GYP have all been updated, and there are quite a few platform-specific bug fixes relating to memory.


xmlson (License: MIT, npm: xmlson) by the developers at Fractal is a libexpat-based XML/JSON conversion module:

var xmlson = require('xmlson');

xmlson.toJSON('<p><h1 title="Details">Title</h1></p>', function(err, obj) {  
  // Do something with obj

In the previous example, [ { '@title': 'Details', text: 'Title' } ] will be printed, so attributes are included when converting to JSON. There's also a synchronous API. Installing xmlson with npm will compile the necessary dependencies with gyp.

This module is a fairly lightweight wrapper around ltx, which is worth checking out.


Mubsub (License: MIT, npm: mubsub) by Scott Nelson is a publish–subscribe implementation that uses MongoDB:

It utilizes Mongo's capped collections and tailable cursors to notify subscribers of inserted documents that match a given query.

To use it, a channel must be created and then subscribed to. It can work with MongoDB connection URLs, so it's fairly easy to drop into an existing MongoDB-based Node project. It comes with Mocha/Sinon.JS tests.

Book: An Introduction to libuv

An Introduction to libuv by Nikhil Marathe is a guide to libuv. It covers streams, threads, processes, event loops, and utilities. If you're trying to understand what makes Node different, and how its asynchronous and event-based design works, then this is actually a great guide. Try looking at Basics of libuv: Event loops as an example.