@nyaomaru/divider 1.9.1 → 1.9.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 +4 -2
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -316,7 +316,7 @@ function dividerLast(input, ...args) {
|
|
|
316
316
|
return getLastElement(result, "");
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
// src/utils/
|
|
319
|
+
// src/utils/generate-indexes.ts
|
|
320
320
|
function generateIndexes(str, size, startOffset = 0) {
|
|
321
321
|
if (!isPositiveInteger(size)) {
|
|
322
322
|
console.warn("generateIndexes: size must be a positive integer");
|
|
@@ -329,7 +329,7 @@ function generateIndexes(str, size, startOffset = 0) {
|
|
|
329
329
|
return result;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
// src/
|
|
332
|
+
// src/utils/chunk.ts
|
|
333
333
|
var MIN_ALLOWED_CHUNKS = 0;
|
|
334
334
|
function shouldTruncateChunks(chunks, maxChunks) {
|
|
335
335
|
return isNumber(maxChunks) && maxChunks > MIN_ALLOWED_CHUNKS && maxChunks < chunks.length;
|
|
@@ -340,6 +340,8 @@ function truncateChunksToMax(chunks, maxChunks) {
|
|
|
340
340
|
const tail = chunks.slice(headCount).join("");
|
|
341
341
|
return [...head, tail];
|
|
342
342
|
}
|
|
343
|
+
|
|
344
|
+
// src/core/divider-loop.ts
|
|
343
345
|
function createChunksFromString(str, size, startOffset, maxChunks) {
|
|
344
346
|
const indexes = generateIndexes(str, size, startOffset);
|
|
345
347
|
const chunks = divider(str, ...indexes);
|
package/dist/index.js
CHANGED
|
@@ -283,7 +283,7 @@ function dividerLast(input, ...args) {
|
|
|
283
283
|
return getLastElement(result, "");
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
// src/utils/
|
|
286
|
+
// src/utils/generate-indexes.ts
|
|
287
287
|
function generateIndexes(str, size, startOffset = 0) {
|
|
288
288
|
if (!isPositiveInteger(size)) {
|
|
289
289
|
console.warn("generateIndexes: size must be a positive integer");
|
|
@@ -296,7 +296,7 @@ function generateIndexes(str, size, startOffset = 0) {
|
|
|
296
296
|
return result;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
// src/
|
|
299
|
+
// src/utils/chunk.ts
|
|
300
300
|
var MIN_ALLOWED_CHUNKS = 0;
|
|
301
301
|
function shouldTruncateChunks(chunks, maxChunks) {
|
|
302
302
|
return isNumber(maxChunks) && maxChunks > MIN_ALLOWED_CHUNKS && maxChunks < chunks.length;
|
|
@@ -307,6 +307,8 @@ function truncateChunksToMax(chunks, maxChunks) {
|
|
|
307
307
|
const tail = chunks.slice(headCount).join("");
|
|
308
308
|
return [...head, tail];
|
|
309
309
|
}
|
|
310
|
+
|
|
311
|
+
// src/core/divider-loop.ts
|
|
310
312
|
function createChunksFromString(str, size, startOffset, maxChunks) {
|
|
311
313
|
const indexes = generateIndexes(str, size, startOffset);
|
|
312
314
|
const chunks = divider(str, ...indexes);
|