tsain-pattern 0.1.0

Chain TypeScript and Rust in fast and secure way
Documentation
mod patterns;
pub use patterns::{Composition, EnumPattern, PropsPattern, TsainPattern};

mod formatter;

fn format_type_args(type_args: &[&str]) -> String {
    if type_args.is_empty() {
        String::new()
    } else {
        format!("<{}>", type_args.join(", "))
    }
}

/// append "\n" when script is not empty && not ends with it.
fn linebreak(script: &mut String) {
    if !script.is_empty() && !script.ends_with("\n") {
        script.push_str("\n");
    }
}

fn linebreak2(script: &mut String) {
    linebreak(script);
    script.push_str("\n");
}