@moneybutton/config
Advanced tools
Comparing version 0.1.8 to 0.21.1
@@ -1,53 +0,51 @@ | ||
'use strict'; | ||
'use strict' | ||
class Config { | ||
constructor(values) { | ||
this.keyDefined = key => key in values; | ||
constructor (values) { | ||
this.keyDefined = key => key in values | ||
this.getValue = key => values[key]; | ||
this.getValue = key => values[key] | ||
} | ||
get(key) { | ||
get (key) { | ||
if (this.keyDefined(key)) { | ||
return this.getValue(key); | ||
return this.getValue(key) | ||
} else { | ||
throw new Error(`Unknown configuration: ${key}`); | ||
throw new Error(`Unknown configuration: ${key}`) | ||
} | ||
} | ||
} | ||
class MoneyButtonConfigBuilder { | ||
constructor() { | ||
this.variables = {}; | ||
constructor () { | ||
this.variables = {} | ||
} | ||
build() { | ||
return new Config(this.variables); | ||
build () { | ||
return new Config(this.variables) | ||
} | ||
addValue(key, value) { | ||
addValue (key, value) { | ||
if (value === undefined) { | ||
throw new Error(`Failed to add "${key}" property. The value cannot be undefined`); | ||
throw new Error(`Failed to add "${key}" property. The value cannot be undefined`) | ||
} | ||
if (key in this.variables) { | ||
throw new Error(`"${key}" already has a value defined.`); | ||
throw new Error(`"${key}" already has a value defined.`) | ||
} | ||
this.variables[key] = value; | ||
return this; | ||
this.variables[key] = value | ||
return this | ||
} | ||
addValueWithDefault(key, value, defaultValue) { | ||
addValueWithDefault (key, value, defaultValue) { | ||
if (defaultValue === undefined) { | ||
throw new Error(`Failed to add "${key}" property. Default value cannot be undefined`); | ||
throw new Error(`Failed to add "${key}" property. Default value cannot be undefined`) | ||
} | ||
return this.addValue(key, value === undefined ? defaultValue : value); | ||
return this.addValue(key, value === undefined ? defaultValue : value) | ||
} | ||
} | ||
module.exports = MoneyButtonConfigBuilder; | ||
//# sourceMappingURL=moneybutton.config.cjs.js.map | ||
module.exports = MoneyButtonConfigBuilder | ||
// # sourceMappingURL=moneybutton.config.cjs.js.map |
class Config { | ||
constructor(values) { | ||
this.keyDefined = key => key in values; | ||
constructor (values) { | ||
this.keyDefined = key => key in values | ||
this.getValue = key => values[key]; | ||
this.getValue = key => values[key] | ||
} | ||
get(key) { | ||
get (key) { | ||
if (this.keyDefined(key)) { | ||
return this.getValue(key); | ||
return this.getValue(key) | ||
} else { | ||
throw new Error(`Unknown configuration: ${key}`); | ||
throw new Error(`Unknown configuration: ${key}`) | ||
} | ||
} | ||
} | ||
class MoneyButtonConfigBuilder { | ||
constructor() { | ||
this.variables = {}; | ||
constructor () { | ||
this.variables = {} | ||
} | ||
build() { | ||
return new Config(this.variables); | ||
build () { | ||
return new Config(this.variables) | ||
} | ||
addValue(key, value) { | ||
addValue (key, value) { | ||
if (value === undefined) { | ||
throw new Error(`Failed to add "${key}" property. The value cannot be undefined`); | ||
throw new Error(`Failed to add "${key}" property. The value cannot be undefined`) | ||
} | ||
if (key in this.variables) { | ||
throw new Error(`"${key}" already has a value defined.`); | ||
throw new Error(`"${key}" already has a value defined.`) | ||
} | ||
this.variables[key] = value; | ||
return this; | ||
this.variables[key] = value | ||
return this | ||
} | ||
addValueWithDefault(key, value, defaultValue) { | ||
addValueWithDefault (key, value, defaultValue) { | ||
if (defaultValue === undefined) { | ||
throw new Error(`Failed to add "${key}" property. Default value cannot be undefined`); | ||
throw new Error(`Failed to add "${key}" property. Default value cannot be undefined`) | ||
} | ||
return this.addValue(key, value === undefined ? defaultValue : value); | ||
return this.addValue(key, value === undefined ? defaultValue : value) | ||
} | ||
} | ||
export default MoneyButtonConfigBuilder; | ||
//# sourceMappingURL=moneybutton.esm.js.map | ||
export default MoneyButtonConfigBuilder | ||
// # sourceMappingURL=moneybutton.esm.js.map |
@@ -20,3 +20,3 @@ /** | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/var MoneyButtonConfigBuilder=function(){"use strict";function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}var b=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},c=function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b},d=function(){function a(c){b(this,a),this.keyDefined=function(a){return a in c},this.getValue=function(a){return c[a]}}return c(a,[{key:"get",value:function(a){if(this.keyDefined(a))return this.getValue(a);throw new Error("Unknown configuration: ".concat(a))}}]),a}(),e=function(){function a(){b(this,a),this.variables={}}return c(a,[{key:"build",value:function(){return new d(this.variables)}},{key:"addValue",value:function(a,b){if(void 0===b)throw new Error("Failed to add \"".concat(a,"\" property. The value cannot be undefined"));if(a in this.variables)throw new Error("\"".concat(a,"\" already has a value defined."));return this.variables[a]=b,this}},{key:"addValueWithDefault",value:function(a,b,c){if(void 0===c)throw new Error("Failed to add \"".concat(a,"\" property. Default value cannot be undefined"));return this.addValue(a,void 0===b?c:b)}}]),a}();return e}(); | ||
//# sourceMappingURL=moneybutton.iife.js.map | ||
*/var MoneyButtonConfigBuilder = (function () { 'use strict'; function a (a, b) { for (var c, d = 0; d < b.length; d++)c = b[d], c.enumerable = c.enumerable || !1, c.configurable = !0, 'value' in c && (c.writable = !0), Object.defineProperty(a, c.key, c) } var b = function (a, b) { if (!(a instanceof b)) throw new TypeError('Cannot call a class as a function') }; var c = function (b, c, d) { return c && a(b.prototype, c), d && a(b, d), b }; var d = (function () { function a (c) { b(this, a), this.keyDefined = function (a) { return a in c }, this.getValue = function (a) { return c[a] } } return c(a, [{ key: 'get', value: function (a) { if (this.keyDefined(a)) return this.getValue(a); throw new Error('Unknown configuration: '.concat(a)) } }]), a }()); var e = (function () { function a () { b(this, a), this.variables = {} } return c(a, [{ key: 'build', value: function () { return new d(this.variables) } }, { key: 'addValue', value: function (a, b) { if (void 0 === b) throw new Error('Failed to add "'.concat(a, '" property. The value cannot be undefined')); if (a in this.variables) throw new Error('"'.concat(a, '" already has a value defined.')); return this.variables[a] = b, this } }, { key: 'addValueWithDefault', value: function (a, b, c) { if (void 0 === c) throw new Error('Failed to add "'.concat(a, '" property. Default value cannot be undefined')); return this.addValue(a, void 0 === b ? c : b) } }]), a }()); return e }()) | ||
// # sourceMappingURL=moneybutton.iife.js.map |
{ | ||
"name": "@moneybutton/config", | ||
"version": "0.1.8", | ||
"version": "0.21.1", | ||
"description": "Money Button configuration.", | ||
@@ -57,3 +57,3 @@ "main": "dist/moneybutton.config.cjs.js", | ||
"should": "13.2.1", | ||
"standard": "11.0.1" | ||
"standard": "12.0.1" | ||
}, | ||
@@ -70,3 +70,4 @@ "standard": { | ||
] | ||
} | ||
}, | ||
"gitHead": "1140693bf8eb445920deeb5d0c76e6e5ba341876" | ||
} |
@@ -23,3 +23,3 @@ # @moneybutton/config | ||
[Money Button](https://www.moneybutton.com) is a UI/UX and API layer for the blockchain which takes 0% transaction fees and makes Bitcoin Cash easy for everyone, everywhere. | ||
[Money Button](https://www.moneybutton.com) is a UI/UX and API layer for the blockchain which takes 0% transaction fees and makes Bitcoin SV easy for everyone, everywhere. | ||
@@ -26,0 +26,0 @@ ## Install |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
106054
15
617
2