use lino_objects_codec::format::format_indented_ordered;
pub fn format_lino_record(id: &str, pairs: &[(&str, String)]) -> String {
let sanitized = pairs
.iter()
.map(|(key, value)| (*key, sanitize_lino_value(value)))
.collect::<Vec<_>>();
let borrowed = sanitized
.iter()
.map(|(key, value)| (*key, value.as_str()))
.collect::<Vec<_>>();
format_indented_ordered(id, &borrowed, " ")
.expect("static Links Notation records should be valid")
}
pub fn sanitize_lino_value(value: &str) -> String {
value
.replace('\r', "\\r")
.replace('\n', "\\n")
.replace('\t', "\\t")
}