@nyaomaru/divider 1.8.0 → 1.8.1

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
@@ -108,6 +108,9 @@ function divideString(input, numSeparators, strSeparators) {
108
108
  if (isEmptyArray(numSeparators) && isEmptyArray(strSeparators)) {
109
109
  return [input];
110
110
  }
111
+ if (!Array.isArray(numSeparators) || !numSeparators.every(isNumber)) {
112
+ throw new Error("Invalid numeric separators");
113
+ }
111
114
  const regex = getRegex(strSeparators);
112
115
  const sortedNumSeparators = sortAscending(numSeparators);
113
116
  const parts = sliceByIndexes(input, sortedNumSeparators);
package/dist/index.js CHANGED
@@ -78,6 +78,9 @@ function divideString(input, numSeparators, strSeparators) {
78
78
  if (isEmptyArray(numSeparators) && isEmptyArray(strSeparators)) {
79
79
  return [input];
80
80
  }
81
+ if (!Array.isArray(numSeparators) || !numSeparators.every(isNumber)) {
82
+ throw new Error("Invalid numeric separators");
83
+ }
81
84
  const regex = getRegex(strSeparators);
82
85
  const sortedNumSeparators = sortAscending(numSeparators);
83
86
  const parts = sliceByIndexes(input, sortedNumSeparators);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyaomaru/divider",
3
3
  "type": "module",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "description": "To divide string or string[] with a given separator",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",