{"id":18256135,"url":"https://github.com/serapath/fnewless","last_synced_at":"2025-04-08T22:26:53.247Z","repository":{"id":57239502,"uuid":"120024399","full_name":"serapath/fnewless","owner":"serapath","description":"turn a function with an object or function as it's prototype into a constructor you CAN call without new","archived":false,"fork":false,"pushed_at":"2018-02-05T11:19:51.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T14:03:53.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fnewless","language":"JavaScript","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/serapath.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-02-02T19:49:57.000Z","updated_at":"2018-02-02T20:03:08.000Z","dependencies_parsed_at":"2022-08-30T00:11:20.996Z","dependency_job_id":null,"html_url":"https://github.com/serapath/fnewless","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/serapath%2Ffnewless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Ffnewless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Ffnewless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Ffnewless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serapath","download_url":"https://codeload.github.com/serapath/fnewless/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247937180,"owners_count":21021209,"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-05T10:20:09.482Z","updated_at":"2025-04-08T22:26:53.231Z","avatar_url":"https://github.com/serapath.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fnewless\nturn a function with an object or function as it's prototype into a constructor you CAN call without new\n\n# usage\n```js\nvar Constructor = require('fnewless')\n\n/******************************************************************************\n  make object instances\n******************************************************************************/\n// make newless constructor\nfunction CTOR_obj (x) { this.x = x }\nCTOR_obj.prototype.type = 'obj'\nvar ctor1 = Constructor(CTOR_obj)\n\n// make instance\nvar obj = ctor1('object') // or `new ctor1('object')`\n\n// test\nconsole.log(obj instanceof ctor1) // true\nconsole.log(obj.constructor === ctor1) // true\nconsole.log(obj.x) // 'object'\nconsole.log(obj.type) // 'obj'\n\n/******************************************************************************\n  make function instances\n******************************************************************************/\n// make newless constructor\nfunction CTOR_fn (x) { this.x = x }\nCTOR_fn.prototype = function () { return this.x.toUpperCase() }\nCTOR_fn.prototype.type = 'fn'\nvar ctor2 = Constructor(CTOR_fn)\n\n// make instance\nvar fn = ctor2('function') // or `new ctor2('function')`\n\n// test\nconsole.log(fn instanceof ctor2) // true\nconsole.log(fn.constructor === ctor2) // true\nconsole.log(fn.x) // 'function'\nconsole.log(fn.type) // 'fn'\nconsole.log(fn()) // 'FUNCTION'\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserapath%2Ffnewless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserapath%2Ffnewless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserapath%2Ffnewless/lists"}