@aidc-toolkit/utility 0.9.5 → 0.9.6-beta

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
@@ -699,28 +699,14 @@ var Transformer = class _Transformer {
699
699
  }));
700
700
  }
701
701
  }
702
- /**
703
- * Transform a value or values forward.
704
- *
705
- * @template T
706
- * Type returned by transformation callback.
707
- *
708
- * @param valueOrValues
709
- * Value(s).
710
- *
711
- * @param transformationCallback
712
- * Called after value(s) is/are transformed to convert it/them to its/their final value(s).
713
- *
714
- * @returns
715
- * Value(s) transformed into object(s).
716
- */
717
- forward(valueOrValues, transformationCallback) {
702
+ // eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
703
+ forward(valueOrValues, transformerCallback) {
718
704
  let result;
719
705
  if (typeof valueOrValues !== "object") {
720
706
  const valueN = BigInt(valueOrValues);
721
707
  this.validate(valueN);
722
708
  const transformedValue = this.doForward(valueN);
723
- result = transformationCallback === void 0 ? transformedValue : transformationCallback(transformedValue, 0);
709
+ result = transformerCallback === void 0 ? transformedValue : transformerCallback(transformedValue, 0);
724
710
  } else if (valueOrValues instanceof Sequencer) {
725
711
  if (valueOrValues.minValue < 0n) {
726
712
  throw new RangeError(i18n_default.t("Transformer.minValueMustBeGreaterThanOrEqualToZero", {
@@ -735,16 +721,16 @@ var Transformer = class _Transformer {
735
721
  domain: this.domain
736
722
  }));
737
723
  }
738
- result = transformationCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => this.doForward(value)) : IteratorProxy.from(valueOrValues).map((value, index) => transformationCallback(this.doForward(value), index));
724
+ result = transformerCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => this.doForward(value)) : IteratorProxy.from(valueOrValues).map((value, index) => transformerCallback(this.doForward(value), index));
739
725
  } else {
740
- result = transformationCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => {
726
+ result = transformerCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => {
741
727
  const valueN = BigInt(value);
742
728
  this.validate(valueN);
743
729
  return this.doForward(valueN);
744
730
  }) : IteratorProxy.from(valueOrValues).map((value, index) => {
745
731
  const valueN = BigInt(value);
746
732
  this.validate(valueN);
747
- return transformationCallback(this.doForward(valueN), index);
733
+ return transformerCallback(this.doForward(valueN), index);
748
734
  });
749
735
  }
750
736
  return result;
@@ -1426,17 +1412,21 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1426
1412
  exclusionDomains[1 /* FirstZero */] = exclusionFirstZeroDomains;
1427
1413
  }
1428
1414
  if (exclusionSupport.includes(2 /* AllNumeric */)) {
1415
+ let validateNumberIndexes2 = function(numberIndexes2) {
1416
+ let expectedNumberIndex = numberIndexes2[0];
1417
+ for (const numberIndex of numberIndexes2) {
1418
+ if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
1419
+ throw new RangeError(i18n_default.t("CharacterSetValidator.allNumericAllNumericCharacters", {
1420
+ ns: utilityNS
1421
+ }));
1422
+ }
1423
+ expectedNumberIndex = numberIndex + 1;
1424
+ }
1425
+ };
1426
+ var validateNumberIndexes = validateNumberIndexes2;
1429
1427
  const exclusionAllNumericDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1430
1428
  const numberIndexes = this.characterIndexes("0123456789");
1431
- let expectedNumberIndex = numberIndexes[0];
1432
- for (const numberIndex of numberIndexes) {
1433
- if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
1434
- throw new RangeError(i18n_default.t("CharacterSetValidator.allNumericAllNumericCharacters", {
1435
- ns: utilityNS
1436
- }));
1437
- }
1438
- expectedNumberIndex = numberIndex + 1;
1439
- }
1429
+ validateNumberIndexes2(numberIndexes);
1440
1430
  const zeroIndex = BigInt(numberIndexes[0]);
1441
1431
  const allZerosValues = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1442
