MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / parse_url

Function parse_url

bindings/javascript/src/options.rs:8–14  ·  view source on GitHub ↗
(url: Option<String>)

Source from the content-addressed store, hash-verified

6use wasm_bindgen::prelude::JsValue;
7
8fn parse_url(url: Option<String>) -> std::result::Result<Option<css_inline::Url>, JsError> {
9 Ok(if let Some(url) = url {
10 Some(css_inline::Url::parse(url.as_str()).map_err(|error| UrlError { error, url })?)
11 } else {
12 None
13 })
14}
15
16#[cfg(not(target_arch = "wasm32"))]
17#[cfg_attr(not(target_arch = "wasm32"), napi(object))]

Callers 1

try_fromMethod · 0.70

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected