[ReactNative] Use RCTNullIfNill and (id)kCFNull

Summary:
@public

Use consistent `null` handling:

`value || null`                ->  `RCTNullIfNil(value)`
`value == null ? nil : value`  ->  `RCTNilIfNull(value)`
`[NSNull null]`                ->  `(id)kCFNull`

Test Plan: The tests should be enough.
This commit is contained in:
Tadeu Zagallo
2015-06-12 11:05:01 -07:00
parent 696b31f1a4
commit 2a7adfb815
13 changed files with 41 additions and 37 deletions

View File

@@ -54,7 +54,7 @@ RCT_CONVERTER(NSString *, NSString, description)
RCTLogConvertError(json, "a number");
}
return number;
} else if (json && json != [NSNull null]) {
} else if (json && json != (id)kCFNull) {
RCTLogConvertError(json, "a number");
}
return nil;
@@ -141,7 +141,7 @@ RCT_CONVERTER(NSString *, NSString, description)
"Expected format: YYYY-MM-DD'T'HH:mm:ss.sssZ", json);
}
return date;
} else if (json && json != [NSNull null]) {
} else if (json && json != (id)kCFNull) {
RCTLogConvertError(json, "a date");
}
return nil;