1432
  let allZerosValue = 0n;
@@ -1523,8 +1513,30 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1523
1513
  }));
1524
1514
  }
1525
1515
  }
1526
- // eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
1527
- create(length, valueOrValues, exclusion = 0 /* None */, tweak, creationCallback) {
1516
+ /**
1517
+ * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
1518
+ * string.
1519
+ *
1520
+ * @param length
1521
+ * Required string length.
1522
+ *
1523
+ * @param valueOrValues
1524
+ * Numeric value(s) of the string(s).
1525
+ *
1526
+ * @param exclusion
1527
+ * String(s) to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
1528
+ *
1529
+ * @param tweak
1530
+ * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
1531
+ * encryption transformer}.
1532
+ *
1533
+ * @param creatorCallback
1534
+ * If provided, called after each string is constructed to create the final value.
1535
+ *
1536
+ * @returns
1537
+ * String(s) created from the value(s).
1538
+ */
1539
+ create(length, valueOrValues, exclusion = 0 /* None */, tweak, creatorCallback) {
1528
1540
  this.validateLength(length);
1529
1541
  this.validateExclusion(exclusion);
1530
1542
  const allZerosValue = exclusion === 2 /* AllNumeric */ ? this._allZerosValues[length] : 0n;
@@ -1543,7 +1555,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1543
1555
  }
1544
1556
  s = this.character(exclusion === 1 /* FirstZero */ ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
1545
1557
  }
1546
- return creationCallback !== void 0 ? creationCallback(s, index) : s;
1558
+ return creatorCallback !== void 0 ? creatorCallback(s, index) : s;
1547
1559
  });
1548
1560
  }
1549
1561
  /**
package/dist/index.d.cts CHANGED
@@ -1,8 +1,51 @@
1
+ /**
2
+ * Transformer input, one of:
3
+ *
4
+ * - T (primitive type)
5
+ * - Iterable<T>
6
+ *
7
+ * @template T
8
+ * Primitive type.
9
+ */
10
+ type TransformerInput<T extends string | number | bigint | boolean> = T | Iterable<T>;
11
+ /**
12
+ * Transformer callback, used to convert transformed value to its final value.
13
+ *
14
+ * @template TInput
15
+ * Type of input to callback.
16
+ *
17
+ * @template TOutput
18
+ * Type of output to callback.
19
+ *
20
+ * @param input
21
+ * Input value.
22
+ *
23
+ * @param index
24
+ * Index in sequence (0 for single transformation).
25
+ *
26
+ * @returns
27
+ * Output value.
28
+ */
29
+ type TransformerCallback<TInput, TOutput> = (input: TInput, index: number) => TOutput;
30
+ /**
31
+ * Transformer output, based on transformer input:
32
+ *
33
+ * - If type T is primitive type, result is type U.
34
+ * - If type T is Iterable type, result is type IterableIterator<U>.
35
+ *
36
+ * @template T
37
+ * Transformer input type.
38
+ *
39
+ * @template U
40
+ * Output base type.
41
+ */
42
+ type TransformerOutput<T extends TransformerInput<string | number | bigint | boolean>, U> = T extends (T extends TransformerInput<infer V> ? V : never) ? U : IterableIterator<U>;
43
+
1
44
  /**
2
45
  * Iterator proxy. In environments where
3
46
  * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers |
4
- * iterator helpers} are supported, this references the {@link Iterator} variable directly. Otherwise, it references an
5
- * implementation of "from" that uses an internally-defined iterator proxy object.
47
+ * iterator helpers} are supported, this references the {@linkcode Iterator} variable directly. Otherwise, it references
48
+ * an implementation of "from" that uses an internally-defined iterator proxy object.
6
49
  *
7
50
  * Client applications should **not** rely on long-term availability of this variable as it will be removed once there
8
51
  * is widespread support for iterator helpers.
@@ -92,22 +135,6 @@ declare class Sequencer implements Iterable<bigint>, IterableIterator<bigint> {
92
135
  reset(): void;
93
136
  }
94
137
 
95
- /**
96
- * Transformation callback, used to convert transformed value to its final value.
97
- *
98
- * @template T
99
- * Type returned by callback.
100
- *
101
- * @param transformedValue
102
- * Transformed value.
103
- *
104
- * @param index
105
- * Index in sequence transformation (0 for single transformation).
106
- *
107
- * @returns
108
- * Final value.
109
- */
110
- type TransformationCallback<T> = (transformedValue: bigint, index: number) => T;
111
138
  /**
112
139
  * Transformer that transforms values in a numeric domain to values in a range equal to the domain or to another range
113
140
  * defined by a callback function. In other words, the domain determines valid input values and, without a callback, the
@@ -179,81 +206,39 @@ declare abstract class Transformer {
179
206
  */
