Created
July 17, 2016 15:01
-
-
Save Samsy/1e728e06c81ccbe5455413f32366ccfe to your computer and use it in GitHub Desktop.
This file contains hidden or 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 fs = require('fs'); | |
| var path = require('path'); | |
| var http = require('http'); | |
| var request = require('request'); | |
| var distTree = ('./'); | |
| var file = ('chin.json'); | |
| var file = path.resolve(distTree, file); | |
| var content = JSON.parse(fs.readFileSync(file, 'utf8')) | |
| var arr = content.data.attributes.position.array | |
| var arr2 = [] | |
| var i = 0 | |
| while( i < arr.length ) { | |
| arr2[i] = Number(arr[i].toFixed(1)) | |
| i++ | |
| } | |
| console.log(arr2) | |
| content.data.attributes.position.array = arr2 | |
| fs.writeFile('chinopti.json', JSON.stringify(content, null), function(err) { | |
| if(err) { | |
| return console.log(err); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment