UNPKG

1.11 kBJavaScriptView Raw
1'use strict';
2var hasOwn = require('./internals/has-own-property');
3var isArray = require('./internals/is-array');
4var isForced = require('./internals/is-forced');
5var shared = require('./internals/shared-store');
6
7var data = isForced.data;
8var normalize = isForced.normalize;
9var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR';
10var ASYNC_ITERATOR_PROTOTYPE = 'AsyncIteratorPrototype';
11
12var setAggressivenessLevel = function (object, constant) {
13 if (isArray(object)) for (var i = 0; i < object.length; i++) data[normalize(object[i])] = constant;
14};
15
16module.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};