lost+found/src/params.js
function (definition) {
                var
                    result = new gpf.Parameter(),
                    typeDefaultValue;
                if (definition === gpf.Parameter.VERBOSE
                    || definition.prefix === gpf.Parameter.VERBOSE) {
                    definition = {
                        name: "verbose",
                        description: "Enable verbose mode",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.VERBOSE
                    };
                } else if (definition === gpf.Parameter.HELP
                           || definition.prefix === gpf.Parameter.HELP) {
                    definition = {
                        name: "help",
                        description: "Display help",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.HELP
                    };
                }
                gpf.json.load(result, definition);
                // name is required
                if (!result._name) {
                    gpf.Error.paramsNameRequired();
                }
                if (!result._multiple) {
                    /**
                     * When multiple is used, the default value will be an array
                     * if not specified.
                     * Otherwise, we get the default value based on the type
                     */
                    typeDefaultValue = this.DEFAULTS[result._type];
                    if (undefined === typeDefaultValue) {
                        gpf.Error.paramsTypeUnknown();
                    }
                    if (result.hasOwnProperty("_defaultValue")) {
                        result._defaultValue =
                            gpf.value(result._defaultValue, typeDefaultValue,
                                result._type);
                    }
                }
                return result;
            }
function (definition) {
                var
                    result = new gpf.Parameter(),
                    typeDefaultValue;
                if (definition === gpf.Parameter.VERBOSE
                    || definition.prefix === gpf.Parameter.VERBOSE) {
                    definition = {
                        name: "verbose",
                        description: "Enable verbose mode",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.VERBOSE
                    };
                } else if (definition === gpf.Parameter.HELP
                           || definition.prefix === gpf.Parameter.HELP) {
                    definition = {
                        name: "help",
                        description: "Display help",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.HELP
                    };
                }
                gpf.json.load(result, definition);
                // name is required
                if (!result._name) {
                    gpf.Error.paramsNameRequired();
                }
                if (!result._multiple) {
                    /**
                     * When multiple is used, the default value will be an array
                     * if not specified.
                     * Otherwise, we get the default value based on the type
                     */
                    typeDefaultValue = this.DEFAULTS[result._type];
                    if (undefined === typeDefaultValue) {
                        gpf.Error.paramsTypeUnknown();
                    }
                    if (result.hasOwnProperty("_defaultValue")) {
                        result._defaultValue =
                            gpf.value(result._defaultValue, typeDefaultValue,
                                result._type);
                    }
                }
                return result;
            }
function ( definition ) { var result = new gpf . Parameter ( ) , typeDefaultValue ; if ( definition === gpf . Parameter . VERBOSE || definition . prefix === gpf . Parameter . VERBOSE ) { definition = { name : "verbose" , description : "Enable verbose mode" , type : "boolean" , defaultValue : false , prefix : gpf . Parameter . VERBOSE } ; } else if ( definition === gpf . Parameter . HELP || definition . prefix === gpf . Parameter . HELP ) { definition = { name : "help" , description : "Display help" , type : "boolean" , defaultValue : false , prefix : gpf . Parameter . HELP } ; } gpf . json . load ( result , definition ) ; // name is required if ( ! result . _name ) { gpf . Error . paramsNameRequired ( ) ; } if ( ! result . _multiple ) { /**
                     * When multiple is used, the default value will be an array
                     * if not specified.
                     * Otherwise, we get the default value based on the type
                     */ typeDefaultValue = this . DEFAULTS [ result . _type ] ; if ( undefined === typeDefaultValue ) { gpf . Error . paramsTypeUnknown ( ) ; } if ( result . hasOwnProperty ( "_defaultValue" ) ) { result . _defaultValue = gpf . value ( result . _defaultValue , typeDefaultValue , result . _type ) ; } } return result ; }
Create a parameter from the definition object

@param {Object} definition
@return {gpf.Parameter}
@private
Create a parameter from the definition object