MCPcopy Create free account
hub / github.com/csskit/csskit / format

Function format

crates/csskit_wasm/src/lib.rs:94–104  ·  view source on GitHub ↗
(source_text: String, options: JsValue)

Source from the content-addressed store, hash-verified

92
93#[wasm_bindgen]
94pub fn format(source_text: String, options: JsValue) -> Result<String, serde_wasm_bindgen::Error> {
95 let options: FormatOptions = match serde_wasm_bindgen::from_value(options) {
96 Ok(opts) => opts,
97 Err(_e) => {
98 #[cfg(feature = "console_error_panic_hook")]
99 web_sys::console::warn_1(&format!("Failed to parse format options: {}. Using defaults.", _e).into());
100 FormatOptions::default()
101 }
102 };
103 format_with_options(&source_text, options).map_err(serde_wasm_bindgen::Error::new)
104}
105
106fn format_with_options(source_text: &str, options: FormatOptions) -> Result<String, String> {
107 let allocator = Bump::default();

Callers 1

handleEventMethod · 0.85

Calls 1

format_with_optionsFunction · 0.85

Tested by

no test coverage detected