1
0
Fork 0

_.extend -> Object.assign

This commit is contained in:
Alan Plum 2016-04-20 14:45:04 +02:00
parent 249dddcdf4
commit 0fff3e661f
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
2 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,4 @@
'use strict';
const _ = require('lodash');
const dd = require('dedent');
const joi = require('joi');
const httpError = require('http-errors');
@ -43,7 +42,7 @@ router.post(function (req, res) {
}
throw e;
}
_.extend(<%= document %>, meta);
Object.assign(<%= document %>, meta);
res.status(201);
res.set('location', req.makeAbsolute(
req.reverse('detail', {key: <%= document %>._key})
@ -96,7 +95,7 @@ router.put(':key', function (req, res) {
}
throw e;
}
_.extend(<%= document %>, meta);
Object.assign(<%= document %>, meta);
res.send(<%= document %>);
}, 'replace')
.pathParam('key', keySchema)

View File

@ -1,5 +1,4 @@
'use strict';
const _ = require('lodash');
const dd = require('dedent');
const joi = require('joi');
const httpError = require('http-errors');
@ -21,8 +20,8 @@ const HTTP_CONFLICT = status('conflict');
const router = createRouter();
module.exports = router;
const New<%= model %> = _.extend({}, <%= model %>, {
schema: _.extend({}, <%= model %>.schema, {
const New<%= model %> = Object.assign({}, <%= model %>, {
schema: Object.assign({}, <%= model %>.schema, {
_from: joi.string(),
_to: joi.string()
})
@ -50,7 +49,7 @@ router.post(function (req, res) {
}
throw e;
}
_.extend(<%= document %>, meta);
Object.assign(<%= document %>, meta);
res.status(201);
res.set('location', req.makeAbsolute(
req.reverse('detail', {key: <%= document %>._key})
@ -103,7 +102,7 @@ router.put(':key', function (req, res) {
}
throw e;
}
_.extend(<%= document %>, meta);
Object.assign(<%= document %>, meta);
res.send(<%= document %>);
}, 'replace')
.pathParam('key', keySchema)