{"id":16985409,"url":"https://github.com/fengb/require-optional","last_synced_at":"2025-04-12T03:30:39.598Z","repository":{"id":26545805,"uuid":"29999305","full_name":"fengb/require-optional","owner":"fengb","description":"Require optional modules in node","archived":false,"fork":false,"pushed_at":"2016-09-15T00:17:16.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-01T21:39:07.299Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fengb.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":"2015-01-29T02:16:55.000Z","updated_at":"2018-10-02T06:21:41.000Z","dependencies_parsed_at":"2022-07-25T15:32:17.977Z","dependency_job_id":null,"html_url":"https://github.com/fengb/require-optional","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Frequire-optional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Frequire-optional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Frequire-optional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Frequire-optional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fengb","download_url":"https://codeload.github.com/fengb/require-optional/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512446,"owners_count":21116601,"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-14T02:43:24.313Z","updated_at":"2025-04-12T03:30:39.567Z","avatar_url":"https://github.com/fengb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# require-optional [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]\n\n## Usage\n\nInstall via npm:\n\n```bash\n$ npm install require-optional\n```\n\nBasic usage:\n\n```javascript\nvar requireOptional = require('require-optional')\nvar optDep = requireOptional('dep')\nif (optDep) {\n  /* do stuff with optDep */\n}\n```\n\n`require-optional` can return a default value:\n\n```javascript\nvar optDep = requireOptional('dep', function () {})\noptDep('processing')\n```\n\n`require-optional` accepts an error callback for when the module is not found:\n\n```javascript\nrequireOptional('dep', null, function (err) {\n  console.warn(err)\n})\n```\n\n`require-optional` can also require relative modules:\n\n```javascript\nvar optDep = requireOptional('./dep')\n```\n\n[npm-image]: https://img.shields.io/npm/v/require-optional.svg?style=flat\n[npm-url]: https://npmjs.org/package/require-optional\n[travis-image]: https://img.shields.io/travis/fengb/require-optional.svg?style=flat\n[travis-url]: https://travis-ci.org/fengb/require-optional\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengb%2Frequire-optional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengb%2Frequire-optional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengb%2Frequire-optional/lists"}