The lodash method kebabCase exported as a standalone Node.js module for converting strings to kebab-case format
Overall
score
68%
Evaluation — 68%
↑ 1.08xAgent success when using this tile
Build a utility that turns concise rule definitions into reusable predicates for filtering and projecting catalog entries.
"status.active", the predicate returns true for { status: { active: true } } and false for { status: { active: 0 } }. @test{ region: "us", tags: ["sale"] }, the predicate passes { region: "us", tags: ["sale", "fresh"] } and fails { region: "us", tags: ["new"] }. @test["score.primary", 90], the predicate returns true for { score: { primary: 90 } } and false for { score: { primary: 80 } }. @test(item) => item.source === "trusted", the returned predicate is that exact function reference and is invoked without extra wrapping. @test["score.primary", 90] and { region: "us" } with mode "any" accepts { score: { primary: 90 }, region: "ca" }, while the default "all" mode rejects that item and only accepts one that meets both rules. @test{ name: "Alpha", region: "eu", featured: true }, { name: "Beta", region: "us", featured: true }, and { name: "Gamma", region: "eu", featured: false }, filtering with rules [ { region: "eu" }, "featured" ] and projecting with ["name", "region"] returns [ { name: "Alpha", region: "eu" } ]. @test@generates
/**
* Converts a single rule definition into a predicate function that receives a catalog entry.
* Supported rules:
* - string paths for truthy checks,
* - [path, expected] tuples for strict equality checks,
* - plain objects for matching nested property values,
* - predicate functions (returned as-is).
*/
function buildPredicate(ruleDef);
/**
* Compiles an array of rule definitions into a combined predicate.
* @param {Array} rules - List of rule definitions accepted by buildPredicate.
* @param {Object} [options]
* @param {"all"|"any"} [options.mode="all"] - Whether every or any rule must pass.
*/
function compileRuleSet(rules, options);
/**
* Filters catalog entries using a compiled rule set and projects fields for matches.
* @param {Array} items - List of catalog entries.
* @param {Array} rules - Rule definitions to compile and apply.
* @param {string|string[]|Function} projector - Field selector(s) or mapper to shape the output.
* @param {Object} [options] - Same options accepted by compileRuleSet.
* @returns {Array} Filtered and projected results.
*/
function filterAndProject(items, rules, projector, options);Utility toolkit for building predicates from shorthand rule definitions.
Install with Tessl CLI
npx tessl i tessl/npm-lodash-kebabcasedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10