{"id":19102089,"url":"https://github.com/davisdevelopment/oregex","last_synced_at":"2025-08-22T13:06:51.214Z","repository":{"id":16310706,"uuid":"19059656","full_name":"DavisDevelopment/ORegEx","owner":"DavisDevelopment","description":"Regular Expressions for Objects","archived":false,"fork":false,"pushed_at":"2014-04-23T06:49:56.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T01:56:55.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/DavisDevelopment.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}},"created_at":"2014-04-23T06:37:55.000Z","updated_at":"2014-04-23T07:02:10.000Z","dependencies_parsed_at":"2022-09-15T06:11:51.172Z","dependency_job_id":null,"html_url":"https://github.com/DavisDevelopment/ORegEx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavisDevelopment%2FORegEx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavisDevelopment%2FORegEx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavisDevelopment%2FORegEx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavisDevelopment%2FORegEx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavisDevelopment","download_url":"https://codeload.github.com/DavisDevelopment/ORegEx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240156680,"owners_count":19756815,"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":[],"created_at":"2024-11-09T03:53:51.128Z","updated_at":"2025-02-22T09:48:32.927Z","avatar_url":"https://github.com/DavisDevelopment.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ORegEx.js #\n## Regular Expressions for Objects ##\n\nORegEx is a JavaScript (Web and/or Node) module that allows for the use of a RegEx-like grammar on Objects, rather than Strings.\nNot only is ORegEx's grammar robust and powerful, it's also highly extensible, so that you can define your own helper functions, or even\n customize the way the parser handles things like:\n\t* Type Checking\n\t* Property Access\n\t* Property Value Testing\netc.  ORegEx does not care about whitespace, so you can have selector strings that span only one line, or hundreds, and they'll evaluate the same way.\n\n# ORegEx Selector Filters #\n\n* `*` : Wild Card.  Will match anything.\n* `#$id` : Checks if the given object's 'id' property (if one exists) matches `$id`\n* `.$class` : Checks if the given object is an instance of the class referred to by `$class`\n* `..$class` : Checks if the given object is an instance of the class referred to by `$class`, or an instance of any subclass of `$class`\n* `:$name` : If a helper function is registered under `$name`, then invokes the helper function on the given object, otherwise, checks if the property of the \n\tgiven object referred to by `$name` is truthy\n* `[$name]` : Checks for the existence of `$name` as a property of the given object\n* `[$name = $value]` : Checks if the property `$name` of the given object is equal to `$value`\n* `[$name != $value]` : Checks that the `$name` property of the given object is *not* equal to `$value`\n* `[$name .= $type]` : Checks that the `$name` property of the given object is of type `$type`\n* `[$name =\u003e $sel]` : Checks that the property `$name1 of the given object is matched by the nested filter `$sel`\n* `($filter)` : An encapsulated filter group\n* `$filterOne | $filterTwo` : Checks that the given object is matched by **either** `$filterOne` *or* `$filterTwo`\n* `$filterOne \u0026 $filterTwo` : Checks that the given object is matched by **both** `$filterOne` *and* `$filterTwo`\n* `$condition ? $ifTrue : $ifNot` : Ternary conditional filter.  If the given object is matched by the `$condition` filter, then\n\tcheck that it is also matched by the `$ifTrue` filter, otherwise, ensure that it is matched by the `$ifNot` filter\n* `/* $comment.. */`  :  ORegEx Comment\n\n\u003cbr\u003e\u003cbr\u003e\n\n# ORegEx API #\n\u003cbr\u003e\nThe ORegEx module exposes the following set of methods:\n*\t`compile` :  Takes a selector string as its only argument, and returns an ORegEx instance.\n*\t`parse` : Takes a selector string as its only argument, and returns the parsed selection-op tree. Mainly just for debugging purposes.\n*\t`lex` : Takes a selector string as its only argument, and returns the token tree.  Again, mainly for debugging.\n*\t`registerHelper` : Takes a string as its first argument, and a helper function as its second.  Registers that function as a helper under given name.\n*\t`is` : Takes a selector string as its first argument, and an object as its second.  Returns whether the given object is matched by the given filter.\n\n## ORegEx Object Methods ##\nAs of right now, the only useful method of the ORegEx Object is `test`, which accepts an object as its only argument, and returns whether that object\nwas matched by `this` ORegEx.\n\n# Examples #\nHere's a simple example of ORegEx at work in NodeJS.\n\n\tvar oregex = require(\"oregex\");\n\n\tvar obj = {\n\t\t\"name\" : \"Ryan Davis\",\n\t\t\"age\" : 18,\n\t\t\"hobbies\" : [\"programming\", \"gaming\", \"..programming\"],\n\t\t\"exhausted\" : true\n\t};\n\tvar selector1 = oregex.compile(\"[name .= 'String'] [name = 'Ryan Davis'] [age .= Int] [age = 18] [hobbies .= 'Array'] :exhausted\");\n\tvar selector2 = oregex.compile(\"[name .= 'String'] [name != 'Ryan Davis'] [age .= Int] [age != 18] [hobbies .= 'Array'] :exhausted\");\n\n\tselector1.test( obj ); //=\u003e 'true'\n\tselector2.test( obj ); //=\u003e 'false'\n\nYou can also find several much more extensive examples in the 'examples' folder.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavisdevelopment%2Foregex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavisdevelopment%2Foregex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavisdevelopment%2Foregex/lists"}