insomnia/packages/insomnia-app/app/models/helpers/get-status-candidates.ts
2021-07-23 11:04:56 +12:00

11 lines
325 B
TypeScript

import { StatusCandidate } from '../../sync/types';
import { BaseModel, canSync } from '..';
const toStatusCandidate = (doc: BaseModel): StatusCandidate => ({
key: doc._id,
name: doc.name || '',
document: doc,
});
export const getStatusCandidates = (docs: BaseModel[]) => docs.filter(canSync).map(toStatusCandidate);