Skip to content

Commit

Permalink
feat: add isBlockStyle type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
theisel committed Jul 20, 2022
1 parent 0ca6330 commit 74574c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions component/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Node, BlockStyle } from "./types";

/** @typedef {import("./types").BlockStyle} BlockStyle */

/**
* Checks if (node) is of {@link BlockStyle}
* @param {Node} node
* @returns {boolean}
*/
export const isBlockStyle = (node: Node): node is BlockStyle =>
typeof (node as BlockStyle).style === "string";

0 comments on commit 74574c4

Please sign in to comment.