Francesco149 / ojsama

pure javascript implementation of https://github.com/Francesco149/oppai-ng
The Unlicense
26 stars 7 forks source link

Replace falsey checks with undefined checks #4

Closed oamaok closed 6 years ago

oamaok commented 6 years ago

Should fix #3

Francesco149 commented 6 years ago

thanks!

Francesco149 commented 6 years ago

the falsey checks always get me in js since I don't write it that often (^:

oamaok commented 6 years ago

Good point.

Francesco149 commented 6 years ago

yes, I will consider changing to isNaN, but this PR is perfectly fine as it went more closely with what the code was originally doing.

btw this is now live on the npm package :ok_hand:

oamaok commented 6 years ago

Also, I fucked up: the undefined check doesn't even work, since it's not comparing it to the string "undefined", but to the actual undefined. This PR actually broke all the checks :D

Francesco149 commented 6 years ago

lolol I thought it was some alternative way to do it but I guess not

Francesco149 commented 6 years ago

anyways I'm changing some of them to isNaN (the required params ones) and leaving others with isUndefined so that it doesn't silently replace wrong types with default values