New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-query-maker

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-query-maker - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

29

dist/index.js

@@ -63,5 +63,8 @@ "use strict";

// src/utils/negativeSelect.ts
var negativeSelect = (input) => {
return input.map((x) => `-${x}`).join(" ");
// src/utils/selectFormatter.ts
var selectFormatter = (input) => {
return {
negative: input.length ? "-" + input.join(" -") : "",
pipe: input.join("|")
};
};

@@ -71,17 +74,17 @@

var select = (input, { select: select2 }) => {
if (!input)
return negativeSelect(select2);
if (Array.isArray(input))
throw new Error("Multiple `select` found.");
const { negative, pipe } = selectFormatter(select2);
let isNegative = false;
const result = input.split(",").map((element) => element.trim()).filter((element) => {
const regexInvalid = new RegExp(/^$|\s|\+$|^-{2,}/).test(element);
const selectInvalid = select2.filter((x) => new RegExp(`${x}|^${x}\\.|^-${x}`).test(element));
if (element.startsWith("-") && element !== "-_id" && !regexInvalid && !selectInvalid.length && !isNegative) {
const result = input.split(",").reduce((prev, value) => {
value = value.trim();
if (new RegExp(`(^$|\\s|^\\+|^--)|((^|\\s)(-?(?:${pipe}))($|\\s))`).test(value)) {
return prev;
}
if (value.startsWith("-") && value !== "-_id" && !isNegative) {
isNegative = true;
}
return !selectInvalid.length && !regexInvalid;
});
const resultValidation = result.length === 0 ? negativeSelect(select2) : result.length === 1 && result[0] === "-_id" ? `-_id ${negativeSelect(select2)}` : isNegative ? `${result.join(" ")} ${negativeSelect(select2)}` : result.join(" ");
return resultValidation.trim();
return `${prev} ${value}`;
}, "");
return `${result} ${isNegative ? negative : ""}`.trim();
};

@@ -88,0 +91,0 @@

{
"name": "mongoose-query-maker",
"version": "3.0.3",
"version": "3.0.4",
"description": "A powerful query maker for MongoDB with Mongoose",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc