File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,13 +160,33 @@ var JSONResponse = {
160160 } ,
161161
162162 /**获取简单名称
163- * @param fullName name 或 name:alias
164- * @return name => name; name:alias => alias
163+ * @param fullName name 或 name:alias 或 User-name 或 User-name:alias
164+ * @return name => name; name:alias 或 User-name:alias => alias; User-name => userName
165165 */
166166 getSimpleName : function ( fullName ) {
167- //key:alias -> alias; key:alias[] -> alias[]
167+ //key:alias -> alias
168168 var index = fullName == null ? - 1 : fullName . indexOf ( ":" ) ;
169- return index < 0 ? fullName : fullName . substring ( index + 1 ) ;
169+ if ( index >= 0 ) {
170+ return fullName . substring ( index + 1 ) ;
171+ }
172+
173+ var left = index < 0 ? fullName : fullName . substring ( 0 , index ) ;
174+
175+ var first = true ;
176+ var name = '' ;
177+ var part ;
178+ do {
179+ index = left . indexOf ( "-" ) ;
180+ part = index < 0 ? left : left . substring ( 0 , index ) ;
181+
182+ name += StringUtil . firstCase ( part , ! first ) ;
183+ left = left . substring ( index + 1 ) ;
184+
185+ first = false ;
186+ }
187+ while ( index >= 0 )
188+
189+ return name ;
170190 } ,
171191
172192
You can’t perform that action at this time.
0 commit comments