You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make it easier to write consise code that avoids prototype pollution
Often, I'd end up converting Object.entries(await redis.hgetall(key)) to a Map anyway.
(easier to make callers write map.has(fieldName) than Object.prototype.hasOwnProperty.call(obj, fieldName), since obj[fieldName] would be wrong for fields that are part of the object prototype)
(Aside: would key in obj work better than obj[key] for the check if the property was already defined, in the PR fixing that issue for hgetall (to account for Object.prototype.customProperty = false;)? Otherwise, the PR looked correct.)
The text was updated successfully, but these errors were encountered:
I definitely think it's useful to add it. However, I'm not sure if this is the right time to add it. For now, although ioredis is 100% written in TypeScript, many types are missing (ex there are no typings for Redis#get). I think we should solve the typing issue first and then add more methods to Redis/Commander since the process of adding types may result in breaking changes.
(Aside: would key in obj work better than obj[key] for the check if the property was already defined...
Good point! I didn't think of that. Can you take a look #1418 ?
(and
hgetallMapBuffer: Map<String, Buffer>
)Motivation:
Object.entries(await redis.hgetall(key))
to a Map anyway.(easier to make callers write
map.has(fieldName)
thanObject.prototype.hasOwnProperty.call(obj, fieldName)
, sinceobj[fieldName]
would be wrong for fields that are part of the object prototype)Related to #1267
(Aside: would
key in obj
work better thanobj[key]
for the check if the property was already defined, in the PR fixing that issue forhgetall
(to account forObject.prototype.customProperty = false;
)? Otherwise, the PR looked correct.)The text was updated successfully, but these errors were encountered: