Lots of updates

This commit is contained in:
baldo 2016-05-16 13:33:49 +02:00
commit 39e7af6238
454 changed files with 221168 additions and 36622 deletions

View file

@ -1,12 +1,16 @@
#es5-shim <sup>[![Version Badge][2]][1]</sup>
#es5-shim <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
[![npm badge][9]][1]
[![npm badge][npm-badge-png]][npm-url]
[![Build Status][3]][4] [![dependency status][5]][6] [![dev dependency status][7]][8]
[![Build Status][travis-svg]][travis-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
`es5-shim.js` and `es5-shim.min.js` monkey-patch a JavaScript context to
contain all EcmaScript 5 methods that can be faithfully emulated with a
legacy JavaScript engine.
**Note:** As `es5-shim.js` is designed to patch the native Javascript
engine, it should be the library that is loaded first.
`es5-sham.js` and `es5-sham.min.js` monkey-patch other ES5 methods as
closely as possible. For these methods, as closely as possible to ES5
@ -14,12 +18,14 @@ is not very close. Many of these shams are intended only to allow code
to be written to ES5 without causing run-time errors in older engines.
In many cases, this means that these shams cause many ES5 methods to
silently fail. Decide carefully whether this is what you want.
**Note:** `es5-sham.js` requires `es5-shim.js` to be able to work properly.
## Tests
The tests are written with the Jasmine BDD test framework.
To run the tests, navigate to <root-folder>/tests/.
To run the tests, navigate to <root-folder>/tests/ , or,
simply `npm install` and `npm test`.
## Shims
@ -31,9 +37,13 @@ To run the tests, navigate to <root-folder>/tests/.
* Array.prototype.indexOf
* Array.prototype.lastIndexOf
* Array.prototype.map
* Array.prototype.slice
* Array.prototype.some
* Array.prototype.sort
* Array.prototype.reduce
* Array.prototype.reduceRight
* Array.prototype.push
* Array.prototype.join
* Array.isArray
* Date.now
* Date.prototype.toJSON
@ -44,14 +54,21 @@ To run the tests, navigate to <root-folder>/tests/.
* :warning: Caveat: bound functions don't have checks in ``call`` and
``apply`` to avoid executing as a constructor.
* Number.prototype.toFixed
* Number.prototype.toPrecision
* Object.keys
* String.prototype.split
* String.prototype.trim
* String.prototype.lastIndexOf
* String.prototype.replace
* Firefox (through v29) natively handles capturing groups incorrectly.
* Date.parse (for ISO parsing)
* Date.prototype.toISOString
* parseInt
* parseFloat
* Error.prototype.toString
* Error.prototype.name
* Error.prototype.message
* RegExp.prototype.toString
## Shams
@ -62,7 +79,7 @@ To run the tests, navigate to <root-folder>/tests/.
engines.
:warning: The second argument is passed to Object.defineProperties
which will probably fail either silently or with extreme predudice.
which will probably fail either silently or with extreme prejudice.
* :warning: Object.getPrototypeOf
@ -128,7 +145,7 @@ To run the tests, navigate to <root-folder>/tests/.
* :warning: Object.defineProperties
This uses the Object.defineProperty shim
This uses the Object.defineProperty shim.
* Object.seal
@ -151,13 +168,23 @@ To run the tests, navigate to <root-folder>/tests/.
provisions of this method, which you cannot possibly
obtain in legacy engines.
[1]: https://npmjs.org/package/es5-shim
[2]: http://vb.teelaun.ch/es-shims/es5-shim.svg
[3]: https://travis-ci.org/es-shims/es5-shim.png
[4]: https://travis-ci.org/es-shims/es5-shim
[5]: https://david-dm.org/es-shims/es5-shim.png
[6]: https://david-dm.org/es-shims/es5-shim
[7]: https://david-dm.org/es-shims/es5-shim/dev-status.png
[8]: https://david-dm.org/es-shims/es5-shim#info=devDependencies
[9]: https://nodei.co/npm/es5-shim.png?downloads=true&stars=true
### Example of applying ES compatability shims in a browser project
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-sham.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-sham.min.js"></script>
<script src="https://wzrd.in/standalone/es7-shim@latest"></script>
<script src="other-libs.js"></script>
```
[npm-url]: https://npmjs.org/package/es5-shim
[npm-version-svg]: http://versionbadg.es/es-shims/es5-shim.svg
[travis-svg]: https://travis-ci.org/es-shims/es5-shim.svg
[travis-url]: https://travis-ci.org/es-shims/es5-shim
[deps-svg]: https://david-dm.org/es-shims/es5-shim.svg
[deps-url]: https://david-dm.org/es-shims/es5-shim
[dev-deps-svg]: https://david-dm.org/es-shims/es5-shim/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/es5-shim#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/es5-shim.png?downloads=true&stars=true