You've already forked matrix-js-sdk
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:
11
lib/utils.js
11
lib/utils.js
@@ -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.
|
||||
|
Reference in New Issue
Block a user