Skip to content

Commit 08d3029

Browse files
georgeajitgeorgeajit
authored andcommitted
#621 - Transform module for writeAll test
1 parent 6c3be79 commit 08d3029

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function writeTimestamp(context, params, content)
2+
{
3+
if (context.inputType.search('json') >= 0) {
4+
const result = content.toObject();
5+
result.writeTimestamp = fn.currentDateTime();
6+
7+
// Add a property for each caller-supplied request param
8+
for (const pname in params) {
9+
if (params.hasOwnProperty(pname)) {
10+
result[pname] = params[pname];
11+
}
12+
}
13+
return result;
14+
} else {
15+
// Pass thru for non-JSON documents
16+
return content;
17+
}
18+
};
19+
20+
exports.transform = writeTimestamp;

0 commit comments

Comments
 (0)