Pretty printing of property filters
When a user selection of a PropertyValueSet
is invalid according to a PropertyFilter
it can be useful to show the filter to the user so he can correct his selections. However showing the raw filter syntax is not very helpful so this package has functions to convert the property filter syntax into human readable form.
npm install --save @promaster-sdk/property-filter-pretty
The library is compiled to ES5 and no polyfills are required.
import { PropertyFilter } from "@promaster-sdk/property";
import {
filterPrettyPrintIndented,
FilterPrettyPrintMessagesEnglish
} from "@promaster-sdk/property-filter-pretty";
const pf = PropertyFilter.fromString("a=1,2&b=3");
const pfPretty = filterPrettyPrintIndented(
FilterPrettyPrintMessagesEnglish,
2,
" "
pf
); // a should equal 1 or 2 and b should equal 3