DailyJS

memdiff, numerizerJS, Obfuscate.js

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

testing node modules parsing text debugging memory

memdiff, numerizerJS, Obfuscate.js

Posted by Alex R. Young on .
Featured

testing node modules parsing text debugging memory

memdiff, numerizerJS, Obfuscate.js

Posted by Alex R. Young on .

memdiff

memdiff (GitHub: azer / memdiff, License: WTFPL, npm: memdiff) by Azer Koculu is a BDD-style memory leak tool based on memwatch. It can either be used by writing scripts with describe and it, and then running them with memdiff:

function SimpleClass(){}  
var leaks = [];

describe('SimpleClass', function() {  
  it('is leaking', function() {
    leaks.push(new SimpleClass);
  });

  it('is not leaking', function() {
    new SimpleClass;
  });
});

Or by loading memdiff with require and passing a callback to memdiff. The memwatch module itself has an event-based API, and includes a platform-independent native module -- so both of these projects are tied to Node and won't work in a browser.

numerizerJS

numerizerJS (GitHub: bolgovr / numerizerJS, License: MIT, npm: numerizer) by Roman Bolgov is a library for parsing English language string representations of numbers:

var numerizer = require('numerizer');  
numerizer('forty two'); // '42'  

It's currently very simple, and doesn't support browsers out of the box, but I like the fact the author has included Mocha tests. It'd work well alongside other libraries like Moment.js for providing intuitive text-based interfaces.

Obfuscate.js

Obfuscate.js (GitHub: miohtama / obfuscate.js, License: MIT) by Mikko Ohtamaa is a client-side script for replacing text on pages with nonsense that may be more desirable than private information. Mikko suggests this might be useful for making screenshots, so post-processing isn't required to blur out personal information. The obfuscate function takes an optional selector, so either the entire body of a document can be obfuscated, or just the contents of a given selector.

It walks through each child node looking for text nodes, so it's lightweight and doesn't have any dependencies. It also tries to make the text look similar (at a glance) to the original text.