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

nodejs-data-grid

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-data-grid - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

6

dist/lib/AGrid.js

@@ -82,8 +82,8 @@ "use strict";

if (dto.search) {
const searches = {};
const searches = [];
(_a = this.searchableColumns) === null || _a === void 0 ? void 0 : _a.forEach(column => {
const name = this.getFilterableColumn(column);
searches[name] = { $regex: dto.search };
searches.push({ [name]: { $regex: dto.search } });
});
filter.$and.push({ $or: [searches] });
filter.$and.push({ $or: searches });
}

@@ -90,0 +90,0 @@ return filter;

@@ -20,3 +20,4 @@ "use strict";

this.searchableColumns = [
'namae'
'id',
'namae',
];

@@ -23,0 +24,0 @@ }

@@ -86,8 +86,8 @@ import { Database, Query } from '@deepkit/orm';

if (dto.search) {
const searches: Record<string, any> = {};
const searches: Record<string, any>[] = [];
this.searchableColumns?.forEach(column => {
const name = this.getFilterableColumn(column);
searches[name] = { $regex: dto.search };
searches.push({ [name]: { $regex: dto.search } });
});
filter.$and.push({ $or: [searches] });
filter.$and.push({ $or: searches });
}

@@ -94,0 +94,0 @@

{
"name": "nodejs-data-grid",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

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

@@ -30,3 +30,3 @@ import { Database } from '@deepkit/orm';

for (let i = 1; i <= 5; i++) {
await db.persist(new ExampleEntity(i.toString()));
await db.persist(new ExampleEntity(`name_${i.toString()}`));
}

@@ -52,3 +52,3 @@ });

expect(data.items[0].id).toEqual(1);
expect(data.items[1].name).toEqual('2');
expect(data.items[1].name).toEqual('name_2');
});

@@ -91,3 +91,3 @@

expect(data.items[0].id).toEqual(5);
expect(data.items[0].name).toEqual('5');
expect(data.items[0].name).toEqual('name_5');
});

@@ -109,3 +109,3 @@

dto.filter = [[{
value: ['3'],
value: ['name_3'],
operator: Operator.EQ,

@@ -116,3 +116,3 @@ column: 'namae',

expect(data.items.length).toEqual(1);
expect(data.items[0].name).toEqual('3');
expect(data.items[0].name).toEqual('name_3');
});

@@ -132,3 +132,3 @@

it('Search', async () => {
dto.search = '3';
dto.search = '_3';
const data = await grid.filter(dto);

@@ -139,2 +139,13 @@ expect(data.items.length).toEqual(1);

it('Search with filter', async () => {
dto.search = '3';
dto.filter = [[{
value: ['3'],
operator: Operator.GT,
column: 'id',
}]];
const data = await grid.filter(dto);
expect(data.items.length).toEqual(0);
});
});

@@ -20,3 +20,4 @@ import AGrid from '../lib/AGrid';

protected searchableColumns: string[] | null = [
'namae'
'id',
'namae',
];

@@ -23,0 +24,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