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

@nextgis/properties-filter

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/properties-filter - npm Package Compare versions

Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [1.0.0-alpha.7](https://github.com/nextgis/nextgis_frontend/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2020-09-22)
**Note:** Version bump only for package @nextgis/properties-filter
# [1.0.0-alpha.6](https://github.com/nextgis/nextgis_frontend/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2020-09-09)

@@ -8,0 +16,0 @@

6

lib/index.d.ts

@@ -37,8 +37,4 @@ import { Feature } from 'geojson';

*/
export declare type PropertyFilter<T extends Properties = Properties> = [
keyof T | string,
Operations,
any
];
export declare type PropertyFilter<T extends Properties = Properties> = [keyof T | string, Operations, any];
export { }

@@ -0,1 +1,2 @@

/** Bundle of @nextgis/properties-filter; version: 1.0.0-alpha.7; author: NextGIS */
'use strict';

@@ -7,28 +8,2 @@

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(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);
};
function like(b, a, iLike) {

@@ -41,26 +16,26 @@ a = String(a);

return true;
var re = ("^" + utils.reEscape(a) + "$").replace(/%/g, '.*').replace('_', '.');
const re = `^${utils.reEscape(a)}$`.replace(/%/g, '.*').replace('_', '.');
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
}
var operationsAliases = {
const operationsAliases = {
// greater(>)
gt: function (a, b) { return a > b; },
gt: (a, b) => a > b,
// lower(<)
lt: function (a, b) { return a < b; },
lt: (a, b) => a < b,
// greater or equal(>=)
ge: function (a, b) { return a >= b; },
ge: (a, b) => a >= b,
// lower or equal(<=)
le: function (a, b) { return a <= b; },
le: (a, b) => a <= b,
// equal(=)
eq: function (a, b) { return a === b; },
eq: (a, b) => a === b,
// not equal(!=)
ne: function (a, b) { return a !== b; },
in: function (a, b) { return b.indexOf(a) !== -1; },
notin: function (a, b) { return b.indexOf(a) === -1; },
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: function (a, b) {
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: function (a, b) {
ilike: (a, b) => {
return like(a, b, true);

@@ -70,3 +45,3 @@ },

function checkIfPropertyFilter(filter) {
var pf = filter;
const pf = filter;
if (pf.length === 3 &&

@@ -80,3 +55,3 @@ typeof pf[0] === 'string' &&

function featureFilter(feature, filters) {
var properties = __assign({}, feature.properties);
const properties = { ...feature.properties };
if (properties) {

@@ -90,19 +65,19 @@ // workaround to filter by feature id

function propertiesFilter(properties, filters) {
var logic = typeof filters[0] === 'string' ? filters[0] : 'all';
var filterFunction = function (p) {
const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
const filterFunction = (p) => {
if (checkIfPropertyFilter(p)) {
var field_1 = p[0], operation = p[1], value_1 = p[2];
var operationExec = operationsAliases[operation];
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === 'like' || operation === 'ilike') {
if (typeof field_1 === 'string') {
var prop_1 = '';
var value_ = field_1.replace(/^%?(\w+)%?$/, function (match, cleanField) {
prop_1 = properties[cleanField];
return field_1.replace(cleanField, value_1);
if (typeof field === 'string') {
let prop = '';
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop_1, value_);
return operationExec(prop, value_);
}
}
return operationExec(properties[field_1], value_1);
return operationExec(properties[field], value);
}

@@ -115,3 +90,3 @@ return false;

};
var filters_ = filters.filter(function (x) { return Array.isArray(x); });
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === 'any'

@@ -118,0 +93,0 @@ ? filters_.some(filterFunction)

@@ -1,15 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@nextgis/utils"),e=function(){return(e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r}).apply(this,arguments)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function t(e,t,n){if((t=String(t))===(e=String(e)))return!0;if(n&&t.toUpperCase()===e.toUpperCase())return!0;var i=("^"+r.reEscape(t)+"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,n?"i":"").exec(e)}var n={gt:function(r,e){return r>e},lt:function(r,e){return r<e},ge:function(r,e){return r>=e},le:function(r,e){return r<=e},eq:function(r,e){return r===e},ne:function(r,e){return r!==e},in:function(r,e){return-1!==e.indexOf(r)},notin:function(r,e){return-1===e.indexOf(r)},like:function(r,e){return t(r,e)},ilike:function(r,e){return t(r,e,!0)}};function i(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function u(r,e){var t="string"==typeof e[0]?e[0]:"all",o=function(e){if(i(e)){var t=e[0],o=e[1],f=e[2],c=n[o];if(c){if(("like"===o||"ilike"===o)&&"string"==typeof t){var p="",a=t.replace(/^%?(\w+)%?$/,(function(e,n){return p=r[n],t.replace(n,f)}));return c(p,a)}return c(r[t],f)}return!1}return u(r,e)},f=e.filter((function(r){return Array.isArray(r)}));return"any"===t?f.some(o):f.every(o)}exports.checkIfPropertyFilter=i,exports.featureFilter=function(r,t){var n=e({},r.properties);return!!n&&(n.$id=r.id,u(n,t))},exports.operationsAliases=n,exports.propertiesFilter=u;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nextgis/utils");function r(r,t,n){if((t=String(t))===(r=String(r)))return!0;if(n&&t.toUpperCase()===r.toUpperCase())return!0;const i=`^${e.reEscape(t)}$`.replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,n?"i":"").exec(r)}const t={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(e,t)=>r(e,t),ilike:(e,t)=>r(e,t,!0)};function n(e){return 3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]}function i(e,r){const o="string"==typeof r[0]?r[0]:"all",s=r=>{if(n(r)){const[n,i,o]=r,s=t[i];if(s){if(("like"===i||"ilike"===i)&&"string"==typeof n){let r="";const t=n.replace(/^%?(\w+)%?$/,(t,i)=>(r=e[i],n.replace(i,o)));return s(r,t)}return s(e[n],o)}return!1}return i(e,r)},p=r.filter(e=>Array.isArray(e));return"any"===o?p.some(s):p.every(s)}exports.checkIfPropertyFilter=n,exports.featureFilter=function(e,r){const t={...e.properties};return!!t&&(t.$id=e.id,i(t,r))},exports.operationsAliases=t,exports.propertiesFilter=i;

@@ -1,27 +0,2 @@

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(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);
};
/** Bundle of @nextgis/properties-filter; version: 1.0.0-alpha.7; author: NextGIS */
function reEscape(s) {

@@ -38,26 +13,26 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');

return true;
var re = ("^" + reEscape(a) + "$").replace(/%/g, '.*').replace('_', '.');
const re = `^${reEscape(a)}$`.replace(/%/g, '.*').replace('_', '.');
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
}
var operationsAliases = {
const operationsAliases = {
// greater(>)
gt: function (a, b) { return a > b; },
gt: (a, b) => a > b,
// lower(<)
lt: function (a, b) { return a < b; },
lt: (a, b) => a < b,
// greater or equal(>=)
ge: function (a, b) { return a >= b; },
ge: (a, b) => a >= b,
// lower or equal(<=)
le: function (a, b) { return a <= b; },
le: (a, b) => a <= b,
// equal(=)
eq: function (a, b) { return a === b; },
eq: (a, b) => a === b,
// not equal(!=)
ne: function (a, b) { return a !== b; },
in: function (a, b) { return b.indexOf(a) !== -1; },
notin: function (a, b) { return b.indexOf(a) === -1; },
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: function (a, b) {
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: function (a, b) {
ilike: (a, b) => {
return like(a, b, true);

@@ -67,3 +42,3 @@ },

function checkIfPropertyFilter(filter) {
var pf = filter;
const pf = filter;
if (pf.length === 3 &&

@@ -77,3 +52,3 @@ typeof pf[0] === 'string' &&

function featureFilter(feature, filters) {
var properties = __assign({}, feature.properties);
const properties = { ...feature.properties };
if (properties) {

@@ -87,19 +62,19 @@ // workaround to filter by feature id

function propertiesFilter(properties, filters) {
var logic = typeof filters[0] === 'string' ? filters[0] : 'all';
var filterFunction = function (p) {
const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
const filterFunction = (p) => {
if (checkIfPropertyFilter(p)) {
var field_1 = p[0], operation = p[1], value_1 = p[2];
var operationExec = operationsAliases[operation];
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === 'like' || operation === 'ilike') {
if (typeof field_1 === 'string') {
var prop_1 = '';
var value_ = field_1.replace(/^%?(\w+)%?$/, function (match, cleanField) {
prop_1 = properties[cleanField];
return field_1.replace(cleanField, value_1);
if (typeof field === 'string') {
let prop = '';
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop_1, value_);
return operationExec(prop, value_);
}
}
return operationExec(properties[field_1], value_1);
return operationExec(properties[field], value);
}

@@ -112,3 +87,3 @@ return false;

};
var filters_ = filters.filter(function (x) { return Array.isArray(x); });
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === 'any'

@@ -115,0 +90,0 @@ ? filters_.some(filterFunction)

@@ -1,15 +0,1 @@

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var r=function(){return(r=Object.assign||function(r){for(var n,e=1,t=arguments.length;e<t;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r}).apply(this,arguments)};function n(r,n,e){if((n=String(n))===(r=String(r)))return!0;if(e&&n.toUpperCase()===r.toUpperCase())return!0;var t,i=("^"+(t=n,t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")+"$")).replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,e?"i":"").exec(r)}var e={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,e){return n(r,e)},ilike:function(r,e){return n(r,e,!0)}};function t(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function i(n,e){var t=r({},n.properties);return!!t&&(t.$id=n.id,u(t,e))}function u(r,n){var i="string"==typeof n[0]?n[0]:"all",o=function(n){if(t(n)){var i=n[0],o=n[1],f=n[2],c=e[o];if(c){if(("like"===o||"ilike"===o)&&"string"==typeof i){var a="",p=i.replace(/^%?(\w+)%?$/,(function(n,e){return a=r[e],i.replace(e,f)}));return c(a,p)}return c(r[i],f)}return!1}return u(r,n)},f=n.filter((function(r){return Array.isArray(r)}));return"any"===i?f.some(o):f.every(o)}export{t as checkIfPropertyFilter,i as featureFilter,e as operationsAliases,u as propertiesFilter};
function e(e,r,n){if((r=String(r))===(e=String(e)))return!0;if(n&&r.toUpperCase()===e.toUpperCase())return!0;const t=`^${i=r,i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}$`.replace(/%/g,".*").replace("_",".");var i;return null!==new RegExp(t,n?"i":"").exec(e)}const r={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(r,n)=>e(r,n),ilike:(r,n)=>e(r,n,!0)};function n(e){return 3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]}function t(e,r){const n={...e.properties};return!!n&&(n.$id=e.id,i(n,r))}function i(e,t){const o="string"==typeof t[0]?t[0]:"all",l=t=>{if(n(t)){const[n,i,o]=t,l=r[i];if(l){if(("like"===i||"ilike"===i)&&"string"==typeof n){let r="";const t=n.replace(/^%?(\w+)%?$/,(t,i)=>(r=e[i],n.replace(i,o)));return l(r,t)}return l(e[n],o)}return!1}return i(e,t)},p=t.filter(e=>Array.isArray(e));return"any"===o?p.some(l):p.every(l)}export{n as checkIfPropertyFilter,t as featureFilter,r as operationsAliases,i as propertiesFilter};

@@ -0,29 +1,4 @@

/** Bundle of @nextgis/properties-filter; version: 1.0.0-alpha.7; author: NextGIS */
import { reEscape } from '@nextgis/utils';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(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);
};
function like(b, a, iLike) {

@@ -36,26 +11,26 @@ a = String(a);

return true;
var re = ("^" + reEscape(a) + "$").replace(/%/g, '.*').replace('_', '.');
const re = `^${reEscape(a)}$`.replace(/%/g, '.*').replace('_', '.');
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
}
var operationsAliases = {
const operationsAliases = {
// greater(>)
gt: function (a, b) { return a > b; },
gt: (a, b) => a > b,
// lower(<)
lt: function (a, b) { return a < b; },
lt: (a, b) => a < b,
// greater or equal(>=)
ge: function (a, b) { return a >= b; },
ge: (a, b) => a >= b,
// lower or equal(<=)
le: function (a, b) { return a <= b; },
le: (a, b) => a <= b,
// equal(=)
eq: function (a, b) { return a === b; },
eq: (a, b) => a === b,
// not equal(!=)
ne: function (a, b) { return a !== b; },
in: function (a, b) { return b.indexOf(a) !== -1; },
notin: function (a, b) { return b.indexOf(a) === -1; },
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: function (a, b) {
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: function (a, b) {
ilike: (a, b) => {
return like(a, b, true);

@@ -65,3 +40,3 @@ },

function checkIfPropertyFilter(filter) {
var pf = filter;
const pf = filter;
if (pf.length === 3 &&

@@ -75,3 +50,3 @@ typeof pf[0] === 'string' &&

function featureFilter(feature, filters) {
var properties = __assign({}, feature.properties);
const properties = { ...feature.properties };
if (properties) {

@@ -85,19 +60,19 @@ // workaround to filter by feature id

function propertiesFilter(properties, filters) {
var logic = typeof filters[0] === 'string' ? filters[0] : 'all';
var filterFunction = function (p) {
const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
const filterFunction = (p) => {
if (checkIfPropertyFilter(p)) {
var field_1 = p[0], operation = p[1], value_1 = p[2];
var operationExec = operationsAliases[operation];
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === 'like' || operation === 'ilike') {
if (typeof field_1 === 'string') {
var prop_1 = '';
var value_ = field_1.replace(/^%?(\w+)%?$/, function (match, cleanField) {
prop_1 = properties[cleanField];
return field_1.replace(cleanField, value_1);
if (typeof field === 'string') {
let prop = '';
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop_1, value_);
return operationExec(prop, value_);
}
}
return operationExec(properties[field_1], value_1);
return operationExec(properties[field], value);
}

@@ -110,3 +85,3 @@ return false;

};
var filters_ = filters.filter(function (x) { return Array.isArray(x); });
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === 'any'

@@ -113,0 +88,0 @@ ? filters_.some(filterFunction)

@@ -1,15 +0,1 @@

import{reEscape as r}from"@nextgis/utils";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var n=function(){return(n=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r}).apply(this,arguments)};function t(n,t,e){if((t=String(t))===(n=String(n)))return!0;if(e&&t.toUpperCase()===n.toUpperCase())return!0;var i=("^"+r(t)+"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,e?"i":"").exec(n)}var e={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return t(r,n)},ilike:function(r,n){return t(r,n,!0)}};function i(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function u(r,t){var e=n({},r.properties);return!!e&&(e.$id=r.id,o(e,t))}function o(r,n){var t="string"==typeof n[0]?n[0]:"all",u=function(n){if(i(n)){var t=n[0],u=n[1],f=n[2],c=e[u];if(c){if(("like"===u||"ilike"===u)&&"string"==typeof t){var a="",p=t.replace(/^%?(\w+)%?$/,(function(n,e){return a=r[e],t.replace(e,f)}));return c(a,p)}return c(r[t],f)}return!1}return o(r,n)},f=n.filter((function(r){return Array.isArray(r)}));return"any"===t?f.some(u):f.every(u)}export{i as checkIfPropertyFilter,u as featureFilter,e as operationsAliases,o as propertiesFilter};
import{reEscape as e}from"@nextgis/utils";function r(r,t,n){if((t=String(t))===(r=String(r)))return!0;if(n&&t.toUpperCase()===r.toUpperCase())return!0;const i=`^${e(t)}$`.replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,n?"i":"").exec(r)}const t={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(e,t)=>r(e,t),ilike:(e,t)=>r(e,t,!0)};function n(e){return 3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]}function i(e,r){const t={...e.properties};return!!t&&(t.$id=e.id,o(t,r))}function o(e,r){const i="string"==typeof r[0]?r[0]:"all",l=r=>{if(n(r)){const[n,i,o]=r,l=t[i];if(l){if(("like"===i||"ilike"===i)&&"string"==typeof n){let r="";const t=n.replace(/^%?(\w+)%?$/,(t,i)=>(r=e[i],n.replace(i,o)));return l(r,t)}return l(e[n],o)}return!1}return o(e,r)},f=r.filter(e=>Array.isArray(e));return"any"===i?f.some(l):f.every(l)}export{n as checkIfPropertyFilter,i as featureFilter,t as operationsAliases,o as propertiesFilter};

@@ -0,1 +1,2 @@

/** Bundle of @nextgis/properties-filter; version: 1.0.0-alpha.7; author: NextGIS */
var PropertiesFilter = (function (exports) {

@@ -2,0 +3,0 @@ 'use strict';

{
"name": "@nextgis/properties-filter",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "Filtering objects by its properties using expressions",

@@ -11,7 +11,7 @@ "main": "index.js",

"dependencies": {
"@nextgis/utils": "^1.0.0-alpha.6",
"@nextgis/utils": "^1.0.0-alpha.7",
"geojson": "^0.5.0"
},
"devDependencies": {
"@nextgis/build-tools": "^1.0.0-alpha.6"
"@nextgis/build-tools": "^1.0.0-alpha.7"
},

@@ -52,3 +52,3 @@ "buildOptions": {

},
"gitHead": "09398fcf869301e8d6628120e54256f17805bdf6"
"gitHead": "d90c7d5a2bc01143221e8ec768ab5d0467fb5530"
}
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