I have an array of N objects and each object has the following fields:
{
id: 'an id',
description: 'a description',
isUser: true/false
}
I need to order that array based on two things:
Firstly, if the description includes either 'dog', 'cat' or 'animal', it should have sooner position in the array.
Secondly, if the value isUser is false, it should also have a sooner position in the array.
I have notice that the sort function doesn't help when you want to prioritize by value of different attributes, so I am wondering what is the best way to do this in Javascript (or Lodash, which I am also using: https://lodash.com/)
isUser: falseanddescription: 'dog'/'cat' or 'animal'to appear before the rest other elements ?