Open
Description
I created a clone statement function as part of a tool which takes statements from one LRS, modifies them and then sends them to another (with a new id). I figured it might be useful to include in this library.
function cloneStatement (inStatement){
var outStatement = JSON.parse(JSON.stringify(inStatement));
delete outStatement.authority;
delete outStatement.stored;
delete outStatement.id;
for (var property in outStatement) {
if (outStatement.hasOwnProperty(property)) {
if (outStatement[property] == null){
delete outStatement[property];
}
}
}
return new TinCan.Statement(outStatement);
}