Skip to content

Commit

Permalink
Improve definition of RCTNilIfNull
Browse files Browse the repository at this point in the history
Reviewed By: fkgozali

Differential Revision: D5479733

fbshipit-source-id: 460845f79a970dd6614b11de3ce8898ea17ae1dc
  • Loading branch information
javache authored and facebook-github-bot committed Aug 9, 2017
1 parent 55117ea commit 0241cb7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion React/Base/RCTUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ RCT_EXTERN NSError *RCTErrorWithMessage(NSString *message);

// Convert nil values to NSNull, and vice-versa
#define RCTNullIfNil(value) (value ?: (id)kCFNull)
#define RCTNilIfNull(value) (value == (id)kCFNull ? nil : value)
#define RCTNilIfNull(value) \
({ __typeof__(value) t = (value); (id)t == (id)kCFNull ? (__typeof(value))nil : t; })

// Convert NaN or infinite values to zero, as these aren't JSON-safe
RCT_EXTERN double RCTZeroIfNaN(double value);
Expand Down

0 comments on commit 0241cb7

Please sign in to comment.