-*- markdown -*-
> King Arthur: One, two, five!
> Sir Galahad: Three sir!
> King Arthur: THREE!
> - Monty Python and the Holy Grail
While some of the best features of ES5 will never run in an ES3-only engine, it also adds some convenience methods which are perfectly possible to implement in current engines (or at least stub out in a tolerable way)
Load the `es5.js` file. The file should be compatible with the CommonJS module system. For non-CommonJS systems, this means it loads all symbols into the global variable `exports`. You'll probably want to follow the load with
var es5 = exports;
delete exports; // optional
To load everything call
- `constructorMethods`: methods on the constructor or class name, e.g. `Array.isArray`.
- `imperfectMethods`: methods on Object, which can allow most code using the new APIs to run without error, but can't really implement the enhanced object model.
- `prototypeMethods`: properties on the prototype, which will show up on for-in iterations, and so might not be desired.
Alternately, you can just cherry-pick methods, or even call them directly. Note that while the `es5.use` methods will not overwrite existing (presumably optimized) methods, such cherry-picking relies on your own discretion.
Array.prototype.forEach = es5.Array.prototype.forEach;
x = es5.Object.create();
This project does not include JSON support. json2.js is recommended as a specification-compatible implementation.
MIT Licence; see LICENSE.txt