feature-toggle-service
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -10,2 +10,9 @@ # Change Log | ||
## [4.1.0][] - 2019-06-22 | ||
### Added | ||
- Added debug mode for `isOn` method | ||
- Exporting type for `FeatureToggleServiceConfig` | ||
## [4.0.1][] - 2019-06-22 | ||
@@ -39,4 +46,5 @@ | ||
[Unreleased]: https://github.com/willmendesneto/feature-toggle-service/compare/v4.0.1...HEAD | ||
[Unreleased]: https://github.com/willmendesneto/feature-toggle-service/compare/v4.1.0...HEAD | ||
[4.1.0]: https://github.com/willmendesneto/feature-toggle-service/compare/v4.0.1...v4.1.0 | ||
[4.0.1]: https://github.com/willmendesneto/feature-toggle-service/compare/v4.0.0...v4.0.1 | ||
[4.0.0]: https://github.com/willmendesneto/feature-toggle-service/tree/v4.0.0 |
@@ -0,1 +1,4 @@ | ||
export declare type FeatureToggleServiceConfig = { | ||
[k: string]: boolean; | ||
}; | ||
/** | ||
@@ -5,2 +8,3 @@ * Checks if Feature toggle/flag exists and it's on. | ||
* @param key - Feature toggle/flag key to be checked | ||
* @param debug - Prints configuration, version and settings for debug purposes | ||
* | ||
@@ -10,3 +14,3 @@ * @returns Boolean | ||
*/ | ||
declare const isOn: (key: string) => boolean; | ||
declare const isOn: (key: string, debug: boolean) => boolean; | ||
/** | ||
@@ -20,5 +24,3 @@ * Set feature toggle/flag configuration | ||
*/ | ||
declare const set: (obj: { | ||
[k: string]: boolean; | ||
}) => void; | ||
declare const set: (obj: FeatureToggleServiceConfig) => void; | ||
export { isOn, set }; |
/*! | ||
* feature-toggle-service.js v4.0.1 | ||
* feature-toggle-service.js v4.1.0 | ||
* https://willmendesneto.github.io/feature-toggle-service.js | ||
@@ -8,42 +8,49 @@ * | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define("FeatureToggleService", ["exports"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports); | ||
global.FeatureToggleService = mod.exports; | ||
} | ||
if (typeof define === "function" && define.amd) { | ||
define("FeatureToggleService", ["exports"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports); | ||
global.FeatureToggleService = mod.exports; | ||
} | ||
})(this, function (exports) { | ||
"use strict"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var settings = {}; | ||
/** | ||
* Checks if Feature toggle/flag exists and it's on. | ||
* | ||
* @param key - Feature toggle/flag key to be checked | ||
* | ||
* @returns Boolean | ||
* | ||
*/ | ||
var isOn = function isOn(key) { | ||
return !!settings[key]; | ||
}; | ||
exports.isOn = isOn; | ||
/** | ||
* Set feature toggle/flag configuration | ||
* | ||
* @param obj - Configuration of your feature toggle/flag | ||
* | ||
* @returns void | ||
* | ||
*/ | ||
var set = function set(obj) { | ||
settings = obj; | ||
}; | ||
exports.set = set; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var version = '4.0.1'; | ||
var settings = (_a = {}, _a[version] = {}, _a); | ||
/** | ||
* Checks if Feature toggle/flag exists and it's on. | ||
* | ||
* @param key - Feature toggle/flag key to be checked | ||
* @param debug - Prints configuration, version and settings for debug purposes | ||
* | ||
* @returns Boolean | ||
* | ||
*/ | ||
var isOn = function isOn(key, debug) { | ||
if (debug === true) { | ||
// tslint:disable-next-line | ||
console.log("\n[DEBUG] Execution Time in milliseconds: " + Date.now() + " version: \"" + version + "\" key: \"" + key + "\" settings: " + JSON.stringify(settings) + "\n"); | ||
} | ||
return !!settings[version][key]; | ||
}; | ||
exports.isOn = isOn; | ||
/** | ||
* Set feature toggle/flag configuration | ||
* | ||
* @param obj - Configuration of your feature toggle/flag | ||
* | ||
* @returns void | ||
* | ||
*/ | ||
var set = function set(obj) { | ||
settings[version] = obj; | ||
}; | ||
exports.set = set; | ||
}); |
/*! | ||
* feature-toggle-service.js v4.0.1 | ||
* feature-toggle-service.js v4.1.0 | ||
* https://willmendesneto.github.io/feature-toggle-service.js | ||
@@ -7,2 +7,2 @@ * | ||
*/ | ||
!function(e,t){if("function"==typeof define&&define.amd)define("FeatureToggleService",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={};t(n),e.FeatureToggleService=n}}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={},t=function e(t){return!!n[t]};e.isOn=t;var i=function e(t){n=t};e.set=i}); | ||
!function(e,n){if("function"==typeof define&&define.amd)define("FeatureToggleService",["exports"],n);else if("undefined"!=typeof exports)n(exports);else{var i={};n(i),e.FeatureToggleService=i}}(this,function(e){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0});var t="4.0.1",o=((n={})[t]={},n),i=function e(n,i){return!0===i&&console.log("\n[DEBUG] Execution Time in milliseconds: "+Date.now()+' version: "'+t+'" key: "'+n+'" settings: '+JSON.stringify(o)+"\n"),!!o[t][n]};e.isOn=i;var r=function e(n){o[t]=n};e.set=r}); |
{ | ||
"name": "feature-toggle-service", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"author": "Will Mendes <willmendesneto@gmail.com>", | ||
@@ -22,2 +22,3 @@ "description": "The simplest solution for feature toggle in Javascript. Simple how it should be.", | ||
"devDependencies": { | ||
"@types/node": "^12.0.10", | ||
"babel-cli": "^6.24.1", | ||
@@ -66,5 +67,5 @@ "babel-core": "^6.25.0", | ||
"path": "./lib/feature-toggle-service.min.js", | ||
"maxSize": "322B" | ||
"maxSize": "450B" | ||
} | ||
] | ||
} |
@@ -89,5 +89,5 @@ # Feature Toggle Service | ||
### `featureToggleService.isOn(key)` | ||
### `featureToggleService.isOn(key, debug)` | ||
Checks if the feature toggle configuration has the string key value with `true` value. For bundle reasons if you want to check if the feature toggle is turned off, please use `!featureToggleService.isOn(key)` | ||
Checks if the feature toggle configuration has the string key value with `true` value. For bundle reasons if you want to check if the feature toggle is turned off, please use `!featureToggleService.isOn(key)`. When `debug` param is passed as `true` and it's not `NODE_ENV` is not set to prod, it prints configuration, version and settings for debug purposes | ||
@@ -94,0 +94,0 @@ ## Author |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16385
174
25