Skip to content

Commit

Permalink
Use optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmielnik committed Aug 25, 2024
1 parent 6ab420d commit bdacc2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/has.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import { find } from './find';
*/
export const has = (node: Node, word: string): boolean => {
const foundNode = find(node, word);
return Boolean(foundNode && foundNode.wordEnd);
return Boolean(foundNode?.wordEnd);
};

0 comments on commit bdacc2a

Please sign in to comment.