Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why just write a field and not doing anything with it?

I'm reading the source of mongoose, find such code in https://github.com/LearnBoost/mongoose/blob/master/lib/collection.js#L23:

/**
 * The collection name
 *
 * @api public
 */

Collection.prototype.name;

I don't understand why this line exist. Does it here just for generating document?

like image 832
Freewind Avatar asked Oct 07 '22 20:10

Freewind


1 Answers

Yes.

It helps anyone reading the code know that this property is meant to be accessed publicly, and helps the doc generator signal the same.

like image 183
Asherah Avatar answered Oct 10 '22 09:10

Asherah