@nyaomaru/divider 1.2.0 → 1.2.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/dist/cjs/core/divider.js
CHANGED
|
@@ -8,7 +8,7 @@ function divider(input, ...args) {
|
|
|
8
8
|
console.warn("divider: 'input' must be a string or an array of strings. So returning an empty array.");
|
|
9
9
|
return [];
|
|
10
10
|
}
|
|
11
|
-
if (
|
|
11
|
+
if ((0, validator_1.isEmptyArray)(args)) {
|
|
12
12
|
return (typeof input === 'string' ? [input] : input);
|
|
13
13
|
}
|
|
14
14
|
// Extract the options from the input
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isOptions = isOptions;
|
|
4
|
+
exports.isEmptyArray = isEmptyArray;
|
|
4
5
|
function isOptions(arg) {
|
|
5
6
|
return typeof arg === 'object' && arg !== null && 'flatten' in arg;
|
|
6
7
|
}
|
|
8
|
+
function isEmptyArray(input) {
|
|
9
|
+
return input.length === 0;
|
|
10
|
+
}
|
package/dist/esm/core/divider.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { divideString } from '@/core/parser';
|
|
2
|
-
import { isOptions } from '@/core/validator';
|
|
2
|
+
import { isOptions, isEmptyArray } from '@/core/validator';
|
|
3
3
|
export function divider(input, ...args) {
|
|
4
4
|
if (typeof input !== 'string' && !Array.isArray(input)) {
|
|
5
5
|
console.warn("divider: 'input' must be a string or an array of strings. So returning an empty array.");
|
|
6
6
|
return [];
|
|
7
7
|
}
|
|
8
|
-
if (args
|
|
8
|
+
if (isEmptyArray(args)) {
|
|
9
9
|
return (typeof input === 'string' ? [input] : input);
|
|
10
10
|
}
|
|
11
11
|
// Extract the options from the input
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DividerArgs } from '@/core/types';
|
|
2
|
-
export declare function dividerLast<T extends string | string[], F extends boolean>(input: T, ...args: DividerArgs<F>): string;
|
|
2
|
+
export declare function dividerLast<T extends string | string[], F extends boolean = false>(input: T, ...args: DividerArgs<F>): string;
|