@nyaomaru/divider 1.6.1 → 1.6.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/index.cjs +12 -14
- package/dist/index.js +12 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -105,7 +105,7 @@ function ensureArray(input) {
|
|
|
105
105
|
return Array.isArray(input) ? input : [input];
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
// src/utils/
|
|
108
|
+
// src/utils/option.ts
|
|
109
109
|
function extractOptions(args) {
|
|
110
110
|
const clonedArgs = [...args];
|
|
111
111
|
const lastArg = clonedArgs.at(-1);
|
|
@@ -118,6 +118,17 @@ function extractOptions(args) {
|
|
|
118
118
|
options
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
+
function applyDividerOptions(result, options) {
|
|
122
|
+
let output = result;
|
|
123
|
+
if (options.trim) {
|
|
124
|
+
const trim = (s) => s.trim();
|
|
125
|
+
output = isNestedStringArray(output) ? output.map((row) => row.map(trim).filter(Boolean)) : output.map(trim).filter(Boolean);
|
|
126
|
+
}
|
|
127
|
+
if (options.flatten) {
|
|
128
|
+
output = output.flat();
|
|
129
|
+
}
|
|
130
|
+
return output;
|
|
131
|
+
}
|
|
121
132
|
|
|
122
133
|
// src/utils/separator.ts
|
|
123
134
|
function classifySeparators(args) {
|
|
@@ -131,19 +142,6 @@ function classifySeparators(args) {
|
|
|
131
142
|
);
|
|
132
143
|
}
|
|
133
144
|
|
|
134
|
-
// src/utils/option.ts
|
|
135
|
-
function applyDividerOptions(result, options) {
|
|
136
|
-
let output = result;
|
|
137
|
-
if (options.trim) {
|
|
138
|
-
const trim = (s) => s.trim();
|
|
139
|
-
output = isNestedStringArray(output) ? output.map((row) => row.map(trim).filter(Boolean)) : output.map(trim).filter(Boolean);
|
|
140
|
-
}
|
|
141
|
-
if (options.flatten) {
|
|
142
|
-
output = output.flat();
|
|
143
|
-
}
|
|
144
|
-
return output;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
145
|
// src/core/divider.ts
|
|
148
146
|
function divider(input, ...args) {
|
|
149
147
|
if (!isValidInput(input)) {
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ function ensureArray(input) {
|
|
|
75
75
|
return Array.isArray(input) ? input : [input];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// src/utils/
|
|
78
|
+
// src/utils/option.ts
|
|
79
79
|
function extractOptions(args) {
|
|
80
80
|
const clonedArgs = [...args];
|
|
81
81
|
const lastArg = clonedArgs.at(-1);
|
|
@@ -88,6 +88,17 @@ function extractOptions(args) {
|
|
|
88
88
|
options
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
+
function applyDividerOptions(result, options) {
|
|
92
|
+
let output = result;
|
|
93
|
+
if (options.trim) {
|
|
94
|
+
const trim = (s) => s.trim();
|
|
95
|
+
output = isNestedStringArray(output) ? output.map((row) => row.map(trim).filter(Boolean)) : output.map(trim).filter(Boolean);
|
|
96
|
+
}
|
|
97
|
+
if (options.flatten) {
|
|
98
|
+
output = output.flat();
|
|
99
|
+
}
|
|
100
|
+
return output;
|
|
101
|
+
}
|
|
91
102
|
|
|
92
103
|
// src/utils/separator.ts
|
|
93
104
|
function classifySeparators(args) {
|
|
@@ -101,19 +112,6 @@ function classifySeparators(args) {
|
|
|
101
112
|
);
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
// src/utils/option.ts
|
|
105
|
-
function applyDividerOptions(result, options) {
|
|
106
|
-
let output = result;
|
|
107
|
-
if (options.trim) {
|
|
108
|
-
const trim = (s) => s.trim();
|
|
109
|
-
output = isNestedStringArray(output) ? output.map((row) => row.map(trim).filter(Boolean)) : output.map(trim).filter(Boolean);
|
|
110
|
-
}
|
|
111
|
-
if (options.flatten) {
|
|
112
|
-
output = output.flat();
|
|
113
|
-
}
|
|
114
|
-
return output;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
115
|
// src/core/divider.ts
|
|
118
116
|
function divider(input, ...args) {
|
|
119
117
|
if (!isValidInput(input)) {
|