Matilde
A small library to transform JSON input to ~FBV~ syntax to work with Meadow endpoints.
From this:
To this!!
Input Structure
[
{...}, // See signature
[ // nesting
{...},
{...},
[ // even more nesting
{...}
]
]
]
Signature
Argument | Type | Required | Description |
---|---|---|---|
prop | String | Yes | The property to query or sort on |
qualifier | String | Yes | A value from the list of qualifiers |
value | String | Yes | Value to query with |
op | String | No | Query using OR . Defaults to AND |
sort | String, Boolean | No | Sort on property ASC or DESC . Defaults to DESC if property is boolean and true |
Usage
var inputData = [{prop: 'ID',qualifier: 'EQ',value: '1'},[{prop: 'Role',qualifier: 'LE',value: '4',op: 'OR'}, {prop: 'FirstName',qualifier: 'LK',value: 'Cesar',op: 'OR',sort: true},[{prop: 'LastName',qualifier: 'INN',values: ['Chavez', 'Vargas']}]]]// instantiatevar stuff = new Matilde();// then manually initstuff.init(inputData);// or instantiate and init in onevar stuff = new Matilde(inputData);// outputstuff.toString();// outputs"FBV~IDCompany~EQ~1~FOP~0~(~0~FBVOR~IDRole~EQ~4~FBVOR~FirstName~LK~one%25~FOP~0~(~0~FBL~LastName~INN~one,two~FCP~0~)~0~FCP~0~)~0~FSF~IDRole~ASC~0~FSF~FirstName~DESC~0"
Methods
.toString()
returns "pew-ter" string