Skip to content

AIDC Toolkit / Utility / CharacterSetCreator

Class: CharacterSetCreator

Defined in: character-set.ts:271

Character set creator. Maps numeric values to strings using the character set as digits.

Extends

Properties

MAXIMUM_STRING_LENGTH

readonly static MAXIMUM_STRING_LENGTH: 40 = 40

Defined in: character-set.ts:275

Maximum string length supported.

Constructors

Constructor

new CharacterSetCreator(characterSet, ...exclusionSupport): CharacterSetCreator

Defined in: character-set.ts:349

Constructor.

Parameters

characterSet

readonly string[]

Character set. Each element is a single-character string, unique within the array, that defines the character set.

exclusionSupport

...readonly Exclusion[]

Exclusions supported by the character set. All character sets implicitly support Exclusions.None.

Returns

CharacterSetCreator

Overrides

CharacterSetValidator.constructor

Accessors

characterSet

Get Signature

get characterSet(): readonly string[]

Defined in: character-set.ts:103

Get the character set.

Returns

readonly string[]

Inherited from

CharacterSetValidator.characterSet


characterSetSize

Get Signature

get characterSetSize(): number

Defined in: character-set.ts:110

Get the character set size.

Returns

number

Inherited from

CharacterSetValidator.characterSetSize


exclusionSupport

Get Signature

get exclusionSupport(): readonly Exclusion[]

Defined in: character-set.ts:117

Get the exclusions supported by the character set.

Returns

readonly Exclusion[]

Inherited from

CharacterSetValidator.exclusionSupport

Methods

powerOf10()

static powerOf10(power): bigint

Defined in: character-set.ts:312

Get a power of 10.

Parameters

power

number

Power.

Returns

bigint

10**power.


create()

Call Signature

create(length, value, exclusion?, tweak?, creatorCallback?): string

Defined in: character-set.ts:538

Create a string by mapping a value to the equivalent characters in the character set across the required string length.

Parameters
length

number

Required string length.

value

Numeric value of the string.

number | bigint

exclusion?

Exclusion

Strings to be excluded from the output range. See Exclusions for possible values and their meanings.

tweak?

If provided, the numeric value of the string is "tweaked" using an encryption transformer.

number | bigint

creatorCallback?

IndexedCallback<string, string>

Called after the string is constructed to create the final value.

Returns

string

String created from the value.

Call Signature

create(length, values, exclusion?, tweak?, creatorCallback?): Iterable<string>

Defined in: character-set.ts:563

Create strings by mapping values to the equivalent characters in the character set across the required string length.

Parameters
length

number

Required string length.

values

Iterable<number | bigint>

Numeric values of the string.

exclusion?

Exclusion

Strings to be excluded from the output range. See Exclusions for possible values and their meanings.

tweak?

If provided, the numeric value of each string is "tweaked" using an encryption transformer.

number | bigint

creatorCallback?

IndexedCallback<string, string>

Called after each string is constructed to create the final value.

Returns

Iterable<string>

Strings created from the values.

Call Signature

create<TInput>(length, valueOrValues, exclusion?, tweak?, creatorCallback?): TInput extends Iterable<number | bigint, any, any> ? Iterable<string, any, any> : string

Defined in: character-set.ts:566

Create a string by mapping a value to the equivalent characters in the character set across the required string length.

Type Parameters
TInput

TInput extends number | bigint | Iterable<number | bigint, any, any>

Parameters
length

number

Required string length.

valueOrValues

TInput extends Iterable<number | bigint, any, any> ? TInput<TInput> : number | bigint

exclusion?

Exclusion

Strings to be excluded from the output range. See Exclusions for possible values and their meanings.

tweak?

If provided, the numeric value of the string is "tweaked" using an encryption transformer.

number | bigint

creatorCallback?

IndexedCallback<string, string>

Called after the string is constructed to create the final value.

Returns

TInput extends Iterable<number | bigint, any, any> ? Iterable<string, any, any> : string

String created from the value.


valueFor()

valueFor(s, exclusion?, tweak?): bigint

Defined in: character-set.ts:624

Determine the value for a string.

Parameters

s

string

String.

exclusion?

Exclusion

Strings excluded from the input domain. See Exclusions for possible values and their meanings.

tweak?

If provided, the numerical value of the string was "tweaked" using an encryption transformer.

number | bigint

Returns

bigint

Numeric value of the string.


character()

character(index): string

Defined in: character-set.ts:130

Get the character at an index.

Parameters

index

number

Index into the character set.

Returns

string

Character at the index.

Inherited from

CharacterSetValidator.character


characterIndex()

characterIndex(c): number | undefined

Defined in: character-set.ts:143

Get the index for a character.

Parameters

c

string

Character.

Returns

number | undefined

Index for the character or undefined if the character is not in the character set.

Inherited from

CharacterSetValidator.characterIndex


characterIndexes()

characterIndexes(s): readonly (number | undefined)[]

Defined in: character-set.ts:156

Get the indexes for all characters in a string.

Parameters

s

string

String.

Returns

readonly (number | undefined)[]

Array of indexes for each character or undefined if the character is not in the character set.

Inherited from

CharacterSetValidator.characterIndexes


validateExclusion()

protected validateExclusion(exclusion): void

Defined in: character-set.ts:180

Validate that an exclusion is supported. If not, an error is thrown.

Parameters

exclusion

Exclusion.

Exclusion | undefined

Returns

void

Inherited from

CharacterSetValidator.validateExclusion


validate()

validate(s, validation?): void

Defined in: character-set.ts:198

Validate a string. If the string violates the character set or any of the character set validation parameters, an error is thrown.

Parameters

s

string

String.

validation?

CharacterSetValidation

Character set validation parameters.

Returns

void

Inherited from

CharacterSetValidator.validate