const data = [
{tag: "ces1", names: [100134], time: 1},
{tag: "cs3", names: [100120, 100135], time: 2},
{tag: "ces4", names: [100123, 100135], time: 2},
{tag: "ces5", names: [100160, 100135], time: 2},
{tag: "ces6", names: [100160, 100135, 100360], time: 3},
{tag: "ces7", names: [100124, 100154, 100899], time: 4},
{tag: "ces2", names: [100160, 100678], time: 2}
]
function sort(data) {
const mapData = _.map(data, item => ({...item, order: _.includes(item.names, '100135') ? 10 : 1}));
return _.orderBy(mapData, ['time', 'order'],['desc','desc']);
}
console.log(JSON.stringify(sort(data)));
console