diff --git a/lib/KubeResourceMeta.js b/lib/KubeResourceMeta.js index b2b596d..16a0c4a 100644 --- a/lib/KubeResourceMeta.js +++ b/lib/KubeResourceMeta.js @@ -53,19 +53,19 @@ module.exports = class KubeResourceMeta { return this._resourceMeta; } get name() { - return this._resourceMeta.name || ''; + return (typeof this._resourceMeta.name === 'string') ? this._resourceMeta.name : ''; } get singularName() { - return this._resourceMeta.singularName || ''; + return (typeof this._resourceMeta.singularName === 'string') ? this._resourceMeta.singularName : ''; } get namespaced() { - return this._resourceMeta.namespaced || false; + return (typeof this._resourceMeta.namespaced === 'boolean') ? this._resourceMeta.namespaced : false; } get kind() { - return this._resourceMeta.kind || ''; + return (typeof this._resourceMeta.kind === 'string') ? this._resourceMeta.kind : ''; } get verbs() { - return this._resourceMeta.verbs || []; + return Array.isArray(this._resourceMeta.verbs) ? this._resourceMeta.verbs : []; } get kubeApiConfig() { return this._kubeApiConfig; @@ -75,11 +75,7 @@ module.exports = class KubeResourceMeta { } hasVerb(verb) { - let result=false; - if (Array.isArray(this.verbs)){ - result=this.verbs.some(v => verb == v); - } - return result; + return this.verbs.some(v => verb == v); } addHeader(key, value) { objectPath.set(this._extraHeaders, ['headers', key], value);