NewsBlur/clients/ios/Other Sources/Overshare Kit/NSDictionary+OSKModel.m
2014-05-19 13:33:42 -07:00

32 lines
721 B
Objective-C
Executable file

//
// NSDictionary+OSKModel.h
// Overshare
//
// Created by Jared Sinclair on 10/10/13.
// Copyright (c) 2013 Overshare Kit. All rights reserved.
//
#import "NSDictionary+OSKModel.h"
@implementation NSDictionary (OSKModel)
- (NSString *)osk_nonNullStringIDForKey:(NSString *)key {
NSString *string = nil;
id value = [self osk_nonNullObjectForKey:key];
if ([value isKindOfClass:[NSNumber class]]) {
string = [(NSNumber *)value stringValue];
} else {
string = value;
}
return string;
}
- (id)osk_nonNullObjectForKey:(NSString *)key {
id value = [self objectForKey:key];
if ([value isKindOfClass:[NSNull class]]) {
value = nil;
}
return value;
}
@end