Open pateketrueke opened 6 years ago
Hi, I'm super excited about this project, fun and interesting!
Of course I was playing around to make it work, so I tried to understand this:
https://github.com/superscriptjs/superscript/blob/37f2be9c149112db924f817faa3726ed2c648c27/src/plugins/user.js#L40
I wrote my own hasProp plugin which receives booleans perfectly, so it could be used as {^hasProp("name", false)} without issues:
hasProp
{^hasProp("name", false)}
function hasProp(prop, val, cb) { const memory = this.user.memory; const userId = this.user.id; memory.db.get({ subject: prop, predicate: userId }, (err, res) => { const value = res[0] && res[0].object; if (typeof value !== 'undefined' && value !== null) { cb(null, val === true); } else { cb(null, val === false); } }); }
I don't feel this consistent, unless you encourage us to use plugins as {^hasProp("name", "false")} which is bit weird imho.
{^hasProp("name", "false")}
The question is, why you used a string comparison instead?
Hi, I'm super excited about this project, fun and interesting!
Of course I was playing around to make it work, so I tried to understand this:
https://github.com/superscriptjs/superscript/blob/37f2be9c149112db924f817faa3726ed2c648c27/src/plugins/user.js#L40
I wrote my own
hasProp
plugin which receives booleans perfectly, so it could be used as{^hasProp("name", false)}
without issues:I don't feel this consistent, unless you encourage us to use plugins as
{^hasProp("name", "false")}
which is bit weird imho.The question is, why you used a string comparison instead?