(columnName, data)
| 540 | } |
| 541 | |
| 542 | containsAll(columnName, data) { |
| 543 | |
| 544 | var isCloudObject = false; |
| 545 | |
| 546 | var CbData = []; |
| 547 | |
| 548 | if (columnName === 'id') |
| 549 | columnName = '_' + columnName; |
| 550 | |
| 551 | if (Object.prototype.toString.call(data) === '[object Object]' && !data instanceof CB.CloudObject) { //if object is passed as an argument |
| 552 | throw 'Array or string expected as an argument'; |
| 553 | } |
| 554 | |
| 555 | if (Object.prototype.toString.call(data) === '[object Array]') { //if array is passed, then replace the whole |
| 556 | |
| 557 | for (var i = 0; i < data.length; i++) { |
| 558 | if (data[i]instanceof CB.CloudObject) { |
| 559 | |
| 560 | isCloudObject = true; |
| 561 | |
| 562 | if (!data[i].id) { |
| 563 | throw "CloudObject passed should be saved and should have an id before being passed to containsAll"; |
| 564 | } |
| 565 | |
| 566 | CbData.push(data[i].id); |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | if (CbData.length === 0) { |
| 571 | CbData = data; |
| 572 | } |
| 573 | |
| 574 | if (isCloudObject) { |
| 575 | columnName = columnName + '._id'; |
| 576 | } |
| 577 | |
| 578 | if (!this.query[columnName]) { |
| 579 | this.query[columnName] = {}; |
| 580 | } |
| 581 | |
| 582 | this.query[columnName]["$all"] = CbData; |
| 583 | |
| 584 | } else { //if the argument is a string then push if it is not present already |
| 585 | |
| 586 | if (data instanceof CB.CloudObject) { |
| 587 | |
| 588 | if (!data.id) { |
| 589 | throw "CloudObject passed should be saved and should have an id before being passed to containsAll"; |
| 590 | } |
| 591 | |
| 592 | columnName = columnName + '._id'; |
| 593 | CbData = data.id; |
| 594 | } else |
| 595 | CbData = data; |
| 596 | |
| 597 | if (!this.query[columnName]) { |
| 598 | this.query[columnName] = {}; |
| 599 | } |
no outgoing calls
no test coverage detected