@lowentry/utils 1.16.1 → 1.16.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowentry/utils",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/LeUtils.js CHANGED
@@ -1049,7 +1049,7 @@ export const LeUtils = {
1049
1049
  {
1050
1050
  const flattenToArrayRecursive = (result, elements, optionalSkipHasOwnPropertyCheck) =>
1051
1051
  {
1052
- if(!LeUtils.supportsEach(elements))
1052
+ if(!LeUtils.supportsEach(elements) || (typeof elements === 'string'))
1053
1053
  {
1054
1054
  result.push(elements);
1055
1055
  return;
@@ -1062,7 +1062,7 @@ export const LeUtils = {
1062
1062
 
1063
1063
  return (elements, optionalSkipHasOwnPropertyCheck = false) =>
1064
1064
  {
1065
- if(!LeUtils.supportsEach(elements))
1065
+ if(!LeUtils.supportsEach(elements) || (typeof elements === 'string'))
1066
1066
  {
1067
1067
  return [elements];
1068
1068
  }
@@ -4,6 +4,16 @@ import {LeUtils} from '../src/index.js';
4
4
  const wait = ms => LeUtils.promiseTimeout(ms ?? 100);
5
5
 
6
6
 
7
+ describe('LeUtils.flattenToArray crash tests', () =>
8
+ {
9
+ test('flattenToArray on strings', () =>
10
+ {
11
+ const res = LeUtils.flattenToArray('test123');
12
+ expect(res).toEqual(['test123']);
13
+ });
14
+ });
15
+
16
+
7
17
  describe('LeUtils.each()', () =>
8
18
  {
9
19
  test('array order', () =>