pg-hstore icon indicating copy to clipboard operation
pg-hstore copied to clipboard

Is callback necessary?

Open mrdulin opened this issue 5 years ago • 4 comments

I read the source code about hstore.stringify: https://github.com/scarney81/pg-hstore/blob/master/lib/index.js#L32

if (!callback || callback === null) return joined;
callback(joined);

It also works fine without passing callback argument. Like this:

const hstore = require('pg-hstore')();
const dataParsed = hstore.parse(data);
const dataStringified = hstore.stringify(data);

Am I correct?

mrdulin avatar Feb 04 '20 07:02 mrdulin

You are correct. This callback is not necessary. If I were re-writing this package I would not have constructed it with a callback signature.

scarney81 avatar Feb 04 '20 16:02 scarney81

@scarney81 Thanks for reply. The documentation should be updated.

mrdulin avatar Feb 05 '20 04:02 mrdulin

Its more than a year but would you like me to make an update to the README? @scarney81

SayakMukhopadhyay avatar Feb 15 '21 11:02 SayakMukhopadhyay

That would be most welcome @SayakMukhopadhyay

scarney81 avatar Feb 16 '21 05:02 scarney81