12
shizpi
8y

F*cking backend guys that send empty arrays like [ null ] ...

array.length === 0 -> false

Comments
  • 3
    That's clearly crap but never understood whether best practice for returning array of one should be [{}] or {}. Always annoys me having to deal with it as {} but loads of established APIs seem to have that approach.
  • 3
    @nano always better to receive [{}] since the client will be expecting an array in there.
  • 0
    @shizpi that's what I thought. In which case: fucking backend devs sending {} instead of [{}] 😫
  • 6
    All these backend/frontend posts make me laugh.... understand both ends and man up
  • 0
    @nano I think it's actually the way converters handle null
  • 1
    @jonjo I understand both ends, but in no way an empty array should be sent with a null value inside...
  • 4
  • 0
    @WhatIsHeDoing this is a different case. I agree with 200 and getting [ ] for and empty list.
    But this is a case where there's no data and you get [ null ]
  • 1
    @bkwilliams are you the devil or something?
  • 0
    You should always check for that stuff though??
Add Comment