From eed32e294549c8f9a77594e294a5e3ace1d8d1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Mu=C3=B1oz?= Date: Tue, 5 Sep 2023 11:04:37 -0300 Subject: [PATCH] fix con resolve de las promesa eliminada --- .eslintrc.cjs | 2 +- index.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 4b66f7f..25e5088 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,7 +5,7 @@ module.exports = { es2022: true }, plugins: ["prettier"], - extends: ["plugin:prettier/recommended"], + extends: ["eslint:recommended"], rules: { "no-console": 0, "max-len": [ diff --git a/index.js b/index.js index c577535..4d4b4d2 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,7 @@ module.exports = function (schema, options) { //no escapar si es un arreglo if (!Array.isArray(pathValue)) { // Escape RegExp chars - pathValue = pathValue.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + pathValue = pathValue.replace(/[-[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); pathValue = new RegExp("^" + pathValue + "$", "i"); } } @@ -92,7 +92,7 @@ module.exports = function (schema, options) { conditions._id = {$ne: this._id}; } else { // if is not new and is not query and the pathName is _id then is the same document no need to check anything - return resolve(true); + return true; } } diff --git a/package.json b/package.json index 6d1efd0..a2094ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mongoose-unique-validator", - "version": "2.1.6", + "version": "2.1.7", "description": "mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.", "main": "index.js", "scripts": {