@nyaomaru/divider 1.3.2 → 1.3.4

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.
@@ -12,10 +12,11 @@ function divider(input, ...args) {
12
12
  return ((0, is_1.isString)(input) ? [input] : input);
13
13
  }
14
14
  // Extract the options from the input
15
- const lastArg = args[args.length - 1];
16
- const options = (0, is_1.isOptions)(lastArg) ? (args.pop(), lastArg) : {};
15
+ const clonedArgs = [...args];
16
+ const lastArg = clonedArgs.at(-1);
17
+ const options = (0, is_1.isOptions)(lastArg) ? (clonedArgs.pop(), lastArg) : {};
17
18
  // Filter out only numbers and strings
18
- const { numSeparators, strSeparators } = args.reduce((acc, arg) => {
19
+ const { numSeparators, strSeparators } = clonedArgs.reduce((acc, arg) => {
19
20
  if ((0, is_1.isNumber)(arg)) {
20
21
  acc.numSeparators.push(arg);
21
22
  }
@@ -9,10 +9,11 @@ export function divider(input, ...args) {
9
9
  return (isString(input) ? [input] : input);
10
10
  }
11
11
  // Extract the options from the input
12
- const lastArg = args[args.length - 1];
13
- const options = isOptions(lastArg) ? (args.pop(), lastArg) : {};
12
+ const clonedArgs = [...args];
13
+ const lastArg = clonedArgs.at(-1);
14
+ const options = isOptions(lastArg) ? (clonedArgs.pop(), lastArg) : {};
14
15
  // Filter out only numbers and strings
15
- const { numSeparators, strSeparators } = args.reduce((acc, arg) => {
16
+ const { numSeparators, strSeparators } = clonedArgs.reduce((acc, arg) => {
16
17
  if (isNumber(arg)) {
17
18
  acc.numSeparators.push(arg);
18
19
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyaomaru/divider",
3
3
  "type": "module",
4
- "version": "1.3.2",
4
+ "version": "1.3.4",
5
5
  "description": "To divide string or string[] with a given separator",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",