{"_id":"toggle-array","_rev":"161636","name":"toggle-array","description":"In an array of objects, this enables a property on the object at the specified index, while disabling the property on all other objects.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T11:40:53.000Z","created":"2016-08-30T00:09:24.994Z","1.0.1":"2017-05-07T19:52:51.240Z","1.0.0":"2017-05-07T19:50:20.269Z","0.1.0":"2016-08-30T00:09:24.994Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/toggle-array.git"},"versions":{"1.0.1":{"name":"toggle-array","description":"In an array of objects, this enables a property on the object at the specified index, while disabling the property on all other objects.","version":"1.0.1","homepage":"https://github.com/jonschlinkert/toggle-array","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/toggle-array.git"},"bugs":{"url":"https://github.com/jonschlinkert/toggle-array/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.0"},"devDependencies":{"gulp-format-md":"^0.1.12","mocha":"^3.3.0"},"keywords":["array","toggle"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["prompt-choices","arr-flatten","array-unique"]},"lint":{"reflinks":true}},"gitHead":"d8b2ebbd7bc1dd7f885c33f05573e2b60fc5cc5c","_id":"toggle-array@1.0.1","_shasum":"cbf5840792bd5097f33117ae824c932affe87d58","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"cbf5840792bd5097f33117ae824c932affe87d58","size":2642,"noattachment":false,"key":"/toggle-array/-/toggle-array-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/toggle-array/download/toggle-array-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/toggle-array-1.0.1.tgz_1494186770035_0.1892693880945444"},"directories":{},"publish_time":1494186771240,"_hasShrinkwrap":false,"_cnpm_publish_time":1494186771240},"1.0.0":{"name":"toggle-array","description":"In an array of objects, this enables a property on the object at the specified index, while disabling the property on all other objects.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/toggle-array","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/toggle-array.git"},"bugs":{"url":"https://github.com/jonschlinkert/toggle-array/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.0"},"devDependencies":{"gulp-format-md":"^0.1.12","mocha":"^3.3.0"},"keywords":["array","toggle"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["prompt-choices","arr-flatten","array-unique"]},"lint":{"reflinks":true}},"gitHead":"be9f732037c320057a39b3587722ef7f4b24a6f1","_id":"toggle-array@1.0.0","_shasum":"9ab040efbff341e23742d96c1adff12cc5270fd2","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"9ab040efbff341e23742d96c1adff12cc5270fd2","size":2628,"noattachment":false,"key":"/toggle-array/-/toggle-array-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/toggle-array/download/toggle-array-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/toggle-array-1.0.0.tgz_1494186618385_0.2927160856779665"},"directories":{},"publish_time":1494186620269,"_hasShrinkwrap":false,"_cnpm_publish_time":1494186620269},"0.1.0":{"name":"toggle-array","description":"In an array of objects, this enables a property on the object at the specified index, while disabling the property on all other objects.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/toggle-array","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/toggle-array.git"},"bugs":{"url":"https://github.com/jonschlinkert/toggle-array/issues"},"license":"Released under the MIT license.","files":["index.js","LICENSE"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"keywords":["array","toggle"],"devDependencies":{"gulp-format-md":"^0.1.10","mocha":"^3.0.2"},"dependencies":{"isobject":"^2.1.0"},"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"related":{"list":[]},"reflinks":["verb","verb-generate-readme"]},"gitHead":"4e64860ce3b6cd0d4e2e84c965d98512c8dabebb","_id":"toggle-array@0.1.0","_shasum":"305c046b1b7b1b8d1d0398d0beb4fe9a19f134fb","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"305c046b1b7b1b8d1d0398d0beb4fe9a19f134fb","size":2160,"noattachment":false,"key":"/toggle-array/-/toggle-array-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/toggle-array/download/toggle-array-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/toggle-array-0.1.0.tgz_1472515763681_0.9451782100368291"},"directories":{},"publish_time":1472515764994,"_cnpm_publish_time":1472515764994,"_hasShrinkwrap":false}},"readme":"# toggle-array [![NPM version](https://img.shields.io/npm/v/toggle-array.svg?style=flat)](https://www.npmjs.com/package/toggle-array) [![NPM monthly downloads](https://img.shields.io/npm/dm/toggle-array.svg?style=flat)](https://npmjs.org/package/toggle-array) [![NPM total downloads](https://img.shields.io/npm/dt/toggle-array.svg?style=flat)](https://npmjs.org/package/toggle-array) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/toggle-array.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/toggle-array)\n\n> In an array of objects, this enables a property on the object at the specified index, while disabling the property on all other objects.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save toggle-array\n```\n\n## Usage\n\n```js\nvar toggle = require('toggle-array');\nvar arr = [\n  {foo: true},\n  {foo: true},\n  {foo: true},\n  {foo: true},\n  {foo: true}\n];\n\nconsole.log(toggle(arr, 'foo', 2));\n// [ { foo: true },\n//   { foo: false },\n//   { foo: true },\n//   { foo: true },\n//   { foo: true } ]\n\nconsole.log(toggle(arr, 'foo', 2));\n// [ { foo: false },\n//   { foo: true },\n//   { foo: false },\n//   { foo: false },\n//   { foo: false } ]\n```\n\n## .enable\n\nEnables the element at the given index, and disables all other items:\n\n```js\nvar toggle = require('toggle-array');\nvar arr = [\n  {foo: true},\n  {foo: true},\n  {foo: true},\n  {foo: true},\n  {foo: true}\n];\n\nconsole.log(toggle.enable(arr, 'foo', 2));\n// [ { foo: false },\n//   { foo: false },\n//   { foo: true },\n//   { foo: false },\n//   { foo: false } ]\n```\n\n## .disable\n\nDisabled the element at the given index, and enables all other items:\n\n```js\nvar toggle = require('toggle-array');\nvar arr = [\n  {foo: false},\n  {foo: false},\n  {foo: false},\n  {foo: false},\n  {foo: false}\n];\n\nconsole.log(toggle.disable(arr, 'foo', 2));\n// [ { foo: true },\n//   { foo: true },\n//   { foo: false },\n//   { foo: true },\n//   { foo: true } ]\n```\n\n## About\n\n### Related projects\n\n* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. | [homepage](https://github.com/jonschlinkert/arr-flatten \"Recursively flatten an array or arrays.\")\n* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique \"Remove duplicate values from an array. Fastest ES5 implementation.\")\n* [prompt-choices](https://www.npmjs.com/package/prompt-choices): Create an array of multiple choice objects for use in prompts. | [homepage](https://github.com/enquirer/prompt-choices \"Create an array of multiple choice objects for use in prompts.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\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 && 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 && 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 07, 2017._","_attachments":{},"homepage":"https://github.com/jonschlinkert/toggle-array","bugs":{"url":"https://github.com/jonschlinkert/toggle-array/issues"},"license":"MIT"}