{"_id":"dipswitch","_rev":"194-f9917333787f4451d10005e4b13386db","name":"dipswitch","dist-tags":{"next":"4.0.0-alpha1","latest":"4.0.2"},"versions":{"0.0.0":{"name":"dipswitch","version":"0.0.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@0.0.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"fb0c7235eb8f6f693443d0184436508108080155","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-0.0.0.tgz","integrity":"sha512-7cFsHT4fq3fFAbrLbOW9LCKNwlZTvQWJ4boIiX5EyJ3kQ6XIcYdU2kRu1GFBSWmNYcXnibJ/YZ/hm2+hIzj5oA==","signatures":[{"sig":"MEUCIQC0mW6p8VhG7XVKeuACW4CEUDLN68LUQDeyplFWJli5zAIgaVRxSXMyUth9mJwkkvh47EHzWjCMOH5uzDsl8/ool/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"fb0c7235eb8f6f693443d0184436508108080155","gitHead":"dc0a1ed90e658f4add6e2b872da4f8d829701ad4","scripts":{"lint":"./bin/lint","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-level feature toggles backed by Redis.","directories":{},"dependencies":{},"devDependencies":{"tap":"^0.4.12","lint":"^1.1.2"}},"2.0.0":{"name":"dipswitch","version":"2.0.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@2.0.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"42bd0866aedb461f9c1e1c5221b3402687def28e","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-2.0.0.tgz","integrity":"sha512-F8Gn5AaFhd4TYQDLrVLBm/JIgAcAsn9eBdNrFifgfV8pipIccBXFG5iF4rYyy4sVkYoXCe3TqhC7wN90iYpShQ==","signatures":[{"sig":"MEUCIFji4cr21YRlo1AtsL1Ad+rwmuCJzwPgK5JIIk7qERXNAiEAvSUwMFCkJV6lNzczDcEB9mLx2F1IDabJRz3fAG26oXE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"42bd0866aedb461f9c1e1c5221b3402687def28e","gitHead":"8db08b57cdab3200811296e073f908ee4567afdc","scripts":{"lint":"./bin/lint","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"lint":"^1.1.2","trap":"^0.4.2"}},"2.1.0":{"name":"dipswitch","version":"2.1.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@2.1.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"8f135d53b1b8b4ff4e8e1d81a8b8ac65ef98c334","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-2.1.0.tgz","integrity":"sha512-2kBHxVmGcTCoOXLN4nw1Ulf71Jq8OWM53x1TtRsKe1nUhHUjrbEbicvbl3RvmHNyNvNi5XkFzu8m6AT/1MSaHg==","signatures":[{"sig":"MEUCIQDMZ0TSd3EgIu71Y/wN4CXYHvmpGJ4GPBfOzzcAVVC/dwIgQzZmgdYIyNQggv9qVSM6YanaBjw1Ktj1EYLeXGXtlaI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"8f135d53b1b8b4ff4e8e1d81a8b8ac65ef98c334","gitHead":"cb9129de465f0c64d5eb528f718f95993b1255b0","scripts":{"lint":"./bin/lint","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"lint":"^1.1.2","trap":"^0.4.2","redis":"^0.12.1"}},"3.0.0":{"name":"dipswitch","version":"3.0.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@3.0.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"363bfb025c1cc72adc35cbcf7689ab368056d996","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-3.0.0.tgz","integrity":"sha512-zXsmU3HxHO2TDd+FTPM5GxUF3r//v8gVY3GltLK0e4m1PldSzzXCAFvZslcUDVN1igBzie2GY6Eb3gw0gDBSCA==","signatures":[{"sig":"MEUCIQDed2xocYc5FuJOmFJ3LXL3veoAsB30ljdGteb/EJSNaAIgQtP1zB1ey4AICRFtOmc8ZHYxYJ44i4VK97HTxCzbVTo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"363bfb025c1cc72adc35cbcf7689ab368056d996","gitHead":"ca4ac4bd859570215842030217b34101db285e79","scripts":{"lint":"./bin/lint","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"lint":"^1.1.2","trap":"^0.4.2","redis":"^0.12.1"}},"3.1.0":{"name":"dipswitch","version":"3.1.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@3.1.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"21662cde20252b83c532c8d26c0abeeaf92807a9","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-3.1.0.tgz","integrity":"sha512-z/QeDoiW3gBU8UnXxqt11TeucdKoQAWvch17XRR+HLHZ6OyiYv5Kleq610ay7TOK+E7M29flzL9CMGB1bgFRog==","signatures":[{"sig":"MEYCIQDmAj/Neqqf0dy0BYyCDChLDLEQRxZ2BAz6OCukwmdkEgIhAMyIAaplSGi7v5qJMjLzsbyKI8vS7ckYxtLC956t4e6D","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"21662cde20252b83c532c8d26c0abeeaf92807a9","gitHead":"1c35c23770d180f502c47387d808536f376aff01","scripts":{"lint":"eslint --ignore-path .gitignore .","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"trap":"^0.4.2","redis":"^0.12.1","eslint":"^0.15","eslint-plugin-nodeca":"^1"}},"4.0.0-alpha1":{"name":"dipswitch","version":"4.0.0-alpha1","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@4.0.0-alpha1","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"b8e78fe759ab0145a9f339e5f17e27601ddb9b38","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-4.0.0-alpha1.tgz","integrity":"sha512-PkGSRdF4WoWzu42yNGAWxkKce1gKaAqBMlp3w5jHjFfENugQb28qEZXCQ1QpB4dcU2L7KjlkyXw5NP2ZgGB6GA==","signatures":[{"sig":"MEUCIFg4eGWYdXMPdc73wZbqY18jCt3iDt38vE93OXfWh6qDAiEA3BqFdrY5lLYfSuFCFzsXV53zD/BHF6ez1H97ACvWNRY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"b8e78fe759ab0145a9f339e5f17e27601ddb9b38","gitHead":"563cc04577d4b4c1afe241330dfbd531cf772334","scripts":{"lint":"eslint --ignore-path .gitignore .","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"2.11.3","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"_nodeVersion":"2.3.3","dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"trap":"^0.4.2","eslint":"^0.15","eslint-plugin-nodeca":"^1"}},"4.0.0":{"name":"dipswitch","version":"4.0.0","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@4.0.0","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"6db5616c9c5d11883fc2183023effd61db53fe30","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-4.0.0.tgz","integrity":"sha512-MN2L2kOo/q4hjg0mXLL0Yxn6aNeEEkKpn6j/bO4HWWCSRe1X9qSvjOB800VkuQiJxx9e1hL2tsGsIQMSSReasw==","signatures":[{"sig":"MEYCIQCjS2YjmEhjGVao74ZqhYB5mvgk+p730YN73nN937mJDQIhAOhhH2orP38uecr2tBY2ncxNxdoBU9X5s/snMtta1W29","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"6db5616c9c5d11883fc2183023effd61db53fe30","gitHead":"aacc82193b22d519d0ab47defcfdb0c492a7a1e2","scripts":{"lint":"eslint --ignore-path .gitignore .","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"trap":"^0.4.2","eslint":"^0.15","eslint-plugin-nodeca":"^1"}},"4.0.1":{"name":"dipswitch","version":"4.0.1","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@4.0.1","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"5694c2504cfd0e3869b6dcc3e79345747e7ebee6","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-4.0.1.tgz","integrity":"sha512-mZ+th9cL9WvLHw6Rt0G2N0g1ia2qfDHrSupUy7jo3i8YIFh2VG+CUp3kaLtETHCJaD1+vbpzQXoQxAfgBG5+/w==","signatures":[{"sig":"MEUCIGv3oLFx0rKqOaZcb/GvqjuI3V48qMc913vNEU8Ip34NAiEAo1Rq3jw3K0aBE4C4NVbxFovuwT8obVbq0aIBGPShrrw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"5694c2504cfd0e3869b6dcc3e79345747e7ebee6","gitHead":"811319337b1dad18677b54a982e481e8e6e40656","scripts":{"lint":"eslint --ignore-path .gitignore .","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"1.4.28","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"trap":"^0.4.2","eslint":"^0.15","eslint-plugin-nodeca":"^1"}},"4.0.2":{"name":"dipswitch","version":"4.0.2","keywords":["feature","flag","toggle","rollout"],"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"_id":"dipswitch@4.0.2","maintainers":[{"name":"lanetix","email":"engineering@lanetix.com"}],"homepage":"https://github.com/lanetix/node-dipswitch/","bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"dist":{"shasum":"362c1bdb3dca239d08111c0b07e5679477bda034","tarball":"https://registry.npmjs.org/dipswitch/-/dipswitch-4.0.2.tgz","integrity":"sha512-WkSDpf5Q/IBmBsFq4lS9MjcogFb3XkVbIzt3Y2o8wD22oTHTI1oGr7ITnwmjuLFGcLuciqarjBemmE50FVQweQ==","signatures":[{"sig":"MEUCIQCgxe1vusznNKU8nQFhkieAs8CHzmqzpfYNJJ1UiOjAQgIgaeDMJQKkvz9WqpabGXdItWjHUt/3bOzA7/PuRVLChmw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","_from":".","_shasum":"362c1bdb3dca239d08111c0b07e5679477bda034","gitHead":"97e4f14aa1ef7f466d9d67556182dbc8f7bcc38f","scripts":{"lint":"eslint --ignore-path .gitignore .","test":"./bin/lint && ./bin/test"},"_npmUser":{"name":"lanetix","email":"engineering@lanetix.com"},"licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"_npmVersion":"2.11.3","description":"Multi-tenant feature toggles backed by Redis.","directories":{},"_nodeVersion":"2.3.3","dependencies":{"lodash":"^2.4.1","bluebird":"^2.3.4"},"devDependencies":{"trap":"^0.4.2","eslint":"^0.15","eslint-plugin-nodeca":"^1"}}},"time":{"created":"2014-09-25T23:37:30.180Z","modified":"2026-08-03T11:04:10.715Z","1.0.0":"2014-09-25T23:37:30.180Z","1.0.1":"2014-09-26T01:17:52.995Z","0.0.0":"2014-09-26T01:24:13.134Z","2.0.0":"2014-10-03T06:17:16.163Z","2.1.0":"2014-10-03T09:42:18.246Z","3.0.0":"2014-10-08T18:12:13.071Z","3.1.0":"2015-03-18T05:21:54.754Z","4.0.0-alpha1":"2015-07-14T20:34:55.877Z","4.0.0":"2015-07-15T13:42:03.669Z","4.0.1":"2015-07-15T14:35:43.504Z","4.0.2":"2015-07-20T17:28:30.927Z"},"bugs":{"url":"https://github.com/lanetix/node-dipswitch/issues"},"author":{"url":"https://github.com/lanetix/","name":"Lanetix","email":"engineering@lanetix.com"},"homepage":"https://github.com/lanetix/node-dipswitch/","keywords":["feature","flag","toggle","rollout"],"repository":{"url":"git://github.com/lanetix/node-dipswitch.git","type":"git"},"description":"Multi-tenant feature toggles backed by Redis.","maintainers":[{"email":"systems@lanetix.com","name":"lanetix-system"},{"email":"jyothiss@qburst.com","name":"jyothis-qb"},{"email":"manu.kodiyan@winmore.app","name":"manu-kodiyan-winmore"},{"email":"ie_winmore_notify@deloitte.com","name":"dnm-winmore"},{"email":"mkdyanugk@gmail.com","name":"mkdyanugk"},{"email":"vigneshk@qburst.com","name":"vigneshk7"},{"email":"aswanth@qburst.com","name":"aswanth"},{"email":"sajith@qburst.com","name":"sajith.qb"},{"email":"dhiluraj@qburst.com","name":"dhiluraj-qburst"},{"email":"rohith.menon@qburst.com","name":"cdrohithmqb"},{"email":"arjun.venugopal@qburst.com","name":"arjunqb"},{"email":"renjith.ramaswamy@qburst.com","name":"renjith_ram_qburst"},{"email":"sidharth.n@qburst.com","name":"sidharth.n"},{"email":"rahul.bharadwaj@winmore.app","name":"rahulbharadwaj"},{"email":"jasif.shameem@winmore.app","name":"jasif-wm"},{"email":"arpit.shrivastava@winmore.app","name":"arpit1024"},{"email":"showvhick.nath@winmore.app","name":"showvhick-winmore"},{"email":"umesh.sahu@winmore.io","name":"umeshsahu32"},{"email":"karthik.chandran@qburst.com","name":"kaarthikchandran"},{"email":"siddlinga.reddy@winmore.io","name":"siddling"},{"email":"manoj.k@winmore.io","name":"mkdyanugk7"},{"email":"souraj.pal@winmore.io","name":"sourajpal"},{"email":"karan.parmar@winmore.io","name":"karan_winmore"},{"email":"yash.patel@winmore.io","name":"yash.patel.winmore"},{"email":"divyansh@winmore.app","name":"divyansh-winmore"},{"email":"ravi.sah@winmore.app","name":"ravi.sah"},{"email":"subham.jaiswal@winmore.app","name":"dev-saj-winmore"}],"readme":"# `dipswitch`\n\nDipswitch is a multi-tenant feature toggle library.\n\n[![NPM](https://nodei.co/npm/dipswitch.png?downloads=true&stars=true)](https://nodei.co/npm/dipswitch/)\n\n[![Build Status](https://travis-ci.org/lanetix/node-dipswitch.svg)](https://travis-ci.org/lanetix/node-dipswitch)\n\n## Installation (via [npm](https://npmjs.org/package/dipswitch))\n\n```bash\n$ npm install dipswitch --save\n```\n\nIf you wish to use redis to store this data, also install [dipswitch-redis](https://npmjs.org/package/dipswitch). Otherwise, an in-memory store will be used.\n\n## Usage\n\n### The Basics\n\n```javascript\nvar Dipswitch = require('dipswitch'),\n  dipswitch = new Dipswitch({\n    redis: require('redis').createClient(),\n\n    getTenantId: function (tenant) { // default is `return tenant.id;`\n      return tenant.tenantId;\n    },\n\n    getUserId: function (user) { // default is `return user.id;`\n      return user.userId;\n    },\n\n    getUserGroups: function (user) { // default is `return user.groups || [];`\n      if (user.isAdmin) {\n        return ['admins'];\n      }\n      return [];\n    }\n  });\n\n// ADDING & REMOVING FEATURES --------------------------------------------------\n\n// add & remove a feature\ndipswitch.features.add('EXAMPLE_FEATURE').then(function () { /* ... */ });\ndipswitch.features.remove('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// and another syntax for registering many features at once\ndipswitch.features.add(['FEATURE_1', 'FEATURE_2']).then(function () { /* ... */ });\n\n// and unregister many features at once as well\ndipswitch.features.remove(['EXAMPLE_FEATURE1', 'EXAMPLE_FEATURE2']).then(function () { /* ... */ });\n\n// retrieve all registered features\ndipswitch.features.find().then(function (features) {\n  /* ... */\n});\n\n// ENABLING FEATURES -----------------------------------------------------------\n\n// enable a feature globally\ndipswitch.features.enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// enable a feature for an entire tenant\ndipswitch.tenant(tenant).enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// enable a feature for a group within a tenant\ndipswitch.tenant(tenant).group('admins').enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// enable a feature a group across all tenants\ndipswitch.group('admins').enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// enable a feature for a user within a tenant\ndipswitch.tenant(tenant).user(user).enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// enable a feature for a user across all tenants\ndipswitch.user(user).enable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n\n// SCHEDULING FEATURES ---------------------------------------------------------\n\n// when enabling a feature you may optionally pass a `start` and/or `end` date\ndipswitch.features.enable('LOL_OMG_CATFACTS', {\n  start: new Date(2015, 3, 1), // April 1st\n  end: new Date(2015, 3, 2) // April 2nd\n}).then(function () { /* ... */ });\n\n// CHECKING FEATURES -----------------------------------------------------------\n\n// retrieve all features and whether they're enabled or not for a user\ndipswitch.tenant(tenant).user(user).features().then(function (features) {\n  console.log(features.EXAMPLE_FEATURE); // `true`\n});\n\n// check a single feature and whether it is enabled or not for a user\ndipswitch.tenant(tenant).user(user).feature('EXAMPLE_FEATURE').then(function (isEnabled) {\n  console.log(isEnabled); // `true`\n});\n\n// DISABLING FEATURES ----------------------------------------------------------\n\n// anywhere that you can call #enable, you can also call #disable\ndipswitch.tenant(tenant).user(user).disable('EXAMPLE_FEATURE').then(function () { /* ... */ });\n```\n\n### Unregistering Out-of-Date Features\n\nRather than having to have an admin UI for unregistering features you no longer care about, you can use a bit of `underscore`/`lodash` magic to automate the process:\n\n```javascript\nvar _ = require('underscore'),\n  Dipswitch = require('dipswitch'),\n  dipswitch = new Dipswitch(options);\n\n// note that FEATURE_2 was removed at some point\nvar desiredFeatures = ['FEATURE_1', 'FEATURE_3'];\n\ndipswitch.register(desiredFeatures)\n  .then(function () {\n    return dipswitch.features(); // lets say this returns ['FEATURE_1', 'FEATURE_2', 'FEATURE_3']\n  })\n  .then(function (registeredFeatures) {\n    var outOfDateFeatures = _.without(registeredFeatures, desiredFeatures);\n    return dipswitch.unregister(outOfDateFeatures); // will remove ['FEATURE_2']\n  });\n```\n\n### Interacting With Unregistered Features\n\nWhen enabling or disabling a feature that has never been registered, that feature is automatically registered. When testing to see the value of a feature that isn't registered, the result will be `false`.\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n\n## Author\n\n[Lanetix](https://github.com/lanetix) ([engineering@lanetix.com](mailto:engineering@lanetix.com))\n\n","readmeFilename":"README.md"}