Private
Optional
aliasesPrivate
Optional
altA short list of correct phrases that are synonyms of the wrong phrase but do not contain the mistake, thus helping to avoid the mistake.
Private
artenThe kind of mistake; each mistake is of exactly one kind.
Private
Optional
confusionA short list of correct phrases that seem similar to the wrong phrase but mean something entirely different, thus creating confusion.
Private
correctThe correct form of the mistake, usually displayed like a headline, meaning that it should be rather short (not a whole sentence).
Private
correctexA correct example of the mistake, usually displayed as a small paragraph. The example should be a whole sentence.
Private
Optional
explanationA short explanation of the mistake. It's usually displayed as a small paragraph and should be a few sentences long.
Private
idThe human-readable identification of the mistake. Must be in the format <mainCategory[0]><UInt>
,
such as b3
or s10
. Can be validated with validateID.
Private
Optional
includeWhether the mistake should be included in the "404: not found
" error page.
Private
Optional
isWhether the mistake is suitable to be used for promotional purposes.
Private
kategorienAll categories the mistake belongs to. The first category is the main category.
Private
nameThe name of the mistake. Must be in the format Grammle-<mainCategory[0]><UInt>
, such as Grammle-B3
or
Grammle-S10
. Can be validated with validateName.
Private
Optional
noteA short note about the mistake that displays additional information. It should be rather short (not a whole paragraph) and may be left out if there's nothing to add.
Private
orderIDThe #id with padding zeros. Must be in the format <mainCategory[0]><UInt4>
, such as b0003
or s0010
.
Can be validated with validateOrderID.
Private
Optional
relatedUIDs of Mistakes that are similar or otherwise related to this one.
Private
slugThe relative URL path of the mistake. This is used by Hugo to create the URL of the mistake.
Private
Optional
sourceThird-party sources that provide additional information about the mistake and that are used to verify the correctness of the rule. Each Mistake must have at least one source. Multiple different entries of the same source are allowed but should be avoided if possible.
Private
Optional
statusThe last time the mistake was updated.
Private
Optional
uidThe unique identification of the mistake. Must be an MD5 hash of 32 hexadecimal characters. Can be validated with validateUID.
Private
wrongThe wrong form of the mistake, usually displayed like a headline, meaning that it should be rather short (not a whole sentence).
Private
wrongexA wrong example of the mistake, usually displayed as a small paragraph. The example should be a whole sentence.
Private
Optional
wrongsRegular expressions that match the wrong form of the mistake. They must not match any correct phrases.
Removes duplicate categories from the #kategorien array. Suggested by ChatGPT.
true
if the categories were de-duplicated successfully
Removes all additional categories from the #kategorien array and keeps the first category, by calling #setAdditionalCategories with an empty array.
true
if the categories were removed successfully
Sets a new #kategorien array and removes duplicate categories, but keeps the previous first category and therefore does NOT update #id, #orderID or #name accordingly.
Info: If the given array is empty, all additional categories are removed, but the first category is kept.
true
if the categories were set successfully
the new #kategorien array
Sets new fields#aliases.
If the first alias is a valid ID, then the second alias (if it exists) is required to be a valid UID.
A second alias is not required to exist, though (i.e. aliases.length may be 1).
The
If the second alias is a valid UID, then the first alias is required to be a valid ID.
If that requirement is met, the #uid is updated accordingly. Otherwise, an IllegalArgumentError
is returned (and the #uid is not updated).
In other words, we enforce that:
[0]
is valid ID ⇒
aliases.length == 1 ||
aliases[1]
is valid UID
[1]
is valid UID ⇒ aliases[0]
is valid ID
[1]
exists ⇒
(aliases[0]
is valid ID ⇔ aliases[1]
is valid UID)
If the first alias is a valid ID and the second alias is a valid UID, then the new aliases array overrides the current one, and
are updated accordingly.[1]
is actually the
correct fields#uid for the Mistake, not just some UID.
If the first alias is not a valid ID and the second alias is not a valid UID, then the new aliases array is
appended to the current one, instead of overriding it.
The #id and #uid are not updated.
However, if the current #uid is undefined
, then there is no option to set
#aliases[2]
to the UID, so an IllegalArgumentError is returned.
true
if the aliases were set successfully
if the aliases are not valid, as described above
the new aliases
Sets a new ID and updates the #orderID, #name, #kategorien and #aliases accordingly.
true
if the ID was set successfully
the new ID
Sets the 404 status of this Fields object. In case of false
, the 404 status is removed, i.e.
#includeIn404 is set to undefined
.
true
if this Fields object shall be displayed on the 404 page, false
otherwise
Sets the isFeatured status of this Fields object. In case of false
, the isFeatured status is removed, i.e.
#isFeatured is set to undefined
.
true
if this Fields object shall be isFeatured, false
otherwise
Sets a new name and updates the #id, #orderID and #aliases accordingly, by calling
#setID(GrammleID). The name must be in the format Grammle-<ID number>
.
true
if the name was set successfully
if the name is not in the format Grammle-<ID number>
the new mistake name
Sets a new order ID and updates the #id, #name and #aliases accordingly, by calling
#setID(GrammleID). The order ID must be in the format
true
if the order ID was set successfully
if the order ID is not in the format
the new order ID
Sets a new UID and updates the #aliases accordingly. The UID must be an MD5 string of 32 characters.
true
if the UID was set successfully
if the UID is not an MD5 string of 32 characters
the new UID
a deep copy of the Fields object as a raw Object
Private
updateUpdates the #aliases with the given ID and UID as the first and second item respectively. The UID must be a valid MD5 string of 32 characters. At least one of the parameters must be defined.
Important:
true
if the aliases were updated successfully
if the UID is not an MD5 string of 32 characters
Private
updateSets a new main category by updating the #kategorien accordingly.
true
: the mistake's main category has been updated to the given category,
false
: the mistake's main category is already the given category
the new main category
Static
fromCreates a new Fields object from a given raw Object.
the new Fields object
if the given parameter is not an Object or if it does not have a required property.
the raw Object to create the Fields from
Static
validateChecks whether the given Fields object is valid.
Conditions:
true
if the given Fields object is valid, false
otherwise
Static
Private
validateIDsValidates that the given ID, name and orderID are equivalent and that the given category is the ID's category.
true
if the given ID, name and orderID are equivalent and if the given category is the ID's category; false
otherwise.
IllegalArgumentError if the given ID, name or orderID are not valid.
the ID to validate
the ID name to validate
the orderID to validate
Optional
category: stringthe category to validate
Static
validateGenerated using TypeDoc
Stores the actual parameters of a Mistake.