@nebular/theme
Version:
@nebular/theme
36 lines • 1.21 kB
JavaScript
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
export function convertToBoolProperty(val) {
if (typeof val === 'string') {
val = val.toLowerCase().trim();
return (val === 'true' || val === '');
}
return !!val;
}
export function getElementHeight(el) {
/**
*
* TODO: Move helpers in separate common module.
* TODO: Provide window through di token.
* */
const style = window.getComputedStyle(el);
const marginTop = parseInt(style.getPropertyValue('margin-top'), 10);
const marginBottom = parseInt(style.getPropertyValue('margin-bottom'), 10);
return el.offsetHeight + marginTop + marginBottom;
}
export function firstChildNotComment(node) {
const children = Array
.from(node.childNodes)
.filter((child) => child.nodeType !== Node.COMMENT_NODE);
return children[0];
}
export function lastChildNotComment(node) {
const children = Array
.from(node.childNodes)
.filter((child) => child.nodeType !== Node.COMMENT_NODE);
return children[children.length - 1];
}
//# sourceMappingURL=helpers.js.map