Skip to content

Commit 0c0383c

Browse files
authored
chore: prettify load-rest-json-error-code-stub.ts (#1257)
1 parent a813d8d commit 0c0383c

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
/**
22
* Load an error code for the aws.rest-json-1.1 protocol.
33
*/
4-
const loadRestJsonErrorCode = (
5-
output: __HttpResponse,
6-
data: any
7-
): string => {
4+
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
85
const findKey = (object: any, key: string) =>
96
Object.keys(object).find(k => k.toLowerCase() === key.toLowerCase());
107

118
const sanitizeErrorCode = (rawValue: string): string => {
129
let cleanValue = rawValue;
13-
if (cleanValue.indexOf(':') >= 0) {
14-
cleanValue = cleanValue.split(':')[0];
10+
if (cleanValue.indexOf(":") >= 0) {
11+
cleanValue = cleanValue.split(":")[0];
1512
}
16-
if (cleanValue.indexOf('#') >= 0) {
17-
cleanValue = cleanValue.split('#')[1];
13+
if (cleanValue.indexOf("#") >= 0) {
14+
cleanValue = cleanValue.split("#")[1];
1815
}
1916
return cleanValue;
2017
};
@@ -28,9 +25,9 @@ const loadRestJsonErrorCode = (
2825
return sanitizeErrorCode(data.code);
2926
}
3027

31-
if (data['__type'] !== undefined) {
32-
return sanitizeErrorCode(data['__type']);
28+
if (data["__type"] !== undefined) {
29+
return sanitizeErrorCode(data["__type"]);
3330
}
3431

35-
return '';
36-
}
32+
return "";
33+
};

0 commit comments

Comments
 (0)