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

@jota-one/drosse

Package Overview
Dependencies
Maintainers
2
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jota-one/drosse - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

examples/database/.drosserc.js

39

app/use/db.js

@@ -124,2 +124,7 @@ const Loki = require('lokijs')

query: {
list(collection) {
const coll = db.getCollection(collection)
return coll.data.map(clean())
},
getRef(refObj, dynamicId) {

@@ -174,2 +179,7 @@ const { collection, id: refId } = refObj

insert(collection, ids, payload) {
const coll = db.getCollection(collection)
return coll.insert(lodash.cloneDeep({ ...payload, DROSSE: { ids } }))
},
update: {

@@ -185,4 +195,33 @@ byId(collection, id, newValue) {

},
subItem: {
append(collection, id, subPath, payload) {
const coll = db.getCollection(collection)
coll.findAndUpdate({ 'DROSSE.ids': { $contains: id } }, doc => {
if (!lodash.get(doc, subPath)) {
lodash.set(doc, subPath, [])
}
lodash.get(doc, subPath).push(payload)
})
},
prepend(collection, id, subPath, payload) {
const coll = db.getCollection(collection)
coll.findAndUpdate({ 'DROSSE.ids': { $contains: id } }, doc => {
if (!lodash.get(doc, subPath)) {
lodash.set(doc, subPath, [])
}
lodash.get(doc, subPath).unshift(payload)
})
},
},
},
remove: {
byId(collection, id) {
const coll = db.getCollection(collection)
const toDelete = coll.findOne({ 'DROSSE.ids': { $contains: id } })
return toDelete && coll.remove(toDelete)
},
},
}
}

2

package.json
{
"name": "@jota-one/drosse",
"version": "1.0.0",
"version": "1.1.0",
"description": "Mock your backend the right way.",

@@ -5,0 +5,0 @@ "main": "app/index.js",

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