Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: lib/src/util.dart

Issue 1274763005: Clean up: (Closed) Base URL: https://github.com/dart-lang/markdown.git@master
Patch Set: Bump. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/inline_parser.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library markdown.util; 1 library markdown.src.util;
2 2
3 /// Replaces `<`, `&`, and `>`, with their HTML entity equivalents. 3 /// Replaces `<`, `&`, and `>`, with their HTML entity equivalents.
4 String escapeHtml(String html) { 4 String escapeHtml(String html) {
5 if (html == '' || html == null) return null;
6 return html 5 return html
7 .replaceAll('&', '&amp;') 6 .replaceAll('&', '&amp;')
8 .replaceAll('<', '&lt;') 7 .replaceAll('<', '&lt;')
9 .replaceAll('>', '&gt;'); 8 .replaceAll('>', '&gt;');
10 } 9 }
11
12 /// Removes null or empty values from [map].
13 void cleanMap(Map map) {
14 map.keys.where((e) => isNullOrEmpty(map[e])).toList().forEach(map.remove);
15 }
16
17 /// Returns true if an object is null or an empty string.
18 bool isNullOrEmpty(object) {
19 return object == null || object == '';
20 }
OLDNEW
« no previous file with comments | « lib/src/inline_parser.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698