Last active
July 29, 2017 07:59
-
-
Save thirdknife/775d5eed45c10cff81b4f2962b3f8109 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
var R = require('ramda') | |
var fs = require('fs') | |
var Promise = require("bluebird"); | |
var logFile = fs.readFileSync('Project.xml', {encoding: 'utf8'}) | |
var parseString = require('xml2js').parseString; | |
var readXMLFile = Promise.promisify(parseString); | |
var parseLog = R.composeP( | |
console.log, | |
R.prop('Project'), | |
readXMLFile | |
); | |
parseLog(logFile); | |
/*{ Project: | |
{ '$': | |
{ Version: '3', | |
MapDefines: 'Default', | |
PhysicsLookup: 'Default', | |
IDMapper: 'Default', | |
Mesh: '....', | |
PreviewResolution: '1.0', | |
FlipY: 'false', | |
HQCurvature: 'true', | |
SeamTermination: 'false' }, | |
Materials: [ [Object] ] } } | |
returns | |
{ '$': | |
{ Version: '3', | |
MapDefines: 'Default', | |
PhysicsLookup: 'Default', | |
IDMapper: 'Default', | |
Mesh: '.....', | |
PreviewResolution: '1.0', | |
FlipY: 'false', | |
HQCurvature: 'true', | |
SeamTermination: 'false' }, | |
Materials: [ { Camera1: [Object] } ] } | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment