Comparing version 1.7.2 to 1.7.3
@@ -28,6 +28,8 @@ 'use strict' | ||
Insertion.prototype.execute = function (db, context, done) { | ||
var that = this | ||
var that = this, | ||
value | ||
// Prepare the document | ||
context[that.name] = this.value.execute(context, '<' + this.name + ' in ' + this.collection + '>') | ||
value = this.value.execute(context, '<' + this.name + ' in ' + this.collection + '>') | ||
context[that.name] = copyDeep(value) | ||
db.collection(this.collection).insert(context[that.name], { | ||
@@ -38,2 +40,24 @@ w: 1 | ||
module.exports = Insertion | ||
module.exports = Insertion | ||
/** | ||
* @param {*} x | ||
* @returns {*} | ||
* @private | ||
*/ | ||
function copyDeep(x) { | ||
var r, key | ||
if (Array.isArray(x)) { | ||
return x.map(copyDeep) | ||
} else if (x && typeof x === 'object' && | ||
(x.constructor === Object || !Object.getPrototypeOf(x))) { | ||
// Map | ||
r = Object.create(null) | ||
for (key in x) { | ||
r[key] = copyDeep(x[key]) | ||
} | ||
return r | ||
} else { | ||
return x | ||
} | ||
} |
{ | ||
"name": "api-test", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"author": "Sitegui <sitegui@sitegui.com.br>", | ||
@@ -5,0 +5,0 @@ "description": "API testing made simple", |
@@ -97,2 +97,6 @@ 'use strict' | ||
app.post('/echo', function (req, res) { | ||
res.success(req.body) | ||
}) | ||
server = http.createServer(app) | ||
@@ -99,0 +103,0 @@ server.listen(port) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60729
31
1795