Skip to content

Latest commit

 

History

History

property-filter-pretty

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@promaster-sdk/property-filter-pretty

npm version code style: prettier types MIT license

Pretty printing of property filters

Introduction

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.

Installation

npm install --save @promaster-sdk/property-filter-pretty

The library is compiled to ES5 and no polyfills are required.

Usage

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