Helper function to wrap an object's property in a list if it's defined, or set it to an empty list if not.
179814
function ensurePropertyIsAList(obj, prop) {
    obj[prop] = [].concat(
      typeof obj[prop] === 'undefined' ?
        [] : obj[prop]);
    return obj;
  }
309376
def listify(obj, ignore=(list, tuple, type(None))):
    '''  '''
    return obj if isinstance(obj, ignore) else [obj]
829850
function(list){
		var type = typeof list;
		if(type === "string" || Array.isArray(list)) {
			return true;
		}
		var length = list && (type !== 'boolean' && type !== 'number' && "length" in list) && list.length;

		// var length = "length" in obj && obj.length;
		return typeof list !== "function" &&
			( length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in list );
	}
1139759
def setwrap(value: Any) -> Set[str]:
    
    return set(map(str, set(flatten([value]))))
1208666
function processProperty(item, property, value) {
    if (value !== null && typeof value === "object") {
        processObjectProperty(item, property, value);
        return;
    }
    if (!item.hasOwnProperty(property)) {
        item[property] = null;
    }

    //Boolean type
    if (value === false && item[property] == null) {
        delete item.$changedProps[property];
        return;
    }

    //Float type
    if (Number.isFinite(item[property])) {
        item[property] = item[property] + "";
    }

    //Other types
    // console.log("OTHER TYPES, value:", value);
    if (item[property] !== value) {
        item.$changedProps[property] = value;
    } else {
        delete item.$changedProps[property];
    }
}
98231
function toEntries(object, properties) {
  return flatten(properties.map(name => {
    const p = descriptorOf(object, name);

    let result = [];

    if (p.get) {
      result.push({ name, value: p.get, kind: 'getter' });
    }
    if (p.set) {
      result.push({ name, value: p.set, kind: 'setter' });
    }
    if (p.value) {
      result.push({ name, value: p.value, kind: 'value' });
    }

    return result;
  }));
}
680379
function inarray (list, item) {
  list = Object.prototype.toString.call(list) === '[object Array]' ? list : []

  var idx = -1
  var end = list.length

  while (++idx < end) {
    if (list[idx] === item) return true
  }

  return false
}
293418
function definePropertyHolder(object) {
                let holder = defaultValue;

                Object.defineProperty(object, id, {
                    enumerable: false,
                    configurable: true,
                    get: function getterWrapper() {
                        if (checkIfWrapped(getterWrapper.caller)) {
                            return holder;
                        }
                        throw new ReferenceError(`Access violation for private property: 
                            ${id}`);
                    },
                    set: function setterWrapper(value) {
                        if (checkIfWrapped(setterWrapper.caller)) {
                            holder = value;
                        } else {
                            throw new ReferenceError(`Access violation for private property:
                                 ${id}`);
                        }
                    }
                });
                propertyHolderDefined = true;
            }
842488
function(list, name) {
    if (Object.prototype.toString.call(list) === '[object Array]' && Object.prototype.toString.call(name) === '[object String]') {
      for (var i = 0; i < list.length; i++) {
        if (list[i] === name) {
          return true;
        }
      }
    }
    return false;
  }
401483
function isObjectEmpty(obj) {
        if (!this.isObject(obj)) {
            return false;
        }

        for (var x in obj) {
            if ({}.hasOwnProperty.call(obj, x)) {
                return false;
            }
        }

        return true;
    }
228398
def blank(*objs):
    """"""
    for o in objs:
        if isinstance(o, Boolean):
            is_blank = not o
        elif isinstance(o, String):
            is_blank = not len(o.value.strip())
        elif isinstance(o, List):
            is_blank = all(blank(el) for el in o)
        else:
            is_blank = False

        if not is_blank:
            return Boolean(False)

    return Boolean(True)
419915
def dumpable_obj(obj):
    ''' '''

    if isinstance(obj, list):
        _return_list = []
        for item in obj:
            if isinstance(item, list):
                _return_list.append(dumpable_obj(item))
            elif isinstance(item, set):
                _return_list.append(list(item))
            elif isinstance(item, dict):
                _return_list.append(dumpable_obj(item))
            else:
                try:
                    json.dumps(item)
                    _return_list.append(item)
                except:
                    _return_list.append(str(type(item)))
        return _return_list
    elif isinstance(obj, set):
        return list(obj)
    elif isinstance(obj, dict):
        _return_obj = {}
        for key, item in obj.items():
            if isinstance(item, list):
                _return_obj[key] = dumpable_obj(item)
            elif isinstance(item, set):
                _return_obj[key] = list(item)
            elif isinstance(item, dict):
                _return_obj[key] = dumpable_obj(item)
            else:
                try:
                    json.dumps(item)
                    _return_obj[key] = item
                except:
                    _return_obj[key] = str(type(item))
        return _return_obj
    else:
        try:
            json.dumps(obj)
            return obj
        except:
            return str(type(obj))
79245
def _add_list_getter(self):
        
        prop_name = '%s_lst' % self._prop_name
        property_ = property(self._list_getter, None, None)
        setattr(self._element_cls, prop_name, property_)
660764
@UiThread
  public static <T extends View, V> void set(@NonNull List<T> list,
      @NonNull Property<? super T, V> setter, @Nullable V value) {
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0, count = list.size(); i < count; i++) {
      setter.set(list.get(i), value);
    }
  }
85210
def _as_list(obj):
    """"""
    if obj is None:
        return None
    elif isinstance(obj, string_types):
        return [obj]
    elif isinstance(obj, tuple):
        return list(obj)
    elif not hasattr(obj, '__len__'):
        return [obj]
    else:
        return obj
1310895
function isEmptyObject(obj) {
    if (obj === null) {
        return true;
    }
    if (!isObject(obj)) {
        return false;
    }

    for (var key in obj) {
        if (obj.hasOwnProperty(key) && obj[key]) {
            return false;
        }
    }

    return true;
}
953029
def wrap_in_array(object)
      if object.nil?
        []
      elsif object.respond_to?(:to_ary)
        object.to_ary || [object]
      else
        [object]
      end
    end