{"id":16057028,"url":"https://github.com/markbates/includejs","last_synced_at":"2025-08-03T23:04:11.895Z","repository":{"id":3661615,"uuid":"4730185","full_name":"markbates/includejs","owner":"markbates","description":"Adds the ability to include Modules into JavaScript objects","archived":false,"fork":false,"pushed_at":"2012-06-20T19:34:42.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T08:40:41.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/markbates.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":"2012-06-20T19:08:17.000Z","updated_at":"2017-05-11T15:29:20.000Z","dependencies_parsed_at":"2022-08-31T05:03:20.565Z","dependency_job_id":null,"html_url":"https://github.com/markbates/includejs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/markbates/includejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fincludejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fincludejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fincludejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fincludejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbates","download_url":"https://codeload.github.com/markbates/includejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fincludejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263632058,"owners_count":23491530,"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-09T03:00:44.209Z","updated_at":"2025-07-04T23:08:35.413Z","avatar_url":"https://github.com/markbates.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Includejs\n\nAllows you to inject functions and properties from other JavaScript objects into your current object. This is similar to the functionality provided by `_.extend` in the [Underscore.js](http://documentcloud.github.com/underscore/#extend) library, the difference being that Includejs will bind the functions to the current object, helpful well dealing with callback functions.\n\n## Installation\n\n### Ruby/Rails\n\nAdd this line to your application's Gemfile:\n\n    gem 'includejs'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install includejs\n\n### Rails\n\nRequire `includejs` in your asset pipeline and you're ready to go.\n\n### Non-Rails\n\nTo use this outside of a Rails application simply copy the `vendor/assets/javascripts/includejs.js` file and add it to your application. That's it.\n\n## Usage\n\n### CoffeeScript Example:\n\n``` coffeescript\nBazModule =\n  sayHi: -\u003e\n    \"Hello #{@name}!\"\n  # If there is an 'included' function it will\n  # be called when the module is included.\n  included: (klass) -\u003e\n    klass.baz = \"Baz!!\"\n\nclass Foo\n  constructor: -\u003e\n    include(@, BazModule)\n\nfoo = new Foo()\nfoo.sayHi() # =\u003e \"Hello undefined!\"\n\nfoo.name = \"Mark\"\nfoo.sayHi() # =\u003e \"Hello Mark!\"\n```\n\n### JavaScript Example:\n\n``` javascript\nvar BazModule, foo;\n\nBazModule = {\n  sayHi: function() {\n    return \"Hello \" + this.name + \"!\";\n  },\n  // If there is an 'included' function it will\n  // be called when the module is included.\n  included: function(klass) {\n    klass.baz = \"Baz!!\";\n  }\n};\n\nfoo = {}\ninclude(foo, BazModule);\n\nfoo.sayHi(); // =\u003e \"Hello undefined!\"\n\nfoo.name = \"Mark\";\n\nfoo.sayHi(); // =\u003e \"Hello Mark!\"\n```\n\n## Testing\n\n1. Run `bundle install`.\n2. Run `guard` or alternatively `rake`.\n3. **Write your tests. No pull request will be accepted without tests.**\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fincludejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbates%2Fincludejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fincludejs/lists"}