{"id":24867491,"url":"https://github.com/fleker/cel-js","last_synced_at":"2025-08-23T03:16:34.886Z","repository":{"id":151519707,"uuid":"456617290","full_name":"Fleker/cel-js","owner":"Fleker","description":"A port of Common Expression Language that can run in a Node or browser JS environment","archived":false,"fork":false,"pushed_at":"2024-03-25T01:52:41.000Z","size":234,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T18:29:38.721Z","etag":null,"topics":["filter","typescript","web"],"latest_commit_sha":null,"homepage":"http://felker.dev/cel-js/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fleker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-02-07T17:56:35.000Z","updated_at":"2024-03-29T19:56:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"8928e640-7bcc-4c58-bce3-6ff2763c2899","html_url":"https://github.com/Fleker/cel-js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fleker%2Fcel-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fleker%2Fcel-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fleker%2Fcel-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fleker%2Fcel-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fleker","download_url":"https://codeload.github.com/Fleker/cel-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236608448,"owners_count":19176471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filter","typescript","web"],"created_at":"2025-02-01T01:58:15.810Z","updated_at":"2025-02-01T01:58:16.465Z","avatar_url":"https://github.com/Fleker.png","language":"TypeScript","readme":"# Common Expression Language - JS\n\n## Supported functionality (subset)\n[x] Basic types and primitives\n[x] Comparisons\n[x] Lists\n[~] Logic - Ternary conditional, logical AND, logical OR\n[ ] etc\n\n## Usage\n\n```\nnpm install @fleker/cel-js\n```\n\n### Create a list\n\n```javascript\nconst expr = '[\"-1\"]'\nconst expected = {\n    list_value: {\n        values: { string_value: `-1` }\n    }\n}\n\nconst celSpec = new CelSpec();\nconst ast = celSpec.toAST(expr, {});\nconst tf = new TextFormatter({}, {})\n\nconst cel = tf.format(ast)\nexpect(cel).toStrictEqual(expected) // Returns `true`\n```\n\n### Pass-in variables through a JSON object\n\n```javascript\nconst expr = 'x'\nconst bindings = {\n    x: 123\n}\nconst expected = {\n    int64_value: 123\n}\nconst celSpec = new CelSpec();\nconst ast = celSpec.toAST(expr, {});\nconst bindingsAst = (() =\u003e {\n    if (!bindings) return {}\n    const tf = new TextFormatter({}, bindings)\n    let res = {}\n    for (const [key, entry] of Object.entries(bindings)) {\n        const entryAst = celSpec.toAST(`${entry}`)\n        const entryCel = tf.format(entryAst)\n        res[key] = entryCel\n    }\n    return res\n})()\nconst tf = new TextFormatter({}, bindingsAst)\n\nconst cel = tf.format(ast)\nexpect(cel).toStrictEqual(expected) // Returns `true`\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleker%2Fcel-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffleker%2Fcel-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleker%2Fcel-js/lists"}