aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-14 00:52:47 -0500
committerSean Allred <code@seanallred.com>2014-11-14 00:52:47 -0500
commit57a55e2721b4f40c892e716831d4f29054f8e631 (patch)
tree234335240de1aff4437a3bce841890db79f2e7eb
parentca39e18431537c87f71a3f67999f79aa32d97fca (diff)
Simplify deep-clean function further
If it is not a cons cell, then it is an atom. We don't need to use `cond' for this.
-rw-r--r--sx-encoding.el15
1 files changed, 5 insertions, 10 deletions
diff --git a/sx-encoding.el b/sx-encoding.el
index 0653d77..9d48e60 100644
--- a/sx-encoding.el
+++ b/sx-encoding.el
@@ -88,31 +88,26 @@ Applies `sx-encoding-normalize-line-endings' and
(sx-encoding-normalize-line-endings
string)))
-;;; @TODO: This is a pretty ugly implementation. It can likely be
-;;; simplified and it should be improved.
(defun sx-encoding-clean-content-deep (data)
"Clean DATA recursively where necessary.
See `sx-encoding-clean-content'."
- (cond
+ (if (consp data)
;; If we're looking at a cons cell, test to see if is a list. If
;; it is, map ourselves over the entire list. If it is not,
;; reconstruct the cons cell using a cleaned cdr.
- ((consp data)
- (if (listp (cdr data))
- (cl-map #'list #'sx-encoding-clean-content-deep data)
- (cons (car data) (sx-encoding-clean-content-deep (cdr data)))))
+ (if (listp (cdr data))
+ (cl-map #'list #'sx-encoding-clean-content-deep data)
+ (cons (car data) (sx-encoding-clean-content-deep (cdr data))))
;; If we're looking at an atom, clean and return if we're looking
;; at a string, map if we're looking at a vector, and just return
;; if we aren't looking at either.
- ((atom data)
(cond
((stringp data)
(sx-encoding-clean-content data))
((vectorp data)
(cl-map #'vector #'sx-encoding-clean-content-deep data))
- (t data)))
- (t data)))
+ (t data))))
(defun sx-encoding-gzipped-p (data)
"Checks for magic bytes in DATA.