{"id":15646420,"url":"https://github.com/martinheidegger/require-implementation","last_synced_at":"2025-04-13T19:03:49.255Z","repository":{"id":57354265,"uuid":"67359878","full_name":"martinheidegger/require-implementation","owner":"martinheidegger","description":"Package that helps you to be okay if some dependency is missing.","archived":false,"fork":false,"pushed_at":"2016-09-05T02:43:36.000Z","size":4,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T18:35:47.035Z","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/martinheidegger.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}},"created_at":"2016-09-04T17:52:04.000Z","updated_at":"2018-09-25T02:30:53.000Z","dependencies_parsed_at":"2022-09-26T20:20:59.274Z","dependency_job_id":null,"html_url":"https://github.com/martinheidegger/require-implementation","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/martinheidegger%2Frequire-implementation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Frequire-implementation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Frequire-implementation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Frequire-implementation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinheidegger","download_url":"https://codeload.github.com/martinheidegger/require-implementation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232815333,"owners_count":18580565,"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-03T12:12:49.373Z","updated_at":"2025-01-07T21:31:30.676Z","avatar_url":"https://github.com/martinheidegger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/martinheidegger/require-implementation.svg?branch=master)](https://travis-ci.org/martinheidegger/require-implementation) [![Coverage Status](https://coveralls.io/repos/github/martinheidegger/require-implementation/badge.svg)](https://coveralls.io/github/martinheidegger/require-implementation)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\n# require-implementation \n\nPackage that helps you to be okay if some dependency is missing.\n\n## Usage\n\n```javascript\nconst impl = require('require-implementation')\n\ntry {\n  // Let the user know what action you would like to take.\n  const math = impl('Trying to do some math.')\n    // ... then require what ever package could\n    //     installed immediatly.\n    .require('math')\n} catch (e) {\n  // You can filter other errors by checking for the code\n  e.code === 'EPACKAGEMISSING'\n\n  // In recommended packages \n  e.recommendedPackages == ['math']\n\n  e.message === 'EPACKAGEMISSING: Trying to do some math.\\n'+\n                'This error can be easily fixed by running the following command:\\n'+\n                '$ npm install --save math'\n}\n\n```\n\nIn case there are multiple options:\n\n```javascript\nconst impl = require('require-implementation')\ntry {\n  // requireFirst lets people know that each of the \n  const mathSet = impl('Trying to do some math.').requireFirst(['math', 'mathjs'])\n\n  // You can find out which was ldaded by taking the name\n  mathSet.name === 'math' || mathSet.name === 'mathjs'\n\n  // The required package can be found in .pkg\n  const math = mathSet.pkg\n} catch (e) {\n  // Same error as above\n}\n```\n\n## License\nISC","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Frequire-implementation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinheidegger%2Frequire-implementation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Frequire-implementation/lists"}