util.flattenObject(object, delim, stop)

Flatten a nested object up until the stop function returns true. The stop function takes the value of the node currently traversed. delim is a delimiter for the combined keys in the resulting object. Example:

joint.util.flattenObject({ 
    a: { 
        a1: 1, 
        a2: 2, 
        a3: { 
            a31: 5, 
            a32: { 
                a321: { a3211: 5 } 
            } 
        } 
    }, 
    b: 6 
}, '/', function(v) { return !!v.a321; });

/*
{
 "a/a1": 1,
 "a/a2": 2,
 "a/a3/a31": 5,
 "a/a3/a32": {
  "a321": {
   "a3211": 5
  }
 },
 "b": 6
}
*/