Skip to content
es5 shims moved from bem-core
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.bem
common.blocks
common.bundles
spec.blocks
.bowerrc
.gitignore
.jscsrc
.jshint-groups.js
.travis.yml
CHANGELOG.md
README.md
bower.json
package.json

README.md

es5-shims

This module provides shim for some commonly used ES5 methods.

Array.prototype.indexOf
Array.prototype.forEach
Array.prototype.map
Array.prototype.filter
Array.prototype.reduce
Array.prototype.some
Array.prototype.every
Array.isArray

Date.now

Object.keys

JSON.stringify
JSON.parse

Function.prototype.bind

String.prototype.trim

Usage

You could use es5-shims as a standalone JS-library or as a BEM-library.

As standalone library

Add JS-file from Yandex CDN:

<script src="https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js"></script>

As BEM library

Add es5-shims to your project's bower.json config:

{
  "dependencies": {
    "es5-shims": "bem/es5-shims~0.0.2"
  }
}

Define shims that you need as your block's dependencies:

// prj/common.blocks/link/link.deps.js

({
    mustDeps : [
        {
            block : 'ecma',
            elem : [
                'array',
                'date',
                'function',
                'json',
                'object',
                'string'
            ]
        }
    ]
})

Don't forget to configure your build system, so it could find blocks from es5-shims/common.blocks.

You can’t perform that action at this time.