@anteros/core 0.0.6 → 0.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/func.ts +13 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anteros/core",
3
3
  "module": "index.ts",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "description": "Anteros Core",
7
7
  "private": false,
package/utils/func.ts CHANGED
@@ -465,11 +465,19 @@ async function generateRandom(options: GenerateRandomOptions, ctx: {
465
465
  result += charset[randomIndex];
466
466
  }
467
467
 
468
- // startWith/endWith sont ajoutés autour du random (length ne contrôle que la partie aléatoire)
469
- // Si c'est une fonction, elle reçoit la valeur aléatoire pour la personnaliser
470
- const start = typeof startWith === 'function' ? startWith(result) : startWith;
471
- const end = typeof endWith === 'function' ? endWith(result) : endWith;
472
- result = start + result + end;
468
+ // String → préfixe/suffixe classique. Fonction → elle reçoit la valeur
469
+ // et retourne le résultat final (pas de re-concaténation pour éviter la duplication).
470
+ if (typeof startWith === 'function') {
471
+ result = startWith(result);
472
+ } else {
473
+ result = startWith + result;
474
+ }
475
+
476
+ if (typeof endWith === 'function') {
477
+ result = endWith(result);
478
+ } else {
479
+ result = result + endWith;
480
+ }
473
481
 
474
482
  if (toLowerCase) {
475
483
  result = result.toLowerCase();