JAVASCRIPT   8

configurator.js

Guest on 11th June 2021 03:29:36 AM

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

Raw Paste


Login or Register to edit or fork this paste. It's free.