Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
for (let api of defaultApis) {
let apiPath = path.join(apisPath, api);
try {
let apiContent = JSON.parse(fs.readFileSync(path.join(resources, common.defaultLang, 'apis', api)));
if (fs.existsSync(apiPath)) {
apiContent = extend(true, [], apiContent, JSON.parse(fs.readFileSync(apiPath)));
}
let since = apiContent.since || common.lastest, deprecated = apiContent.deprecated || common.newest;
for (let method of (apiContent.methods || [])) {
since = common.minVersion(Enumerable.min(common.histroys(method.histroys), histroy => histroy.since, common.versionComparer), since);
deprecated = common.maxVersion(Enumerable.max(common.histroys(method.histroys), histroy => histroy.deprecated || common.lastest, common.versionComparer), deprecated);
}
for (let property of (apiContent.properties || [])) {
since = common.minVersion(Enumerable.min(common.histroys(property.histroys), histroy => histroy.since, common.versionComparer), since);
deprecated = common.maxVersion(Enumerable.max(common.histroys(property.histroys), histroy => histroy.deprecated || common.lastest, common.versionComparer), deprecated);
}
apis.children.push({
code: path.basename(api, jsonExt),
title: `${ apiContent.name || path.basename(api, jsonExt) } ${ common.capitalize(caption[apiContent.type]) }`,
since: since,
deprecated: deprecated
});
} catch(e) {
console.error(e);
}
}
directorys.splice(directorys.indexOf("apis"), 1, apis);
fs.writeFileSync(path.join(langPath, directoryFile), JSON.stringify(directorys, null, '\t'));
console.log(`Directory file for language ${ langName } is created`);
}
maxVersion(...versions) {
return Enumerable.max(versions, '', this.versionComparer);
},
minVersion(...versions) {