lib/services/db-operations.js
function splitCascadingData(uri, data) {
  let ops, list;

  // search for _ref with _size greater than 1
  list = references.listDeepObjects(data, isReferencedAndReal);
  ops = _.map(list.reverse(), function (obj) {
    const ref = obj[referenceProperty],
      // since children are before parents, no one will see data below them
      op = {key: ref, value: _.omit(obj, referenceProperty)};

    // omit cloned 1 level deep and we clear what omit cloned from obj
    // so the op gets the first level of data, but it's removed from the main obj
    clearOwnProperties(obj);
    obj[referenceProperty] = ref;

    return op;
  });

  // add the cleaned root object at the end
  ops.push({key: uri, value: data});

  return ops;
}
function splitCascadingData(uri, data) {
  let ops, list;

  // search for _ref with _size greater than 1
  list = references.listDeepObjects(data, isReferencedAndReal);
  ops = _.map(list.reverse(), function (obj) {
    const ref = obj[referenceProperty],
      // since children are before parents, no one will see data below them
      op = {key: ref, value: _.omit(obj, referenceProperty)};

    // omit cloned 1 level deep and we clear what omit cloned from obj
    // so the op gets the first level of data, but it's removed from the main obj
    clearOwnProperties(obj);
    obj[referenceProperty] = ref;

    return op;
  });

  // add the cleaned root object at the end
  ops.push({key: uri, value: data});

  return ops;
}
function splitCascadingData ( uri , data ) { let ops , list ; // search for _ref with _size greater than 1 list = references . listDeepObjects ( data , isReferencedAndReal ) ; ops = _ . map ( list . reverse ( ) , function ( obj ) { const ref = obj [ referenceProperty ] , // since children are before parents, no one will see data below them op = { key : ref , value : _ . omit ( obj , referenceProperty ) } ; // omit cloned 1 level deep and we clear what omit cloned from obj // so the op gets the first level of data, but it's removed from the main obj clearOwnProperties ( obj ) ; obj [ referenceProperty ] = ref ; return op ; } ) ; // add the cleaned root object at the end ops . push ( { key : uri , value : data } ) ; return ops ; }
Split cascading component data into individual components
@param {string} uri  Root reference in uri form
@param {object} data  Cascading component data
@returns {[{key: string, value: object}]}
Split cascading component data into individual components