src/aria/resources/handlers/LCResourcesHandler.js
function (suggestions) {

                if (typesUtil.isArray(suggestions)) {
                    var newSuggestions = [], suggestionsLabel = this._options.labelKey, suggestionsCode = this._options.codeKey;
                    if (this._options.sortingMethod && typesUtil.isFunction(this._options.sortingMethod)) {
                        suggestions.sort(this._options.sortingMethod);
                    } else {
                        suggestions.sort(function (a, b) {
                            return (a[suggestionsLabel] < b[suggestionsLabel])
                                    ? 1
                                    : (a[suggestionsLabel] > b[suggestionsLabel]) ? -1 : 0;
                        });
                    }

                    for (var index = 0, l = suggestions.length; index < l; index++) {
                        var suggestion = suggestions[index], eachSuggestion = {};
                        if (this.__islabelCode && !jsonValidator.check(suggestion, this.SUGGESTION_BEAN)) {
                            return this.$logError(this.INVALID_SUGGESTIONS, null, suggestions);

                        } else if (!(suggestion.hasOwnProperty(suggestionsLabel) && suggestion.hasOwnProperty(suggestionsCode))) {
                            return this.$logError(this.INVALID_KEYCODE, null, suggestions);
                        }
                        eachSuggestion.label = suggestion[suggestionsLabel];
                        eachSuggestion.code = suggestion[suggestionsCode];
                        var newSuggestion = {
                            label : stringUtil.stripAccents(eachSuggestion.label).toLowerCase(),
                            code : stringUtil.stripAccents(eachSuggestion.code).toLowerCase(),
                            original : eachSuggestion
                        };
                        if (this._labelMatchAtWordBoundaries) {
                            newSuggestion.wordBoundaries = this.__getWordBoundaries(newSuggestion.label);
                        }
                        newSuggestions.push(newSuggestion);
                    }
                    this._suggestions = newSuggestions;

                } else {
                    return this.$logError(this.INVALD_SUGGESTION_TYPE, null, suggestions);
                }

            }
function (suggestions) {

                if (typesUtil.isArray(suggestions)) {
                    var newSuggestions = [], suggestionsLabel = this._options.labelKey, suggestionsCode = this._options.codeKey;
                    if (this._options.sortingMethod && typesUtil.isFunction(this._options.sortingMethod)) {
                        suggestions.sort(this._options.sortingMethod);
                    } else {
                        suggestions.sort(function (a, b) {
                            return (a[suggestionsLabel] < b[suggestionsLabel])
                                    ? 1
                                    : (a[suggestionsLabel] > b[suggestionsLabel]) ? -1 : 0;
                        });
                    }

                    for (var index = 0, l = suggestions.length; index < l; index++) {
                        var suggestion = suggestions[index], eachSuggestion = {};
                        if (this.__islabelCode && !jsonValidator.check(suggestion, this.SUGGESTION_BEAN)) {
                            return this.$logError(this.INVALID_SUGGESTIONS, null, suggestions);

                        } else if (!(suggestion.hasOwnProperty(suggestionsLabel) && suggestion.hasOwnProperty(suggestionsCode))) {
                            return this.$logError(this.INVALID_KEYCODE, null, suggestions);
                        }
                        eachSuggestion.label = suggestion[suggestionsLabel];
                        eachSuggestion.code = suggestion[suggestionsCode];
                        var newSuggestion = {
                            label : stringUtil.stripAccents(eachSuggestion.label).toLowerCase(),
                            code : stringUtil.stripAccents(eachSuggestion.code).toLowerCase(),
                            original : eachSuggestion
                        };
                        if (this._labelMatchAtWordBoundaries) {
                            newSuggestion.wordBoundaries = this.__getWordBoundaries(newSuggestion.label);
                        }
                        newSuggestions.push(newSuggestion);
                    }
                    this._suggestions = newSuggestions;

                } else {
                    return this.$logError(this.INVALD_SUGGESTION_TYPE, null, suggestions);
                }

            }
function ( suggestions ) { if ( typesUtil . isArray ( suggestions ) ) { var newSuggestions = [ ] , suggestionsLabel = this . _options . labelKey , suggestionsCode = this . _options . codeKey ; if ( this . _options . sortingMethod && typesUtil . isFunction ( this . _options . sortingMethod ) ) { suggestions . sort ( this . _options . sortingMethod ) ; } else { suggestions . sort ( function ( a , b ) { return ( a [ suggestionsLabel ] < b [ suggestionsLabel ] ) ? 1 : ( a [ suggestionsLabel ] > b [ suggestionsLabel ] ) ? - 1 : 0 ; } ) ; } for ( var index = 0 , l = suggestions . length ; index < l ; index ++ ) { var suggestion = suggestions [ index ] , eachSuggestion = { } ; if ( this . __islabelCode && ! jsonValidator . check ( suggestion , this . SUGGESTION_BEAN ) ) { return this . $logError ( this . INVALID_SUGGESTIONS , null , suggestions ) ; } else if ( ! ( suggestion . hasOwnProperty ( suggestionsLabel ) && suggestion . hasOwnProperty ( suggestionsCode ) ) ) { return this . $logError ( this . INVALID_KEYCODE , null , suggestions ) ; } eachSuggestion . label = suggestion [ suggestionsLabel ] ; eachSuggestion . code = suggestion [ suggestionsCode ] ; var newSuggestion = { label : stringUtil . stripAccents ( eachSuggestion . label ) . toLowerCase ( ) , code : stringUtil . stripAccents ( eachSuggestion . code ) . toLowerCase ( ) , original : eachSuggestion } ; if ( this . _labelMatchAtWordBoundaries ) { newSuggestion . wordBoundaries = this . __getWordBoundaries ( newSuggestion . label ) ; } newSuggestions . push ( newSuggestion ) ; } this . _suggestions = newSuggestions ; } else { return this . $logError ( this . INVALD_SUGGESTION_TYPE , null , suggestions ) ; } }
Set the list of available suggestion
@param {Array} suggestions list of suggestion objects
Set the list of available suggestion