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

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 1.0.0-alpha.18 to 1.0.0-alpha.19

2

lib/service.d.ts

@@ -20,3 +20,3 @@ import { Low } from 'lowdb';

findById(name: string, id: string, query: {
_embed?: string[];
_embed?: string[] | string;
}): Item | undefined;

@@ -23,0 +23,0 @@ find(name: string, query?: {

@@ -27,2 +27,5 @@ import { randomBytes } from 'node:crypto';

}
function ensureArray(arg = []) {
return Array.isArray(arg) ? arg : [arg];
}
function embed(db, name, item, related) {

@@ -110,3 +113,3 @@ if (inflection.singularize(related) === related) {

let item = value.find((item) => item['id'] === id);
query._embed?.forEach((related) => {
ensureArray(query._embed).forEach((related) => {
if (item !== undefined)

@@ -125,5 +128,6 @@ item = embed(this.#db, name, item, related);

// Include
query._embed?.forEach((related) => {
if (items !== undefined && Array.isArray(items))
ensureArray(query._embed).forEach((related) => {
if (items !== undefined && Array.isArray(items)) {
items = items.map((item) => embed(this.#db, name, item, related));
}
});

@@ -148,4 +152,13 @@ // Return list if no query params

}
if (['_sort', '_start', '_end', '_limit', '_page', '_per_page'].includes(key))
if ([
'_embed',
'_sort',
'_start',
'_end',
'_limit',
'_page',
'_per_page',
].includes(key)) {
continue;
}
conds[key] = [Condition.default, value];

@@ -152,0 +165,0 @@ }

{
"name": "json-server",
"version": "1.0.0-alpha.18",
"version": "1.0.0-alpha.19",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

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