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

Move getFriendlyRoomName to Room. Add recalculate() function to cache info.

This commit is contained in:
Kegan Dougal
2015-06-08 16:10:23 +01:00
parent 9fa7fa0487
commit 2d00998b61
5 changed files with 89 additions and 67 deletions

View File

@@ -42,7 +42,7 @@ module.exports.encodeUri = function(pathTemplate, variables) {
* Applies a map function to the given array.
* @param {Array} array The array to apply the function to.
* @param {Function} fn The function that will be invoked for each element in
* the array.
* the array with the signature <code>fn(element){...}</code>
* @return {Array} A new array with the results of the function.
*/
module.exports.map = function(array, fn) {
@@ -108,6 +108,15 @@ module.exports.isFunction = function(value) {
return Object.prototype.toString.call(value) == "[object Function]";
};
/**
* Checks if the given thing is an array.
* @param {*} value The thing to check.
* @return {boolean} True if it is an array.
*/
module.exports.isArray = function(value) {
return Boolean(value && value.constructor === Array);
};
/**
* Checks that the given object has the specified keys.
* @param {Object} obj The object to check.