@progress/kendo-angular-common
Version:
Kendo UI for Angular - Utility Package
24 lines (23 loc) • 898 B
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
export const processCssValue = (value) => {
if (typeof value === 'number') {
return `${value}px`;
}
else if (typeof value === 'string') {
const trimmedValue = value.trim();
const numValue = parseInt(trimmedValue, 10);
if (!isNaN(numValue) && Number.isFinite(numValue)) {
if (numValue.toString() === trimmedValue) {
return `${numValue}px`;
}
else {
return value;
}
}
return null;
}
return null;
};