debian-mirror-gitlab/core-js/configurator.js

24 lines
1 KiB
JavaScript
Raw Normal View History

2019-10-31 01:37:42 +05:30
var has = require('./internals/has');
2019-09-25 13:30:05 +05:30
var isArray = require('./internals/is-array');
var isForced = require('./internals/is-forced');
2019-10-31 01:37:42 +05:30
var shared = require('./internals/shared-store');
2019-09-25 13:30:05 +05:30
var data = isForced.data;
var normalize = isForced.normalize;
2019-10-31 01:37:42 +05:30
var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR';
var ASYNC_ITERATOR_PROTOTYPE = 'AsyncIteratorPrototype';
2019-09-25 13:30:05 +05:30
var setAggressivenessLevel = function (object, constant) {
if (isArray(object)) for (var i = 0; i < object.length; i++) data[normalize(object[i])] = constant;
};
module.exports = function (options) {
if (typeof options == 'object') {
setAggressivenessLevel(options.useNative, isForced.NATIVE);
setAggressivenessLevel(options.usePolyfill, isForced.POLYFILL);
setAggressivenessLevel(options.useFeatureDetection, null);
2019-10-31 01:37:42 +05:30
if (has(options, USE_FUNCTION_CONSTRUCTOR)) shared[USE_FUNCTION_CONSTRUCTOR] = !!options[USE_FUNCTION_CONSTRUCTOR];
if (has(options, ASYNC_ITERATOR_PROTOTYPE)) shared[USE_FUNCTION_CONSTRUCTOR] = options[ASYNC_ITERATOR_PROTOTYPE];
2019-09-25 13:30:05 +05:30
}
};