es6-shim
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
ES6-shim is a powerful, ECMAScript 6 (Harmony) compatible tool designed to create seamless compatibility shims for legacy JavaScript engines. With ES6-shim, your JavaScript environment mimics as closely as possible to ECMAScript 6 (Harmony), allowing more progressive coding patterns and language features to be executed even on systems that may not natively support them. Notably, it caters to several functionalities such as Map
, Set
, Promise
, and various String
, Object
, Number
, Array
, RegExp
, Math
functions, and more.
To use ES6-shim, you have two main options:
For use in a browser, you need to include the es6-shim
before your scripts. If your browser doesn't support ECMAScript 5, you should also include es5-shim
before es6-shim
.
For node.js
, io.js
or any npm
-managed workflow, you just have to install it through the npm package manager with the command npm install es6-shim
.
For better String.prototype.normalize
support, it is recommended to install the unorm
package alongside es6-shim
.
Below is a basic usage code snippet:
require('es6-shim');
var assert = require('assert');
//Using startsWith and endsWith String methods
assert.equal(true, 'abc'.startsWith('a'));
assert.equal(false, 'abc'.endsWith('a'));
//Using Map, a replacement for `{}` key-value storage.
var map = new Map([['Bob', 42], ['Foo', 'bar']]);
map.set('John', 25);
map.set('Alice', 400);
map.set(['meh'], 555);
//... and so on
Consult the README of es6-shim
for a detailed usage guide.
For detailed documentation and support, visit the official GitHub repository git://github.com/paulmillr/es6-shim.git. The repository contains comprehensive information about what's provided by ES6-shim, and how to use it effectively. For a more detailed understanding of ECMAScript 6 spec shims, you can visit the HTML version of the final ECMAScript 6 spec here.