[Pkg-javascript-commits] [node-clean-yaml-object] 10/21: remove last of the `node-tap` specific code

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:52:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-clean-yaml-object.

commit f1fc60503b8440a2421580dd5f52bc2add9e878c
Author: James Talmage <james at talmage.io>
Date:   Sat Jan 16 00:59:54 2016 -0500

    remove last of the `node-tap` specific code
---
 index.js | 33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/index.js b/index.js
index 1cabd6f..7e315fc 100644
--- a/index.js
+++ b/index.js
@@ -49,7 +49,7 @@ function cleanYamlObj(object, filter, isRoot, seen) {
 		var set = isArray ? [] : {};
 
 		// name is typically not an ownProperty on an Error
-		if (isError && object.name && !object.hasOwnProperty('name') && filter('name', isRoot, object)) {
+		if (isError && object.name && !object.hasOwnProperty('name') && filter('name', isRoot, object, set)) {
 			setProp('name', object, set, seen, filter);
 		}
 
@@ -66,7 +66,7 @@ function cleanYamlObj(object, filter, isRoot, seen) {
 				return set;
 			}
 
-			if (!filter(k, isRoot, object)) {
+			if (!filter(k, isRoot, object, set)) {
 				return set;
 			}
 
@@ -79,27 +79,6 @@ function cleanYamlObj(object, filter, isRoot, seen) {
 	return object;
 }
 
-/*
- var stack = null;
-
- ...
-
- // put this in filter
-
- if (isRoot && k === 'stack') {
-  stack = object[k];
-  return set;
- }
-
-....
-
- if (stack) {
- newObj.stack = stack;
- }
- return newObj;
-
- */
-
 function setProp(propName, source, target, seen, filter) {
 	if (seen.indexOf(source[propName]) === -1) {
 		target[propName] = cleanYamlObj(source[propName], filter, false, seen);
@@ -108,10 +87,6 @@ function setProp(propName, source, target, seen, filter) {
 	}
 }
 
-function defaultFilter(k, isRoot, object) {
-	if (isRoot && (k === 'todo' || k === 'skip')) {
-		return false;
-	}
-
-	return !(isRoot && k === 'at' && !object[k]);
+function defaultFilter() {
+	return true;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-clean-yaml-object.git



More information about the Pkg-javascript-commits mailing list