{"id":20796415,"url":"https://github.com/jazz-soft/alltag","last_synced_at":"2026-01-04T22:02:01.702Z","repository":{"id":57176668,"uuid":"222357871","full_name":"jazz-soft/alltag","owner":"jazz-soft","description":"combine query tags into simple logic expressions","archived":false,"fork":false,"pushed_at":"2025-10-10T22:46:05.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T12:56:44.544Z","etag":null,"topics":["logic","query","tags"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jazz-soft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null},"funding":{"github":"jazz-soft","custom":"https://paypal.me/jazzsoft"}},"created_at":"2019-11-18T03:42:28.000Z","updated_at":"2025-10-10T22:46:08.000Z","dependencies_parsed_at":"2024-11-17T16:35:07.479Z","dependency_job_id":"7a3e10ab-c429-41f1-85d5-e1c298a38904","html_url":"https://github.com/jazz-soft/alltag","commit_stats":{"total_commits":43,"total_committers":2,"mean_commits":21.5,"dds":"0.39534883720930236","last_synced_commit":"574c7ca639fc418f4abcd5d83de0e83abf73769f"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/jazz-soft/alltag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Falltag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Falltag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Falltag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Falltag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jazz-soft","download_url":"https://codeload.github.com/jazz-soft/alltag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Falltag/sbom","scorecard":{"id":509577,"data":{"date":"2025-08-11","repo":{"name":"github.com/jazz-soft/alltag","commit":"d2a11d086d6df1d6a141b83fe3a96e9ef0f39a85"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/alltag/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/alltag/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/alltag/build.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/build.yml:12","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T00:12:02.002Z","repository_id":57176668,"created_at":"2025-08-20T00:12:02.003Z","updated_at":"2025-08-20T00:12:02.003Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28209130,"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","status":"online","status_checked_at":"2026-01-04T02:00:06.065Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["logic","query","tags"],"created_at":"2024-11-17T16:27:10.438Z","updated_at":"2026-01-04T22:02:01.696Z","avatar_url":"https://github.com/jazz-soft.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jazz-soft","https://paypal.me/jazzsoft"],"categories":[],"sub_categories":[],"readme":"# alltag\n[![npm](https://img.shields.io/npm/v/alltag.svg)](https://www.npmjs.com/package/alltag)\n[![npm](https://img.shields.io/npm/dt/alltag.svg)](https://www.npmjs.com/package/alltag)\n[![build](https://github.com/jazz-soft/alltag/actions/workflows/build.yml/badge.svg)](https://github.com/jazz-soft/alltag/actions)\n[![Coverage Status](https://coveralls.io/repos/github/jazz-soft/alltag/badge.svg?branch=master)](https://coveralls.io/github/jazz-soft/alltag?branch=master)\n\n## combine query tags into simple logic expressions\n\nI use this script in my own projects at both the front-end and the back-end. It may suit your needs as well...\n\nImagine, you have an online movie database,\nand want your visitors to be able to write queries like this:\n\n`(comedy, action) !horror (/batman/, /joker/)`,\n\nthat means the movie should be `comedy` OR `action`, NOT `horror`,\nand have the title matching either `/batman/` OR `/joker/`.\n\n**alltag** parses the query string into an AST object *(say hi to the LISP fans)*:\n```\n[ 'and',\n  [ 'or', [ 'tag', '', 'comedy' ], [ 'tag', '', 'action' ] ],\n  [ 'not', [ 'tag', '', 'horror' ] ],\n  [ 'or', [ 'tag', '', '/batman/' ], [ 'tag', '', '/joker/' ] ]\n]\n```\n\nand it's up to you how to handle the result.\n\n### Query syntax\n\nValid tag must be a combination of alphanumeric (plus dot) characters `/[a-zA-Z0-9_$.]/` plus some additional characters `/[\u003c\u003e=+-*]/`,\nor be a valid regular expression (in this case, it may contain any characters):\n\n`robin` =\u003e `[ 'tag', '', 'robin' ]`  \n`/\\bburt\\s+ward\\b/i` =\u003e `[ 'tag', '', '/\\\\bburt\\\\s+ward\\\\b/i' ]`  \n`1966-1968` =\u003e `[ 'tag', '', '1966-1968' ]`\n\nTags may have an alphanumeric (plus dot) prefix followed by the colon:\n\n`director.name:/burton|nolan/` =\u003e `[ 'tag', 'director.name', '/burton|nolan/' ]`\n\nExpressions can be AND-ed by a space, OR-ed by a comma, NOT-ed by an exclamation mark, or combined with the brackets:\n\n`(joker, penguin) !catwoman` =\u003e  \n`[ 'and', [ 'or', [ 'tag', '', 'joker' ], [ 'tag', '', 'penguin' ] ], [ 'not', [ 'tag', '', 'catwoman' ] ] ]`\n\n### Install\n\n`npm install alltag --save`  \nor clone it from the [`Github`](https://github.com/jazz-soft/alltag)\n\n### Usage\n\n#### Front end:\n\n```html\n\u003cscript src=\"alltag.js\"\u003e\u003c/script\u003e\n// ...\nvar query = ...\ntry {\n  var ast = alltag.parse(query);\n  // ...\n}\ncatch (err) { alert(err.message); }\n```\n\n#### Back end:\n\n```js\nvar alltag = require('alltag');\n// ...\nvar query = ...\ntry {\n  var ast = alltag.parse(query);\n  // ...\n}\ncatch (err) { console.log(err.message); }\n```\n\n#### Testing the objects:\n\n```js\n// The actual test will depend on your object's structure,\n// but the overall logic will be the same.\n\nfunction passes(obj, ast) {\n  var m;\n  if (ast[0] == 'true') {\n    return true;\n  }\n  if (ast[0] == 'false') {\n    return false;\n  }\n  if (ast[0] == 'and') {\n    for (m = 1; m \u003c ast.length; m++) {\n      if (!passes(obj, ast[m])) return false;\n    }\n    return true;\n  }\n  if (ast[0] == 'or') {\n    for (m = 1; m \u003c ast.length; m++) {\n      if (passes(obj, ast[m])) return true;\n    }\n    return false;\n  }\n  if (ast[0] == 'not') {\n    return !passes(obj, ast[1]);\n  }\n  if (ast[0] == 'tag') {\n    if (ast[2][0] == '/') {\n      m = ast[2].match(/^\\/(.*)\\/([^/]*)$/);\n      m = new RegExp(m[1], 'i');  // or: m = new RegExp(m[1], m[2]);\n      return !!obj.title.match(m);\n    }\n    return obj.tags.includes(ast[2]);\n  }\n}\n```\n\n#### Additional restrictions:\n\n```js\n// To introduce additional restrictions on the tag values,\n// pass a validator function as a second argument to the parser:\n\nast = alltag.parse(query, function(s1, p1, s2, p2) { ... });\n\n// where\n// s1 - the string value of the prefix\n// p1 - it's position in the input string\n// s2 - the string value of the tag\n// p2 - it's position in the input string\n// if there is no prefix, s1 = '' and p1 = p2\n// e.g.:\n\nfunction requirePrefix(s1, p1, s2, p2) {\n  if (s1 == '') {\n    throw new Error('Prefix required at position ' + p1);\n  }\n}\n\nfunction noRegEx(s1, p1, s2, p2) {\n  if (s2[0] == '/') {\n    throw new Error('Unexpected RegEx ( ' + s2 + ' ) at position ' + p2);\n  }\n}\n\nfunction validDirection(s1, p1, s2, p2) {\n  if (!['north', 'west', 'south', 'east'].includes(s2) {\n    throw new Error('Invalid tag ( ' + s2 + ' ) at position ' + p2);\n  }\n}\n```\n\n### API\n\n#### alltag.parse(query)\n\nCreate logical expression from string `query`.\n\n#### alltag.parse(query, validate)\n\nCreate logical expression from string `query` with additional restrictions (see above).\n\n#### alltag.not(x)\n\nReturn inversion of expression `x`.\n\n#### alltag.and(x, y)\n\nReturn logical conjunction of expressions `x` and `y`.\n\n#### alltag.or(x, y)\n\nReturn logical disjunction of expressions `x` and `y`.\n\n#### alltag.true()\n\nReturn an expression for `TRUE`.\n\n#### alltag.false()\n\nReturn an expression for `FALSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazz-soft%2Falltag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjazz-soft%2Falltag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazz-soft%2Falltag/lists"}