DailyJS

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

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

JSON web node modules xml urls

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

Posted by Alex R. Young on .
Featured

JSON web node modules xml urls

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

Posted by Alex R. Young 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.

speakingurl

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

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

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

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

node-xmljson

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.

XML to JSON:
// 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>' +
    '</data>';

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

    // Format as a JSON string
    console.log(JSON.stringify(data));
    // -> {"prop1":"val1","prop2":"val2","prop3":"val3"}
});
JSON to XML:
// 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
    console.log(xml);
    // -> <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.