Skip to content

Commit ad3f82b

Browse files
committed
自动注释,自动生成代码:Table-key[]转为tableKeyList
1 parent a37bda1 commit ad3f82b

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

apijson/JSONResponse.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)