@promaster-sdk/property-filter-pretty
TypeScript icon, indicating that this package has built-in type declarations

7.0.1 • Public • Published

@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

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @promaster-sdk/property-filter-pretty

    Weekly Downloads

    286

    Version

    7.0.1

    License

    MIT

    Unpacked Size

    80.1 kB

    Total Files

    60

    Last publish

    Collaborators

    • rassva
    • zlafil
    • timmotoo
    • jonaskello
    • adam.luotonen
    • bjolind
    • dividstefansvensson
    • erieng
    • johankristiansson
    • jontem
    • geon