@@ 577-593 (lines=17) @@ | ||
574 | return out; |
|
575 | }, |
|
576 | ||
577 | pickMatching: function(slots, evenIfNull = false){ |
|
578 | var list = this; |
|
579 | var out = []; |
|
580 | ||
581 | if (!slots){ |
|
582 | return out; |
|
583 | } |
|
584 | ||
585 | for (var i = 0, il = slots.length;i<il;i++){ |
|
586 | id = slots[i]; |
|
587 | val = list[id]; |
|
588 | if (val != null || evenIfNull) { |
|
589 | out[id] = val; |
|
590 | } |
|
591 | } |
|
592 | return out; |
|
593 | }, |
|
594 | ||
595 | /** Get the data of `list`, by searching `indexID` in `indexArr`, or return `defaultVal` if not found */ |
|
596 | getByMatchingArray: function(indexArr, indexID, defaultVal = null){ |
|
@@ 559-575 (lines=17) @@ | ||
556 | return list[parseInt(Math.random() * 1000000) % list.length]; |
|
557 | }, |
|
558 | ||
559 | pick: function(slots){ |
|
560 | var list = this; |
|
561 | var out = []; |
|
562 | ||
563 | if (!slots){ |
|
564 | return out; |
|
565 | } |
|
566 | ||
567 | for (var i = 0, il = slots.length;i<il;i++){ |
|
568 | id = slots[i]; |
|
569 | val = list[id]; |
|
570 | if (val != null) { |
|
571 | out.push(val); |
|
572 | } |
|
573 | } |
|
574 | return out; |
|
575 | }, |
|
576 | ||
577 | pickMatching: function(slots, evenIfNull = false){ |
|
578 | var list = this; |