// hasDescription.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Assets.Asset.prototype;
/**
* See if asset has a description for an identifier,
* such as "look in book", where
* "in" has been defined as a key at
* asset.descriptions.in.
* "look" is always the default identifier.
* @memberOf AdventureJS.Assets.Asset
* @method AdventureJS.Assets.Asset#hasDescription
* @param {String} identifier
* @return {String|Boolean}
*/
p.hasDescription = function Asset_hasDescription(identifier) {
identifier = identifier || "look";
let description = this.descriptions[identifier];
if (description === null || "undefined" === typeof description) {
return false;
}
if (
("string" === typeof description && description.length) ||
"function" === typeof description ||
Array.isArray(description) ||
("object" === typeof description && description.array) ||
("object" === typeof description && description.default)
) {
return true;
}
return false;
};
})();