DailyJS

Node Roundup: HTTP DoS Fixed, Flocon, Trans

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

JSON node modules uuid

Node Roundup: HTTP DoS Fixed, Flocon, Trans

Posted by Alex R. Young on .
Featured

JSON node modules uuid

Node Roundup: HTTP DoS Fixed, Flocon, Trans

Posted by Alex R. Young on .

Node DoS Fixes

This week two maintenance releases of Node were rolled out to fix a DoS vulnerability in the HTTP module.

Flocon

I seem to find myself generating a lot of unique IDs lately. Flocon (GitHub: Yosee / flocon, License: MIT, npm: flocon) from Yosee is a 64-bit unique ID generator, written in C++. It's currently considered experimental by the authors but comes with unit tests.

Flocon returns IDs synchronously as strings with flocon.snow(), and the algorithm used is based on Twitter's Snowflake service.

There are also some benchmarks of the flocon module so you can compare it to other projects.

Trans

Gabriel Adomnicai sent in "trans" (GitHub: gabesoft / trans, License: MIT, npm: trans), a module for transforming objects. Given some JSON, trans can group and modify objects by using a chainable API:

var trans = require('trans');  
var data = [  
  { a: { b: 'fbc' }, c: 1 }
, { a: { b: 'foo' }, c: 3 }
, { a: { b: 'fde' }, c: 2 }
, { a: { b: 'def' }, c: 3 }
, { a: { b: 'ghk' }, c: 4 }
];

trans(data)  
  .group('a.b', 'c', ['charAt', 0], 'toUpperCase')
  .sortf('value')
  .sort('key')
  .value();

/*
[ { key: 'D', value: [ 3 ] },
  { key: 'F', value: [ 1, 2, 3 ] },
  { key: 'G', value: [ 4 ] } ]
*/

Each of the methods is documented in the readme, and Gabriel has included tests as well.