@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/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +2 -2
- package/tests/each.test.js +10 -0
package/package.json
CHANGED
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
|
}
|
package/tests/each.test.js
CHANGED
|
@@ -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', () =>
|