Skip to content

Commit ab31495

Browse files
committed
apply review comments
1 parent d9b7c48 commit ab31495

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/serializer.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { ObjectSerializer } from "./api";
22
import { V1ObjectMeta } from "./gen/model/v1ObjectMeta";
33

4-
export type AttributeType = {
4+
type AttributeType = {
55
name: string;
66
baseName: string;
77
type: string;
88
};
99

10-
export class KubernetesObject {
10+
class KubernetesObject {
1111
/**
1212
* APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1313
*/
@@ -68,14 +68,12 @@ class KubernetesObjectSerializer {
6868
}
6969

7070
const instance: Record<string, any> = {};
71-
const attributeTypes = KubernetesObject.attributeTypeMap;
72-
for (let index = 0; index < attributeTypes.length; index++) {
73-
let attributeType = attributeTypes[index];
71+
for (const attributeType of KubernetesObject.attributeTypeMap) {
7472
instance[attributeType.name] = ObjectSerializer.serialize(data[attributeType.baseName], attributeType.type);
7573
}
7674
// add all unknown properties as is.
7775
for (const [key, value] of Object.entries(data)) {
78-
if (attributeTypes.find((t) => t.name === key)) {
76+
if (KubernetesObject.attributeTypeMap.find((t) => t.name === key)) {
7977
continue;
8078
}
8179
instance[key] = value;
@@ -96,14 +94,12 @@ class KubernetesObjectSerializer {
9694
}
9795

9896
const instance = new KubernetesObject();
99-
const attributeTypes = KubernetesObject.attributeTypeMap;
100-
for (let index = 0; index < attributeTypes.length; index++) {
101-
let attributeType = attributeTypes[index];
97+
for (const attributeType of KubernetesObject.attributeTypeMap) {
10298
instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
10399
}
104100
// add all unknown properties as is.
105101
for (const [key, value] of Object.entries(data)) {
106-
if (attributeTypes.find((t) => t.name === key)) {
102+
if (KubernetesObject.attributeTypeMap.find((t) => t.name === key)) {
107103
continue;
108104
}
109105
instance[key] = value;

0 commit comments

Comments
 (0)