cleanModifiedSubpaths.js 452 B

123456789101112131415161718
  1. 'use strict';
  2. /*!
  3. * ignore
  4. */
  5. module.exports = function cleanModifiedSubpaths(doc, path) {
  6. var _modifiedPaths = Object.keys(doc.$__.activePaths.states.modify);
  7. var _numModifiedPaths = _modifiedPaths.length;
  8. var deleted = 0;
  9. for (var j = 0; j < _numModifiedPaths; ++j) {
  10. if (_modifiedPaths[j].indexOf(path + '.') === 0) {
  11. delete doc.$__.activePaths.states.modify[_modifiedPaths[j]];
  12. ++deleted;
  13. }
  14. }
  15. return deleted;
  16. };