eslint-plugin-logical-properties
Version:
12 lines (11 loc) • 380 B
JavaScript
export const isValidProperty = (property) => {
if (typeof property !== 'object' || property === null) {
return false;
}
const candidate = property;
return (candidate.type === 'Property'
&& !!candidate.key
&& (candidate.key.type === 'Identifier'
|| candidate.key.type === 'Literal')
&& candidate.value !== undefined);
};