Skip to content
Myr

Changed; res.locals() without object returns the locals

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 1555b92 · Browse files · 1 file+10 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−4 removed

  • other:+10 added−4 removed

1 file+10 added−4 removed

modified:lib/response.js+10 added-4 removed
383 unmodified lines
384 : this._locals[name] = val;385};386387/**388 * Assign several locals with the given `obj`.388 * Assign several locals with the given `obj`,389 * or return the locals.390 *391 * @param {Object} obj391 * @return {ServerResponse} for chaining392 * @return {Object|Undefined}393 * @api public394 */395396res.locals = function(obj){396 for (var key in obj) this.local(key, obj[key]);397 return this;397 if (obj) {398 for (var key in obj) {399 this.local(key, obj[key]);400 }401 } else {402 return this._locals;403 }404};