Skip to content

拓展原生对象,提供ES5规范新增的部分功能。

Notifications You must be signed in to change notification settings

yu-cover/es5-safe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

es5-safe

es5-safe Fork from https://github.com/lifesinger/dew/tree/master/lib/es5-safe。

This module provides compatibility shims so that legacy JavaScript engines behave as closely as possible to ES5.


It provides the following methods:

Function.prototype.bind
Object.keys
Array.isArray
Array.prototype.forEach
Array.prototype.map
Array.prototype.filter
Array.prototype.every
Array.prototype.some
Array.prototype.reduce
Array.prototype.reduceRight
Array.prototype.indexOf
Array.prototype.lastIndexOf
String.prototype.trim
Date.now
Date.prototype.toLocaleString
Date.prototype.format

Please refer to MDN for detail usages.

Comparing to kriskowal/es5-shim module, this module only contains the safe parts of ES5 shims, and it is more robust and elegant for old browsers.

Test Cases

http://lifesinger.github.com/es5-safe/test/runner.html

Thanks to

  1. http://es5.github.com/
  2. http://kangax.github.com/es5-compat-table/
  3. https://github.com/kriskowal/es5-shim
  4. http://perfectionkills.com/extending-built-in-native-objects-evil-or-not/
  5. https://gist.github.com/1120592
  6. https://code.google.com/p/v8/

Copyright

es5-safe.js is released under the MIT license.

About

拓展原生对象,提供ES5规范新增的部分功能。

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%