From 117152d09069c9a10bac339de66bdb71f9b87288 Mon Sep 17 00:00:00 2001 From: Kevin Delisle Date: Fri, 19 May 2017 13:31:24 -0400 Subject: [PATCH] model-builder: JSDoc tidy-up --- lib/model-builder.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/model-builder.js b/lib/model-builder.js index 3de4a64a..10df4111 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -71,7 +71,7 @@ function isModelClass(cls) { * * @param {String} name The model name * @param {Boolean} forceCreate Whether the create a stub for the given name if a model doesn't exist. - * @returns {*} The model class + * @returns {ModelClass} The model class */ ModelBuilder.prototype.getModel = function(name, forceCreate) { var model = this.models[name]; @@ -116,7 +116,7 @@ ModelBuilder.prototype.getModelDefinition = function(name) { * @param {Object} properties Hash of class properties in format `{property: Type, property2: Type2, ...}` or `{property: {type: Type}, property2: {type: Type2}, ...}` * @param {Object} settings Other configuration of class * @param {Function} parent Parent model - * @return newly created class + * @return {ModelClass} The class constructor. * */ ModelBuilder.prototype.define = function defineClass(className, properties, settings, parent) { @@ -444,7 +444,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett * * - Any * - `{replace: true}` (default): child replaces the value from parent - * - assignin `null` on child setting deletes the inherited setting + * - assigning `null` on child setting deletes the inherited setting * * - Arrays: * - `{replace: false}`: unique elements of parent and child cumulate @@ -763,7 +763,10 @@ function hiddenProperty(where, property, value) { } /** - * Get the schema name + * Get the schema name. If no parameter is given, then an anonymous model name + * is generated and returned. + * @param {string=} name The optional name parameter. + * @returns {string} The schema name. */ ModelBuilder.prototype.getSchemaName = function(name) { if (name) { @@ -780,7 +783,8 @@ ModelBuilder.prototype.getSchemaName = function(name) { /** * Resolve the type string to be a function, for example, 'String' to String. * Returns {Function} if the type is resolved - * @param {String} type The type string, such as 'number', 'Number', 'boolean', or 'String'. It's case insensitive + * @param {String} type The type string, such as 'number', 'Number', 'boolean', + * or 'String'. This parameter is case insensitive. */ ModelBuilder.prototype.resolveType = function(type) { if (!type) { @@ -832,7 +836,8 @@ ModelBuilder.prototype.resolveType = function(type) { * 3. A list of property definitions (anonymous) * * @param {*} schemas The schemas - * @returns {Object} A map of model constructors keyed by model name + * @returns {Object.} A map of model constructors keyed by + * model name. */ ModelBuilder.prototype.buildModels = function(schemas, createModel) { var models = {}; @@ -887,7 +892,7 @@ ModelBuilder.prototype.buildModels = function(schemas, createModel) { * @param {String} name The model name * @param {Object} json The JSON object * @param {Object} options The options - * @returns {} + * @returns {ModelClass} The generated model class constructor. */ ModelBuilder.prototype.buildModelFromInstance = function(name, json, options) { // Introspect the JSON document to generate a schema