180
207
  protected abstract doForward(value: bigint): bigint;
181
208
  /**
182
- * Transform a value forward.
183
- *
184
- * @param value
185
- * Value.
186
- *
187
- * @returns
188
- * Transformed value.
189
- */
190
- forward(value: number | bigint): bigint;
191
- /**
192
- * Transform a value forward.
193
- *
194
- * @template T
195
- * Type returned by transformation callback.
196
- *
197
- * @param value
198
- * Value.
199
- *
200
- * @param transformationCallback
201
- * Called after the value is transformed to convert it to its final value.
202
- *
203
- * @returns
204
- * Value transformed into object.
205
- */
206
- forward<T>(value: number | bigint, transformationCallback: TransformationCallback<T>): T;
207
- /**
208
- * Transform values forward.
209
- *
210
- * @param values
211
- * Values. If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
212
- * transformation. Otherwise, the individual values are validated at the time of transformation.
213
- *
214
- * @returns
215
- * Transformed values.
216
- */
217
- forward(values: Iterable<number | bigint>): IterableIterator<bigint>;
218
- /**
219
- * Transform values forward.
209
+ * Transform value(s) forward.
220
210
  *
221
211
  * @template T
222
- * Type returned by transformation callback.
223
- *
224
- * @param values
225
- * Values. If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
226
- * transformation. Otherwise, the individual values are validated at the time of transformation.
227
- *
228
- * @param transformationCallback
229
- * Called after each value is transformed to convert it to its final value.
230
- *
231
- * @returns
232
- * Values transformed into objects.
233
- */
234
- forward<T>(values: Iterable<number | bigint>, transformationCallback: TransformationCallback<T>): IterableIterator<T>;
235
- /**
236
- * Transform a value or values forward. This signature exists to allow similar overloaded methods in other classes
237
- * to call this method correctly.
212
+ * Value(s) input type.
238
213
  *
239
214
  * @param valueOrValues
215
+ * Value(s). If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
216
+ * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
240
217
  *
241
218
  * @returns
219
+ * Transformed value(s).
242
220
  */
243
- forward(valueOrValues: number | bigint | Iterable<number | bigint>): bigint | IterableIterator<bigint>;
221
+ forward<T extends TransformerInput<number | bigint>>(valueOrValues: T): TransformerOutput<T, bigint>;
244
222
  /**
245
- * Transform a value or values forward. This signature exists to allow similar overloaded methods in other classes
246
- * to call this method correctly.
223
+ * Transform value(s) forward, optionally applying a transformation.
247
224
  *
248
225
  * @template T
226
+ * Value(s) input type.
227
+ *
228
+ * @template U
229
+ * Transformation callback output type.
249
230
  *
250
231
  * @param valueOrValues
232
+ * Value(s). If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
233
+ * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
251
234
  *
252
- * @param transformationCallback
235
+ * @param transformerCallback
236
+ * Called after each value is transformed to convert it to its final value.
253
237
  *
254
238
  * @returns
239
+ * Transformed value(s).
255
240
  */
256
- forward<T>(valueOrValues: number | bigint | Iterable<number | bigint>, transformationCallback: TransformationCallback<T>): T | IterableIterator<T>;
241
+ forward<T extends TransformerInput<number | bigint>, U>(valueOrValues: T, transformerCallback: TransformerCallback<bigint, U>): TransformerOutput<T, U>;
257
242
  /**
258
243
  * Do the work of transforming a value in reverse.
259
244
  *
@@ -699,19 +684,6 @@ declare class CharacterSetValidator implements StringValidator<CharacterSetValid
699
684
  */
