Acme.BookStore.HttpApi.Host/node_modules/es5-ext/README.md

(开头部分) 39KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

[![Build status][nix-build-image]][nix-build-url]
[![Windows status][win-build-image]][win-build-url]
![Transpilation status][transpilation-image]
[![npm version][npm-image]][npm-url]

# es5-ext

## ECMAScript 5 extensions

### (with respect to ECMAScript 6 standard)

Shims for upcoming ES6 standard and other goodies implemented strictly with ECMAScript conventions in mind.

It's designed to be used in compliant ECMAScript 5 or ECMAScript 6 environments. Older environments are not supported, although most of the features should work with correct ECMAScript 5 shim on board.

When used in ECMAScript 6 environment, native implementation (if valid) takes precedence over shims.

### Installation

    $ npm install es5-ext

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)

### Usage

#### ECMAScript 6 features

You can force ES6 features to be implemented in your environment, e.g. following will assign `from` function to `Array` (only if it's not implemented already).

```javascript
require("es5-ext/array/from/implement");
Array.from("foo"); // ['f', 'o', 'o']
```

You can also access shims directly, without fixing native objects. Following will return native `Array.from` if it's available and fallback to shim if it's not.

```javascript
var aFrom = require("es5-ext/array/from");
aFrom("foo"); // ['f', 'o', 'o']
```

If you want to use shim unconditionally (even if native implementation exists) do:

```javascript
var aFrom = require("es5-ext/array/from/shim");
aFrom("foo"); // ['f', 'o', 'o']
```

##### List of ES6 shims

It's about properties introduced with ES6 and those that have been updated in new spec.

-   `Array.from` -> `require('es5-ext/array/from')`
-   `Array.of` -> `require('es5-ext/array/of')`
-   `Array.prototype.concat` -> `require('es5-ext/array/#/concat')`
-   `Array.prototype.copyWithin` -> `require('es5-ext/array/#/copy-within')`
-   `Array.prototype.entries` -> `require('es5-ext/array/#/entries')`
-   `Array.prototype.fill` -> `require('es5-ext/array/#/fill')`
-   `Array.prototype.filter` -> `require('es5-ext/array/#/filter')`
-   `Array.prototype.find` -> `require('es5-ext/array/#/find')`
后面还有 969 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。