Skip to content

Commit

Permalink
some improvements of README
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 4, 2017
1 parent eec836b commit 159a8ca
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![npm downloads](https://img.shields.io/npm/dm/core-js.svg)](http://npm-stat.com/charts.html?package=core-js&author=&from=2014-11-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev)
#### As advertising: the author is looking for a good job :)

Modular standard library for JavaScript. Includes polyfills for [ECMAScript 5, 2015, 2016, 2017](#ecmascript): [promises](#ecmascript-promise), [symbols](#ecmascript-symbol), [collections](#ecmascript-collections), iterators, [typed arrays](#ecmascript-typed-arrays), many other features, [ECMAScript proposals](#ecmascript-proposals), [setImmediate](#setimmediate), etc. You can require only needed features or use it without global namespace pollution.
Modular standard library for JavaScript. Includes polyfills for [ECMAScript 5, 2015, 2016, 2017](#ecmascript): [promises](#ecmascript-promise), [symbols](#ecmascript-symbol), [collections](#ecmascript-collections), iterators, [typed arrays](#ecmascript-typed-arrays), many other features, [ECMAScript proposals](#ecmascript-proposals), [some cross-platform WHATWG / W3C ECMAScript-related features and proposals](#web-standards) like [setImmediate](#setimmediate). You can load only required features or use it without global namespace pollution.

[*Example*](http://goo.gl/a2xexl):
```js
import 'core-js'; // <- at the top of your entry point

Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
'*'.repeat(10); // => '**********'
[1, [2, 3], [4, [5]]].flatten(2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
```

*You can get only required features*:
*You can load only required features*:
```js
import 'core-js/fn/array/from'; // <- at the top of your entry point
import 'core-js/fn/string/repeat'; // <- at the top of your entry point
import 'core-js/fn/array/flatten'; // <- at the top of your entry point
import 'core-js/fn/set'; // <- at the top of your entry point
import 'core-js/fn/promise'; // <- at the top of your entry point

Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
'*'.repeat(10); // => '**********'
[1, [2, 3], [4, [5]]].flatten(2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
```

*Or use it without global namespace pollution*:
```js
import from from 'core-js/library/fn/array/from';
import repeat from 'core-js/library/fn/string/repeat';
import flatten from 'core-js/library/fn/array/flatten';
import Set from 'core-js/library/fn/set';
import Promise from 'core-js/library/fn/promise';

from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
repeat('*', 10); // => '**********'
flatten([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32
```

Expand Down Expand Up @@ -116,9 +116,9 @@ Array(10)::fill(0).map((a, b) => b * b)::findIndex(it => it && !(it % 8)); // =>
### Custom build (from the command-line)
```
npm i core-js && cd node_modules/core-js && npm i
npm run grunt build:core.dict,es -- --blacklist=es.promise,es.math --library=on --path=custom uglify
npm run grunt build:es,web -- --blacklist=es.reflect,es.math --library=on --path=custom uglify
```
Where `core.dict` and `es` are modules (namespaces) names, which will be added to the build, `es.promise` and `es.math` are modules (namespaces) names, which will be excluded from the build, `--library=on` is flag for build without global namespace pollution and `custom` is target file name.
Where `es` and `web` are modules (namespaces) names, which will be added to the build, `es.reflect` and `es.math` are modules (namespaces) names, which will be excluded from the build, `--library=on` is flag for build without global namespace pollution and `custom` is target file name.

Available namespaces: for example, `es.array` contains [ES `Array` features](#ecmascript-array), `es` contains all modules whose names start with `es`.

Expand All @@ -128,10 +128,10 @@ Available namespaces: for example, `es.array` contains [ES `Array` features](#ec

```js
require('core-js-builder')({
modules: ['es', 'core.dict'], // modules / namespaces
blacklist: ['es.reflect'], // blacklist of modules / namespaces, by default - empty list
library: false, // flag for build without global namespace pollution, by default - false
umd: true // use UMD wrapper for export `core` object, by default - true
modules: ['es', 'web'], // modules / namespaces
blacklist: ['es.reflect'], // blacklist of modules / namespaces, by default - empty list
library: false, // flag for build without global namespace pollution, by default - false
umd: true // use UMD wrapper for export `core` object, by default - true
}).then(code => {
// ...
}).catch(error => {
Expand Down

0 comments on commit 159a8ca

Please sign in to comment.