MCPcopy Index your code
hub / github.com/CloudBoost/cloudboost / substring

Method substring

sdk/src/CloudQuery.js:645–686  ·  view source on GitHub ↗
(columnName, value, isCaseInsensitive)

Source from the content-addressed store, hash-verified

643 }
644
645 substring(columnName, value, isCaseInsensitive) {
646
647 if (typeof columnName === "string") {
648 columnName = [columnName];
649 }
650
651 for (var j = 0; j < columnName.length; j++) {
652 if (Object.prototype.toString.call(value) === '[object Array]' && value.length > 0) {
653 if (!this.query["$or"])
654 this.query["$or"] = [];
655 for (var i = 0; i < value.length; i++) {
656 var obj = {};
657 obj[columnName[j]] = {};
658 obj[columnName[j]]["$regex"] = ".*" + value[i] + ".*";
659
660 if (isCaseInsensitive) {
661 obj[columnName[j]]["$options"] = "i";
662 }
663
664 this.query["$or"].push(obj);
665 }
666 } else {
667 if (columnName.length === 1) {
668 this.regex(columnName[j], ".*" + value + ".*", isCaseInsensitive);
669 } else {
670 if (!this.query["$or"])
671 this.query["$or"] = [];
672 var obj = {};
673 obj[columnName[j]] = {};
674 obj[columnName[j]]["$regex"] = ".*" + value + ".*";
675
676 if (isCaseInsensitive) {
677 obj[columnName[j]]["$options"] = "i";
678 }
679
680 this.query["$or"].push(obj);
681 }
682 }
683 }
684
685 return this;
686 }
687
688 //GeoPoint near query
689 near(columnName, geoPoint, maxDistance, minDistance) {

Callers 15

cloudboost.jsFile · 0.80
validateSocketQueryFunction · 0.80
test.jsFile · 0.80
queryTest.jsFile · 0.80
stringifyTOCFunction · 0.80
sFunction · 0.80
should.min.jsFile · 0.80
AssertionErrorFunction · 0.80
should.jsFile · 0.80
AssertionErrorFunction · 0.80
PrivateMethods.jsFile · 0.80

Calls 1

regexMethod · 0.95

Tested by

no test coverage detected