Index: third_party/pkg/markdown/lib/src/util.dart |
diff --git a/third_party/pkg/markdown/lib/src/util.dart b/third_party/pkg/markdown/lib/src/util.dart |
index a6d52de8ac115bebf6e6bc8f85789f524c3c05b9..2da80da2966fee0fd3d580da59bed622c9e942de 100644 |
--- a/third_party/pkg/markdown/lib/src/util.dart |
+++ b/third_party/pkg/markdown/lib/src/util.dart |
@@ -2,7 +2,21 @@ library markdown.util; |
/// Replaces `<`, `&`, and `>`, with their HTML entity equivalents. |
String escapeHtml(String html) { |
+ if (html == '' || html == null) return null; |
return html.replaceAll('&', '&') |
.replaceAll('<', '<') |
.replaceAll('>', '>'); |
} |
+ |
+/// Removes null or empty values from [map]. |
+void cleanMap(Map map) { |
+ map.keys |
+ .where((e) => isNullOrEmpty(map[e])) |
+ .toList() |
+ .forEach(map.remove); |
+} |
+ |
+/// Returns true if an object is null or an empty string. |
+bool isNullOrEmpty(object) { |
+ return object == null || object == ''; |
+} |