Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+23 added−0 removed
other:+23 added−0 removed
Provenance
Commit
cdbd8af
Tree
16767ce
Author
Tj Holowaychuk <tj@vision-media.ca>
Committer
Tj Holowaychuk <tj@vision-media.ca>
Parent
a6fdc1b
1 file changed+23 added−0 removed
modified:docs/migrate.md+23 added
119 unmodified lines
Expand all
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
27 unmodified lines
119 unmodified lines
Expand all
// render a single comment
res.partial('comment', comment);
### partial() locals
Both _res.partial()_ and the _partial()_ functions accept an single object consisting of both the options and the locals. Previously with Express 1.x you may pass _user_ to a partial, along with _date_ like so:
partial('user', { object: user, locals: { date: new Date }})
or perhaps if you preferred not to use the inferred name _user_ you may used a local for this as well:
partial('user', { locals: { user: user, date: new Date }})
With recent changes to Express 2.x the object passed is now both, so the following is valid for the _object_ option and locals:
partial('user', { object: user, date: new Date })
Or the following which is equivalent, however the local var name is explicitly set to _user_ instead of deduced from the filename.
partial('user', { user: user, date: new Date })
When a "basic" object aka _{}_ or _new Object_ is passed, it is considered options, otherwise it is considered the _object_. The following are equivalent:
partial('user', user);
partial('user', { object: user });
### Template Engine Compliance
To comply with Express previously engines needed the following signature: