Skip to content

Commit

Permalink
add code to handle POST metadata's statements is object or array.
Browse files Browse the repository at this point in the history
  • Loading branch information
xcv58 committed Sep 17, 2015
1 parent 5ebb73c commit a1b886b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/server/RESTful/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ addDeviceToCollection = function(obj, collection) {
};

addMetadataToCollection = function(obj, collection) {
var statements = {};
obj.statements.forEach(function(oneStatement) {
statements[oneStatement.label] = oneStatement;
});
obj.statements = statements;
if (Array.isArray(obj.statements)) {
var statements = {};
obj.statements.forEach(function(oneStatement) {
statements[oneStatement.label] = oneStatement;
});
obj.statements = statements;
}
var newPackage = {
package: obj
};
Expand Down

0 comments on commit a1b886b

Please sign in to comment.