@nativescript-community/ui-mapbox
Version:
Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.
37 lines • 1.32 kB
JavaScript
// src/ui-mapbox/expression-parser.ios.ts
// TypeScript shim that exports ExpressionParser (TS API) while delegating to native NativeExpressionParser when available.
export class ExpressionParser {
// Return native predicate object (opaque) if native parser available, otherwise return the expression JSON.
static parseJson(json) {
try {
if (global.NativeExpressionParser && global.NativeExpressionParser.parseJson) {
const res = global.NativeExpressionParser.parseJson(json);
if (res)
return res;
}
}
catch (e) {
// ignore and fallback
}
return json;
}
// Try to convert native predicate back to JSON expression. Returns array or null.
static toJson(filter) {
try {
if (!filter)
return null;
if (Array.isArray(filter))
return filter;
if (global.NativeExpressionParser && global.NativeExpressionParser.toJson) {
const res = global.NativeExpressionParser.toJson(filter);
if (res)
return res;
}
}
catch (e) {
// ignore
}
return null;
}
}
//# sourceMappingURL=expression-parser.ios.js.map