source: trip-planner-front/node_modules/core-js-compat/README.md@ 8d391a1

Last change on this file since 8d391a1 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 4.6 KB
Line 
1[`core-js-compat` package](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) contains data about the necessity of [`core-js`](https://github.com/zloirock/core-js) modules and API for getting a list of required core-js modules by browserslist query.
2
3```js
4const {
5 list, // array of required modules
6 targets, // object with targets for each module
7} = require('core-js-compat')({
8 targets: '> 2.5%', // browserslist query or object of minimum environment versions to support
9 filter: /^(es|web)\./, // optional filter - string-prefix, regexp or list of modules
10 version: '3.19', // used `core-js` version, by default - the latest
11});
12
13console.log(targets);
14/* =>
15{
16 'es.symbol.match-all': { ios: '12.2-12.4' },
17 'es.array.unscopables.flat': { ios: '12.2-12.4' },
18 'es.array.unscopables.flat-map': { ios: '12.2-12.4' },
19 'es.math.hypot': { chrome: '77' },
20 'es.promise.all-settled': { firefox: '69', ios: '12.2-12.4' },
21 'es.promise.finally': { ios: '12.2-12.4' },
22 'es.string.match-all': { chrome: '77', firefox: '69', ios: '12.2-12.4' },
23 'es.string.replace': { firefox: '69', ios: '12.2-12.4' },
24 'es.typed-array.float32-array': { ios: '12.2-12.4' },
25 'es.typed-array.float64-array': { ios: '12.2-12.4' },
26 'es.typed-array.int8-array': { ios: '12.2-12.4' },
27 'es.typed-array.int16-array': { ios: '12.2-12.4' },
28 'es.typed-array.int32-array': { ios: '12.2-12.4' },
29 'es.typed-array.uint8-array': { ios: '12.2-12.4' },
30 'es.typed-array.uint8-clamped-array': { ios: '12.2-12.4' },
31 'es.typed-array.uint16-array': { ios: '12.2-12.4' },
32 'es.typed-array.uint32-array': { ios: '12.2-12.4' },
33 'es.typed-array.from': { ios: '12.2-12.4' },
34 'es.typed-array.of': { ios: '12.2-12.4' },
35 'web.dom-collections.iterator': { ios: '12.2-12.4' },
36 'web.immediate': { chrome: '77', firefox: '69', ios: '12.2-12.4' },
37 'web.url': { ios: '12.2-12.4' },
38 'web.url.to-json': { ios: '12.2-12.4' },
39 'web.url-search-params': { ios: '12.2-12.4' }
40}
41*/
42```
43
44### `targets` option
45`targets` could be [a `browserslist` query](https://github.com/browserslist/browserslist) or a targets object that specifies minimum environment versions to support:
46```js
47// browserslist query:
48'defaults, not IE 11, maintained node versions'
49// object:
50{
51 android: '4.0', // Android WebView version
52 chrome: '38', // Chrome version
53 deno: '1.12', // Deno version
54 edge: '13', // Edge version
55 electron: '5.0', // Electron framework version
56 firefox: '15', // Firefox version
57 ie: '8', // Internet Explorer version
58 ios: '13.0', // iOS Safari version
59 node: 'current', // NodeJS version, you could use 'current' for set it to currently used
60 opera: '12', // Opera version
61 opera_mobile: '7', // Opera Mobile version
62 phantom: '1.9', // PhantomJS headless browser version
63 rhino: '1.7.13', // Rhino engine version
64 safari: '14.0', // Safari version
65 samsung: '14.0', // Samsung Internet version
66 esmodules: true, // That option set target to minimum supporting ES Modules versions of all browsers
67 browsers: '> 0.25%', // Browserslist query or object with target browsers
68}
69```
70
71### Additional API:
72
73```js
74// equals of of the method from the example above
75require('core-js-compat/compat')({ targets, filter, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
76// or
77require('core-js-compat').compat({ targets, filter, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
78
79// full compat data:
80require('core-js-compat/data'); // => { [ModuleName]: { [EngineName]: EngineVersion } }
81// or
82require('core-js-compat').data; // => { [ModuleName]: { [EngineName]: EngineVersion } }
83
84// map of modules by `core-js` entry points:
85require('core-js-compat/entries'); // => { [EntryPoint]: Array<ModuleName> }
86// or
87require('core-js-compat').entries; // => { [EntryPoint]: Array<ModuleName> }
88
89// full list of modules:
90require('core-js-compat/modules'); // => Array<ModuleName>
91// or
92require('core-js-compat').modules; // => Array<ModuleName>
93
94// the subset of modules which available in the passed `core-js` version:
95require('core-js-compat/get-modules-list-for-target-version')('3.19'); // => Array<ModuleName>
96// or
97require('core-js-compat').getModulesListForTargetVersion('3.19'); // => Array<ModuleName>
98```
99
100If you want to add new / update data about modules required for target engines, [follow this instruction](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data).
Note: See TracBrowser for help on using the repository browser.