pusher-js/core/utils/collections library

Functions

all(List array, Function test) bool
Checks whether all elements of the array pass the test. Function test gets 3 arguments passed:
any(List array, Function test) bool
Checks whether any element of the array passes the test. Function test gets 3 arguments passed:
apply(List array, Function f, [dynamic context]) → dynamic
Applies a function f to all elements of an array. Function f gets 3 arguments passed:
arrayIndexOf(List array, dynamic item) num
buildQueryString(dynamic data) String
decycleObject(dynamic object) → dynamic
See https://github.com/douglascrockford/JSON-js/blob/master/cycle.js Remove circular references from an object. Required for JSON.stringify in React Native, which tends to blow up a lot.
encodeParamsObject(dynamic data) String
extend(dynamic target, [dynamic sources1, dynamic sources2, dynamic sources3, dynamic sources4, dynamic sources5]) → dynamic
Merges multiple objects into the target argument. For properties that are plain Objects, performs a deep-merge. For the rest it just copies the value of the property. To extend prototypes use it as following: Pusher.Util.extend(Target.prototype, Base.prototype) You can also use it to merge objects without altering them: Pusher.Util.extend({}, object1, object2)
filter(List array, Function test) List
Filters elements of the array using a test function. Function test gets 4 arguments passed:
filterObject(Object object, Function test) → dynamic
Filters properties of the object using a test function. Function test gets 4 arguments passed:
flatten(Object object) List
Flattens an object into a two-dimensional array.
keys(dynamic object) List<String>
Return a list of objects own proerty keys
map(List array, Function f) List
Maps all elements of the array and returns the result. Function f gets 4 arguments passed:
mapObject(dynamic object, Function f) → dynamic
Maps all elements of the object and returns the result. Function f gets 4 arguments passed:
objectApply(dynamic object, Function f) → dynamic
Applies a function f to all properties of an object. Function f gets 3 arguments passed:
safeJSONStringify(dynamic source) String
Provides a cross-browser and cross-platform way to safely stringify objects into JSON. This is particularly necessary for ReactNative, where circular JSON structures throw an exception.
stringify() String
values(dynamic object) List
Return a list of object's own property values