Socket
Socket
Sign inDemoInstall

json-server

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-server - npm Package Compare versions

Comparing version 0.7.11 to 0.7.12

2

package.json
{
"name": "json-server",
"version": "0.7.11",
"version": "0.7.12",
"description": "Serves JSON files through REST routes.",

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

@@ -148,6 +148,9 @@ var express = require('express')

var _embed = req.query._embed
var id = utils.toNative(req.params.id)
var resource = db(req.params.resource)
.get(utils.toNative(req.params.id))
.get(id)
if (resource) {
// Clone resource to avoid making changes to the underlying object
resource = _.cloneDeep(resource)
// Always use an array

@@ -158,6 +161,11 @@ _embed = _.isArray(_embed) ? _embed : [_embed]

_embed.forEach(function (otherResource) {
if (otherResource && otherResource.trim().length > 0) {
if (otherResource
&& otherResource.trim().length > 0
&& db.object[otherResource]) {
var query = {}
query[req.params.resource + 'Id'] = req.params.id
var prop = pluralize.singular(req.params.resource) + 'Id'
query[prop] = id
resource[otherResource] = db(otherResource).where(query)
}

@@ -164,0 +172,0 @@ })

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