How to use the is_js.regexp function in is_js

To help you get started, we’ve selected a few is_js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vadimdemedes / mongorito / src / query.js View on Github external
this.where(key, conditions[key]);
      });
    }

    if (is.string(key)) {
      // if only one argument was supplied
      // save the key in this.lastKey
      // for future methods, like .equals()
      if (is.undefined(value)) {
        this.lastKey = key;
        return this;
      }

      // if value is a regular expression
      // use $regex modifier
      if (is.regexp(value)) {
        value = { $regex: value };
      }

      this.query[key] = value;
    }

    return this;
  }
github vadimdemedes / mongorito / build / query.js View on Github external
});
      })();
    }

    if (is.string(key)) {
      // if only one argument was supplied
      // save the key in this.lastKey
      // for future methods, like .equals()
      if (is.undefined(value)) {
        this.lastKey = key;
        return this;
      }

      // 1. if regular expression
      // 2. if object and not ObjectID
      if (is.regexp(value)) {
        value = { $regex: value };
      } else if (is.object(value) && !isObjectID(value)) {
        value = { $elemMatch: value };
      }

      this.query[key] = value;
    }

    return this;
  };
github vadimdemedes / interaptor / src / interceptor.js View on Github external
Interceptor.prototype[method] = function (path) {
    this.method = method;
    this.path = is.regexp(path) ? path : pathToRegExp(path);
    
    return this;
  };
});
github vadimdemedes / interaptor / lib / interceptor.js View on Github external
Interceptor.prototype[method] = function (path) {
    this.method = method;
    this.path = is.regexp(path) ? path : pathToRegExp(path);

    return this;
  };
});