SPL is a very small, lightweight, straightforward and non-evaluated expression language to sort, filter and paginate arrays of maps.
See SPL.g4 file
Given this simple dataset:
const dataset = [
{
firstName: "Martin",
lastName: "Dupont",
age: 21,
address: {
country: "France",
town: "Paris",
},
},
{
firstName: "Bertrand",
lastName: "Dupont",
age: 17,
address: {
country: "South Korea",
town: "Seoul",
},
},
{
firstName: "Michel",
lastName: "Dupond",
age: 19,
address: {
country: "France",
town: "Toulouse",
},
},
]The following expressions can be applied using SPL:
lastName = 'Dupont'(firstName = 'Seb') AND (lastName = 'Dupont')(firstName IN ['Seb', 'Paul', 'Jean']) OR (lastName = 'Dupont')(givenName IN [firstName, lastName]) OR (lastName = 'Dupont')(givenName IN [:variable1, :variable2]) OR (lastName = :variable3)address.country = 'France'SORT BY firstName ASC, lastName DESCLIMIT 0, 100