aboutsummaryrefslogtreecommitdiff
path: root/stack-core.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-01 13:29:10 -0400
committerSean Allred <code@seanallred.com>2014-11-01 13:29:10 -0400
commitb6b0b8dd82031eb55189ad3bea5eaacd8444b9d5 (patch)
tree700465dcf624682146779a14ae724722edd1908b /stack-core.el
parent2e9a5dbb953d463ef9e54beb84c6355ff22e35ad (diff)
More work on data filter; add tests
Diffstat (limited to 'stack-core.el')
-rw-r--r--stack-core.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/stack-core.el b/stack-core.el
index cf7dde5..be385c3 100644
--- a/stack-core.el
+++ b/stack-core.el
@@ -211,12 +211,19 @@ entire response as a complex alist."
(defun stack-core-filter-data (data desired-tree)
"Filters DATA and returns the DESIRED-TREE"
- (delq
- nil
- (mapcar (lambda (cons-cell)
- (when (member (car cons-cell) desired-tree)
- cons-cell))
- data)))
+ (if (vectorp data)
+ (mapcar (lambda (entry)
+ (stack-core-filter-data
+ entry desired-tree))
+ data)
+ (delq
+ nil
+ (mapcar (lambda (cons-cell)
+ (when (member (car cons-cell) desired-tree)
+ (if (sequencep (cdr cons-cell))
+ (stack-core-filter-data ))
+ cons-cell))
+ data))))
(provide 'stack-core)
;;; stack-core.el ends here