[Pkg-javascript-commits] [node-cssstyle] 15/39: tweaked background to work like the others

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Sep 20 19:37:32 UTC 2014


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

debacle pushed a commit to branch master
in repository node-cssstyle.

commit e7d15bb4ce34124531ce62b792b1de51885ce200
Author: Chad Walker <chad at chad-cat-lore-eddie.com>
Date:   Wed Dec 26 17:06:15 2012 -0600

    tweaked background to work like the others
---
 lib/properties/background.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/properties/background.js b/lib/properties/background.js
index f54cff9..4961825 100644
--- a/lib/properties/background.js
+++ b/lib/properties/background.js
@@ -11,7 +11,7 @@ var shorthand_for = {
 };
 
 /*
- * this either returns false meaning that it isn't valid
+ * this either returns undefined meaning that it isn't valid
  * or returns an object where the keys are dashed short
  * hand properties and the values are the values to set
  * on them
@@ -21,7 +21,7 @@ var parse = function parse(v) {
         return {};
     }
     var parts = v.split(/\s+/);
-    var valid = false;
+    var valid = true;
     var obj = {};
     parts.forEach(function (part) {
         var part_valid = false;
@@ -31,18 +31,22 @@ var parse = function parse(v) {
                 obj[shorthand_for[property]] = part;
             }
         });
-        valid = valid || part_valid;
+        valid = valid && part_valid;
     });
     if (!valid) {
-        return false;
+        return undefined;
     }
     return obj;
 };
 
+module.exports.isValid = function isValid(v) {
+    return parse(v) !== undefined;
+};
+
 module.exports.definition = {
     set: function (v) {
         var parsed = parse(v);
-        if (parsed === false) {
+        if (parsed === undefined) {
             return;
         }
         this.setProperty('background', v);

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



More information about the Pkg-javascript-commits mailing list