Releases: joooKiwi/enumeration
Release list
JS / TS v3.1.0 to v3.12.0
Those updates are centered about the "joookiwi/collection"
JS / TS 3.0.0
Big changes to the javascript implementation for the upcoming Java & Kotlin version.
In this change, the type order has been changed.
By that, the Enum has no change due to having only optional types.
But, the inheritor (like the EnumWithParent) have the changed
Enum(erable)With(Nullable)Parent[ORDINAL, NAME, PARENT] → [PARENT, ORDINAL?, NAME?]Enum(erable)With(Nullable)GrandParent[ORDINAL, NAME, PARENT, GRAND_PARENT] → [PARENT, GRAND_PARENT, ORDINAL?, NAME?]Enum(erable)With(Nullable)GreatGrandParent[ORDINAL, NAME, PARENT, GRAND_PARENT, GREAT_GRAND_PARENT] → [PARENT, GRAND_PARENT, GREAT_GRAND_PARENT, ORDINAL?, NAME?]
Most notably, the protected methods in the CompanionEnum are now more separated instead of not customizable:
- validation
- edge case numeric
- new
_isNotInEdgeCaseNumericByString(string, PossibleString) - new
_isNotInEdgeCaseNumericByNumber(number, PossibleNumber)
- new
- inherited enumerable member
- new
_isNotInInheritedEnumerableMembers(string, PossibleString)
- new
- excluded name
- new
_isNotInExcludedNames(string, PossibleString)
- new
- is in ordinal
- new
isInOrdinalsByString(NumberTemplate, PossibleString) - new
isInOrdinalsByNumber(number, PossibleNumber): ORDINAL - new
isInOrdinalsByBigInt(bigint, PossibleBigInt): ORDINAL
- new
- is positive
- new
isPositiveByString(NumberTemplate, PossibleString) - new
isPositiveByNumber(number, PossibleNumber) - new
isPositiveByBigInt(bigint, PossibleBigInt)
- new
- is not over MAX_VALUE
- new
isNotOverMaxValueByString(NumberTemplate, PossibleString) - new
isNotOverMaxValueByNumber(number, PossibleNumber) - new
isNotOverMaxValueByBigInt(bigint, PossibleBigInt)
- new
- is not a floating value
- new
isNotAFloatingNumberByString(NumberTemplate, PossibleString) - new
isNotAFloatingNumberByNumber(number, PossibleNumber)
- new
- get valid value
_getValueByEnumerable(Enumerable): ENUMERABLE→_getValidValueByEnumerable(Enumerable): ENUMERABLE- new
_getValueByString(NonNullable<unknown>, string, PossibleString, ENUMERABLE_CONSTRUCTOR): ENUMERABLE
- get value from …
- new
_getValueFromReflection(string, PossibleString): ENUMERABLE - new
_getValueFromOrdinals(ORDINAL, PossibleNumeric): ENUMERABLE _getValueFromParentInValues→_getValueFromValuesByParent(Enumerable): ENUMERABLE_getValueFromGrandParentInValues→_getValueFromValuesByGrandParent(Enumerable): ENUMERABLE_getValueFromGreatGrandParentInValues→_getValueFromValuesByGreatGrandParent(Enumerable): ENUMERABLE
- new
- get valid name
- new
_getValidName(string, PossibleString): string
- new
- get valid ordinal
- new
_getValidOrdinalByNumber(number, PossibleNumber): ORDINAL - new
_getValidOrdinalByBigInt(bigint, PossibleBigInt): ORDINAL
- new
- edge case numeric
- get non null
- new
_getNonNullValueFromGetValue(T?): T - new
_getNonNullValueFromGetName(T?): T - new
_getNonNullValueFromGetOrdinal(T?): T
- new
- get value
_getValueByEnumerable(Enumerable): ENUMERABLEnow readonly_getValueByString(string, PossibleString): ENUMERABLEnow readonly_getValueByNumber(number, PossibleNumber): ENUMERABLEnow readonly_getValueByBigInt(bigint, PossibleBigInt): ENUMERABLEnow readonly
- get name
_getNameByEnumerable(Enumerable): NAMEnow readonly_getNameByString(string, PossibleString): NAMEnow readonly_getNameByNumber(number, PossibleNumber): NAMEnow readonly_getNameByBigInt(bigint, PossibleBigInt): NAMEnow readonly
- get ordinal
_getOrdinalByEnumerable(Enumerable): ORDINALnow readonly_getOrdinalByString(string, PossibleString): ORDINALnow readonly_getOrdinalByNumber(number, PossibleNumber): ORDINALnow readonly_getOrdinalByBigInt(bigint, PossibleBigInt): ORDINALnow readonly
The Array are changed to a CollectionHolder in the EnumConstants
ENUMERABLE_MEMBERSENUMERABLE_WITH_PARENT_MEMBERSENUMERABLE_WITH_GRAND_PARENT_MEMBERSENUMERABLE_WITH_GREAT_GRAND_PARENT_MEMBERSCOMPANION_ENUM_MEMBERSCOMPANION_ENUM_WITH_PARENT_MEMBERSCOMPANION_ENUM_WITH_GRAND_PARENT_MEMBERSCOMPANION_ENUM_WITH_GREAT_GRAND_PARENT_MEMBERSEVERY_ENUMERABLE_MEMBEREVERY_COMPANION_ENUM_MEMBER
There is also a new exception ForbiddenNameException in order to capture some forbidden names (by the inheritors) when retrieving from getValue, getName or getOrdinal.
There is new Regex (RegExp) in the EnumConstants that will be used eventually
EXPONENTIAL_REGEXUNICODE_EXPONENTIAL_REGEXHEXADECIMAL_REGEXBINARY_REGEX
The max number is now changed to be the maximum Integer (32-bit number)
- from
2¹⁰²⁴ - 1to2³² - 1
New types were added:
- In the
Enumerable.typesPossibleEnumerableMembersValueByEnumerableConstructorAndEnumerableName- deprecation of the
ValueByEnumerableConstructorAndEnumerableOrdinal EnumWithNullableParentGeneralTypeEnumWithParentGeneralTypeEnumWithNullableGrandParentGeneralTypeEnumWithGrandParentGeneralTypeEnumWithNullableGreatGrandParentGeneralTypeEnumWithGreatGrandParentGeneralTypeEnumerableWithNullableParentGeneralTypeEnumerableWithParentGeneralTypeEnumerableWithNullableGrandParentGeneralTypeEnumerableWithGrandParentGeneralTypeEnumerableWithNullableGreatGrandParentGeneralTypeEnumerableWithGreatGrandParentGeneralType
- In the
companion/typesImpossibleNamesPossibleCompanionEnumMembersCompanionEnumTypeCompanionEnumDeclarationTypeCompanionEnumWithParentTypeCompanionEnumWithParentDeclarationTypeCompanionEnumWithGrandParentTypeCompanionEnumWithGrandParentDeclarationTypeCompanionEnumWithGreatGrandParentTypeCompanionEnumWithGreatGrandParentDeclarationType
- In the
Singleton.typesCompanionEnumDeclarationSingletonCompanionEnumWithParentDeclarationSingletonCompanionEnumWithGrandParentDeclarationSingletonCompanionEnumWithGreatGrandParentDeclarationSingleton
JS / TS: 2.7.0
The EnumHelper is now removed from the project
The Enum now has the default values (apparently I did forgot to added it)
And a simple update of the collection dependency (1.1.0 to 1.2.0)
JS / TS 2.4.0
Changes in the enumerable folder
There is a new way to implement the default value.
Originally, it could have been done by only _DEFAULT,
but some exception could be thrown if something other was provided.
So now, there is only the NullEnumerableException and UnhandledValueException that can be thrown by the get default method even if an unexpected exception is thrown by the values.
Also, there is 3 different implementation depending on your needs.
By using _DEFAULT, only an Enumerable is supported.
As for the _DEFAULT_NAME, it can be a string (primitive or object)
And for the _DEFAULT_ORDINAL, it can be a number or bigint (primitive or object)
*Eventually, there will be methods to confirm if the value exist instead of just throwing exception (like in C#)*
Changes in the collection folder
The collection folder has been relocated to a different repository.
The package (collection) can be used independently.
If you want to see how it handle the changes. See its release note.
(Quick note, the Java & Kotlin are in their way)
JS/TS: 2.3.0
Changes in the enumerable folder
The unused types were removed.
Meaning that EnumerableConstructorFromEnumerableConstructorOrCompanionEnum, CompanionEnumIfNameOfEnumerable, CompanionEnumIfOrdinalOfEnumerable, CompanionEnumIfOrdinalOrNameOfEnumerable, Enumerable[Name|Ordinal?]ByEnumerableConstructor, Enumerable[Name|Ordinal?]ByEnumerableConstructorAndEnumerable, Enumerable[Name|Ordinal?]ByEnumerableConstructorAndName & Enumerable[Name|Ordinal?]ByEnumerableConstructorAndOrdinal are no longer present.
Changes in the CollectionHolder
The function were added to give more opportunity to use other languages features
- (new) any
- (new) all
- (new) none
- (new)
getwith 2 counterpartgetOrElseandgetOrNull - (new)
indexOfandlastIndexOf filterByIndex→filterIndexedfilterNotByIndex→filterIndexedNotfilterNonNull→filterNoNullmapIndex→mapIndexedforEachIndex→forEachIndexed- (new)
requireNoNulls - (new)
toMapandtoMutableMap
Changes in typing
In order to have more generic usage, some names were changed.
With this, it could be use in different methods.
It will also be more descriptive on what they have.
- JoinCallback → ValueWithStringReturnCallback
- MapCallback → ValueIndexWithReturnCallback
- MapIndexCallback → ValueIndexValueWithReturnCallback
- ForEachCallback → ValueIndexCallback
- ForEachIndexCallback → ValueIndexValueCallback
And there is also type removal due to some "Typescript excessive deep possibly infinite" errors IsEmptyIsNotEmptyFilterNonNull
Also, note that the collection will eventually be in its own repository.
JS/TS: 2.2.0
Addition of new features:
joinnow has more arguments that it can receive (like the Kotlin counterpart)toWeakSetand totoMutableWeakSetis now presentreverseis now present (with 2 arguments, start and end)hasNull(with their counterpart,containsNull&includesNull) is now present- The collection now has the index parameter (like in Array)
Some performance optimization were used (thanks to JsPerf) on the collection methods and the companion enum initialization.
Minor changes (in the AbstractCollectionHolder)
- Renaming of
get _iterabletoget _reference - Removal of
get _set
(Keep in mind that the changes only apply to the Javascript part since there is no other so far)
JS / TS 2.5.0
In this release, there will be new classes in order to have less boilerplace code when having the "inheritance".
Also, there will be new kind of inheritance with the nullability in mind.
This was done in order to be compilable in Kotlinwith its nullability system.
By that change, there will be 2 different kind of structures depending on the nullability that you want.
(The types have been omitted in order to keep the interface as clear as possible)
interface Enumerable {
get name(): NAME
get ordinal(): ORDINAL
}
interface EnumerableWithNullableParent
extends Enumerable {
get parent(): NullOr<PARENT>
}
interface EnumerableWithParent
extends EnumerableWithNullableParent {
get parent(): PARENT
}
interface EnumerableWithNullableGrandParent
extends EnumerableWithNullableParent {
get grandParent(): NullOr<GRAND_PARENT>
}
interface EnumerableWithGrandParent
extends EnumerableWithParent, EnumerableWithNullableGrandParent {
get grandParent(): GRAND_PARENT
}
interface EnumerableWithNullableGreatGrandParent
extends EnumerableWithNullableParent {
get greatGrandParent(): NullOr<GREAT_GRAND_PARENT>
}
interface EnumerableWithGreatGrandParent
extends EnumerableWithGrandParent, EnumerableWithNullableGreatGrandParent {
get greatGrandParent(): GREAT_GRAND_PARENT
}In order to have a better inheritance, a new class (in the helper folder) was added, KnownEnumConstructors.
With that, when attempting to use the getLastPrototype will be handled properly once the instance is added.
The BasicCompanionEnum was chosen to not interfere with the value. But since it doesn't cause any trouble.
The name has been renamed to CompanionEnum directly.
Meaning that:
BasicCompanionEnum→CompanionEnumBasicCompanionEnumDeclaration→CompanionEnumDeclarationBasicSingletonCompanionEnum→SingletonCompanionEnumEnumHelper.isBasicCompanionEnum→EnumHelper.isCompanionEnum
Changes to the EnumHelper
By the fact that the EnumHelper was only using a namespace in Typescript, it makes its less relevant. But still useful if the utility methods can be attached in a single exportation.
By that, all of the methods has been upgraded to first-member function instead of being related to the EnumHelper namespace.
Also, it has been relocated in the folder src/helper.
You can now use
isEnuminstead ofEnumHelper.isEnumisCompanionEnuminstead ofEnumHelper.isBasicCompanionEnumisEnumByStructureinstead ofEnumHelper.isEnumerableByStructureisCompanionEnumByStructureinstead ofEnumHelper.isCompanionEnumByStructuregetCompanioninstead ofEnumHelper.getCompaniongetLastPrototypeinstead ofEnumHelper.getLastPrototype
And there is new utility method for the new implementations:
isCompanionEnumWithParentisCompanionEnumWithParentByStructureisCompanionEnumWithGrandParentisCompanionEnumWithGrandParentByStructureisCompanionEnumWithGreatGrandParentisCompanionEnumWithGreatGrandParentByStructureisEnumWithNullableParentisEnumWithParentisEnumWithParentByStructureisEnumWithNullableGrandParentisEnumWithGrandParentisEnumWithGrandParentByStructureisEnumWithNullableGreatGrandParentisEnumWithGreatGrandParentisEnumWithGreatGrandParentByStructure