Made it possible to use a function as a mock

I have made a small change to the code making it possible to use functions as mocks. This is useful when you for example use Sinon.JS and need to inject a spy in place of the actual implementation.

The problem with the original code is that Require.JS apparently automatically invokes functions. I have fixed this by wrapping the mock in a function that simply return the mock.

I also fixed a small bug where the mocks was added to the mocks array, even if the path was of type `object`.