@descope/web-components-ui 1.0.266 → 1.0.267

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var merge = require('lodash.merge');
4
- var set = require('lodash.set');
5
4
  var Color = require('color');
6
5
 
7
6
  const DESCOPE_PREFIX = 'descope';
@@ -199,6 +198,19 @@ const componentsThemeManager = new ComponentsThemeManager();
199
198
 
200
199
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
201
200
 
201
+ // lodash.set alternative
202
+ const set = (obj, path, value) => {
203
+ const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
204
+
205
+ pathArray.reduce((acc, key, i) => {
206
+ if (acc[key] === undefined) acc[key] = {};
207
+ if (i === pathArray.length - 1) acc[key] = value;
208
+ return acc[key];
209
+ }, obj);
210
+
211
+ return obj;
212
+ };
213
+
202
214
  const transformTheme = (theme, path, getTransformation) => {
203
215
  return Object.entries(theme).reduce((acc, [key, val]) => {
204
216
  if (val?.constructor !== Object) {