homey-lib
Advanced tools
Comparing version 1.0.52 to 1.0.53
@@ -187,35 +187,50 @@ "use strict"; | ||
if( lvl_publish && typeof json.contributors != 'undefined' ) { | ||
[ 'developers', 'translators' ].forEach(function(contributor_type){ | ||
if( Array.isArray(json.contributors[contributor_type]) ) { | ||
json.contributors[contributor_type].forEach(function(contributor, i){ | ||
if( typeof contributor == 'object' ) { | ||
if( typeof contributor.name != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].name` is undefined or not a string"); | ||
if( typeof contributor.email != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].email` is undefined or not a string"); | ||
if( contributor_type == 'translators' ) { | ||
if( Array.isArray(contributor.languages) ) { | ||
contributor.languages.forEach(function(language, j){ | ||
if( typeof language != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].languages[" + j + "]` is not a string"); | ||
}) | ||
} else { | ||
error("`contributors." + contributor_type + "[" + i + "].languages` is not an array"); | ||
if( typeof json.contributors === 'object' ) { | ||
if( typeof json.contributors === 'undefined' ) | ||
error('`contributors` is undefined'); | ||
if( json.contributors === null ) | ||
error('`contributors` is null'); | ||
if( Array.isArray(json.contributors) ) | ||
error('`contributors` is Array, expected Object'); | ||
[ 'developers', 'translators' ].forEach(function(contributor_type){ | ||
if( Array.isArray(json.contributors[contributor_type]) ) { | ||
json.contributors[contributor_type].forEach(function(contributor, i){ | ||
if( typeof contributor == 'object' ) { | ||
if( typeof contributor.name != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].name` is undefined or not a string"); | ||
if( typeof contributor.email != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].email` is undefined or not a string"); | ||
if( contributor_type == 'translators' ) { | ||
if( Array.isArray(contributor.languages) ) { | ||
contributor.languages.forEach(function(language, j){ | ||
if( typeof language != 'string' ) | ||
error("`contributors." + contributor_type + "[" + i + "].languages[" + j + "]` is not a string"); | ||
}) | ||
} else { | ||
error("`contributors." + contributor_type + "[" + i + "].languages` is not an array"); | ||
} | ||
} | ||
} else { | ||
error("`contributors." + contributor_type + "[" + i + "]` is not an object"); | ||
} | ||
} else { | ||
error("`contributors." + contributor_type + "[" + i + "]` is not an object"); | ||
} | ||
}); | ||
} else if( typeof json.contributors[contributor_type] != 'undefined' ) { | ||
error("`contributors.developers` is not an array"); | ||
} | ||
}) | ||
}); | ||
} else if( typeof json.contributors[contributor_type] != 'undefined' ) { | ||
error("`contributors." + contributor_type + "` is not an array"); | ||
} | ||
}) | ||
} else { | ||
error('`contributors` is not an object'); | ||
} | ||
} | ||
@@ -222,0 +237,0 @@ |
{ | ||
"name": "homey-lib", | ||
"version": "1.0.52", | ||
"version": "1.0.53", | ||
"description": "Library for Homey", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
124159
2105