smartobject/ts/tools/exists.ts

15 lines
378 B
TypeScript
Raw Normal View History

2023-07-12 17:40:41 +00:00
import * as plugins from '../smartobject.plugins.js';
2022-03-07 14:28:32 +00:00
/**
* checks if an object has a parameter with a given key name, returns true if yes.
* @param parentObject
* @param childParam
* @returns {boolean}
*/
2023-07-12 17:40:41 +00:00
export let exists = (parentObject: object, childParam: string): boolean => {
2022-03-07 14:28:32 +00:00
if (parentObject.hasOwnProperty(childParam)) {
return true;
}
return false;
2023-07-12 17:40:41 +00:00
};