{"id":16146536,"url":"https://github.com/voxpelli/node-fulfills","last_synced_at":"2025-06-23T11:37:02.887Z","repository":{"id":10491683,"uuid":"65934232","full_name":"voxpelli/node-fulfills","owner":"voxpelli","description":"Checks whether or not an object fulfills a specified condition","archived":false,"fork":false,"pushed_at":"2025-05-29T03:44:13.000Z","size":117,"stargazers_count":2,"open_issues_count":17,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-29T04:31:45.115Z","etag":null,"topics":["comparison","conditions","expression-evaluator","grammar","pegjs","validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/voxpelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["voxpelli"]}},"created_at":"2016-08-17T19:00:28.000Z","updated_at":"2025-02-16T14:47:32.000Z","dependencies_parsed_at":"2024-02-06T01:23:30.730Z","dependency_job_id":"7b5592e8-e73f-4475-a15a-cc61a2affba4","html_url":"https://github.com/voxpelli/node-fulfills","commit_stats":{"total_commits":187,"total_committers":4,"mean_commits":46.75,"dds":"0.22994652406417115","last_synced_commit":"708b1dfc9489afb4813afc4845c8f8b1e9209120"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/voxpelli/node-fulfills","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-fulfills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-fulfills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-fulfills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-fulfills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpelli","download_url":"https://codeload.github.com/voxpelli/node-fulfills/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-fulfills/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261470042,"owners_count":23163210,"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":["comparison","conditions","expression-evaluator","grammar","pegjs","validation"],"created_at":"2024-10-10T00:20:27.024Z","updated_at":"2025-06-23T11:36:57.872Z","avatar_url":"https://github.com/voxpelli.png","language":"JavaScript","funding_links":["https://github.com/sponsors/voxpelli","https://tidelift.com/subscription/pkg/npm-fulfills?utm_source=npm-fulfills\u0026utm_medium=referral\u0026utm_campaign=enterprise"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg\n    src=\"fulfills.svg\"\n    width=\"650\"\n    height=\"auto\"\n  /\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![npm version](https://img.shields.io/npm/v/fulfills.svg?style=flat)](https://www.npmjs.com/package/fulfills)\n[![npm downloads](https://img.shields.io/npm/dm/fulfills.svg?style=flat)](https://www.npmjs.com/package/fulfills)\n[![Module type: CJS](https://img.shields.io/badge/module%20type-cjs-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![Types in JS](https://img.shields.io/badge/types_in_js-yes-brightgreen)](https://github.com/voxpelli/types-in-js)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-7fffff?style=flat\u0026labelColor=ff80ff)](https://github.com/neostandard/neostandard)\n[![Follow @voxpelli@mastodon.social](https://img.shields.io/mastodon/follow/109247025527949675?domain=https%3A%2F%2Fmastodon.social\u0026style=social)](https://mastodon.social/@voxpelli)\n\n\u003c/div\u003e\n\nChecks whether or not an object fulfills a specified condition\n\n## Installation\n\n```bash\nnpm install fulfills --save\n```\n\n## Usage\n\n```javascript\nconst fulfills = require('fulfills');\n\nconst obj = {\n  property: { subproperty: 'value' }\n};\n\n// Performant option – useful if the same condition is used over and over again\nconst condition = fulfills.compileCondition('property.subproperty = value OR property.subproperty = 123');\n\nif (fulfills(obj, condition)) {\n  // ...\n}\n\n// Short option – useful if a condition will only be used once\nif (fulfills(obj, 'property.subproperty = value OR property.subproperty = 123')) {\n  // ...\n}\n```\n\n## Condition syntax\n\nA condition has the syntax of:\n\n`property == value` or just `property`\n\nThe `==` can be any supported comparison operator. If only a property is given then the condition will be true of the property contains a truthy value in the javascript sense.\n\nMultiple conditions can be combined or modified through the use of logical operators and when doing so parantheses can be used to group them together into different groups.\n\n### Needlessly complex example\n\n`!(bookmark.bar-car.foo[\"abc adf sdaf sda f\"][][][]=123) AND foo OR bar=abc OR foo=\"\\\\\" OR foo[]=123 OR foo.abc[].bar.foo[] != true`\n\n### Property syntax\n\nThe property can be targeted at subproperties by appending them with a `.` before each level, like: `property.subproperty.subpropertyOfSubproperty`.\n\nTo look for a value in an array rather than compare the value to the array itself, then append `[]` to the property like: `property[]`\n\nThe array syntax and subproperties can be combined however one likes. For example: `property.subproperty[][].propertyOfObjectInATwoLevelDeepArray`\n\nComplex property names can be specified like `[\"very complex property name\"]`. Values in such property names can be escaped, like: `[\"property name including a \\\"funny\\\" char\"]`\n\n### Supported values\n\n* *Simple strings* – a single word containing just a-z needs no quotes. Example: `foobar`\n* *Quoted stringes* – multiple words or complex words needs to be quoted. Example: `\"a very long text\"`. Supports escaping, like: `\"This is an escaped \\\" character\"`\n* *Integers* – a number containg just `0-9` chars\n* *Booleans* – when set to exactly `true` or `false`\n\n### Comparison operators\n\nAll work just like the javascript comparison operators does.\n\n* `===`\n* `==` (alias: `=`)\n* `!==`\n* `!=` (alias: `\u003c\u003e`)\n* `\u003c`\n* `\u003e`\n* `\u003c=`\n* `\u003e=`\n\n### Logical operators\n\n* `OR` (alias: `||`)\n* `AND` (alias: `\u0026\u0026`)\n* `NOT` (alias: `!`)\n\n## For enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of fulfills and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-fulfills?utm_source=npm-fulfills\u0026utm_medium=referral\u0026utm_campaign=enterprise)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fnode-fulfills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpelli%2Fnode-fulfills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fnode-fulfills/lists"}