data-oriented-programming's Issues
wrong condition in threeWayMerge?
if(havePathInCommon(previousToCurrent, previousToNext)) {
return _.merge(current, previousToNext);
}
In the book, the explanation for the code above is:
"In order to determine whether there is a conflict, we calculate two diffs: the diff between previous and current and the diff between previous and next. If the intersection between the two diffs is empty, it means there is no conflict. We can safely patch the changes between previous to next into current."
Per my understanding the condition should be negated: if(**!**havePathInCommon(previousToCurrent, previousToNext)) { ...
It seems that the code throws exception if the intersection is empty.
havePathsInCommon will always return false for nested objects
the havePathInCommon
function of chapter 5 uses lodash intersection
which will always return false
.
data-oriented-programming/src/chapter05/paths-in-common.js
Lines 1 to 4 in 07bf95b
havePathInCommon
uses informationPaths
which returns an array of the paths, where each path is an array with keys as values of the array.
A return value example of informationPaths
would be:
[
['library', 'catalog', 'authorsById', '1', 'name'] ,
['library', 'userManagement', 'userssById', '1', 'name']
]
but lodash's intersection will not deeply check this nested array, so if the above path was compared with
[
['library', 'catalog', 'authorsById', '1', 'name'] ,
]
It will return false because arrays are reference type.
Images
Is there a bigger example for DOP that's not in Clojure?
Hi, besides the code in this library, is there some open source project or larger example for DOP that's not implemented in Clojure?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.