Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lucis-api-query

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucis-api-query - npm Package Compare versions

Comparing version 0.1.0 to 0.5.1

README.md

28

index.js

@@ -0,1 +1,3 @@

const jsonpatch = require('fast-json-patch');
function pluginMongoose (schema) {

@@ -245,2 +247,28 @@

};
/**
* Be careful: some patches may not be applied to mongoose model (deleting stuff, e.g)
*/
schema.statics.findByIdAndPatch = function(entidadeId, patches, callback){
this.findById(entidadeId)
.exec((err, entidade)=>{
if (err){
return callback(err);
}
jsonpatch.apply(entidade,patches);
const validacao = entidade.validateSync();
if (validacao){
const erro = Object.values(validacao.errors)[0];
return callback(erro);
}
entidade.save((err)=>{
if (err){
return callback(err);
}
return callback
});
});
};
};

@@ -247,0 +275,0 @@

7

package.json
{
"name": "lucis-api-query",
"version": "0.1.0",
"version": "0.5.1",
"description": "Adaptação do mongoose-api-query para necessidades mais comuns",

@@ -10,3 +10,6 @@ "main": "index.js",

"author": "Luciano Júnior <luciannojunior@gmail.com> (http://juniorluciano.com)",
"license": "ISC"
"license": "ISC",
"dependencies": {
"fast-json-patch": "^2.0.6"
}
}
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