FilterQL A tiny query language for filtering structured data 🚀 There are two main parts of this repository: the TypeScript library and the FilterQL language specification. Implementations in other languages are more than welcome! TypeScript Library Installation bun add filterql # or: npm install filterql Usage Define a schema for your data and create a FilterQL instance: import { FilterQL } from "filterql" // The schema determines what fields are allowed in the query const schema = { title : { type : "string" , alias : "t" } , year : { type : "number" , alias : "y" } , monitored : { type : "boolean" , alias : "m" } , rating : { type : "number" } , genre : { type : "string" } , } const filterql = new FilterQL ( { schema } ) const movies = [ { title : "The Matrix" , year : 1999 , monitored : true , rating : 8.7 , genre : "Action" } , { title : "Inception" , year : 2010 , monitored : true , rating : 8.8 , genre : "Thriller" } , { title : "The Dark Knight" , year : 2008 , monitored : false , rating : 9.0 , genre : "Action" } , ] // Filter movies by genre const actionMovies = filterql . filter ( movies , "genre == Action" ) // Field aliases and multiple comparisons const recentGoodMovies = filterql . filter ( movies , "y >= 2008 && rating >= 8.5" ) // Sort the filtered data by using the built-in SORT operation const recentGoodMovies = filterql . filter ( movies , "year >= 2008 | SORT rating desc" ) // Filter using boolean shorthand const monitoredMovies = filterql . filter ( movies , "monitored" ) A more realistic example Let's say you're building a CLI tool that fetches some data to be filtered by a query the user provides: import { FilterQL } from "filterql" // data is an array of objects const data = await ( await fetch ( "https://api.example.com/movies" ) ) . json ( ) const query = process . argv [ 2 ] // first argument const schema = { title : { type : "string" , alias : "t" } , year : { type : "number" , alias : "y" } , monitored : { type : "boolean" , alias : "m" ...
First seen: 2025-08-27 11:22
Last seen: 2025-08-27 18:23