IsEmpty

static inline BOOL IsEmpty(id thing) {
  return thing == nil || ([thing isEqual:[NSNull null]]) // JS addition for coredata
  || ([thing respondsToSelector:@selector(length)] && [(NSData *)thing length] == 0) ||
  ([thing respondsToSelector:@selector(count)] && [(NSArray *)thing count] == 0);
}