My bestfriend has BPD. Her mood can change very quickly. Something small she doesn't like can make her go from super happy to super sad/angry which can lead to her hating me and saying stuff that can be hurtful. 

She's said that if I do or say something she doesn't like, I can go from being her favourite person, to the person she hates most. Obviously I'm not going to leave her for this, but I'd like to know, what do I do in these situations and how can I be a good friend?