{"action":"created","comment":{"url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/comments/242408429","pull_request_review_id":185908873,"id":242408429,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjQwODQyOQ==","diff_hunk":"@@ -54,4 +54,58 @@ - (NSString *)getStringOrEmpty {\n     }\n     return string;\n }\n+\n+- (BOOL)isValidAttributeValue {\n+    if (self) {\n+        if ([self isEqual:[NSNull null]]) {\n+            return false;\n+        }\n+        // check value is NSString\n+        if ([self isKindOfClass:[NSString class]]) {\n+            return true;\n+        }\n+        NSNumber *number = (NSNumber *)self;\n+        // check value is NSNumber\n+        if (number && [number isKindOfClass:[NSNumber class]]) {\n+            const char *objCType = [number objCType];\n+            \n+            // check NSNumber is bool\n+            if ((strcmp(objCType, @encode(bool)) == 0)\n+                || [number isEqual:@YES]\n+                || [number isEqual:@NO]) {\n+                return true;\n+            }\n+            // check for Nan\n+            if (isnan([number doubleValue])) {\n+                return false;\n+            }\n+            // check for infinity\n+            if (isinf([number doubleValue])) {\n+                return false;\n+            }\n+            // check NSNumber is of type int, double\n+            Boolean isNumeric = (strcmp(objCType, @encode(short)) == 0)\n+            || (strcmp(objCType, @encode(unsigned short)) == 0)\n+            || (strcmp(objCType, @encode(int)) == 0)\n+            || (strcmp(objCType, @encode(unsigned int)) == 0)\n+            || (strcmp(objCType, @encode(long)) == 0)\n+            || (strcmp(objCType, @encode(unsigned long)) == 0)\n+            || (strcmp(objCType, @encode(long long)) == 0)\n+            || (strcmp(objCType, @encode(unsigned long long)) == 0)\n+            || (strcmp(objCType, @encode(float)) == 0)\n+            || (strcmp(objCType, @encode(double)) == 0)\n+            || (strcmp(objCType, @encode(char)) == 0)\n+            || (strcmp(objCType, @encode(unsigned char)) == 0);\n+            \n+            if (isNumeric) {\n+                //double is the only data type capable of handling values greater than 3.40282e+038 && less than 1.17549e-038\n+                //https://stackoverflow.com/a/12322917/4849178\n+                // check for value greater than 1e53 and less than -1e53","path":"OptimizelySDKCore/OptimizelySDKCore/OPTLYNSObject+Validation.m","position":50,"original_position":50,"commit_id":"48bd8e21dc8a31e32209e8493cdcd5297aab77f9","original_commit_id":"48bd8e21dc8a31e32209e8493cdcd5297aab77f9","user":{"login":"yasirfolio3","id":39988750,"node_id":"MDQ6VXNlcjM5OTg4NzUw","avatar_url":"https://avatars3.githubusercontent.com/u/39988750?v=4","gravatar_id":"","url":"https://api.github.com/users/yasirfolio3","html_url":"https://github.com/yasirfolio3","followers_url":"https://api.github.com/users/yasirfolio3/followers","following_url":"https://api.github.com/users/yasirfolio3/following{/other_user}","gists_url":"https://api.github.com/users/yasirfolio3/gists{/gist_id}","starred_url":"https://api.github.com/users/yasirfolio3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yasirfolio3/subscriptions","organizations_url":"https://api.github.com/users/yasirfolio3/orgs","repos_url":"https://api.github.com/users/yasirfolio3/repos","events_url":"https://api.github.com/users/yasirfolio3/events{/privacy}","received_events_url":"https://api.github.com/users/yasirfolio3/received_events","type":"User","site_admin":false},"body":"Kindly view this link:\r\nhttps://ideone.com/h1bpP\r\nit has limits for all the datatypes, correct me if i'm wrong.","created_at":"2018-12-18T05:11:27Z","updated_at":"2018-12-18T05:11:28Z","html_url":"https://github.com/optimizely/objective-c-sdk/pull/348#discussion_r242408429","pull_request_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/comments/242408429"},"html":{"href":"https://github.com/optimizely/objective-c-sdk/pull/348#discussion_r242408429"},"pull_request":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348"}},"in_reply_to_id":242403582},"pull_request":{"url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348","id":238000658,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4MDAwNjU4","html_url":"https://github.com/optimizely/objective-c-sdk/pull/348","diff_url":"https://github.com/optimizely/objective-c-sdk/pull/348.diff","patch_url":"https://github.com/optimizely/objective-c-sdk/pull/348.patch","issue_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/348","number":348,"state":"open","locked":false,"title":"feat(attribute_value): Don't target NAN, INF, -INF and Doubles > 1e53…","user":{"login":"yasirfolio3","id":39988750,"node_id":"MDQ6VXNlcjM5OTg4NzUw","avatar_url":"https://avatars3.githubusercontent.com/u/39988750?v=4","gravatar_id":"","url":"https://api.github.com/users/yasirfolio3","html_url":"https://github.com/yasirfolio3","followers_url":"https://api.github.com/users/yasirfolio3/followers","following_url":"https://api.github.com/users/yasirfolio3/following{/other_user}","gists_url":"https://api.github.com/users/yasirfolio3/gists{/gist_id}","starred_url":"https://api.github.com/users/yasirfolio3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yasirfolio3/subscriptions","organizations_url":"https://api.github.com/users/yasirfolio3/orgs","repos_url":"https://api.github.com/users/yasirfolio3/repos","events_url":"https://api.github.com/users/yasirfolio3/events{/privacy}","received_events_url":"https://api.github.com/users/yasirfolio3/received_events","type":"User","site_admin":false},"body":"Summary\r\n-------\r\nDon't target NAN, INF, -INF or > 1e53 doubles. \r\nModified isValidAttributeValue and added it to NSObject Category.\r\nCreated new Test file for Validation testing.\r\n\r\nTest plan\r\n---------\r\n\r\nIssues\r\n------\r\nOASIS-3654\r\nhttps://github.com/optimizely/python-sdk/pull/146#discussion_r237850806\r\n","created_at":"2018-12-12T11:19:22Z","updated_at":"2018-12-18T05:11:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9635c1147f7596c981057564d9a12ff125e37146","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348/commits","review_comments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348/comments","review_comment_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/348/comments","statuses_url":"https://api.github.com/repos/optimizely/objective-c-sdk/statuses/48bd8e21dc8a31e32209e8493cdcd5297aab77f9","head":{"label":"optimizely:yasir/dont-target-nan-inf-1e53","ref":"yasir/dont-target-nan-inf-1e53","sha":"48bd8e21dc8a31e32209e8493cdcd5297aab77f9","user":{"login":"optimizely","id":1274132,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzQxMzI=","avatar_url":"https://avatars3.githubusercontent.com/u/1274132?v=4","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"repo":{"id":69407259,"node_id":"MDEwOlJlcG9zaXRvcnk2OTQwNzI1OQ==","name":"objective-c-sdk","full_name":"optimizely/objective-c-sdk","private":false,"owner":{"login":"optimizely","id":1274132,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzQxMzI=","avatar_url":"https://avatars3.githubusercontent.com/u/1274132?v=4","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/optimizely/objective-c-sdk","description":"Optimizely X Objective-C SDK for iOS and tvOS","fork":false,"url":"https://api.github.com/repos/optimizely/objective-c-sdk","forks_url":"https://api.github.com/repos/optimizely/objective-c-sdk/forks","keys_url":"https://api.github.com/repos/optimizely/objective-c-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimizely/objective-c-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimizely/objective-c-sdk/teams","hooks_url":"https://api.github.com/repos/optimizely/objective-c-sdk/hooks","issue_events_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/optimizely/objective-c-sdk/events","assignees_url":"https://api.github.com/repos/optimizely/objective-c-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/optimizely/objective-c-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/optimizely/objective-c-sdk/tags","blobs_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimizely/objective-c-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/optimizely/objective-c-sdk/languages","stargazers_url":"https://api.github.com/repos/optimizely/objective-c-sdk/stargazers","contributors_url":"https://api.github.com/repos/optimizely/objective-c-sdk/contributors","subscribers_url":"https://api.github.com/repos/optimizely/objective-c-sdk/subscribers","subscription_url":"https://api.github.com/repos/optimizely/objective-c-sdk/subscription","commits_url":"https://api.github.com/repos/optimizely/objective-c-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/optimizely/objective-c-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/optimizely/objective-c-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimizely/objective-c-sdk/merges","archive_url":"https://api.github.com/repos/optimizely/objective-c-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimizely/objective-c-sdk/downloads","issues_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/optimizely/objective-c-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/optimizely/objective-c-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimizely/objective-c-sdk/labels{/name}","releases_url":"https://api.github.com/repos/optimizely/objective-c-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/deployments","created_at":"2016-09-27T23:32:27Z","updated_at":"2018-12-11T19:30:30Z","pushed_at":"2018-12-14T21:22:18Z","git_url":"git://github.com/optimizely/objective-c-sdk.git","ssh_url":"git@github.com:optimizely/objective-c-sdk.git","clone_url":"https://github.com/optimizely/objective-c-sdk.git","svn_url":"https://github.com/optimizely/objective-c-sdk","homepage":"","size":313392,"stargazers_count":13,"watchers_count":13,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":14,"watchers":13,"default_branch":"master"}},"base":{"label":"optimizely:master","ref":"master","sha":"6ff2290d254a02db9523beb7718da6f59798a85c","user":{"login":"optimizely","id":1274132,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzQxMzI=","avatar_url":"https://avatars3.githubusercontent.com/u/1274132?v=4","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"repo":{"id":69407259,"node_id":"MDEwOlJlcG9zaXRvcnk2OTQwNzI1OQ==","name":"objective-c-sdk","full_name":"optimizely/objective-c-sdk","private":false,"owner":{"login":"optimizely","id":1274132,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzQxMzI=","avatar_url":"https://avatars3.githubusercontent.com/u/1274132?v=4","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/optimizely/objective-c-sdk","description":"Optimizely X Objective-C SDK for iOS and tvOS","fork":false,"url":"https://api.github.com/repos/optimizely/objective-c-sdk","forks_url":"https://api.github.com/repos/optimizely/objective-c-sdk/forks","keys_url":"https://api.github.com/repos/optimizely/objective-c-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimizely/objective-c-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimizely/objective-c-sdk/teams","hooks_url":"https://api.github.com/repos/optimizely/objective-c-sdk/hooks","issue_events_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/optimizely/objective-c-sdk/events","assignees_url":"https://api.github.com/repos/optimizely/objective-c-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/optimizely/objective-c-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/optimizely/objective-c-sdk/tags","blobs_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimizely/objective-c-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/optimizely/objective-c-sdk/languages","stargazers_url":"https://api.github.com/repos/optimizely/objective-c-sdk/stargazers","contributors_url":"https://api.github.com/repos/optimizely/objective-c-sdk/contributors","subscribers_url":"https://api.github.com/repos/optimizely/objective-c-sdk/subscribers","subscription_url":"https://api.github.com/repos/optimizely/objective-c-sdk/subscription","commits_url":"https://api.github.com/repos/optimizely/objective-c-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimizely/objective-c-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/optimizely/objective-c-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/optimizely/objective-c-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimizely/objective-c-sdk/merges","archive_url":"https://api.github.com/repos/optimizely/objective-c-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimizely/objective-c-sdk/downloads","issues_url":"https://api.github.com/repos/optimizely/objective-c-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/optimizely/objective-c-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/optimizely/objective-c-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimizely/objective-c-sdk/labels{/name}","releases_url":"https://api.github.com/repos/optimizely/objective-c-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/optimizely/objective-c-sdk/deployments","created_at":"2016-09-27T23:32:27Z","updated_at":"2018-12-11T19:30:30Z","pushed_at":"2018-12-14T21:22:18Z","git_url":"git://github.com/optimizely/objective-c-sdk.git","ssh_url":"git@github.com:optimizely/objective-c-sdk.git","clone_url":"https://github.com/optimizely/objective-c-sdk.git","svn_url":"https://github.com/optimizely/objective-c-sdk","homepage":"","size":313392,"stargazers_count":13,"watchers_count":13,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":14,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348"},"html":{"href":"https://github.com/optimizely/objective-c-sdk/pull/348"},"issue":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/348"},"comments":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/issues/348/comments"},"review_comments":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348/comments"},"review_comment":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/pulls/348/commits"},"statuses":{"href":"https://api.github.com/repos/optimizely/objective-c-sdk/statuses/48bd8e21dc8a31e32209e8493cdcd5297aab77f9"}},"author_association":"NONE"}}
{"actor":{"display_login":"yasirfolio3"}}