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.11.10 to 1.12.0

80

lib/properties-filter.cjs.js

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

/** Bundle of @nextgis/properties-filter; version: 1.11.10; author: NextGIS */
/** Bundle of @nextgis/properties-filter; version: 1.12.0; author: NextGIS */
'use strict';

@@ -6,2 +6,28 @@

/*! *****************************************************************************
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 reEscape(s) {

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

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

@@ -46,3 +72,3 @@ },

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

@@ -60,3 +86,3 @@ typeof pf[0] === 'string' &&

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

@@ -70,19 +96,19 @@ // workaround to filter by feature id

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

@@ -95,3 +121,3 @@ return false;

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

@@ -98,0 +124,0 @@ ? filters_.some(filterFunction)

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

"use strict";function e(e,r,t){if((r=String(r))===(e=String(e)))return!0;if(t&&r.toUpperCase()===e.toUpperCase())return!0;const n=`^${i=r,i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}$`.replace(/%/g,".*").replace("_",".");var i;return null!==new RegExp(n,t?"i":"").exec(e)}Object.defineProperty(exports,"__esModule",{value:!0});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,t)=>e(r,t),ilike:(r,t)=>e(r,t,!0)};function t(e){return 3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]}function n(e,i){const o="string"==typeof i[0]?i[0]:"all",p=i=>{if(t(i)){const[t,n,o]=i,p=r[n];if(p){if(("like"===n||"ilike"===n)&&"string"==typeof t){let r="";const n=t.replace(/^%?(\w+)%?$/,((n,i)=>(r=e[i],t.replace(i,o))));return p(r,n)}return p(e[t],o)}return!1}return n(e,i)},s=i.filter((e=>Array.isArray(e)));return"any"===o?s.some(p):s.every(p)}exports.checkIfPropertyFilter=function(e){return t(e)},exports.featureFilter=function(e,r){const t={...e.properties};return!!t&&(t.$id=e.id,n(t,r))},exports.isPropertyFilter=t,exports.propertiesFilter=n;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
/*! *****************************************************************************
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 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)};function e(r,e,t){if((e=String(e))===(r=String(r)))return!0;if(t&&e.toUpperCase()===r.toUpperCase())return!0;var n,i="^".concat((n=e,n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(r)}var t={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,t){return e(r,t)},ilike:function(r,t){return e(r,t,!0)}};function n(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function i(r,e){var u="string"==typeof e[0]?e[0]:"all",o=function(e){if(n(e)){var u=e[0],o=e[1],f=e[2],c=t[o];if(c){if(("like"===o||"ilike"===o)&&"string"==typeof u){var p="",a=u.replace(/^%?(\w+)%?$/,(function(e,t){return p=r[t],u.replace(t,f)}));return c(p,a)}return c(r[u],f)}return!1}return i(r,e)},f=e.filter((function(r){return Array.isArray(r)}));return"any"===u?f.some(o):f.every(o)}exports.checkIfPropertyFilter=function(r){return n(r)},exports.featureFilter=function(e,t){var n=r({},e.properties);return!!n&&(n.$id=e.id,i(n,t))},exports.isPropertyFilter=n,exports.propertiesFilter=i;
//# sourceMappingURL=properties-filter.cjs.prod.js.map

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

/** Bundle of @nextgis/properties-filter; version: 1.11.10; author: NextGIS */
/** Bundle of @nextgis/properties-filter; version: 1.12.0; author: NextGIS */
/*! *****************************************************************************
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 reEscape(s) {

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

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

@@ -41,3 +67,3 @@ },

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

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

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

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

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

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

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

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

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

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){return n(e)}function i(e,r){const n={...e.properties};return!!n&&(n.$id=e.id,o(n,r))}function o(e,t){const i="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 o(e,t)},c=t.filter((e=>Array.isArray(e)));return"any"===i?c.some(l):c.every(l)}export{t as checkIfPropertyFilter,i as featureFilter,n as isPropertyFilter,o as propertiesFilter};
/*! *****************************************************************************
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(n){for(var r,t=1,e=arguments.length;t<e;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n}).apply(this,arguments)};function r(n,r,t){if((r=String(r))===(n=String(n)))return!0;if(t&&r.toUpperCase()===n.toUpperCase())return!0;var e,i="^".concat((e=r,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(n)}var t={gt:function(n,r){return n>r},lt:function(n,r){return n<r},ge:function(n,r){return n>=r},le:function(n,r){return n<=r},eq:function(n,r){return n===r},ne:function(n,r){return n!==r},in:function(n,r){return-1!==r.indexOf(n)},notin:function(n,r){return-1===r.indexOf(n)},like:function(n,t){return r(n,t)},ilike:function(n,t){return r(n,t,!0)}};function e(n){return 3===n.length&&"string"==typeof n[0]&&"string"==typeof n[1]}function i(n){return e(n)}function u(r,t){var e=n({},r.properties);return!!e&&(e.$id=r.id,o(e,t))}function o(n,r){var i="string"==typeof r[0]?r[0]:"all",u=function(r){if(e(r)){var i=r[0],u=r[1],f=r[2],c=t[u];if(c){if(("like"===u||"ilike"===u)&&"string"==typeof i){var a="",p=i.replace(/^%?(\w+)%?$/,(function(r,t){return a=n[t],i.replace(t,f)}));return c(a,p)}return c(n[i],f)}return!1}return o(n,r)},f=r.filter((function(n){return Array.isArray(n)}));return"any"===i?f.some(u):f.every(u)}export{i as checkIfPropertyFilter,u as featureFilter,e as isPropertyFilter,o as propertiesFilter};
//# sourceMappingURL=properties-filter.esm-browser.prod.js.map

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

/** Bundle of @nextgis/properties-filter; version: 1.11.10; author: NextGIS */
/** Bundle of @nextgis/properties-filter; version: 1.12.0; author: NextGIS */
/*! *****************************************************************************
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 reEscape(s) {

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

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

@@ -41,3 +67,3 @@ },

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

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

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

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

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

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

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

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

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

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){return n(e)}function i(e,r){const n={...e.properties};return!!n&&(n.$id=e.id,o(n,r))}function o(e,t){const i="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 o(e,t)},c=t.filter((e=>Array.isArray(e)));return"any"===i?c.some(l):c.every(l)}export{t as checkIfPropertyFilter,i as featureFilter,n as isPropertyFilter,o as propertiesFilter};
/*! *****************************************************************************
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(n){for(var r,t=1,e=arguments.length;t<e;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n}).apply(this,arguments)};function r(n,r,t){if((r=String(r))===(n=String(n)))return!0;if(t&&r.toUpperCase()===n.toUpperCase())return!0;var e,i="^".concat((e=r,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(n)}var t={gt:function(n,r){return n>r},lt:function(n,r){return n<r},ge:function(n,r){return n>=r},le:function(n,r){return n<=r},eq:function(n,r){return n===r},ne:function(n,r){return n!==r},in:function(n,r){return-1!==r.indexOf(n)},notin:function(n,r){return-1===r.indexOf(n)},like:function(n,t){return r(n,t)},ilike:function(n,t){return r(n,t,!0)}};function e(n){return 3===n.length&&"string"==typeof n[0]&&"string"==typeof n[1]}function i(n){return e(n)}function u(r,t){var e=n({},r.properties);return!!e&&(e.$id=r.id,o(e,t))}function o(n,r){var i="string"==typeof r[0]?r[0]:"all",u=function(r){if(e(r)){var i=r[0],u=r[1],f=r[2],c=t[u];if(c){if(("like"===u||"ilike"===u)&&"string"==typeof i){var a="",p=i.replace(/^%?(\w+)%?$/,(function(r,t){return a=n[t],i.replace(t,f)}));return c(a,p)}return c(n[i],f)}return!1}return o(n,r)},f=r.filter((function(n){return Array.isArray(n)}));return"any"===i?f.some(u):f.every(u)}export{i as checkIfPropertyFilter,u as featureFilter,e as isPropertyFilter,o as propertiesFilter};
//# sourceMappingURL=properties-filter.esm-bundler.prod.js.map

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

/** Bundle of @nextgis/properties-filter; version: 1.11.10; author: NextGIS */
/** Bundle of @nextgis/properties-filter; version: 1.12.0; author: NextGIS */
var PropertiesFilter = (function (exports) {

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

{
"name": "@nextgis/properties-filter",
"version": "1.11.10",
"version": "1.12.0",
"description": "Filtering objects by its properties using expressions",

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

"dependencies": {
"@nextgis/utils": "^1.11.10",
"@nextgis/utils": "^1.12.0",
"geojson": "^0.5.0"
},
"devDependencies": {
"@nextgis/build-tools": "^1.11.10"
"@nextgis/build-tools": "^1.12.0"
},

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

},
"gitHead": "51bd939cf50df9657bbe5ed37327d641457eb417"
"gitHead": "cc0e45b49ec7cfcbd3c5ce00a5e0d6682cf8f21c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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