| import uuid from 'uuid'; | |
| import { stringMd5 } from 'pouchdb-md5'; | |
| import clone from './clone'; | |
| function rev(doc, deterministic_revs) { | |
| var clonedDoc = clone(doc); | |
| if (!deterministic_revs) { | |
| return uuid.v4().replace(/-/g, '').toLowerCase(); | |
| } | |
| delete clonedDoc._rev_tree; | |
| return stringMd5(JSON.stringify(clonedDoc)); | |
| } | |
| export default rev; |