Socket
Socket
Sign inDemoInstall

@asymmetrik/elastic-querybuilder

Package Overview
Dependencies
0
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.10 to 0.9.11

33

__tests__/QueryBuilder.test.js

@@ -58,3 +58,3 @@ const QueryBuilder = require('../src/index');

const trackScores = true;
// Set the stractScore
// Set the trackScore
builder.trackScores(trackScores);

@@ -67,3 +67,34 @@ expect(builder._query.track_scores).toEqual(trackScores);

describe('clone', () => {
test('should be able to clone the builder', () => {
const builder = new QueryBuilder();
const clone = builder.clone();
expect(clone).toBeInstanceOf(QueryBuilder);
expect(clone).not.toBe(builder);
});
test('should have the same output on the original and clone but not be the same object', () => {
const builder = new QueryBuilder()
.should('match', 'alias', 'Mysterion')
.from(15)
.size(15);
const clone = builder.clone();
expect(clone.build()).toEqual(builder.build());
});
test('should be able to modify them separately after cloning them', () => {
const builder = new QueryBuilder().from(15).size(15);
const clone = builder.clone();
expect(clone).not.toBe(builder);
expect(clone.build()).toEqual(builder.build());
builder.should('match', 'alias', 'Mysterion');
expect(clone.build()).not.toEqual(builder.build());
});
});
describe('build', () => {

@@ -70,0 +101,0 @@

2

package.json
{
"name": "@asymmetrik/elastic-querybuilder",
"version": "0.9.10",
"version": "0.9.11",
"description": "A query builder for Elasticsearch.",

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

@@ -70,2 +70,13 @@ const BaseBuilder = require('./BaseBuilder');

/**
* @description Clone the current builder
* @return {QueryBuilder} this
*/
clone () {
return Object.assign(
Object.create(Object.getPrototypeOf(this)),
JSON.parse(JSON.stringify(this))
);
}
/**
* @description Build our boolean ES query

@@ -72,0 +83,0 @@ * @param {Object} options

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc