insomnia/packages/insomnia-app/app/models/helpers/project.ts

11 lines
385 B
TypeScript
Raw Normal View History

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);