@nextgis/properties-filter
Advanced tools
Comparing version 1.16.8 to 1.17.0
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/properties-filter; version: 1.16.8; author: NextGIS */ | ||
/** Bundle of @nextgis/properties-filter; version: 1.17.0; author: NextGIS */ | ||
'use strict'; | ||
@@ -6,28 +6,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 reEscape(s) { | ||
@@ -43,26 +17,26 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
return true; | ||
var re = "^".concat(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); | ||
@@ -72,3 +46,3 @@ }, | ||
function isPropertyFilter(filter) { | ||
var pf = filter; | ||
const pf = filter; | ||
if (pf.length === 3 && | ||
@@ -86,3 +60,3 @@ typeof pf[0] === 'string' && | ||
function featureFilter(feature, filters) { | ||
var properties = __assign({}, feature.properties); | ||
const properties = { ...feature.properties }; | ||
if (properties) { | ||
@@ -96,19 +70,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 (isPropertyFilter(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); | ||
} | ||
@@ -121,3 +95,3 @@ return false; | ||
}; | ||
var filters_ = filters.filter(function (x) { return Array.isArray(x); }); | ||
const filters_ = filters.filter((x) => Array.isArray(x)); | ||
return logic === 'any' | ||
@@ -124,0 +98,0 @@ ? filters_.some(filterFunction) |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});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},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; | ||
"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; | ||
//# sourceMappingURL=properties-filter.cjs.prod.js.map |
@@ -1,28 +0,2 @@ | ||
/** Bundle of @nextgis/properties-filter; version: 1.16.8; 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); | ||
}; | ||
/** Bundle of @nextgis/properties-filter; version: 1.17.0; author: NextGIS */ | ||
function reEscape(s) { | ||
@@ -38,26 +12,26 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
return true; | ||
var re = "^".concat(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 +41,3 @@ }, | ||
function isPropertyFilter(filter) { | ||
var pf = filter; | ||
const pf = filter; | ||
if (pf.length === 3 && | ||
@@ -81,3 +55,3 @@ typeof pf[0] === 'string' && | ||
function featureFilter(feature, filters) { | ||
var properties = __assign({}, feature.properties); | ||
const properties = { ...feature.properties }; | ||
if (properties) { | ||
@@ -91,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 (isPropertyFilter(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); | ||
} | ||
@@ -116,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' | ||
@@ -119,0 +93,0 @@ ? filters_.some(filterFunction) |
@@ -1,2 +0,2 @@ | ||
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},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}; | ||
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}; | ||
//# sourceMappingURL=properties-filter.esm-browser.prod.js.map |
@@ -1,28 +0,2 @@ | ||
/** Bundle of @nextgis/properties-filter; version: 1.16.8; 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); | ||
}; | ||
/** Bundle of @nextgis/properties-filter; version: 1.17.0; author: NextGIS */ | ||
function reEscape(s) { | ||
@@ -38,26 +12,26 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
return true; | ||
var re = "^".concat(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 +41,3 @@ }, | ||
function isPropertyFilter(filter) { | ||
var pf = filter; | ||
const pf = filter; | ||
if (pf.length === 3 && | ||
@@ -81,3 +55,3 @@ typeof pf[0] === 'string' && | ||
function featureFilter(feature, filters) { | ||
var properties = __assign({}, feature.properties); | ||
const properties = { ...feature.properties }; | ||
if (properties) { | ||
@@ -91,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 (isPropertyFilter(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); | ||
} | ||
@@ -116,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' | ||
@@ -119,0 +93,0 @@ ? filters_.some(filterFunction) |
@@ -1,2 +0,2 @@ | ||
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},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}; | ||
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}; | ||
//# sourceMappingURL=properties-filter.esm-bundler.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/properties-filter; version: 1.16.8; author: NextGIS */ | ||
/** Bundle of @nextgis/properties-filter; version: 1.17.0; author: NextGIS */ | ||
var PropertiesFilter = (function (exports) { | ||
@@ -31,2 +31,7 @@ 'use strict'; | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
function reEscape(s) { | ||
@@ -33,0 +38,0 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); |
@@ -1,2 +0,2 @@ | ||
var PropertiesFilter=function(r){"use strict";var e=function(){return e=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},e.apply(this,arguments)};function n(r,e,n){if((e=String(e))===(r=String(r)))return!0;if(n&&e.toUpperCase()===r.toUpperCase())return!0;var t,i="^".concat((t=e,t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,n?"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,e){return n(r,e)},ilike:function(r,e){return n(r,e,!0)}};function i(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function u(r,e){var n="string"==typeof e[0]?e[0]:"all",o=function(e){if(i(e)){var n=e[0],o=e[1],f=e[2],c=t[o];if(c){if(("like"===o||"ilike"===o)&&"string"==typeof n){var a="",l=n.replace(/^%?(\w+)%?$/,(function(e,t){return a=r[t],n.replace(t,f)}));return c(a,l)}return c(r[n],f)}return!1}return u(r,e)},f=e.filter((function(r){return Array.isArray(r)}));return"any"===n?f.some(o):f.every(o)}return r.checkIfPropertyFilter=function(r){return i(r)},r.featureFilter=function(r,n){var t=e({},r.properties);return!!t&&(t.$id=r.id,u(t,n))},r.isPropertyFilter=i,r.propertiesFilter=u,Object.defineProperty(r,"__esModule",{value:!0}),r}({}); | ||
var PropertiesFilter=function(r){"use strict";var e=function(){return e=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},e.apply(this,arguments)};function n(r,e,n){if((e=String(e))===(r=String(r)))return!0;if(n&&e.toUpperCase()===r.toUpperCase())return!0;var t,i="^".concat((t=e,t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,n?"i":"").exec(r)}"function"==typeof SuppressedError&&SuppressedError;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,e){return n(r,e)},ilike:function(r,e){return n(r,e,!0)}};function i(r){return 3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]}function u(r,e){var n="string"==typeof e[0]?e[0]:"all",o=function(e){if(i(e)){var n=e[0],o=e[1],f=e[2],c=t[o];if(c){if(("like"===o||"ilike"===o)&&"string"==typeof n){var p="",a=n.replace(/^%?(\w+)%?$/,(function(e,t){return p=r[t],n.replace(t,f)}));return c(p,a)}return c(r[n],f)}return!1}return u(r,e)},f=e.filter((function(r){return Array.isArray(r)}));return"any"===n?f.some(o):f.every(o)}return r.checkIfPropertyFilter=function(r){return i(r)},r.featureFilter=function(r,n){var t=e({},r.properties);return!!t&&(t.$id=r.id,u(t,n))},r.isPropertyFilter=i,r.propertiesFilter=u,Object.defineProperty(r,"__esModule",{value:!0}),r}({}); | ||
//# sourceMappingURL=properties-filter.global.prod.js.map |
{ | ||
"name": "@nextgis/properties-filter", | ||
"version": "1.16.8", | ||
"version": "1.17.0", | ||
"description": "Filtering objects by its properties using expressions", | ||
@@ -11,7 +11,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"@nextgis/utils": "^1.16.8", | ||
"@nextgis/utils": "^1.17.0", | ||
"geojson": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"@nextgis/build-tools": "^1.16.8" | ||
"@nextgis/build-tools": "^1.17.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "buildOptions": { | ||
}, | ||
"gitHead": "e156aa6d884f1987e3f84649284d5f0c70d713a5" | ||
"gitHead": "c3162aae53c381cd6a581a2a67173fb1bf6de87e" | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76234
473
Updated@nextgis/utils@^1.17.0