INNER CODE UNIT · TypeScript
checkType
org-formation/org-formation-cli · src/yaml-cfn/index.ts:45
const checkType = (obj: {}, keyName: string): boolean => {
return obj && typeof obj === 'object' && Object.keys(obj).length === 1 &&
obj.hasOwnProperty(keyName);
};
const overrides: any = {
// ShortHand notation for !GetAtt accepts Resource.Attribute format while the standard notation
// is to use an array [Resource, Attribute]. Convert shorthand to standard format.
GetAtt: {
parse: (data: any): any => typeof data === 'string' ? splitOne(data, '.') : data,
dump: (data: []): string => data.join('.'),
},
};
const applyOverrides = (data: any, tag: string, method: string): any => {
return overrides[tag] ? overrides[tag][method](data) : data;
};