Skip to content

Commit e69cf77

Browse files
committed
feat: make "options" optional
Signed-off-by: Chang Wang <[email protected]>
1 parent c597083 commit e69cf77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wasm/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ pub fn inline(
8080
html: &str,
8181
options: JsValue,
8282
) -> Result<String, JsValue> {
83-
let options: WasmOptions = options.into_serde().map_err(SerdeError)?;
83+
let options: Options = if !options.is_undefined() {
84+
options.into_serde().map_err(SerdeError)?
85+
} else {
86+
Options::default()
87+
};
8488
let inliner = rust_inline::CSSInliner::new(options.try_into()?);
8589
Ok(inliner.inline(html).map_err(InlineErrorWrapper)?)
8690
}

0 commit comments

Comments
 (0)