Created
January 25, 2016 06:06
-
-
Save vikikamath/7d8e894b7f81ffec400e to your computer and use it in GitHub Desktop.
Playing with oboe.js
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
{ | |
"v":1, | |
"t":[{ | |
"t":7, | |
"e":"form", | |
"f":[{ | |
"t":7, | |
"e":"label", | |
"f":["Without Focus Handler"] | |
}, | |
" ", | |
{ | |
"t":7, | |
"e":"input", | |
"a":{ | |
"value":[] | |
} | |
}, | |
" ", | |
{ | |
"t":7, | |
"e":"label", | |
"f":["With Focus Handler"] | |
}, | |
" ", | |
{ | |
"t":7, | |
"e":"input", | |
"a":{ | |
"value":[] | |
}, | |
"v":{ | |
"focus":"blah", | |
"focusin":"blah" | |
} | |
}] | |
}] | |
} |
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
var oboe = require('oboe'); | |
var fs = require('fs'); | |
oboe(fs.createReadStream( 'blah.json' )) | |
.node({ | |
'{t e}': function(x, path){ | |
//console.log(path); | |
if (x.e === "input" && x.v){ | |
delete x.v["focusin"]; | |
} | |
return; | |
} | |
}) | |
.done(function(json){ | |
console.log(JSON.stringify(json)); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment