Disadvantages of .toStringing node.js server side functions

So, I first started .toString'ing a couple of validation functions, because that way I could use them both on the server side and the client side (awesome!). As I was just about to .toString() a function that is only used on the client side (but has to be send dynamically through ajax) I was re-evaluating this approach. For what it's worth it works splendidly in the current setup, but

  • Is .toString() an expensive function to run?
  • Are there any situations in V9 where .toString() will return something else than the source code?
  • Are there any other dangers I should take into account?

The only advantage in this case is that I can group certain related functions neatly together in a single class/file, but both in this case and the validation case it would also be possible to split it in a seperate .js file which I could require in node and serve to the client side directly for client use.

There is a huge disadvantage of using toString, you don't get any outer contexts of the function.

Something like this wouldn't work toStringed:

var validator = require('validator');

exports.validateEmail = function(email) {
    return validator.isEmail(email) && ~email.indexOf('mydomain');
};

Tools such as browserify can compile server side node to work on the client with a single file without having to do any extra work.