@nyaomaru/divider 1.9.21 → 1.9.22

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/dist/index.cjs CHANGED
@@ -103,11 +103,10 @@ function isValidInput(value) {
103
103
  function isStringOrNumber(value) {
104
104
  return isString(value) || isNumber(value);
105
105
  }
106
- function isStringArray(value) {
107
- return Array.isArray(value) && value.every(isString);
108
- }
109
106
  function isNestedStringArray(value) {
110
- return Array.isArray(value) && value.length > 0 && Array.isArray(value[0]) && value[0].length > 0 && isStringArray(value[0]);
107
+ if (!Array.isArray(value) || value.length === 0) return false;
108
+ const firstRow = value[0];
109
+ return Array.isArray(firstRow) && firstRow.every((item) => isString(item));
111
110
  }
112
111
  function isWhitespaceOnly(value) {
113
112
  return value.trim() === "";
@@ -301,8 +300,8 @@ var applyTrimOption = (output, options, shouldPreserveEmpty) => {
301
300
  };
302
301
  var applyFlattenOption = (output, options) => options.flatten ? output.flat() : output;
303
302
  var applyExcludeOption = (output, options, shouldPreserveEmpty) => {
304
- if (isNoneMode(options.exclude)) return output;
305
- const exclude = options.exclude ?? DIVIDER_EXCLUDE_MODES.NONE;
303
+ if (options.exclude == null || isNoneMode(options.exclude)) return output;
304
+ const exclude = options.exclude;
306
305
  let shouldKeep = () => true;
307
306
  if (exclude in excludePredicateMap) {
308
307
  shouldKeep = excludePredicateMap[exclude];
package/dist/index.js CHANGED
@@ -69,11 +69,10 @@ function isValidInput(value) {
69
69
  function isStringOrNumber(value) {
70
70
  return isString(value) || isNumber(value);
71
71
  }
72
- function isStringArray(value) {
73
- return Array.isArray(value) && value.every(isString);
74
- }
75
72
  function isNestedStringArray(value) {
76
- return Array.isArray(value) && value.length > 0 && Array.isArray(value[0]) && value[0].length > 0 && isStringArray(value[0]);
73
+ if (!Array.isArray(value) || value.length === 0) return false;
74
+ const firstRow = value[0];
75
+ return Array.isArray(firstRow) && firstRow.every((item) => isString(item));
77
76
  }
78
77
  function isWhitespaceOnly(value) {
79
78
  return value.trim() === "";
@@ -267,8 +266,8 @@ var applyTrimOption = (output, options, shouldPreserveEmpty) => {
267
266
  };
268
267
  var applyFlattenOption = (output, options) => options.flatten ? output.flat() : output;
269
268
  var applyExcludeOption = (output, options, shouldPreserveEmpty) => {
270
- if (isNoneMode(options.exclude)) return output;
271
- const exclude = options.exclude ?? DIVIDER_EXCLUDE_MODES.NONE;
269
+ if (options.exclude == null || isNoneMode(options.exclude)) return output;
270
+ const exclude = options.exclude;
272
271
  let shouldKeep = () => true;
273
272
  if (exclude in excludePredicateMap) {
274
273
  shouldKeep = excludePredicateMap[exclude];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyaomaru/divider",
3
3
  "type": "module",
4
- "version": "1.9.21",
4
+ "version": "1.9.22",
5
5
  "description": "To divide string or string[] with a given separator",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",