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

Remove utils-merge dependency - use spread syntax instead #6091

Merged
merged 1 commit into from
Jan 8, 2025
Merged
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
@@ -1,6 +1,7 @@
unreleased
========================

* Remove `utils-merge` dependency - use spread syntax instead
* Remove `Object.setPrototypeOf` polyfill
* cleanup: remove AsyncLocalStorage check from tests
* cleanup: remove unnecessary require for global Buffer
Expand Down
12 changes: 1 addition & 11 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 @@ -525,7 +524,6 @@ app.render = function render(name, options, callback) {
var done = callback;
var engines = this.engines;
var opts = options;
var renderOptions = {};
var view;

// support callback function as second arg
Expand All @@ -534,16 +532,8 @@ app.render = function render(name, options, callback) {
opts = {};
}

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

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

// merge options
merge(renderOptions, opts);
var renderOptions = { ...this.locals, ...opts._locals, ...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 = { ...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 = { ...options };

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