Flourish pocket knife
A module with handy tools that you can use in Flourish templates.
import { isUrl, isImage } from "@flourish/pocket-knife"
Functions
isUrl(string)
Checks if string looks like valid URL. Returns true
or false
isImage(string)
Checks if string looks like valid image URL. Returns true
or false
getTextWidth(string, font)
Gets width of text. First argument contains the text you want to calculate the width for. The second argument is optional and lets you set font settings for the text in the standard css font property, eg. 16px arial bold
. If font
is empty, it uses 10px sans-serif
.