@symbo.ls/scratch 2.11.360 → 2.11.373

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.
@@ -297,6 +297,7 @@ var require_array = __commonJS({
297
297
  createNestedObject: () => createNestedObject,
298
298
  cutArrayAfterValue: () => cutArrayAfterValue,
299
299
  cutArrayBeforeValue: () => cutArrayBeforeValue,
300
+ getFrequencyInArray: () => getFrequencyInArray,
300
301
  joinArrays: () => joinArrays,
301
302
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
302
303
  mergeArray: () => mergeArray,
@@ -311,6 +312,11 @@ var require_array = __commonJS({
311
312
  var arrayContainsOtherArray = (arr1, arr2) => {
312
313
  return arr2.every((val) => arr1.includes(val));
313
314
  };
315
+ var getFrequencyInArray = (arr, value) => {
316
+ return arr.reduce((count, currentValue) => {
317
+ return currentValue === value ? count + 1 : count;
318
+ }, 0);
319
+ };
314
320
  var removeFromArray = (arr, index) => {
315
321
  if ((0, import_types.isString)(index))
316
322
  index = parseInt(index);
@@ -377,7 +383,7 @@ var require_array = __commonJS({
377
383
  newArray.splice(index, 1);
378
384
  return newArray;
379
385
  }
380
- return arr.slice();
386
+ return arr;
381
387
  };
382
388
  var removeValueFromArrayAll = (arr, value) => {
383
389
  return arr.filter((item) => item !== value);
@@ -725,7 +731,7 @@ var require_object = __commonJS({
725
731
  continue;
726
732
  const objProp = obj[prop];
727
733
  if ((0, import_types.isString)(objProp)) {
728
- if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
734
+ if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
729
735
  try {
730
736
  const evalProp = import_globals.window.eval(`(${objProp})`);
731
737
  destringified[prop] = evalProp;
@@ -765,11 +771,11 @@ var require_object = __commonJS({
765
771
  }
766
772
  return destringified;
767
773
  };
768
- var stringToObject = (str, verbose) => {
774
+ var stringToObject = (str, opts = { verbose: true }) => {
769
775
  try {
770
776
  return import_globals.window.eval("(" + str + ")");
771
777
  } catch (e) {
772
- if (verbose)
778
+ if (opts.verbose)
773
779
  console.warn(e);
774
780
  }
775
781
  };