Permalink
Browse files

misc linting on switch statements

  • Loading branch information...
domharrington committed Mar 26, 2013
1 parent 7628e7a commit 6b61b7fcf27e6de97b231307e08e95d9481a11d6
Showing with 30 additions and 30 deletions.
  1. +30 −30 lib/schemata.js
View
@@ -96,12 +96,12 @@ module.exports = function(schema) {
}
} else {
switch (type) {
- case Object:
- value = {};
- break;
- case Array:
- value = [];
- break;
+ case Object:
+ value = {};
+ break;
+ case Array:
+ value = [];
+ break;
}
}
newEntity[key] = value;
@@ -174,29 +174,29 @@ module.exports = function(schema) {
throw new Error('Missing type');
}
switch (type) {
- case Boolean:
- if (value === undefined || value === '' || value === null) {
- return null;
- }
- return !(value === false || value === 0 || value === '0' ||
- value === 'false' || value === 'off' || value === 'no');
- case Number:
- if (value === undefined || value === '' || value === null) {
- return null;
- }
- return +value;
- case String:
- if (value === undefined || value === '' || value === null) {
- return null;
- }
- return value.toString && value.toString();
- case Object:
- // typeof null === 'object', so the extra check is needed for null
- return (typeof value !== 'object' || value === null) ? {} : value;
- case Date:
- return (value === '' || value === null || value === undefined) ? null : (value instanceof Date ? value : new Date(value));
- case Array:
- return (value === '' || value === null || value === undefined) ? [] : (Array.isArray(value) ? value : [value]);
+ case Boolean:
+ if (value === undefined || value === '' || value === null) {
+ return null;
+ }
+ return !(value === false || value === 0 || value === '0' ||
+ value === 'false' || value === 'off' || value === 'no');
+ case Number:
+ if (value === undefined || value === '' || value === null) {
+ return null;
+ }
+ return +value;
+ case String:
+ if (value === undefined || value === '' || value === null) {
+ return null;
+ }
+ return value.toString && value.toString();
+ case Object:
+ // typeof null === 'object', so the extra check is needed for null
+ return (typeof value !== 'object' || value === null) ? {} : value;
+ case Date:
+ return (value === '' || value === null || value === undefined) ? null : (value instanceof Date ? value : new Date(value));
+ case Array:
+ return (value === '' || value === null || value === undefined) ? [] : (Array.isArray(value) ? value : [value]);
}
return value;
}
@@ -290,7 +290,7 @@ module.exports = function(schema) {
});
}
- }, function(error, results) {
+ }, function(error) {
seriesCallback(error || Object.keys(errors).length > 0);
});
}

0 comments on commit 6b61b7f

Please sign in to comment.