@@ -33,19 +33,7 @@ export default {
3333 } ,
3434 computed : {
3535 formOptions ( ) {
36- const options = this . options
37- // Normalize the given options array
38- if ( isArray ( options ) ) {
39- return options . map ( option => this . normalizeOption ( option ) )
40- } else if ( isPlainObject ( options ) ) {
41- // Deprecate the object options format
42- warn ( OPTIONS_OBJECT_DEPRECATED_MSG , this . $options . name )
43- // Normalize a `options` object to an array of options
44- return keys ( options ) . map ( key => this . normalizeOption ( options [ key ] || { } , key ) )
45- }
46- // If not an array or object, return an empty array
47- /* istanbul ignore next */
48- return [ ]
36+ return this . normalizeOptions ( this . options )
4937 }
5038 } ,
5139 methods : {
@@ -67,6 +55,20 @@ export default {
6755 text : stripTags ( String ( option ) ) ,
6856 disabled : false
6957 }
58+ } ,
59+ normalizeOptions ( options ) {
60+ // Normalize the given options array
61+ if ( isArray ( options ) ) {
62+ return options . map ( option => this . normalizeOption ( option ) )
63+ } else if ( isPlainObject ( options ) ) {
64+ // Deprecate the object options format
65+ warn ( OPTIONS_OBJECT_DEPRECATED_MSG , this . $options . name )
66+ // Normalize a `options` object to an array of options
67+ return keys ( options ) . map ( key => this . normalizeOption ( options [ key ] || { } , key ) )
68+ }
69+ // If not an array or object, return an empty array
70+ /* istanbul ignore next */
71+ return [ ]
7072 }
7173 }
7274}
0 commit comments