1.150912.12 • Published 9 years ago
mc.utils v1.150912.12
mc.utils
mc.utils is a package which contains helper methods for JavaScript development
Current version
Modules and methods
- Validators
- CheckNumberParam(value, paramName)
- CheckStringParam(value, paramName)
- CheckBooleanParam(value, paramName)
- CheckFunctionParam(value, paramName)
- CheckCustomTypeParam(value, paramName, customType)
- GetWrongTypeMessageFor(paramName, wrongType, expectedType)
- Common
- GenerateId()
- IsWebStorageSupported()
- IsGeolocationSupported()
- Exceptions
- NotImplementedException()
- LessOrEqualZeroException(paramName, paramValue)
Examples
Use of validators
function CalcFryingPanDiscount(price, percent) {
MCUtils.Validators.CheckNumberParam(price, 'price');
MCUtils.Validators.CheckNumberParam(percent, 'percent');
return price * (1 - percent);
}
Use of Common
function CreateFryingPan() {
var id = MCUtils.Custom.GenerateId();
var manufacturer = 'M€Pans';
var diameter = 30;
return new KitchenModule.FryingPan(id, manufacturer, diameter);
}
function IsSupportedCountry(countryCode) {
MCUtils.Validators.CheckStringParam(countryCode, 'countryCode');
if (MCUtils.Common.IsGeolocationSupported()) {
return IsShippingAvailable(countryCode);
}
return false;
}
Use of Exceptions
function IsShippingAvailable(countryCode) {
MCUtils.Exceptions.NotImplementedException();
}
Release notes
It's a first version of an NPM package.
Contact
For more information please visit: https://bitbucket.org/Sylvin_Stallone/jsutils_java
1.150912.12
9 years ago