{"id":16890818,"url":"https://github.com/isruslan/popo","last_synced_at":"2026-05-05T18:35:23.996Z","repository":{"id":10042367,"uuid":"12088224","full_name":"isRuslan/popo","owner":"isRuslan","description":"Stupid way to implement polymorphism in javascript","archived":false,"fork":false,"pushed_at":"2015-04-29T09:30:47.000Z","size":2504,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T10:07:56.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/isRuslan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-13T17:39:52.000Z","updated_at":"2017-06-24T16:37:49.000Z","dependencies_parsed_at":"2022-09-11T07:50:29.581Z","dependency_job_id":null,"html_url":"https://github.com/isRuslan/popo","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/isRuslan%2Fpopo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isRuslan%2Fpopo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isRuslan%2Fpopo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isRuslan%2Fpopo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isRuslan","download_url":"https://codeload.github.com/isRuslan/popo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244574798,"owners_count":20474818,"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-13T17:04:33.822Z","updated_at":"2025-10-09T09:35:59.292Z","avatar_url":"https://github.com/isRuslan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# popo [![Build Status](https://secure.travis-ci.org/isRuslan/popo.png?branch=master)](http://travis-ci.org/isRuslan/popo)\n\n\u003e Simple way to implement polymorphism in javascript\n\n## Install\n\nInstall with npm:\n\n```\nnpm install --save popo\n```\n\nInstall with bower:\n\n```\nbower install --save popo\n```\n\n## Usage\n\u003e There is only possible overload function by arguments number\n\n`Node.js`\n\n```\nvar popo = require('popo');\n\nvar sayHello = popo({\n\t0: function () {\n\t\treturn 'Hello Anonymous!';\n\t},\n\t1: function (name) {\n\t\treturn 'Hello ' + name + '!';\n\t}\n}, function otherWay () {\n\treturn 'Do I need to say Hello?';\n});\n\nsayHello(); // 'Hello Anonymous!';\nsayHello('Haruki'); // 'Hello Haruki!';\nsayHello('Haruki', 'Murakami'); // 'Do I need to say Hello?';\n```\n`Browser`\n\n```\npopo({\n\t0: function () {\n\t\treturn 'Hello Anonymous!';\n\t},\n\t1: function (name) {\n\t\treturn 'Hello ' + name + '!';\n\t}\n}, function otherWay () {\n\treturn 'Do I need to say Hello?';\n});\n```\n\n\n## TODO\n - overload by type\n - better implementation of `default` function\n\n## Test\n\nFrom the repo root:\n\n```\nnpm test\n```\n## License\nCopyright (c) 2014 Ruslan Ismagilov. Licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisruslan%2Fpopo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisruslan%2Fpopo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisruslan%2Fpopo/lists"}