fix: modify argment variables - #17
Conversation
There was a problem hiding this comment.
ちょっとよく理解できてないので、コメントだけ失礼します。
修正の意図としては 「要素が null の時には省略せず、null を返してほしい」 という事になるでしょうか。
元のコードで判定に使われていた isNullish 関数はコード的には、値が
- nil
- 型付きの nil
- 数値の不正な値
- undefined
のときに true を返すとしているようなので、単純に null である場合以外も扱っているような感じがします。ここの isNullish を完全に外してしまっていいのが不安になりました(←理解できてない)。
( '-`).oO( isNullish は undefined をどう扱ってるんですかね(string の条件のところ?)
|
@ikawaha |
| if !isNullish(value) { | ||
| obj[name] = value | ||
| if isUndefined { | ||
| if !isNullish(value) { |
There was a problem hiding this comment.
fieldASTs は filed にある場合です。graphqlの。この場合はundefinedはないのですが、念のため同じ実装にしています。
There was a problem hiding this comment.
fieldASTsは戻り値のfieldになります。
| ) | ||
| if tmpValue, ok := argASTMap[argDef.PrivateName]; ok { | ||
| value = tmpValue.Value | ||
| } else { |
There was a problem hiding this comment.
argASTMap にフィールドがあるかないかでundefinedを考慮しています。
argASTMapには、実際の引数の情報が入ってきます。
ikawaha
left a comment
There was a problem hiding this comment.
ありがとうございます!やっと理解できました (あつかいがむつかしい・・・
このままで問題ないと思いますが、値を設定するところの条件をすこしコンパクトに出来そうだったのでコメントしました。ご確認ください。
|
@ikawaha |
Issue
TL; DR
Task summary / Change details