* feat: zscan

* fix: mongodb tests

* feat: scan, ip search starts with
This commit is contained in:
Barış Soner Uşaklı
2020-07-02 20:11:53 -04:00
committed by GitHub
parent be85123ad5
commit e95cd28f6f
8 changed files with 81 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
var helpers = module.exports;
const helpers = module.exports;
const utils = require('../../utils');
helpers.noop = function () {};
@@ -48,3 +49,21 @@ helpers.deserializeData = function (data) {
helpers.valueToString = function (value) {
return String(value);
};
helpers.buildMatchQuery = function (match) {
let _match = match;
if (match.startsWith('*')) {
_match = _match.substring(1);
}
if (match.endsWith('*')) {
_match = _match.substring(0, _match.length - 1);
}
_match = utils.escapeRegexChars(_match);
if (!match.startsWith('*')) {
_match = '^' + _match;
}
if (!match.endsWith('*')) {
_match += '$';
}
return _match;
};