That could be very interesting. We could modify the values returned by using conditionals and such. However, I don't think this provides much difference unless an API is also provided to allow access to data like the player type (then mega CPUs could be given units with higher stats), map size, scenario name (if any; would allow the same faction to work differently in a scenario), etc.
It would create a bit of overhead, though, as we'd have to run a JavaScript engine when loading everything in the beginning, which I imagine would be far slower than parsing a static file.