{"id":19443749,"url":"https://github.com/aretecode/likeaboss","last_synced_at":"2026-05-08T03:10:22.571Z","repository":{"id":85930917,"uuid":"89297319","full_name":"aretecode/likeaboss","owner":"aretecode","description":"export for nodejs or web like a boss, easy, fast, fluent, \u0026 tiny.","archived":false,"fork":false,"pushed_at":"2017-04-25T10:23:54.000Z","size":19,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T08:48:01.215Z","etag":null,"topics":["babel","boss","dynamic","export","exports","fluent","module","typescript"],"latest_commit_sha":null,"homepage":"","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/aretecode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-24T23:52:47.000Z","updated_at":"2017-04-30T01:27:40.000Z","dependencies_parsed_at":"2023-04-21T08:17:29.226Z","dependency_job_id":null,"html_url":"https://github.com/aretecode/likeaboss","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"1243c8cfd6f2d01f395307e5db074f7803fc8ead"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Flikeaboss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Flikeaboss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Flikeaboss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Flikeaboss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aretecode","download_url":"https://codeload.github.com/aretecode/likeaboss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240627960,"owners_count":19831600,"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":["babel","boss","dynamic","export","exports","fluent","module","typescript"],"created_at":"2024-11-10T15:44:04.860Z","updated_at":"2025-11-19T03:04:02.078Z","avatar_url":"https://github.com/aretecode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕴 likeaboss\n\n[![NPM version][likeaboss-npm-image]][likeaboss-npm-url]\n[![MIT License][license-image]][license-url]\n[![fliphub][gitter-badge]][gitter-url]\n[![fluents][fluents-image]][fluents-url]\n\n[likeaboss-npm-image]: https://img.shields.io/npm/v/likeaboss.svg\n[likeaboss-npm-url]: https://npmjs.org/package/likeaboss\n[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat\n[license-url]: https://spdx.org/licenses/MIT\n[gitter-badge]: https://img.shields.io/gitter/room/fliphub/pink.svg\n[gitter-url]: https://gitter.im/fliphub/Lobby\n[fluents-image]: https://img.shields.io/badge/⛓-fluent-9659F7.svg\n[fluents-url]: https://www.npmjs.com/package/flipchain\n\n\u003e export like a boss with functions, dynamic \u0026 static requires, module \u0026 web support; easy, fast \u0026 tiny.\n\n#### works with:\n- 📼 es5\n- 🍬 es6+\n- 🌊 typescript\n- 🗼 babel\n- 🕸 web\n- 🔙🔚 node\n- other?\n\n## 📦 usage\n```bash\nyarn add likeaboss\nnpm i likeaboss --save\n```\n\n## [🌐 documentation](./docs)\n## [🔬 tests](./tests)\n## [📘 examples](./examples)\n\n\u003cimg width=\"442\" alt=\"screen shot 2017-04-24 at 4 48 22 pm\" src=\"https://cloud.githubusercontent.com/assets/4022631/25363323/7860cc44-290e-11e7-9d30-1a183e0d61ea.png\"\u003e\n\n```js\nconst Export = require('likeaboss')\n\nconst pkg = require('./package.json')\n\n// export directly on the module without module.exports\n// or do `exports = module.exports = ` when using .export\nExport\n  .module(module)\n\n  // main export to be decorated\n  .main(ClassOrFunction)\n\n  // export for web usage when needed\n  .web('your-lib-name')\n\n  // load dynamic\n  .dir(__dirname + '/your-dist-folder')\n\n  // and all other props you want to use\n  .props({version: pkg.version})\n\n  // only `required` when used\n  .dynamics([\n    {name: 'PluginEh', path: '/PluginEh'},\n    {name: 'PluginOh', path: '/PluginOh'},\n  ])\n\n  // finish\n  .end()\n```\n\n### dynamics\n\n[see the output](#output)\n\nonly used when the \"import\"er / client does\n\n```js\nimport {PluginEh} from 'your-lib'\n```\n\nor\n```js\n import ClassOrFunction from 'your-lib'\n const {PluginEh} = ClassOrFunction\n```\n\n\n## [🕳 diving deeper examples](./examples)\n\n\n#### ⛓ fluent function export\n\n```js\nconst Export = require('likeaboss')\n\nfunction fn(options, callback) {\n  // magical things when called as a function\n}\n\nconst Canada = {canada: true}\n\nexports = module.exports = Export.export(module.exports)\n  .fn(fn)\n  .props({Canada})\n  .end()\n```\n\n#### fluent fn with requires\n\n\u003e dynamic and static requires, dynamic requires only are required when they are used\n\n[see the tests](./test)\n\n\n```js\nconst Export = require('likeaboss')\n\nfunction fn() {\n  console.log('called as a function')\n}\n\nexports = module.exports = Export.export(module.exports)\n  .dir(__dirname)\n  .fn(fn)\n  .dynamics('src', ['Boss'])\n  .dynamics('src/plugins', ['BossPlugin'])\n  .dynamics('', [{path: 'package.json', name: 'pkg'}])\n  .statics('', ['Statics'])\n  .end()\n```\n\n\n###### 🦐 importing:\n\n\u003e requires `./eh/src/Boss.js`\n\n```js\n  import {Boss} from './eh'\n  import eh from './eh'\n\n  eh('callable as a function!')\n  console.log(Boss)\n\n  // requires the BossPlugin\n  console.log(eh.plugins.BossPlugin)\n```\n\n\n\n#### object function with requires\n\n\u003e same as with fluent, but using object syntax\n\n```js\nconst Export = require('likeaboss')\n\nexports = module.exports = Export.from({\n  target: module.exports,\n  dir: __dirname,\n  fn: func,\n  props: {Eh, Canada},\n  dynamics: {\n    'src': ['Boss'],\n    'src/plugins': ['BossPlugin'],\n  },\n  statics: {\n    '': ['Statics'],\n  },\n})\n```\n\n## module\n\n\u003e no need to reassign exports and modules ([exports] is optional 2nd arg)\n\n```js\nExports.module(module).props({Canada}).end()\n```\n\n\n# 👽 exports\n\u003e file size (~700 bytes)\n\n### from\n```js\n// imports the `from` static fn\nconst from = require('likeaboss/from')\n\nconst Export = require('likeaboss')\n```\n\n\n### generate\n\n\u003e 🚧⚗ warning, experimental\n\n```js\n// export.js\nconst gen = require('likeaboss/gen')\n\nfunction fn(options, callback) { /* magic */ }\n\nconst Eh = {eh: true}\nconst Canada = {canada: true}\n\nexports = module.exports = Exports.export()\n  .dir(__dirname)\n  .fn(fn)\n  .dynamics('src', ['Boss'])\n  .dynamics('src/plugins', ['BossPlugin'])\n  .statics('', ['Statics'])\n  .props({Eh, Canada})\n  .web('eh')\n  .end()\n  .toString()\n\nconsole.log(exports)\n\n// outputs exporting string\n// node export.js \u003e index.js\n```\n\n# [⚖️ benchmark](./bench)\nusing [🏋️⛓ bench-chain](https://www.npmjs.com/package/bench-chain)\n\n\u003cimg width=\"300\" alt=\"screen shot 2017-04-24 at 5 51 21 am\" src=\"https://cloud.githubusercontent.com/assets/4022631/25358171/616dcc44-28f5-11e7-80ab-883ce5a9ae9a.png\"\u003e\n\n\n\u003c!-- add 100 runs here with \u003cdetails\u003e --\u003e\n\n```js\noptimized x 30,975 ops/sec ±13.48% (50 runs sampled)\nfluent x 20,434 ops/sec ±3.52% (73 runs sampled)\n```\n\n#### times [with last example](#object-fn-with-requires)\n\n- `console.log({})`: ~ ⏲ 35000ms / 35ms\n- fluent: ~ ⏲ 1300 microseconds / 1.3ms\n- optimized: ~ ⏲ 400 microseconds  / .4ms\n- `exports = module.exports = ...`: ~ ⏲ 100-200 microseconds / .1ms-.2ms\n\n\n\u003c!-- NMD(new module definition(s)) --\u003e\n\n# 🏭\n### [output](./examples/example-output-pseudo.js)\n\n\u003e example generated output pseudo code\n\n```js\nfunction fn() {}\nconst ex = {\n  Eh: {eh: true},\n  Canada: {canada: true},\n  Boss: 'boss',\n  plugins: {},\n  Statics: {static: true},\n  __esModule: true,\n}\n\nObject.defineProperty(ex.plugins, 'BossPlugin', {\n  get() {\n    return 'boss'\n  },\n})\n\nex.default = ex\n\nObject.assign(fn, ex)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faretecode%2Flikeaboss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faretecode%2Flikeaboss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faretecode%2Flikeaboss/lists"}