Version 1.7 — Realize Notes
Core Package (@yamato-daiwa/es-extensions)
Breaking Changes
Working with Arrays
Renaming of the Third Parameter in getArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne
and
getIndexOfArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne
In the 3rd parameter of the object
type the mustThrowErrorIfElementNotFoundOrMoreThan1
property has been renamed to
mustThrowErrorIfElementNotFoundOrMatchesAreMultiple.
- Reason
- The previous name is confusing because "or more than1" could be misinterpreted as like there must not be more than one element in the source array. Now, «or matches are multiple» clearly declares that it must not be more than one element namely among ones which satisfying the predicate.
- Changes in your code will required if
- In your code, during the calling of
getArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne
function, 3rd parameter is being used. - Migration
- Using the appropriate functionality of your code editor or IDE, replace
mustThrowErrorIfElementNotFoundOrMoreThan1
occurrences withmustThrowErrorIfElementNotFoundOrMatchesAreMultiple
in all files of the project.
"RawObjectDataProcessor" class
Renaming of Localization Object
According the updated naming conventions, the localization object
RawObjectDataProcessorLocalization__English
has been renamed
to rawObjectDataProcessorLocalization__english
.
Similar changes has been applied to other localization objects.
BrowserJS JavaScript (@yamato-daiwa/es-extensions-browserjs)
Braking changes
Working with DOM
The Changes in Parameters and Conditions of Error Throwing at Functions getExpectedToBeSingleDOM_Element
and getExpectedToBeSingleChildOfTemplateElement
Previously, the sole object-type parameter has
optional polymorphic property
context
which, if defined, must have type
Element,
Document or
derived from them.
Now, this property has been replaced with contextElement
,
which also polymorphic, but now has
ParentNode | Readonly<{ selector: string; }>
type, due to what besides
the specifying of the context element itself it has become possible to specify its
selector.
However, if the selector of context element specified,
exactly one element must correspond to it,
otherwise error will be thrown (DOM_ElementRetrievingFailedError
if element not found, or UnexpectedEventError
, if two
or more elements found).
Because both Element
and Document
are inherited from ParentNode
, the new type of new property is
compatible with old one.
- Reason
- The unification of API for specifying of the context element: the
contextElement
property ofParentNode | Readonly<{ selector: string; }>
type now being used in parameters of multiple functions and even outside of YDEE library (for example, in Yamato Daiwa Frontend library for the frontend development). - Changes in your code will required if
- You have use the
context
property ofgetExpectedToBeSingleDOM_Element
orgetExpectedToBeSingleChildOfTemplateElement
functions. - Migration
- Rename
context
property tocontextElement
in all files of your project. If it will be good for you to specify the selector of the context element instead of context element itself, you may refactor the calling of these function using the newest API, herewith exactly one element must correspond to specified selector, otherwise the error will be thrown.