@nyaomaru/divider 1.0.8 → 1.0.9

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/cjs/index.js CHANGED
@@ -33,10 +33,9 @@ function divideString(input, numSeparators, strSeparators) {
33
33
  // Divide by number delimiters
34
34
  let parts = (0, slice_1.sliceByIndexes)(input, numSeparators);
35
35
  // Divide by string delimiters
36
- if (regex) {
37
- parts = parts.flatMap((part) => part.split(regex)).filter(Boolean);
38
- }
39
- return parts;
36
+ return regex
37
+ ? parts.flatMap((part) => part.split(regex)).filter(Boolean)
38
+ : parts;
40
39
  }
41
40
  function isOptions(arg) {
42
41
  return typeof arg === 'object' && arg !== null && 'flatten' in arg;
package/dist/esm/index.js CHANGED
@@ -30,10 +30,9 @@ function divideString(input, numSeparators, strSeparators) {
30
30
  // Divide by number delimiters
31
31
  let parts = sliceByIndexes(input, numSeparators);
32
32
  // Divide by string delimiters
33
- if (regex) {
34
- parts = parts.flatMap((part) => part.split(regex)).filter(Boolean);
35
- }
36
- return parts;
33
+ return regex
34
+ ? parts.flatMap((part) => part.split(regex)).filter(Boolean)
35
+ : parts;
37
36
  }
38
37
  function isOptions(arg) {
39
38
  return typeof arg === 'object' && arg !== null && 'flatten' in arg;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { DividerResult } from '@/utils/types';
2
2
  export declare function divider<T extends string | string[]>(input: string | string[], ...args: (number | string | {
3
3
  flatten?: boolean;
4
- })[]): DividerResult<T, boolean>;
4
+ })[]): DividerResult<T>;
@@ -1 +1 @@
1
- export type DividerResult<T extends string | string[], F extends boolean = false> = T extends string ? string[] : F extends true ? string[] : string[][];
1
+ export type DividerResult<T extends string | string[], F extends boolean = true> = T extends string ? string[] : F extends true ? string[] : string[][];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyaomaru/divider",
3
3
  "type": "module",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
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",
@@ -28,7 +28,7 @@
28
28
  "type": "git",
29
29
  "url": "git+https://github.com/nyaomaru/divider.git"
30
30
  },
31
- "homepage": "https://github.com/nyaomaru/divider.git",
31
+ "homepage": "https://divider-docs.vercel.app/",
32
32
  "author": "nyaomaru",
33
33
  "license": "MIT",
34
34
  "devDependencies": {