https://github.com/bem/es5-shims
es5 shims moved from bem-core
https://github.com/bem/es5-shims
Last synced: about 1 year ago
JSON representation
es5 shims moved from bem-core
- Host: GitHub
- URL: https://github.com/bem/es5-shims
- Owner: bem
- Created: 2014-01-28T18:04:32.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-11-09T12:43:24.000Z (over 10 years ago)
- Last Synced: 2025-02-14T19:54:07.859Z (over 1 year ago)
- Language: JavaScript
- Size: 261 KB
- Stars: 3
- Watchers: 18
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
es5-shims
=========
This module provides shim for some commonly used ES5 methods.
```js
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:
```html
```
### As BEM library
Add `es5-shims` to your project's `bower.json` config:
```json
{
"dependencies": {
"es5-shims": "bem/es5-shims~0.0.2"
}
}
```
Define shims that you need as your block's dependencies:
```js
// 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`.*