// selectSingular.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all objects that are collections.
* @method adventurejs.Parser#selectSingular
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectSingular = function Parser_selectSingular(list) {
if ("string" === typeof list) list = [list];
if (!Array.isArray(list)) {
this.game.log(
"L1246",
"error",
"critical",
["[selectSingular.js] selectSingular() received non-array", list],
"Parser"
);
return [];
}
this.game.log(
"L1155",
"log",
"high",
`[selectSingular.js] selectSingular() receive:\n${list}`,
"Parser"
);
var foundObjects = [];
for (var i = 0; i < list.length; i++) {
var object = this.game.getAsset(list[i]);
if (object.is.collection) {
continue;
}
foundObjects.push(list[i]);
}
return foundObjects;
};
})();