{"id":25180653,"url":"https://github.com/base-repos/base-option","last_synced_at":"2025-05-07T06:04:41.463Z","repository":{"id":60775005,"uuid":"43537090","full_name":"base-repos/base-option","owner":"base-repos","description":"Adds an `option` method to base-methods.","archived":false,"fork":false,"pushed_at":"2019-11-06T20:19:55.000Z","size":47,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T06:04:35.708Z","etag":null,"topics":["assemble","base","cache","config","configuration","generate","nodejs","option","options","plugin","settings","update","verb"],"latest_commit_sha":null,"homepage":null,"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/base-repos.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":"2015-10-02T05:20:33.000Z","updated_at":"2025-01-31T00:38:50.000Z","dependencies_parsed_at":"2022-10-04T16:16:00.997Z","dependency_job_id":null,"html_url":"https://github.com/base-repos/base-option","commit_stats":null,"previous_names":["jonschlinkert/base-options","node-base/base-option","base-repos/base-option"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-option","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-option/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-option/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-option/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/base-repos","download_url":"https://codeload.github.com/base-repos/base-option/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823920,"owners_count":21809713,"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":["assemble","base","cache","config","configuration","generate","nodejs","option","options","plugin","settings","update","verb"],"created_at":"2025-02-09T16:19:13.625Z","updated_at":"2025-05-07T06:04:41.441Z","avatar_url":"https://github.com/base-repos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# base-option [![NPM version](https://img.shields.io/npm/v/base-option.svg?style=flat)](https://www.npmjs.com/package/base-option) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-option.svg?style=flat)](https://npmjs.org/package/base-option) [![NPM total downloads](https://img.shields.io/npm/dt/base-option.svg?style=flat)](https://npmjs.org/package/base-option) [![Linux Build Status](https://img.shields.io/travis/node-base/base-option.svg?style=flat\u0026label=Travis)](https://travis-ci.org/node-base/base-option)\n\n\u003e Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save base-option\n```\n\n## Usage\n\nUse as a plugin with with your `base` application:\n\n```js\nvar Base = require('base');\nvar options = require('base-option');\n\nvar base = new Base();\nbase.use(options()); // plugin\n\n// set an option\napp.option('a', 'b');\n\n// set a nested property\napp.option('x.y', 'z');\n\n// get an option\nconsole.log(app.option('x'));\n//=\u003e {y: 'z'}\n```\n\n## API\n\n### .option\n\nSet or get an option.\n\n**Params**\n\n* `key` **{String}**: The option name.\n* `value` **{any}**: The value to set.\n* `returns` **{any}**: Returns a `value` when only `key` is defined.\n\n**Example**\n\n```js\napp.option('a', true);\napp.option('a');\n//=\u003e true\n```\n\n### .hasOption\n\nReturn true if `options.hasOwnProperty(key)`\n\n**Params**\n\n* `prop` **{String}**\n* `returns` **{Boolean}**: True if `prop` exists.\n\n**Example**\n\n```js\napp.hasOption('a');\n//=\u003e false\napp.option('a', 'b');\napp.hasOption('a');\n//=\u003e true\n```\n\n### .enable\n\nEnable `key`.\n\n**Params**\n\n* `key` **{String}**\n* `returns` **{Object}** `Options`: to enable chaining\n\n**Example**\n\n```js\napp.enable('a');\n```\n\n### .disable\n\nDisable `key`.\n\n**Params**\n\n* `key` **{String}**: The option to disable.\n* `returns` **{Object}** `Options`: to enable chaining\n\n**Example**\n\n```js\napp.disable('a');\n```\n\n### .enabled\n\nCheck if `prop` is enabled (truthy).\n\n**Params**\n\n* `prop` **{String}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\napp.enabled('a');\n//=\u003e false\n\napp.enable('a');\napp.enabled('a');\n//=\u003e true\n```\n\n### .disabled\n\nCheck if `prop` is disabled (falsey).\n\n**Params**\n\n* `prop` **{String}**\n* `returns` **{Boolean}**: Returns true if `prop` is disabled.\n\n**Example**\n\n```js\napp.disabled('a');\n//=\u003e true\n\napp.enable('a');\napp.disabled('a');\n//=\u003e false\n```\n\n### .isTrue\n\nReturns true if the value of `prop` is strictly `true`.\n\n**Params**\n\n* `prop` **{String}**\n* `returns` **{Boolean}**: Uses strict equality for comparison.\n\n**Example**\n\n```js\napp.option('a', 'b');\napp.isTrue('a');\n//=\u003e false\n\napp.option('c', true);\napp.isTrue('c');\n//=\u003e true\n\napp.option({a: {b: {c: true}}});\napp.isTrue('a.b.c');\n//=\u003e true\n```\n\n### .isFalse\n\nReturns true if the value of `key` is strictly `false`.\n\n**Params**\n\n* `prop` **{String}**\n* `returns` **{Boolean}**: Uses strict equality for comparison.\n\n**Example**\n\n```js\napp.option('a', null);\napp.isFalse('a');\n//=\u003e false\n\napp.option('c', false);\napp.isFalse('c');\n//=\u003e true\n\napp.option({a: {b: {c: false}}});\napp.isFalse('a.b.c');\n//=\u003e true\n```\n\n### .isBoolean\n\nReturn true if the value of key is either `true` or `false`.\n\n**Params**\n\n* `key` **{String}**\n* `returns` **{Boolean}**: True if `true` or `false`.\n\n**Example**\n\n```js\napp.option('a', 'b');\napp.isBoolean('a');\n//=\u003e false\n\napp.option('c', true);\napp.isBoolean('c');\n//=\u003e true\n```\n\n### [.option.set](index.js#L45)\n\nSet option `key` on `app.options` with the given `value`\n\n**Params**\n\n* `key` **{String}**: Option key, dot-notation may be used.\n* `value` **{any}**\n\n**Example**\n\n```js\napp.option.set('a', 'b');\nconsole.log(app.option.get('a'));\n//=\u003e 'b'\n```\n\n### [.option.get](index.js#L64)\n\nGet option `key` from `app.options`\n\n**Params**\n\n* `key` **{String}**: Option key, dot-notation may be used.\n* `returns` **{any}**\n\n**Example**\n\n```js\napp.option({a: 'b'});\nconsole.log(app.option.get('a'));\n//=\u003e 'b'\n```\n\n### [.option.create](index.js#L82)\n\nReturns a shallow clone of `app.options` with all of the options methods, as well as a `.merge` method for merging options onto the cloned object.\n\n**Params**\n\n* `options` **{Options}**: Object to merge onto the returned options object.\n* `returns` **{Object}**\n\n**Example**\n\n```js\nvar opts = app.option.create();\nopts.merge({foo: 'bar'});\n```\n\n## About\n\n### Related projects\n\n* [base-data](https://www.npmjs.com/package/base-data): adds a `data` method to base-methods. | [homepage](https://github.com/node-base/base-data \"adds a `data` method to base-methods.\")\n* [base-task](https://www.npmjs.com/package/base-task): base plugin that provides a very thin wrapper around [https://github.com/doowb/composer](https://github.com/doowb/composer) for adding task methods to… [more](https://github.com/node-base/base-task) | [homepage](https://github.com/node-base/base-task \"base plugin that provides a very thin wrapper around \u003chttps://github.com/doowb/composer\u003e for adding task methods to your application.\")\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality node.js applications, using plugins like building blocks\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 64 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 4 | [doowb](https://github.com/doowb) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 30, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-repos%2Fbase-option","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbase-repos%2Fbase-option","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-repos%2Fbase-option/lists"}