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

mingo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mingo - npm Package Compare versions

Comparing version 6.0.5 to 6.0.6

6

CHANGELOG.md
# Changelog
## 6.0.6 / 2022-04-29
**Fixes**
- Correctly handle comparison of multiple deeply nested arrays. Fixes [#238](https://github.com/kofrasa/mingo/issues/238)
## 6.0.5 / 2022-02-24

@@ -4,0 +10,0 @@

34

operators/_predicates.d.ts

@@ -6,2 +6,5 @@ /**

import { AnyVal, Predicate, RawArray, RawObject } from "../types";
declare type PredicateOptions = Options & {
depth: number;
};
/**

@@ -26,3 +29,3 @@ * Returns a query operator created from the predicate

*/
export declare function $eq(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $eq(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -35,3 +38,3 @@ * Matches all values that are not equal to the value specified in the query.

*/
export declare function $ne(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $ne(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -44,3 +47,3 @@ * Matches any of the values that exist in an array specified in the query.

*/
export declare function $in(a: RawArray, b: RawArray, options?: Options): boolean;
export declare function $in(a: RawArray, b: RawArray, options?: PredicateOptions): boolean;
/**

@@ -53,3 +56,3 @@ * Matches values that do not exist in an array specified to the query.

*/
export declare function $nin(a: RawArray, b: RawArray, options?: Options): boolean;
export declare function $nin(a: RawArray, b: RawArray, options?: PredicateOptions): boolean;
/**

@@ -62,3 +65,3 @@ * Matches values that are less than the value specified in the query.

*/
export declare function $lt(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $lt(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -71,3 +74,3 @@ * Matches values that are less than or equal to the value specified in the query.

*/
export declare function $lte(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $lte(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -80,3 +83,3 @@ * Matches values that are greater than the value specified in the query.

*/
export declare function $gt(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $gt(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -89,3 +92,3 @@ * Matches values that are greater than or equal to the value specified in the query.

*/
export declare function $gte(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $gte(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -98,3 +101,3 @@ * Performs a modulo operation on the value of a field and selects documents with a specified result.

*/
export declare function $mod(a: AnyVal, b: number[], options?: Options): boolean;
export declare function $mod(a: AnyVal, b: number[], options?: PredicateOptions): boolean;
/**

@@ -107,3 +110,3 @@ * Selects documents where values match a specified regular expression.

*/
export declare function $regex(a: AnyVal, b: RegExp, options?: Options): boolean;
export declare function $regex(a: AnyVal, b: RegExp, options?: PredicateOptions): boolean;
/**

@@ -116,3 +119,3 @@ * Matches documents that have the specified field.

*/
export declare function $exists(a: AnyVal, b: AnyVal, options?: Options): boolean;
export declare function $exists(a: AnyVal, b: AnyVal, options?: PredicateOptions): boolean;
/**

@@ -125,3 +128,3 @@ * Matches arrays that contain all elements specified in the query.

*/
export declare function $all(values: RawArray, queries: Array<RawObject>, options?: Options): boolean;
export declare function $all(values: RawArray, queries: Array<RawObject>, options?: PredicateOptions): boolean;
/**

@@ -134,3 +137,3 @@ * Selects documents if the array field is a specified size.

*/
export declare function $size(a: RawArray, b: number, options?: Options): boolean;
export declare function $size(a: RawArray, b: number, options?: PredicateOptions): boolean;
/**

@@ -142,3 +145,3 @@ * Selects documents if element in the array field matches all the specified $elemMatch condition.

*/
export declare function $elemMatch(a: RawArray, b: RawObject, options?: Options): boolean;
export declare function $elemMatch(a: RawArray, b: RawObject, options?: PredicateOptions): boolean;
/**

@@ -151,2 +154,3 @@ * Selects documents if a field is of the specified type.

*/
export declare function $type(a: AnyVal, b: number | string | Array<number | string>, options?: Options): boolean;
export declare function $type(a: AnyVal, b: number | string | Array<number | string>, options?: PredicateOptions): boolean;
export {};

@@ -5,2 +5,13 @@ "use strict";

*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,6 +31,7 @@ exports.$type = exports.$elemMatch = exports.$size = exports.$all = exports.$exists = exports.$regex = exports.$mod = exports.$gte = exports.$gt = exports.$lte = exports.$lt = exports.$nin = exports.$in = exports.$ne = exports.$eq = exports.createExpressionOperator = exports.createQueryOperator = void 0;

var opts = { unwrapArray: true };
var depth = Math.max(1, selector.split(".").length - 1);
return function (obj) {
// value of field must be fully resolved.
var lhs = (0, util_1.resolve)(obj, selector, opts);
return predicate(lhs, value, options);
return predicate(lhs, value, __assign(__assign({}, options), { depth: depth }));
};

@@ -58,3 +70,3 @@ };

var eq = util_1.isEqual.bind(null, b);
return a.some(eq) || (0, util_1.flatten)(a, 1).some(eq);
return a.some(eq) || (0, util_1.flatten)(a, options.depth).some(eq);
}

@@ -61,0 +73,0 @@ return false;

{
"name": "mingo",
"version": "6.0.5",
"version": "6.0.6",
"description": "MongoDB query language for in-memory objects",

@@ -5,0 +5,0 @@ "main": "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