pawn-requests icon indicating copy to clipboard operation
pawn-requests copied to clipboard

Deprecate incorrectly named "Append" and implement "Push", "Concat" and "Merge"

Open Southclaws opened this issue 4 years ago • 0 comments

After some confusion I've realised that the JsonAppend function is named incorrectly!

Appending is adding a single item to a collection of items however the current API expects the input and destination to either be both arrays or both objects. This is actually concatenation not appending.

So, the existing JsonAppend function should be marked deprecated and two new functions introduced:

  • JsonPush this is purely for arrays where you want to push a single item to the end.
  • JsonConcat does exactly what JsonAppend does but only for arrays.
  • JsonMerge does exactly what JsonAppend does but only for objects.

Southclaws avatar Sep 30 '19 13:09 Southclaws