{"id":20513773,"url":"https://github.com/webreflection/endow","last_synced_at":"2025-07-13T02:03:01.619Z","repository":{"id":57225240,"uuid":"125423894","full_name":"WebReflection/endow","owner":"WebReflection","description":"A minimalistic, yet powerful, class based mixin utility.","archived":false,"fork":false,"pushed_at":"2018-07-03T17:19:46.000Z","size":37,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T15:17:53.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.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":"2018-03-15T20:42:20.000Z","updated_at":"2024-11-03T10:16:38.000Z","dependencies_parsed_at":"2022-08-24T11:00:14.126Z","dependency_job_id":null,"html_url":"https://github.com/WebReflection/endow","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/WebReflection/endow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fendow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fendow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fendow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fendow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/endow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fendow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259553130,"owners_count":22875609,"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-15T21:13:02.330Z","updated_at":"2025-06-13T00:06:41.615Z","avatar_url":"https://github.com/WebReflection.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# endow [![Coverage Status](https://coveralls.io/repos/github/WebReflection/endow/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/endow?branch=master) [![Build Status](https://travis-ci.org/WebReflection/endow.svg?branch=master)](https://travis-ci.org/WebReflection/endow) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC)\n\nA minimalistic, yet powerful, class based mixin utility.\n\nFollowing an approach explained in [this post](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/),\nand inspired by one piece of [the following utility](https://github.com/justinfagnani/mixwith.js#mixwith),\n_endow_ makes creation of mixins a no-brainer, giving the ability to use `instanceof` operator.\n\n```js\n// define mixins through this class based pattern\nconst Mixin1 = Super =\u003e class extends Super {\n  behavior1() {}\n};\nconst Mixin2 = Super =\u003e class extends Super {\n  behavior2() {}\n};\n\n// endow classes with mixins while extending\nclass Sub extends endow(Super).with(Mixin1, Mixin2) {\n  behaviors() {\n    this.behavior1();\n    this.behavior2();\n  }\n}\n\nnew Sub instanceof Sub;     // true\nnew Sub instanceof Super;   // true\nnew Sub instanceof Mixin1;  // true\nnew Sub instanceof Mixin2;  // true\n```\n\n### How to include\n\n  * _ESM_ via `import endow from 'endow/esm'`\n  * _CJS_ via `const {endow} = require('endow/cjs');`\n  * browsers via [unpkg.com/endow](https://unpkg.com/endow)\n\n\n### Compatibility\n\nThis module syntax is purposely written in an ES3 compatible fashion.\n\nES5 [Array#some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) and [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) are needed,\nand to have a proper `instanceof` operator result, the [Symbol.hasInstance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) is needed too,\nbut it's not mandatory.\n\nPlease note this utility works with all polyfills \u003csup\u003e\u003csub\u003e(loaded upfront)\u003c/sub\u003e\u003c/sup\u003e and transpilers too.\n\n#### Size\n\n  * plain `index.js` is 2535 bytes\n  * plain `min.js` is 499 bytes\n  * gzip `min.js` is 337 bytes\n  * brotli `min.js` is 277 bytes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fendow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fendow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fendow/lists"}