fent/randexp.js — Issue #1: Modifying RegExp prototype
Author: alexyoung
Created: 2011-12-23 10:23:24+00:00
State: open

Do you think it would be better if this library just returned a function?

var randexp = require('randexp');
randexp(/hello+ (world|to you)/); // hellooooooooooooooooooo world

Or:

var RandRegExp = require('randexp')
, rand = new RandRegExp(/hello+ (world|to you)/);

rand.gen();

I realise the API you've created using the getter on RegExp has a certain stylistic elegance, but most Node libraries don't work this way and people will get upset about modifying the built in prototype.