700
685
  validate(s: string, validation?: CharacterSetValidation): void;
701
686
  }
702
- /**
703
- * Creation callback, used to convert created string to its final value.
704
- *
705
- * @param s
706
- * Created string.
707
- *
708
- * @param index
709
- * Index in sequence creation (0 for single creation).
710
- *
711
- * @returns
712
- * Final value.
713
- */
714
- type CreationCallback = (s: string, index: number) => string;
715
687
  /**
716
688
  * Character set creator. Maps numeric values to strings using the character set as digits.
717
689
  */
@@ -805,70 +777,29 @@ declare class CharacterSetCreator extends CharacterSetValidator {
805
777
  */
806
778
  private validateLength;
807
779
  /**
808
- * Create a string by mapping a value to the equivalent characters in the character set across the length of the
780
+ * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
809
781
  * string.
810
782
  *
811
783
  * @param length
812
784
  * Required string length.
813
785
  *
814
- * @param value
815
- * Numeric value of the string.
816
- *
817
- * @param exclusion
818
- * Strings to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
819
- *
820
- * @param tweak
821
- * If provided, the numerical value of the string is "tweaked" using an {@link EncryptionTransformer | encryption
822
- * transformer}.
823
- *
824
- * @param creationCallback
825
- * If provided, called after the string is constructed to create the final value.
826
- *
827
- * @returns
828
- * String created from the value.
829
- */
830
- create(length: number, value: number | bigint, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): string;
831
- /**
832
- * Create multiple strings by mapping each value to the equivalent characters in the character set across the length
833
- * of the string. Equivalent to calling this method for each individual value.
834
- *
835
- * @param length
836
- * Required string length.
837
- *
838
- * @param values
839
- * Numeric values of the strings.
840
- *
841
- * @param exclusion
842
- * Strings to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
843
- *
844
- * @param tweak
845
- * If provided, the numerical value of the strings are "tweaked" using an {@link EncryptionTransformer | encryption
846
- * transformer}.
847
- *
848
- * @param creationCallback
849
- * If provided, called after each string is constructed to create the final value.
850
- *
851
- * @returns
852
- * Iterable iterator over strings created from the values.
853
- */
854
- create(length: number, values: Iterable<number | bigint>, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): IterableIterator<string>;
855
- /**
856
- * Create a string or multiple strings. This signature exists to allow similar overloaded methods in other classes
857
- * to call this method correctly.
858
- *
859
- * @param length
860
- *
861
786
  * @param valueOrValues
787
+ * Numeric value(s) of the string(s).
862
788
  *
863
789
  * @param exclusion
790
+ * String(s) to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
864
791
  *
865
792
  * @param tweak
793
+ * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
794
+ * encryption transformer}.
866
795
  *
867
- * @param creationCallback
796
+ * @param creatorCallback
797
+ * If provided, called after each string is constructed to create the final value.
868
798
  *
869
799
  * @returns
800
+ * String(s) created from the value(s).
870
801
  */
871
- create(length: number, valueOrValues: number | bigint | Iterable<number | bigint>, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): string | IterableIterator<string>;
802
+ create<T extends TransformerInput<number | bigint>>(length: number, valueOrValues: T, exclusion?: Exclusion, tweak?: number | bigint, creatorCallback?: TransformerCallback<string, string>): TransformerOutput<T, string>;
872
803
  /**
873
804
  * Determine the value for a string.
874
805
  *
@@ -906,4 +837,4 @@ declare const ALPHABETIC_CREATOR: CharacterSetCreator;
906
837
  */
907
838
  declare const ALPHANUMERIC_CREATOR: CharacterSetCreator;
908
839
 
909
- export { ALPHABETIC_CREATOR, ALPHANUMERIC_CREATOR, CharacterSetCreator, type CharacterSetValidation, CharacterSetValidator, type CreationCallback, EncryptionTransformer, Exclusion, HEXADECIMAL_CREATOR, IdentityTransformer, IteratorProxy, NUMERIC_CREATOR, RecordValidator, RegExpValidator, Sequencer, type StringValidation, type StringValidator, type TransformationCallback, Transformer };
840
+ export { ALPHABETIC_CREATOR, ALPHANUMERIC_CREATOR, CharacterSetCreator, type CharacterSetValidation, CharacterSetValidator, EncryptionTransformer, Exclusion, HEXADECIMAL_CREATOR, IdentityTransformer, IteratorProxy, NUMERIC_CREATOR, RecordValidator, RegExpValidator, Sequencer, type StringValidation, type StringValidator, Transformer, type TransformerCallback, type TransformerInput, type TransformerOutput };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,51 @@
1
+ /**
2
+ * Transformer input, one of:
3
+ *
4
+ * - T (primitive type)
5
+ * - Iterable<T>
6
+ *
7
+ * @template T
8
+ * Primitive type.
9
+ */
10
+ type TransformerInput<T extends string | number | bigint | boolean> = T | Iterable<T>;
11
+ /**
12
+ * Transformer callback, used to convert transformed value to its final value.
13
+ *
14
+ * @template TInput
15
+ * Type of input to callback.
16
+ *
17
+ * @template TOutput
18
+ * Type of output to callback.
19
+ *
20
+ * @param input
21
+ * Input value.
22
+ *
23
+ * @param index
24
+ * Index in sequence (0 for single transformation).
25
+ *
26
+ * @returns
27
+ * Output value.
28
+ */
29
+ type TransformerCallback<TInput, TOutput> = (input: TInput, index: number) => TOutput;
30
+ /**
31
+ * Transformer output, based on transformer input:
32
+ *
33
+ * - If type T is primitive type, result is type U.
34
+ * - If type T is Iterable type, result is type IterableIterator<U>.
35
+ *
36
+ * @template T
37
+ * Transformer input type.
38
+ *
39
+ * @template U
40
+ * Output base type.
41
+ */
42
+ type TransformerOutput<T extends TransformerInput<string | number | bigint | boolean>, U> = T extends (T extends TransformerInput<infer V> ? V : never) ? U : IterableIterator<U>;
43
+
1
44
  /**
2
45
  * Iterator proxy. In environments where
3
46
  * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers |
4
- * iterator helpers} are supported, this references the {@link Iterator} variable directly. Otherwise, it references an
5
- * implementation of "from" that uses an internally-defined iterator proxy object.
47
+ * iterator helpers} are supported, this references the {@linkcode Iterator} variable directly. Otherwise, it references
48
+ * an implementation of "from" that uses an internally-defined iterator proxy object.
6
49
  *
7
50
  * Client applications should **not** rely on long-term availability of this variable as it will be removed once there
8
51
  * is widespread support for iterator helpers.
@@ -92,22 +135,6 @@ declare class Sequencer implements Iterable<bigint>, IterableIterator<bigint> {
92
135
  reset(): void;
93
136
  }
94
137
 
95
- /**
96
- * Transformation callback, used to convert transformed value to its final value.
97
- *
98
- * @template T
99
- * Type returned by callback.
100
- *
101
- * @param transformedValue
102
- * Transformed value.
103
- *
104
- * @param index
105
- * Index in sequence transformation (0 for single transformation).
106
- *
107
- * @returns
108
- * Final value.
109
- */
110
- type TransformationCallback<T> = (transformedValue: bigint, index: number) => T;
111
138
  /**
112
139
  * Transformer that transforms values in a numeric domain to values in a range equal to the domain or to another range
113
140
  * defined by a callback function. In other words, the domain determines valid input values and, without a callback, the
@@ -179,81 +206,39 @@ declare abstract class Transformer {
179
206
  */
180
207
  protected abstract doForward(value: bigint): bigint;
181
208
  /**
182
- * Transform a value forward.
183
- *
184
- * @param value
185
- * Value.
186
- *
187
- * @returns
188
- * Transformed value.
189
- */
190
- forward(value: number | bigint): bigint;
191
- /**
192
- * Transform a value forward.
193
- *
194
- * @template T
195
- * Type returned by transformation callback.
196
- *
197
- * @param value
198
- * Value.
199
- *
200
- * @param transformationCallback
201
- * Called after the value is transformed to convert it to its final value.
202
- *
203
- * @returns
204
- * Value transformed into object.
205
- */
206
- forward<T>(value: number | bigint, transformationCallback: TransformationCallback<T>): T;
207
- /**
208
- * Transform values forward.
209
- *
210
- * @param values
211
- * Values. If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
212
- * transformation. Otherwise, the individual values are validated at the time of transformation.
213
- *
214
- * @returns
215
- * Transformed values.
216
- */
217
- forward(values: Iterable<number | bigint>): IterableIterator<bigint>;
218
- /**
219
- * Transform values forward.
209
+ * Transform value(s) forward.
220
210
  *
221
211
  * @template T
222
- * Type returned by transformation callback.
223
- *
224
- * @param values
225
- * Values. If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
226
- * transformation. Otherwise, the individual values are validated at the time of transformation.
227
- *
228
- * @param transformationCallback
229
- * Called after each value is transformed to convert it to its final value.
230
- *
231
- * @returns
232
- * Values transformed into objects.
233
- */
234
- forward<T>(values: Iterable<number | bigint>, transformationCallback: TransformationCallback<T>): IterableIterator<T>;
235
- /**
236
- * Transform a value or values forward. This signature exists to allow similar overloaded methods in other classes
237
- * to call this method correctly.
212
+ * Value(s) input type.
238
213
  *
239
214
  * @param valueOrValues
215
+ * Value(s). If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
216
+ * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
240
217
  *
241
218
  * @returns
219
+ * Transformed value(s).
242
220
  */
243
- forward(valueOrValues: number | bigint | Iterable<number | bigint>): bigint | IterableIterator<bigint>;
221
+ forward<T extends TransformerInput<number | bigint>>(valueOrValues: T): TransformerOutput<T, bigint>;
244
222
  /**
245
- * Transform a value or values forward. This signature exists to allow similar overloaded methods in other classes
246
- * to call this method correctly.
223
+ * Transform value(s) forward, optionally applying a transformation.
247
224
  *
248
225
  * @template T
226
+ * Value(s) input type.
227
+ *
228
+ * @template U
229
+ * Transformation callback output type.
249
230
  *
250
231
  * @param valueOrValues
232
+ * Value(s). If this is an instance of {@link Sequencer}, the minimum and maximum values are validated prior to
233
+ * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
251
234
  *
252
- * @param transformationCallback
235
+ * @param transformerCallback
236
+ * Called after each value is transformed to convert it to its final value.
253
237
  *
254
238
  * @returns
239
+ * Transformed value(s).
255
240
  */
256
- forward<T>(valueOrValues: number | bigint | Iterable<number | bigint>, transformationCallback: TransformationCallback<T>): T | IterableIterator<T>;
241
+ forward<T extends TransformerInput<number | bigint>, U>(valueOrValues: T, transformerCallback: TransformerCallback<bigint, U>): TransformerOutput<T, U>;
257
242
  /**
258
243
  * Do the work of transforming a value in reverse.
259
244
  *
@@ -699,19 +684,6 @@ declare class CharacterSetValidator implements StringValidator<CharacterSetValid
699
684
  */
700
685
  validate(s: string, validation?: CharacterSetValidation): void;
701
686
  }
