All my calls to push and pop into this array were encapsulated in calls to prependMessage and appendMessage; so I wrote a quick function to link the items within the array to their previous or next item on push or unshift :
It's maybe not as 'right' as a real linked list, which encapsulates this transparently but it's "good enough" in the sense that it works and didn't require too much open heart surgery, and saved me a hundred lines.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey everyone!
Here's what I wound up doing:
All my calls to push and pop into this array were encapsulated in calls to
prependMessage
andappendMessage
; so I wrote a quick function to link the items within the array to their previous or next item on push or unshift :It's maybe not as 'right' as a real linked list, which encapsulates this transparently but it's "good enough" in the sense that it works and didn't require too much open heart surgery, and saved me a hundred lines.