add jsdoc for global_dependencies

inner function names are renamed to keep consistency with exported names

Change-Id: I2f03d160f19ef57dc99d1aff9d1422ca983fb459
This commit is contained in:
Yujun Zhang
2016-07-20 10:19:51 +08:00
parent df6ee674df
commit f29944ba29

View File

@@ -17,6 +17,11 @@
* Access to the global-dependencies.json file. * Access to the global-dependencies.json file.
*/ */
/**
* Global dependency module
* @module
*/
'use strict'; 'use strict';
var globalDependencies = require('../../../global-dependencies.json'); var globalDependencies = require('../../../global-dependencies.json');
@@ -27,7 +32,7 @@ var globalDependencies = require('../../../global-dependencies.json');
* @param {String} name The name of the dependency. * @param {String} name The name of the dependency.
* @returns {Boolean} True if the dependency exists, otherwise false. * @returns {Boolean} True if the dependency exists, otherwise false.
*/ */
function containsDependency (name) { function contains (name) {
return globalDependencies.hasOwnProperty(name); return globalDependencies.hasOwnProperty(name);
} }
@@ -37,7 +42,7 @@ function containsDependency (name) {
* @param {String} name The dependency name. * @param {String} name The dependency name.
* @returns {String|undefined} The version, or undefined. * @returns {String|undefined} The version, or undefined.
*/ */
function getVersion (name) { function read (name) {
return globalDependencies[name] || undefined; return globalDependencies[name] || undefined;
} }
@@ -48,7 +53,7 @@ function getVersion (name) {
* @param {{}} dependencies The list of dependencies. * @param {{}} dependencies The list of dependencies.
* @returns {{}} The above list of dependencies, with only the appropriate versions updated. * @returns {{}} The above list of dependencies, with only the appropriate versions updated.
*/ */
function synchronizeDependencies (dependencies) { function synchronize (dependencies) {
var results = {}; var results = {};
for (var key in dependencies) { for (var key in dependencies) {
if (globalDependencies.hasOwnProperty(key)) { if (globalDependencies.hasOwnProperty(key)) {
@@ -61,7 +66,10 @@ function synchronizeDependencies (dependencies) {
} }
module.exports = { module.exports = {
contains: containsDependency, /** @see {@link module:global_dependencies~contains} */
read: getVersion, contains: contains,
synchronize: synchronizeDependencies /** @see {@link module:global_dependencies~read} */
read: read,
/** @see {@link module:global_dependencies~synchronize} */
synchronize: synchronize
}; };