{"id":18469542,"url":"https://github.com/tricinel/cuddy","last_synced_at":"2026-05-01T19:32:55.553Z","repository":{"id":53083805,"uuid":"322282811","full_name":"tricinel/cuddy","owner":"tricinel","description":"An aggregation pipeline built in a functional programming style that lets you search, group, order and transform a collection.","archived":false,"fork":false,"pushed_at":"2021-12-27T16:46:37.000Z","size":740,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-25T18:43:46.414Z","etag":null,"topics":["aggregation","functional-programming","javascript","pipeline","query-builder","search","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tricinel.png","metadata":{"files":{"readme":"Readme.md","changelog":"Changelog.md","contributing":"Contributing.md","funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-17T12:05:39.000Z","updated_at":"2021-12-27T16:46:40.000Z","dependencies_parsed_at":"2022-09-12T12:24:46.216Z","dependency_job_id":null,"html_url":"https://github.com/tricinel/cuddy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tricinel/cuddy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricinel%2Fcuddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricinel%2Fcuddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricinel%2Fcuddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricinel%2Fcuddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tricinel","download_url":"https://codeload.github.com/tricinel/cuddy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricinel%2Fcuddy/sbom","scorecard":{"id":898540,"data":{"date":"2025-08-11","repo":{"name":"github.com/tricinel/cuddy","commit":"ecbbe215c87a323e4b111374218e93b55ad19fc6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Code-Review","score":0,"reason":"Found 0/28 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":-1,"reason":"No tokens found","details":null,"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":"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: License.md:0","Info: FSF or OSI recognized license: MIT License: License.md:0"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-24T14:38:31.974Z","repository_id":53083805,"created_at":"2025-08-24T14:38:31.974Z","updated_at":"2025-08-24T14:38:31.974Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32510743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["aggregation","functional-programming","javascript","pipeline","query-builder","search","typescript"],"created_at":"2024-11-06T10:10:49.851Z","updated_at":"2026-05-01T19:32:55.534Z","avatar_url":"https://github.com/tricinel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ecuddy\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"./cuddy-logo.png\" alt=\"crazy looking donkey\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003ecuddy\u003c/strong\u003e is an aggregation pipeline built in a functional programming style. If you ever wanted to search through a collection using logical operators, sort, group, transform and return only the fields you care about, then cuddy is for you.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/cuddy?style=flat-square\" alt=\"npm version badge\" /\u003e\n  \u003cimg src=\"https://img.shields.io/circleci/build/github/tricinel/cuddy?label=circleci\u0026style=flat-square\" alt=\"npm version badge\" /\u003e\n  \u003cimg src=\"https://img.shields.io/node/v/cuddy?style=flat-square\" alt=\"node version badge\" /\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/cuddy.svg?style=flat-square\" alt=\"license version badge\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cem\u003eThe cuddy donkey logo designed by the talented \u003ca href=\"https://www.linkedin.com/in/lauradinulescu/\"\u003eLaura Dinulescu\u003c/a\u003e.\u003c/em\u003e\u003c/p\u003e\n\n## Install\n\nThis module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:\n\n`npm install cuddy --save` or `yarn add cuddy`\n\n### Usage\n\nImport cuddy and create the query.\n\n```js\nimport cuddy from 'cuddy';\nimport { copyFrom } from 'cuddy/transform/helpers';\n\nconst query = {\n  fields: ['title', 'permalink', 'runTime'],\n  match: {\n    in: { genre: 'Comedy', cast: 'Adam Sandler' },\n    eq: { lang: 'en' }\n  },\n  orderBy: {\n    reviews: 'asc'\n  },\n  groupBy: 'director',\n  transform: {\n    permalink: copyFrom('url')\n  },\n  limit: 2,\n  skip: 1\n};\n```\n\nThe above query translates into:\n\n- I want all the items where the `genre` contains `Comedy` and `cast` contains `Adam Sandler` and the `lang` is `en`.\n- I want only 2 results and I want to skip the first item in the list.\n- I want to order the items by `reviews` in ascending order.\n- I want to group the items by `director`.\n- I want to create a new field called `permalink` and set its value to that of the `url` field.\n- From all the fields of each item, I only want the `title`, `permalink` and `runTime`.\n\nNext, build the pipeline and aggregate your data.\n\n```js\nconst { aggregate } = cuddy(query, data);\nconst results = aggregate();\n```\n\nDepending on the shape of your data, the results could look like this:\n\n```json\n{\n  \"Robert Smigel\": [\n    {\n      \"title\": \"The Week Of\",\n      \"permalink\": \"https://www.imdb.com/title/tt6821012\",\n      \"runTime\": 116\n    }\n  ]\n}\n```\n\n\u003e For more query examples, see the [Books test cases](./src/__tests__/books.test.ts) and the associated [Books collection](./src/__mocks__/books.ts).\n\u003e\n\u003e If it looks like mongodb's query language, it's because lots of inspirations came from there. :)\n\n### Stages\n\nThe aggregation pipeline contains the following stages:\n\n- [Matching](./docs/match.md). Filter out any items that do not match the criteria.\n- [Sorting](./docs/sort.md). Sort the items in  the specified order.\n- [Pagination](./docs/pagination.md). Limit the number of results and/or skip over the first results.\n- [Grouping](./docs/group.md). Group the items by a specified field.\n- [Count](./docs/count.md). Count the items by a specified field.\n- [Project](./docs/project.md). Limit the fields that are returned for each item.\n- [Transform](./docs/transform.md). Transform existing properties and add new properties to the matched items.\n\n### Pipeline functions\n\nOnce you've built your pipeline, you can use it to aggregate your data and return results. Depending on whether you want one result, all of them or just a count of the total results, you will need to call the appropriate method:\n\n* `aggregate()` will return all the results from your query.\n* `first()` will return the first result in the list of results from your query.\n* `last()` will return the last result in the list of results from your query.\n* `count()` will return the total number of results from your query.\n* `explain()` will return an object explaining the set of steps resulted from your query. For details on the output, see the [Explanation](./docs/explain.md) section.\n\n#### Why cuddy?\n\n\u003e _noun_\n\u003e\n\u003e cud·​dy | \\ ˈku̇-dē\n\u003e\n\u003e Synonyms: donkey (British slang)\n\nThe donkey is used as a working animal and is considered the cheapest form of labor.\n\n#### Contributing\n\n- Run tests with `npm run test` or `yarn test`.\n- Run the lint with `npm run lint` or `yarn lint`.\n\nFor details, check out the [Contributing][./Contributing.md] guide.\n\n##### LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricinel%2Fcuddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftricinel%2Fcuddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricinel%2Fcuddy/lists"}