Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace utils-merge dependency with Object.assign() #6194

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ unreleased
* cleanup: remove AsyncLocalStorage check from tests
* cleanup: remove unnecessary require for global Buffer
* perf: use loop for acceptParams
* Replace `utils-merge` dependency with `Object.assign()`

5.0.1 / 2024-10-08
==========
Expand Down
7 changes: 3 additions & 4 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var http = require('http');
var compileETag = require('./utils').compileETag;
var compileQueryParser = require('./utils').compileQueryParser;
var compileTrust = require('./utils').compileTrust;
var merge = require('utils-merge');
var resolve = require('path').resolve;
var once = require('once')
var Router = require('router');
Expand Down Expand Up @@ -535,15 +534,15 @@ app.render = function render(name, options, callback) {
}

// merge app.locals
merge(renderOptions, this.locals);
Object.assign(renderOptions, this.locals);

// merge options._locals
if (opts._locals) {
merge(renderOptions, opts._locals);
Object.assign(renderOptions, opts._locals);
}

// merge options
merge(renderOptions, opts);
Object.assign(renderOptions, opts);

// set .cache unless explicitly provided
if (renderOptions.cache == null) {
Expand Down
3 changes: 1 addition & 2 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var mime = require('mime-types')
var path = require('path');
var pathIsAbsolute = require('path').isAbsolute;
var statuses = require('statuses')
var merge = require('utils-merge');
var sign = require('cookie-signature').sign;
var normalizeType = require('./utils').normalizeType;
var normalizeTypes = require('./utils').normalizeTypes;
Expand Down Expand Up @@ -732,7 +731,7 @@ res.clearCookie = function clearCookie(name, options) {
*/

res.cookie = function (name, value, options) {
var opts = merge({}, options);
var opts = Object.assign({}, options);
var secret = this.req.secret;
var signed = opts.signed;

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"serve-static": "^2.1.0",
"statuses": "2.0.1",
"type-is": "^2.0.0",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions test/res.cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var express = require('../')
, request = require('supertest')
, cookieParser = require('cookie-parser')
var merge = require('utils-merge');

describe('res', function(){
describe('.cookie(name, object)', function(){
Expand Down Expand Up @@ -130,7 +129,7 @@ describe('res', function(){
var app = express();

var options = { maxAge: 1000 };
var optionsCopy = merge({}, options);
var optionsCopy = Object.assign({}, options);

app.use(function(req, res){
res.cookie('name', 'tobi', options)
Expand Down