{"id":19443757,"url":"https://github.com/aretecode/thisless","last_synced_at":"2025-04-14T20:04:44.073Z","repository":{"id":85931091,"uuid":"101923693","full_name":"aretecode/thisless","owner":"aretecode","description":"allow using classes as blank objects","archived":false,"fork":false,"pushed_at":"2017-08-30T20:05:59.000Z","size":6,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-10T15:51:01.528Z","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/aretecode.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-30T20:02:42.000Z","updated_at":"2024-08-18T11:44:00.000Z","dependencies_parsed_at":"2023-05-03T15:33:41.086Z","dependency_job_id":null,"html_url":"https://github.com/aretecode/thisless","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/aretecode%2Fthisless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Fthisless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Fthisless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aretecode%2Fthisless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aretecode","download_url":"https://codeload.github.com/aretecode/thisless/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232944842,"owners_count":18600541,"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-10T15:44:05.769Z","updated_at":"2025-01-07T22:19:02.869Z","avatar_url":"https://github.com/aretecode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# thisless\n\u003e allow using classes as blank objects\n\n- [statetree](./statetree.js) for [mobx-state-tree](https://github.com/mobxjs/mobx-state-tree)\n- [index](./index.js) for the functions to wrap classes in `thisless`, `selfless`, or use as decorators\n- [test](./test.js) for usage of the api\n- [snippet](./snippet.js) all-in-one copy paste to try running it in your setup with jest\n\n\n# exports \n```js\nconst {\n  selfless,\n  thisless,\n  toBlankObj,\n  getOwnPrototypeNames,\n  NATIVE_PROPS_NON_ENUMERABLE,\n  isUndefined,\n} = require('thisless')\n\n// for adding wrappers to mobx-state-tree prototype\n// require('thisless/statetree')\n```\n\n# why?\n- can use decorators\n- no commas required\n- no paren wrappers required\n- can add metadata in a cleaner shorter more understandable syntax\n\n\n# example \n## these are all the same\n\n```js\n// setup\nconst $self = {igloo: 10}\n```\n\n```js\nconst getPreThisLess = self =\u003e @thisless class {\n  get aboot() {\n    return 100\n  }\n  moose() {\n    return self.igloo\n  }\n}\n\nconst getThisLessed = self =\u003e class {\n  get aboot() {\n    return 100\n  }\n  moose() {\n    return self.igloo\n  }\n}\n\nconst getSelflessed = self =\u003e class {\n  get aboot() {\n    return 100\n  }\n  moose() {\n    return self.igloo\n  }\n}\n\nconst getES6Obj = self =\u003e ({\n  get aboot() {\n    return 100\n  },\n  moose() {\n    return self.igloo\n  },\n})\nconst getReturnedInitializedObj = self =\u003e {\n  return {\n    get aboot() {\n      return 100\n    },\n    moose() {\n      return self.igloo\n    },\n  }\n}\n\n```\n\n## usage\n\n```js\n\n// common usage as objects not classes no thisless needed\nconst ES6Obj = getES6Obj($self)\nconst Initialized = getReturnedInitializedObj($self)\n\n// to do the same as ^ with classes\nconst SelfLessed = selfless(getSelflessed($self))\nconst ThisLessed = thisless(getThisLessed($self))\nconst ThisLessedDecorated = getPreThisLess($self)\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faretecode%2Fthisless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faretecode%2Fthisless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faretecode%2Fthisless/lists"}