MCPcopy
hub / github.com/apache/pouchdb / cleanDocs

Function cleanDocs

lib/index.js:1518–1533  ·  view source on GitHub ↗
(docs)

Source from the content-addressed store, hash-verified

1516
1517// clean docs given to us by the user
1518function cleanDocs(docs) {
1519 for (var i = 0; i < docs.length; i++) {
1520 var doc = docs[i];
1521 if (doc._deleted) {
1522 delete doc._attachments; // ignore atts for deleted docs
1523 } else if (doc._attachments) {
1524 // filter out extraneous keys from _attachments
1525 var atts = Object.keys(doc._attachments);
1526 for (var j = 0; j < atts.length; j++) {
1527 var att = atts[j];
1528 doc._attachments[att] = pick(doc._attachments[att],
1529 ['data', 'digest', 'content_type', 'length', 'revpos', 'stub']);
1530 }
1531 }
1532 }
1533}
1534
1535// compare two docs, first by _id then by _rev
1536function compareByIdThenRev(a, b) {

Callers 1

_setupMethod · 0.70

Calls 1

pickFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…