Browse Source

Change `GetTextByPointer()` to be simpler

pull/8/head
Anton Tarasenko 4 years ago
parent
commit
a9ae0f9580
  1. 21
      sources/Data/Collections/Collection.uc

21
sources/Data/Collections/Collection.uc

@ -355,8 +355,8 @@ public final function float GetFloatByPointer(
* [JSON pointer](https://tools.ietf.org/html/rfc6901). * [JSON pointer](https://tools.ietf.org/html/rfc6901).
* See `GetItemByPointer()` for more information. * See `GetItemByPointer()` for more information.
* *
* Referred value must be stored as `Text` or `MutableText` * Referred value must be stored as `Text` (or one of it's sub-classes,
* (or one of their sub-classes) for this method to work. * such as `MutableText`) for this method to work.
* *
* @param jsonPointerAsText Description of a path to the `Text` value. * @param jsonPointerAsText Description of a path to the `Text` value.
* @return `Text` value, stored at `jsonPointerAsText` or `none` if it * @return `Text` value, stored at `jsonPointerAsText` or `none` if it
@ -364,22 +364,7 @@ public final function float GetFloatByPointer(
*/ */
public final function Text GetTextByPointer(Text jsonPointerAsText) public final function Text GetTextByPointer(Text jsonPointerAsText)
{ {
local AcediaObject result; return Text(GetItemByPointer(jsonPointerAsText));
local MutableText asMutable;
local Text asImmutable;
result = GetItemByPointer(jsonPointerAsText);
if (result == none) {
return none;
}
asMutable = MutableText(result);
if (asMutable != none) {
return asMutable;
}
asImmutable = Text(result);
if (asImmutable != none) {
return asImmutable;
}
return none;
} }
/** /**

Loading…
Cancel
Save