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

matches-where-query

Package Overview
Dependencies
Maintainers
11
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matches-where-query

This function determines if the provided `object` matches every comparison clause in `whereQuery`, returning `true` or `false` accordingly.

  • 2.0.2
  • npm
  • Socket score

Version published
Weekly downloads
67
increased by19.64%
Maintainers
11
Weekly downloads
 
Created
Source

matchesWhereQuery( object, whereQuery )

This function determines if the provided object matches every comparison clause in whereQuery, returning true or false accordingly.

whereQuery is an object of the form:

{
	<attribute> : <value>
	<attribute> : [ <value1>, ..., <valueN> ]
	<attribute> : { comparator : <comparator>, value : <value> }
}

Comparisons

For each clause in whereQuery, an attribute of object is compared to a value (primitive or object.)

equals (default)

Single Value

If the attribute is a single value, object.attribute must strictly equal the value to result in a match.

{
	<attribute> : <value>
}

Array

If the attribute is is an array, only records for which object.attribute is strictly equally to one of the elements in the array will result in a match.

{
	<attribute> : [ <value1>, ..., <valueN> ]
}

doesNotEqual

The compared attribute must must not be strictly equal to the value to result in a match.

{
	<attribute> : { comparator : 'doesNotEqual', value : <value> }
}

isGreaterThan

The compared attribute must be greater than the value to result in a match.

{
	<attribute> : { comparator : 'isGreaterThan', value : <value> }
}

isGreaterThanOrEqualTo

The compared attribute must be greater than or equal to the value to result in a match.

{
	<attribute> : { comparator : 'isGreaterThan', value : <value> }
}

isLessThan

The compared attribute must be less than the value to result in a match.

{
	<attribute> : { comparator : 'isLessThan', value : <value> }
}

isLessThanOrEqualTo

The compared attribute must be less than or equal to the value to result in a match.

{
	<attribute> : { comparator : 'isLessThanOrEqualTo', value : <value> }
}

isBetween

The compared attribute must be between the minimum and maximum values provided to result in a match. The limits provided are included in the range for the value.

{
	<attribute> : { comparator : 'isBetween', value : [ <minValue>, <maxValue> ] }
}

startsWith

The compared attribute must be a string that starts with the string value provided to result in a match.

{
	<attribute> : { comparator : 'startsWith', value : <value> }
}

endsWith

The compared attribute must be a string that ends with the string value provided to result in a match.

{
	<attribute> : { comparator : 'endsWith', value : <value> }
}

FAQs

Package last updated on 25 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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