insomnia/packages/insomnia-app/app/models/helpers/project.ts
Dimitri Mitropoulos 02c65a852d
implements sort order for projects (#3953)
Co-authored-by: Opender Singh <opender94@gmail.com>
2021-09-09 21:42:57 +00:00

11 lines
385 B
TypeScript

import { ascend, descend, prop, sortWith } from 'ramda';
import { isDefaultProject, isLocalProject, isRemoteProject, Project } from '../project';
export const sortProjects = <T extends Pick<Project, 'name' | 'remoteId' | '_id'>>(projects: T[]) => sortWith<T>([
descend(isDefaultProject),
descend(isLocalProject),
descend(isRemoteProject),
ascend(prop('name')),
], projects);