1 | 'use strict';
|
2 | var hasOwn = require('./internals/has-own-property');
|
3 | var isArray = require('./internals/is-array');
|
4 | var isForced = require('./internals/is-forced');
|
5 | var shared = require('./internals/shared-store');
|
6 |
|
7 | var data = isForced.data;
|
8 | var normalize = isForced.normalize;
|
9 | var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR';
|
10 | var ASYNC_ITERATOR_PROTOTYPE = 'AsyncIteratorPrototype';
|
11 |
|
12 | var setAggressivenessLevel = function (object, constant) {
|
13 | if (isArray(object)) for (var i = 0; i < object.length; i++) data[normalize(object[i])] = constant;
|
14 | };
|
15 |
|
16 | module.exports = function (options) {
|
17 | if (typeof options == 'object') {
|
18 | setAggressivenessLevel(options.useNative, isForced.NATIVE);
|
19 | setAggressivenessLevel(options.usePolyfill, isForced.POLYFILL);
|
20 | setAggressivenessLevel(options.useFeatureDetection, null);
|
21 | if (hasOwn(options, USE_FUNCTION_CONSTRUCTOR)) {
|
22 | shared[USE_FUNCTION_CONSTRUCTOR] = !!options[USE_FUNCTION_CONSTRUCTOR];
|
23 | }
|
24 | if (hasOwn(options, ASYNC_ITERATOR_PROTOTYPE)) {
|
25 | shared[ASYNC_ITERATOR_PROTOTYPE] = options[ASYNC_ITERATOR_PROTOTYPE];
|
26 | }
|
27 | }
|
28 | };
|