Sha256: 648476c63b232fb6ff453a07735da8ca7233f74e0be909df4b2012756b17af00
Contents?: true
Size: 820 Bytes
Versions: 8
Compression:
Stored size: 820 Bytes
Contents
(function (self) { function isItemMatched(item, matcher, attribute) { var value = typeof attribute === undefined ? item : item[attribute]; if (typeof matcher === "function") { return matcher.call(items, value); } if (typeof matcher === "object" && RegExp.prototype.isPrototypeOf(matcher)) { if (typeof value !== "string") value = value.toString(); return matcher.test(value); } return matcher == value; } self.detectItem = function (items, matcher, attribute) { if (!Array.isArray(items)) return; for (var i = 0; i < items.length; i++) { if (isItemMatched(items[i], matcher, attribute)) { return items[i]; } } }; self.detectByTitle = function (items, matcher) { return self.detectItem(items, matcher, "title"); }; })(this);
Version data entries
8 entries across 8 versions & 1 rubygems