{"id":16731609,"url":"https://github.com/missinglink/regexemitter","last_synced_at":"2025-07-17T14:07:41.789Z","repository":{"id":9611615,"uuid":"11536117","full_name":"missinglink/regexemitter","owner":"missinglink","description":"a regex event emitter","archived":false,"fork":false,"pushed_at":"2015-03-16T18:04:52.000Z","size":374,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T20:41:31.720Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://missinglink.github.io/regexemitter","language":"CoffeeScript","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/missinglink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-19T20:03:05.000Z","updated_at":"2015-03-16T18:05:20.000Z","dependencies_parsed_at":"2022-08-30T10:11:22.497Z","dependency_job_id":null,"html_url":"https://github.com/missinglink/regexemitter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/missinglink/regexemitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fregexemitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fregexemitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fregexemitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fregexemitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/missinglink","download_url":"https://codeload.github.com/missinglink/regexemitter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fregexemitter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265614332,"owners_count":23798427,"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-10-12T23:38:08.453Z","updated_at":"2025-07-17T14:07:41.776Z","avatar_url":"https://github.com/missinglink.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# regex event emitter\n\nAn event emitter which takes regular expressions \u0026 strings for event names.\n\nWell tested and available in vanilla javascript for the browser or server.\n\n### install\n\n```bash\nnpm install regexemitter --save\n```\n\n[![NPM](https://nodei.co/npm/regexemitter.png?downloads=true\u0026stars=true)](https://nodei.co/npm/regexemitter/)\n\n### example\n\n```javascript\n/**\n  regexeventemitter behaves just like nodejs native emitter except it\n  allows regular expressions as event names.\n**/\n\nvar EventEmitter = require('regexemitter');\nvar events = new EventEmitter();\n\n// register a new event\nevents.on( /send this message to (john|dave)/, function ( arg1, arg2 ){\n\n  console.log( 'event:', this.event );\n  console.log( 'message:', arg1, arg2 );\n\n});\n\nevents.emit( 'send this message to john', 'hello', 'john' );\nevents.emit( 'send this message to andy', 'hi', 'andy' );\nevents.emit( 'send this message to dave', 'ahoy', 'dave' );\n```\n\n### output\n\n```bash\nevent: send this message to john\nmessage: hello john\n\nevent: send this message to dave\nmessage: ahoy dave\n```\n\n## for the browser\n\nCopy `index.js` to your web server and rename it `regexemitter.js`.\n\n### example\n\n```html\n\u003cscript type=\"text/javascript\" src=\"regexemitter.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n\n  /**\n    regexeventemitter behaves just like nodejs native emitter except it\n    allows regular expressions as event names.\n  **/\n\n  var events = new EventEmitter();\n\n  // register a new event\n  events.on( /send this message to (john|dave)/, function ( arg1, arg2 ){\n\n    console.log( 'event:', this.event );\n    console.log( 'message:', arg1, arg2 );\n\n  });\n\n  events.emit( 'send this message to john', 'hello', 'john' );\n  events.emit( 'send this message to andy', 'hi', 'andy' );\n  events.emit( 'send this message to dave', 'ahoy', 'dave' );\n\n\u003c/script\u003e\n```\n\n### output\n\n```bash\nevent: send this message to john\nmessage: hello john\n\nevent: send this message to dave\nmessage: ahoy dave\n```\n\n## build status\n\n```bash\nnpm test\n```\n\n[![Build Status](https://travis-ci.org/missinglink/regexemitter.png?branch=master)](https://travis-ci.org/missinglink/regexemitter)\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/missinglink/regexemitter/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n## license\n\nThe MIT License (MIT)\n\nCopyright (c) Peter Johnson \u003c@insertcoffee\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissinglink%2Fregexemitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmissinglink%2Fregexemitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissinglink%2Fregexemitter/lists"}