@zensen/form-validators
Version:
Validators for form-service
20 lines (17 loc) • 430 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.extents = extents;
exports.getValueByPath = getValueByPath;
function extents(ext1, ext2) {
return {
min: ext1 < ext2 ? ext1 : ext2,
max: ext1 > ext2 ? ext1 : ext2
};
}
function getValueByPath(obj, keyPath) {
return keyPath.reduce(function (obj, key) {
return typeof obj !== 'undefined' ? obj[key] : undefined;
}, obj);
}