702
- /**
703
- * Creation callback, used to convert created string to its final value.
704
- *
705
- * @param s
706
- * Created string.
707
- *
708
- * @param index
709
- * Index in sequence creation (0 for single creation).
710
- *
711
- * @returns
712
- * Final value.
713
- */
714
- type CreationCallback = (s: string, index: number) => string;
715
687
  /**
716
688
  * Character set creator. Maps numeric values to strings using the character set as digits.
717
689
  */
@@ -805,70 +777,29 @@ declare class CharacterSetCreator extends CharacterSetValidator {
805
777
  */
806
778
  private validateLength;
807
779
  /**
808
- * Create a string by mapping a value to the equivalent characters in the character set across the length of the
780
+ * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
809
781
  * string.
810
782
  *
811
783
  * @param length
812
784
  * Required string length.
813
785
  *
814
- * @param value
815
- * Numeric value of the string.
816
- *
817
- * @param exclusion
818
- * Strings to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
819
- *
820
- * @param tweak
821
- * If provided, the numerical value of the string is "tweaked" using an {@link EncryptionTransformer | encryption
822
- * transformer}.
823
- *
824
- * @param creationCallback
825
- * If provided, called after the string is constructed to create the final value.
826
- *
827
- * @returns
828
- * String created from the value.
829
- */
830
- create(length: number, value: number | bigint, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): string;
831
- /**
832
- * Create multiple strings by mapping each value to the equivalent characters in the character set across the length
833
- * of the string. Equivalent to calling this method for each individual value.
834
- *
835
- * @param length
836
- * Required string length.
837
- *
838
- * @param values
839
- * Numeric values of the strings.
840
- *
841
- * @param exclusion
842
- * Strings to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
843
- *
844
- * @param tweak
845
- * If provided, the numerical value of the strings are "tweaked" using an {@link EncryptionTransformer | encryption
846
- * transformer}.
847
- *
848
- * @param creationCallback
849
- * If provided, called after each string is constructed to create the final value.
850
- *
851
- * @returns
852
- * Iterable iterator over strings created from the values.
853
- */
854
- create(length: number, values: Iterable<number | bigint>, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): IterableIterator<string>;
855
- /**
856
- * Create a string or multiple strings. This signature exists to allow similar overloaded methods in other classes
857
- * to call this method correctly.
858
- *
859
- * @param length
860
- *
861
786
  * @param valueOrValues
787
+ * Numeric value(s) of the string(s).
862
788
  *
863
789
  * @param exclusion
790
+ * String(s) to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
864
791
  *
865
792
  * @param tweak
793
+ * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
794
+ * encryption transformer}.
866
795
  *
867
- * @param creationCallback
796
+ * @param creatorCallback
797
+ * If provided, called after each string is constructed to create the final value.
868
798
  *
869
799
  * @returns
800
+ * String(s) created from the value(s).
870
801
  */
871
- create(length: number, valueOrValues: number | bigint | Iterable<number | bigint>, exclusion?: Exclusion, tweak?: number | bigint, creationCallback?: CreationCallback): string | IterableIterator<string>;
802
+ create<T extends TransformerInput<number | bigint>>(length: number, valueOrValues: T, exclusion?: Exclusion, tweak?: number | bigint, creatorCallback?: TransformerCallback<string, string>): TransformerOutput<T, string>;
872
803
  /**
873
804
  * Determine the value for a string.
874
805
  *
@@ -906,4 +837,4 @@ declare const ALPHABETIC_CREATOR: CharacterSetCreator;
906
837
  */
907
838
  declare const ALPHANUMERIC_CREATOR: CharacterSetCreator;
908
839
 
909
- export { ALPHABETIC_CREATOR, ALPHANUMERIC_CREATOR, CharacterSetCreator, type CharacterSetValidation, CharacterSetValidator, type CreationCallback, EncryptionTransformer, Exclusion, HEXADECIMAL_CREATOR, IdentityTransformer, IteratorProxy, NUMERIC_CREATOR, RecordValidator, RegExpValidator, Sequencer, type StringValidation, type StringValidator, type TransformationCallback, Transformer };
840
+ export { ALPHABETIC_CREATOR, ALPHANUMERIC_CREATOR, CharacterSetCreator, type CharacterSetValidation, CharacterSetValidator, EncryptionTransformer, Exclusion, HEXADECIMAL_CREATOR, IdentityTransformer, IteratorProxy, NUMERIC_CREATOR, RecordValidator, RegExpValidator, Sequencer, type StringValidation, type StringValidator, Transformer, type TransformerCallback, type TransformerInput, type TransformerOutput };