cudr_slate-collaborative/packages/bridge/src/convert/create.ts

13 lines
278 B
TypeScript
Raw Normal View History

2019-10-06 20:56:27 +00:00
import * as Automerge from 'automerge'
const createByType = (type: any) =>
type === 'map' ? {} : type === 'list' ? [] : ''
2019-10-05 08:44:49 +00:00
const opCreate = ({ obj, type }: Automerge.Diff, [map, ops]: any) => {
2019-10-05 08:44:49 +00:00
map[obj] = createByType(type)
return [map, ops]
}
export default opCreate