1 Star 0 Fork 72

liuhongfei/freecodecamp.cn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
simple-json.js 3.31 KB
一键复制 编辑 原始数据 按行查看 历史
huluoyang 提交于 2016-04-30 09:22 . remove pt language
var fs = require('fs');
var source = [
'./seed/challenges/01-front-end-development-certification/html5-and-css.json',
'./seed/challenges/01-front-end-development-certification/bootstrap.json',
'./seed/challenges/01-front-end-development-certification/gear-up-for-success.json',
'./seed/challenges/01-front-end-development-certification/jquery.json',
'./seed/challenges/01-front-end-development-certification/basic-ziplines.json',
'./seed/challenges/01-front-end-development-certification/basic-javascript.json',
'./seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json',
'./seed/challenges/01-front-end-development-certification/basic-bonfires.json',
'./seed/challenges/01-front-end-development-certification/json-apis-and-ajax.json',
'./seed/challenges/01-front-end-development-certification/intermediate-ziplines.json',
'./seed/challenges/01-front-end-development-certification/intermediate-bonfires.json',
'./seed/challenges/01-front-end-development-certification/advanced-bonfires.json',
'./seed/challenges/01-front-end-development-certification/advanced-ziplines.json',
'./seed/challenges/01-front-end-development-certification/front-end-development-certificate.json',
'./seed/challenges/02-data-visualization-certification/sass.json',
'./seed/challenges/02-data-visualization-certification/react.json',
'./seed/challenges/02-data-visualization-certification/react-projects.json',
'./seed/challenges/02-data-visualization-certification/d3.json',
'./seed/challenges/02-data-visualization-certification/data-visualization-projects.json',
'./seed/challenges/02-data-visualization-certification/data-visualization-certificate.json',
'./seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json',
'./seed/challenges/03-back-end-development-certification/git.json',
'./seed/challenges/03-back-end-development-certification/nodejs-and-expressjs.json',
'./seed/challenges/03-back-end-development-certification/mongodb.json',
'./seed/challenges/03-back-end-development-certification/api-projects.json',
'./seed/challenges/03-back-end-development-certification/dynamic-web-applications.json',
'./seed/challenges/03-back-end-development-certification/back-end-development-certificate.json',
'./seed/challenges/04-video-challenges/computer-basics.json',
'./seed/challenges/04-video-challenges/dom.json',
'./seed/challenges/04-video-challenges/jslingo.json',
'./seed/challenges/04-video-challenges/chromedevtools.json',
'./seed/challenges/04-video-challenges/bigonotation.json'
];
for(var j=0;j<source.length;j++){
var res = fs.readFileSync(source[j],'utf-8')
var out = JSON.parse(res);
var challenges = out.challenges;
for(var i=0;i<challenges.length;i++){
delete challenges[i].namePtBR;
delete challenges[i].descriptionPtBR;
delete challenges[i].titleEs;
delete challenges[i].descriptionEs;
delete challenges[i].titleDe;
delete challenges[i].descriptionDe;
delete challenges[i].titlePt;
delete challenges[i].descriptionPt;
delete challenges[i].titleRu;
delete challenges[i].descriptionRu;
}
//由于JSON.stringify默认会自动压缩文件,不利于翻译,所以必须添加参数2,表示缩进为2个空格。
var input = JSON.stringify(out,null,2);
fs.writeFileSync(source[j],input)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/sandayleo/freecodecamp.cn.git
git@gitee.com:sandayleo/freecodecamp.cn.git
sandayleo
freecodecamp.cn
freecodecamp.cn
dev

搜索帮助