Skip to content

Instantly share code, notes, and snippets.

View brhrmaster's full-sized avatar

Bruno Henry brhrmaster

  • Criativa Inteligente Soluções Digitais
  • Brazil
View GitHub Profile
@7ictor
7ictor / partial-update.js
Last active April 26, 2018 10:13
CouchDB update handler for partial updates of a document.
function (doc, req) {
var findTheChanges = function (prevK, obj) {
var arr = [];
for (var key in obj) {
var prevKey = prevK || '';
if (obj.hasOwnProperty(key)) {
var value = obj[key];
// If its an Object dig deeper.
if (value !== null &&
typeof value === 'object' &&