import { last } from 'rambda';
const transformRevision = (revision) => ({
    state: revision.fields['System.State'],
    date: revision.fields['System.ChangedDate'].toISOString(),
});
export default (revisions) => revisions.reduce((acc, revision) => {
    var _a;
    if (acc.length === 0) {
        return [transformRevision(revision)];
    }
    if (((_a = last(acc)) === null || _a === void 0 ? void 0 : _a.state) === revision.fields['System.State']) {
        return acc;
    }
    return acc.concat(transformRevision(revision));
}, []);
