Closed zhaohanweng closed 8 years ago
From the code it looks like isNaN is used to check the "" empty string, https://github.com/basho/riak-nodejs-client/blob/master/lib/commands/yokozuna/search.js#L98
But isNaN(""); // false: the empty string is converted to 0 which is not NaN. from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN.
isNaN(""); // false: the empty string is converted to 0 which is not NaN.
Just so I understand, if a search returns a document whose value is the empty string, the value gets converted into an integer whose value is 0?
0
It seems like this check should be used instead.
From the code it looks like isNaN is used to check the "" empty string, https://github.com/basho/riak-nodejs-client/blob/master/lib/commands/yokozuna/search.js#L98
But
isNaN(""); // false: the empty string is converted to 0 which is not NaN.
from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN.