session icon indicating copy to clipboard operation
session copied to clipboard

Session Store Implementation doesn't mention that at times `callback` parameter won't be defined

Open TimDaub opened this issue 3 years ago • 0 comments

  • I maintain an express/session store and the other day I got someone's contribution that makes calling the function destroy's callback optional: https://github.com/TimDaub/better-sqlite3-session-store/pull/10
  • So I looked into https://github.com/expressjs/session#session-store-implementation because I thought that I must have missed this rather important detail
  • But I couldn't find any mention that potentially the callback parameter is omitted in some invocations
  • So I continued searching and found that a very popular implementation of expressjs/session adds noop as the cb's default value in every function signature: https://github.com/tj/connect-redis/blob/a4770bd07f7a248beb902708b3c1d3914ddb5dc6/lib/connect-redis.js#L12

So, hence, I think the readme's specification should make a mention that callback may not always be invocable as a JavaScript function.

TimDaub avatar Jun 25 '22 18:06 TimDaub