@nyaomaru/divider 2.0.15 → 2.0.16

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 CHANGED
@@ -355,6 +355,13 @@ function applyDividerOptions(result, options) {
355
355
  return output;
356
356
  }
357
357
 
358
+ // src/utils/transform-divider-input.ts
359
+ function transformDividerInput(input, transform, options) {
360
+ const result = isString(input) ? transform(input) : input.map(transform);
361
+ const resolvedOptions = options ?? {};
362
+ return applyDividerOptions(result, resolvedOptions);
363
+ }
364
+
358
365
  // src/utils/separator.ts
359
366
  function classifySeparators(args) {
360
367
  return args.reduce(
@@ -367,11 +374,15 @@ function classifySeparators(args) {
367
374
  );
368
375
  }
369
376
 
370
- // src/utils/transform-divider-input.ts
371
- function transformDividerInput(input, transform, options) {
372
- const result = isString(input) ? transform(input) : input.map(transform);
373
- const resolvedOptions = options ?? {};
374
- return applyDividerOptions(result, resolvedOptions);
377
+ // src/core/divider-plan.ts
378
+ function createDividerPlan(args) {
379
+ const { cleanedArgs, options } = extractOptions(args);
380
+ const { numSeparators, strSeparators } = classifySeparators(cleanedArgs);
381
+ return {
382
+ numSeparators,
383
+ strSeparators,
384
+ options
385
+ };
375
386
  }
376
387
 
377
388
  // src/core/divider.ts
@@ -385,8 +396,7 @@ function divider(input, ...args) {
385
396
  if (isEmptyArray(args)) {
386
397
  return ensureStringArray(input);
387
398
  }
388
- const { cleanedArgs, options } = extractOptions(args);
389
- const { numSeparators, strSeparators } = classifySeparators(cleanedArgs);
399
+ const { numSeparators, strSeparators, options } = createDividerPlan(args);
390
400
  const applyDivision = (str) => divideString(str, numSeparators, strSeparators, {
391
401
  preserveEmpty: options.preserveEmpty
392
402
  });
package/dist/index.js CHANGED
@@ -321,6 +321,13 @@ function applyDividerOptions(result, options) {
321
321
  return output;
322
322
  }
323
323
 
324
+ // src/utils/transform-divider-input.ts
325
+ function transformDividerInput(input, transform, options) {
326
+ const result = isString(input) ? transform(input) : input.map(transform);
327
+ const resolvedOptions = options ?? {};
328
+ return applyDividerOptions(result, resolvedOptions);
329
+ }
330
+
324
331
  // src/utils/separator.ts
325
332
  function classifySeparators(args) {
326
333
  return args.reduce(
@@ -333,11 +340,15 @@ function classifySeparators(args) {
333
340
  );
334
341
  }
335
342
 
336
- // src/utils/transform-divider-input.ts
337
- function transformDividerInput(input, transform, options) {
338
- const result = isString(input) ? transform(input) : input.map(transform);
339
- const resolvedOptions = options ?? {};
340
- return applyDividerOptions(result, resolvedOptions);
343
+ // src/core/divider-plan.ts
344
+ function createDividerPlan(args) {
345
+ const { cleanedArgs, options } = extractOptions(args);
346
+ const { numSeparators, strSeparators } = classifySeparators(cleanedArgs);
347
+ return {
348
+ numSeparators,
349
+ strSeparators,
350
+ options
351
+ };
341
352
  }
342
353
 
343
354
  // src/core/divider.ts
@@ -351,8 +362,7 @@ function divider(input, ...args) {
351
362
  if (isEmptyArray(args)) {
352
363
  return ensureStringArray(input);
353
364
  }
354
- const { cleanedArgs, options } = extractOptions(args);
355
- const { numSeparators, strSeparators } = classifySeparators(cleanedArgs);
365
+ const { numSeparators, strSeparators, options } = createDividerPlan(args);
356
366
  const applyDivision = (str) => divideString(str, numSeparators, strSeparators, {
357
367
  preserveEmpty: options.preserveEmpty
358
368
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyaomaru/divider",
3
3
  "type": "module",
4
- "version": "2.0.15",
4
+ "version": "2.0.16",
5
5
  "description": "To divide string or string[] with a given separator",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -64,6 +64,7 @@
64
64
  },
65
65
  "scripts": {
66
66
  "test": "jest",
67
+ "test:types": "tsc -p tests/tsconfig.json",
67
68
  "test:performance": "jest --config jest.performance.config.cjs",
68
69
  "test:unit": "jest --testPathIgnorePatterns=performance",
69
70
  "lint": "eslint .",