@nyaomaru/divider 1.3.5 → 1.3.6
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
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.divider = divider;
|
|
4
4
|
const parser_1 = require("@/core/parser");
|
|
5
5
|
const is_1 = require("@/utils/is");
|
|
6
|
+
const array_1 = require("@/utils/array");
|
|
6
7
|
function divider(input, ...args) {
|
|
7
8
|
if (!(0, is_1.isString)(input) && !Array.isArray(input)) {
|
|
8
9
|
console.warn("divider: 'input' must be a string or an array of strings. So returning an empty array.");
|
|
9
10
|
return [];
|
|
10
11
|
}
|
|
11
12
|
if ((0, is_1.isEmptyArray)(args)) {
|
|
12
|
-
return (
|
|
13
|
+
return (0, array_1.ensureArray)(input);
|
|
13
14
|
}
|
|
14
15
|
// Extract the options from the input
|
|
15
16
|
const clonedArgs = [...args];
|
package/dist/esm/core/divider.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { divideString } from '@/core/parser';
|
|
2
2
|
import { isString, isNumber, isOptions, isEmptyArray } from '@/utils/is';
|
|
3
|
+
import { ensureArray } from '@/utils/array';
|
|
3
4
|
export function divider(input, ...args) {
|
|
4
5
|
if (!isString(input) && !Array.isArray(input)) {
|
|
5
6
|
console.warn("divider: 'input' must be a string or an array of strings. So returning an empty array.");
|
|
6
7
|
return [];
|
|
7
8
|
}
|
|
8
9
|
if (isEmptyArray(args)) {
|
|
9
|
-
return (
|
|
10
|
+
return ensureArray(input);
|
|
10
11
|
}
|
|
11
12
|
// Extract the options from the input
|
|
12
13
|
const clonedArgs = [...args];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureArray<T>(input: T | T[]): T[];
|