Comparing version 2.0.0-dev1 to 2.0.0-dev2
{ | ||
"name": "baobab", | ||
"main": "build/baobab.min.js", | ||
"version": "2.0.0-dev1", | ||
"version": "2.0.0-dev2", | ||
"homepage": "https://github.com/Yomguithereal/baobab", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -415,3 +415,3 @@ /** | ||
Object.defineProperty(Baobab, 'version', { | ||
value: '2.0.0-dev1' | ||
value: '2.0.0-dev2' | ||
}); | ||
@@ -418,0 +418,0 @@ |
@@ -113,3 +113,3 @@ /** | ||
// TODO: some operations here might be merged for perfs | ||
var additionalPaths = _this._facetPath ? (0, _helpers.getIn)(_this.tree._computedDataIndex, _this._facetPath).paths : []; | ||
var additionalPaths = _this._facetPath ? (0, _helpers.getIn)(_this.tree._computedDataIndex, _this._facetPath).relatedPaths() : []; | ||
@@ -116,0 +116,0 @@ // If this is the root selector, we fire already |
@@ -64,2 +64,7 @@ /** | ||
// Is the facet recursive? | ||
this.isRecursive = !!this.paths.filter(function (p) { | ||
return _type2['default'].facetPath(p); | ||
}).length; | ||
// Internal state | ||
@@ -81,3 +86,3 @@ this.state = { | ||
// Is this facet affected by the current write event? | ||
var concerned = (0, _helpers.solveUpdate)([path], _this.paths); | ||
var concerned = (0, _helpers.solveUpdate)([path], _this.relatedPaths()); | ||
@@ -95,2 +100,22 @@ if (concerned) { | ||
_createClass(Facet, [{ | ||
key: 'relatedPaths', | ||
/** | ||
* Method returning solved paths related to the facet. | ||
* | ||
* @return {array} - An array of related paths. | ||
*/ | ||
value: function relatedPaths() { | ||
var _this2 = this; | ||
if (!this.isRecursive) return this.paths;else return this.paths.reduce(function (paths, path) { | ||
if (!_type2['default'].facetPath(path)) return paths.concat(path); | ||
// Solving recursive path | ||
var relatedFacet = (0, _helpers.getIn)(_this2.tree._computedDataIndex, path); | ||
return paths.concat(relatedFacet.relatedPaths()); | ||
}, []); | ||
} | ||
}, { | ||
key: 'get', | ||
@@ -97,0 +122,0 @@ |
{ | ||
"name": "baobab", | ||
"version": "2.0.0-dev1", | ||
"version": "2.0.0-dev2", | ||
"description": "JavaScript persistent data tree with cursors.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/baobab.js", |
@@ -399,3 +399,3 @@ /** | ||
Object.defineProperty(Baobab, 'version', { | ||
value: '2.0.0-dev1' | ||
value: '2.0.0-dev2' | ||
}); | ||
@@ -402,0 +402,0 @@ |
@@ -98,3 +98,3 @@ /** | ||
const additionalPaths = this._facetPath ? | ||
getIn(this.tree._computedDataIndex, this._facetPath).paths : | ||
getIn(this.tree._computedDataIndex, this._facetPath).relatedPaths() : | ||
[]; | ||
@@ -101,0 +101,0 @@ |
@@ -10,2 +10,3 @@ /** | ||
deepFreeze, | ||
getIn, | ||
makeError, | ||
@@ -55,2 +56,5 @@ solveUpdate | ||
// Is the facet recursive? | ||
this.isRecursive = !!this.paths.filter(p => type.facetPath(p)).length; | ||
// Internal state | ||
@@ -71,3 +75,3 @@ this.state = { | ||
// Is this facet affected by the current write event? | ||
const concerned = solveUpdate([path], this.paths); | ||
const concerned = solveUpdate([path], this.relatedPaths()); | ||
@@ -85,2 +89,23 @@ if (concerned) { | ||
/** | ||
* Method returning solved paths related to the facet. | ||
* | ||
* @return {array} - An array of related paths. | ||
*/ | ||
relatedPaths() { | ||
if (!this.isRecursive) | ||
return this.paths; | ||
else | ||
return this.paths.reduce((paths, path) => { | ||
if (!type.facetPath(path)) | ||
return paths.concat(path); | ||
// Solving recursive path | ||
const relatedFacet = getIn(this.tree._computedDataIndex, path); | ||
return paths.concat(relatedFacet.relatedPaths()); | ||
}, []); | ||
} | ||
/** | ||
* Getter method | ||
@@ -87,0 +112,0 @@ * |
@@ -5,2 +5,3 @@ TODO | ||
* TRY RECURSIVE FACETS BITCH | ||
* DYNAMIC PATHS IN FACETS BITCH | ||
@@ -7,0 +8,0 @@ * Make the facets update work |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
154094
3760
0