2

我正在尝试在主干模型中使用 JSDoc,所以我有以下profile.js文件:

/** 
        A module representing a Profile.
        @exports models/profle
        @example
        // Load module
        require(['models/profile'], function(Profile) {
            var Myprofile = new Profile();
        });         
    */

define(['backbone'], function(Backbone) {
    /** 
            @constructor
            @requires Backbone
            @augments module:Backbone.Model
        */

    var Profile = Backbone.Model.extend({
         /** 
                @lends profile.prototype
            */

        defaults: {
            PIN : null,
            is_guest: true,
            has_pin: false,
            imgSrc: null
        },

            /** 
                    Validate a Profile 
                    The validate method is passed the model attributes, as well as the options from set or save
                    @param {attrs} The attributes of the profile
                    @param {options} The options from set or save
                */
        validate: function(attrs, options) {
            if (!attrs.name || attrs.name.length == 0) 
                return 'You must enter a name!';

            if (!!attrs.name && attrs.name.length < 1 && attrs.name.length > 24)
                return "User name must be between 1 and 24 characters";

            if (!attrs.password || attrs.password.length != 4) 
                return "The pincode has to be four digits"; 

            if (!attrs.password || attrs.password != attrs.confirmPassword)
                return "Confirmed pincode does not match";          
        }

    });

    return Profile;

});

问题是当我执行 `jsdoc profile.js -d="home/mydocumentation" 时会生成警告

>> 警告:尝试将验证记录为未记录符号配置文件的成员。

并且它没有记录验证功能,知道我做错了什么吗?

4

0 回答 0