1/*! 2 * Bootstrap config.js v5.2.3 (https://getbootstrap.com/) 3 * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 */ 6(function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./index'), require('../dom/manipulator')) : 8 typeof define === 'function' && define.amd ? define(['./index', '../dom/manipulator'], factory) : 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Index, global.Manipulator)); 10})(this, (function (index, Manipulator) { 'use strict'; 11 12 const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e }; 13 14 const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator); 15 16 /** 17 * -------------------------------------------------------------------------- 18 * Bootstrap (v5.2.3): util/config.js 19 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 20 * -------------------------------------------------------------------------- 21 */ 22 /** 23 * Class definition 24 */ 25 26 class Config { 27 // Getters 28 static get Default() { 29 return {}; 30 } 31 32 static get DefaultType() { 33 return {}; 34 } 35 36 static get NAME() { 37 throw new Error('You have to implement the static method "NAME", for each component!'); 38 } 39 40 _getConfig(config) { 41 config = this._mergeConfigObj(config); 42 config = this._configAfterMerge(config); 43 44 this._typeCheckConfig(config); 45 46 return config; 47 } 48 49 _configAfterMerge(config) { 50 return config; 51 } 52 53 _mergeConfigObj(config, element) { 54 const jsonConfig = index.isElement(element) ? Manipulator__default.default.getDataAttribute(element, 'config') : {}; // try to parse 55 56 return { ...this.constructor.Default, 57 ...(typeof jsonConfig === 'object' ? jsonConfig : {}), 58 ...(index.isElement(element) ? Manipulator__default.default.getDataAttributes(element) : {}), 59 ...(typeof config === 'object' ? config : {}) 60 }; 61 } 62 63 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 64 for (const property of Object.keys(configTypes)) { 65 const expectedTypes = configTypes[property]; 66 const value = config[property]; 67 const valueType = index.isElement(value) ? 'element' : index.toType(value); 68 69 if (!new RegExp(expectedTypes).test(valueType)) { 70 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 71 } 72 } 73 } 74 75 } 76 77 return Config; 78 79})); 80//# sourceMappingURL=config.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.