1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-03 08:42:03 +03:00

Handle m.typing events.

This commit is contained in:
Kegan Dougal
2015-06-09 10:27:37 +01:00
parent 7d2dc07c3f
commit 2fb68cfed2
5 changed files with 120 additions and 13 deletions

View File

@@ -99,6 +99,18 @@ module.exports.values = function(obj) {
return values;
};
/**
* Invoke a function for each item in the array.
* @param {Array} array The array.
* @param {Function} fn The function to invoke for each element. Has the
* function signature <code>fn(element, index)</code>.
*/
module.exports.forEach = function(array, fn) {
for (var i = 0; i < array.length; i++) {
fn(array[i], i);
}
};
/**
* Checks if the given thing is a function.
* @param {*} value The thing to check.