Last active
June 27, 2016 22:27
-
-
Save coodoo/c3df4b5b746d76cda2524ec7ffab99e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hyperarray from 'hyper-array' | |
import memdb from 'memdb' | |
const dag = hyperarray( memdb() ) | |
// step 1 | |
// api: array.insert(value, [before], [after], [cb=function (err, entry) {}]) | |
dag.insert( 'abc', null, null, ( err, node ) => { | |
conole.log( node ) | |
}) | |
// step 2 | |
// how to insert z between b and c? | |
// Pseudo code should look like below but how do one get the id of 'b' and 'c'? | |
dag.insert( 'z', 'b', 'c', cb ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment