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

lapidary

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lapidary - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

readme_images/basic_parens.png

2

dist/lib/helpers.js

@@ -91,3 +91,3 @@ "use strict";

*/
return (!exports.traverseEvaluationTree(item, tree.left, l) !=
return (!exports.traverseEvaluationTree(item, tree.left, l) !==
!(!tree.invert === exports.traverseEvaluationTree(item, tree.right, l)));

@@ -94,0 +94,0 @@ default:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _a, _b;
var _a, _b, _c;
var date_fns_1 = require("date-fns");
var constants_1 = require("./constants");

@@ -106,2 +107,64 @@ var checkValue = function (v, facetKey) {

};
var DateEqualityEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
return date_fns_1.isEqual(date_fns_1.parse(item[objectKey]), date_fns_1.parse(cleanString(expression, facetKey)));
};
};
var DateNegativeEqualityEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
return !date_fns_1.isEqual(date_fns_1.parse(item[objectKey]), date_fns_1.parse(cleanString(expression, facetKey)));
};
};
var DateLTEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
return date_fns_1.isBefore(date_fns_1.parse(item[objectKey]), date_fns_1.parse(cleanString(expression, facetKey)));
};
};
var DateLTEEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
var date1 = date_fns_1.parse(item[objectKey]);
var date2 = date_fns_1.parse(cleanString(expression, facetKey));
return date_fns_1.isBefore(date1, date2) || date_fns_1.isEqual(date1, date2);
};
};
var DateGTEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
return date_fns_1.isAfter(date_fns_1.parse(item[objectKey]), date_fns_1.parse(cleanString(expression, facetKey)));
};
};
var DateGTEEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
var date1 = date_fns_1.parse(item[objectKey]);
var date2 = date_fns_1.parse(cleanString(expression, facetKey));
return date_fns_1.isAfter(date1, date2) || date_fns_1.isEqual(date1, date2);
};
};
var DateBetweenEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
var _a = expression.split(','), lower = _a[0], upper = _a[1];
var date = date_fns_1.parse(item[objectKey]);
var lowerDate = date_fns_1.parse(cleanString(lower, facetKey));
var upperDate = date_fns_1.parse(cleanString(upper, facetKey));
return date_fns_1.isAfter(date, lowerDate) && date_fns_1.isBefore(date, upperDate);
};
};
var DateInclusiveBetweenEvaluationGenerator = function (facetKey, expression) {
return function (item, l) {
var objectKey = l.getFacet(facetKey).objectKey;
var _a = expression.split(','), lower = _a[0], upper = _a[1];
var date = date_fns_1.parse(item[objectKey]);
var lowerDate = date_fns_1.parse(cleanString(lower, facetKey));
var upperDate = date_fns_1.parse(cleanString(upper, facetKey));
return ((date_fns_1.isAfter(date, lowerDate) && date_fns_1.isBefore(date, upperDate)) ||
date_fns_1.isEqual(date, lowerDate) ||
date_fns_1.isEqual(date, upperDate));
};
};
var DefaultEvaluationGenerator = function (facetKey, expression) {

@@ -130,2 +193,13 @@ return function (item, l) { return l.defaultFacet(item, facetKey); };

exports.NumericOperations = NumericOperations;
var DateOperations = (_c = {},
_c[constants_1.EQUAL] = DateEqualityEvaluationGenerator,
_c[constants_1.NOT_EQUAL] = DateNegativeEqualityEvaluationGenerator,
_c[constants_1.GREATER_THAN] = DateGTEvaluationGenerator,
_c[constants_1.LESS_THAN] = DateLTEvaluationGenerator,
_c[constants_1.GREATER_THAN_OR_EQUAL] = DateGTEEvaluationGenerator,
_c[constants_1.LESS_THAN_OR_EQUAL] = DateLTEEvaluationGenerator,
_c[constants_1.BETWEEN] = DateBetweenEvaluationGenerator,
_c[constants_1.INCLUSIVE_BETWEEN] = DateInclusiveBetweenEvaluationGenerator,
_c);
exports.DateOperations = DateOperations;
//# sourceMappingURL=operations.js.map

@@ -5,2 +5,3 @@ import { FilterGenerator, OperationMapping } from './types';

declare const NumericOperations: OperationMapping;
export { StringOperations, NumericOperations, DefaultEvaluationGenerator };
declare const DateOperations: OperationMapping;
export { StringOperations, NumericOperations, DateOperations, DefaultEvaluationGenerator };
{
"name": "lapidary",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -126,7 +126,8 @@ "keywords": [],

"@types/lodash.partition": "^4.6.4",
"lodash.partition": "^4.6.0",
"date-fns": "^1.30.1",
"express": "^4.16.4",
"express-favicon": "^2.0.1",
"lodash.partition": "^4.6.0",
"path": "^0.12.7"
}
}
![](https://i.imgur.com/RTlTF2g.png)
![Travis CI Badge](https://travis-ci.org/jbccollins/lapidary.svg?branch=master)
![Travis CI Badge](https://travis-ci.org/jbccollins/lapidary.svg?branch=master) [![NPM](https://img.shields.io/npm/v/lapidary.svg)](https://www.npmjs.com/package/lapidary)
## [Demo](https://jbccollins.github.io/lapidary/demo/index.html)
## [Demo](https://lapidary-demo.herokuapp.com/)

@@ -46,3 +46,4 @@ ### Configurable Faceted Filtering

There are two join types: `AND` and `OR`
There are three join types: `AND`, `OR` and `XOR`.
Spaces between cuts are implicitly treated as an `AND` join type.

@@ -87,3 +88,3 @@ This means that `age:>:21 AND age:<:30` is equivalent to `age:>:21 age:<:30`. It is still possible to have spaces in your parameters by using quotes like so: `street:=:"Brookside Avenue"`

Once again: English is a weird language. Be careful when while writing lapidary queries
Consider the question `I want to find everyone who is not 18 and who is not 21 either`;
Consider the question `I want to find everyone who is not 20 and who is not 30 either`;

@@ -103,2 +104,2 @@ You might be tempted to write this:

![](https://i.imgur.com/az5M2kM.png)
![](https://i.imgur.com/az5M2kM.png)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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