@splidejs/splide
Version:
Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.
15 lines (12 loc) • 375 B
text/typescript
import { isString } from '../../type/type';
/**
* Appends `px` to the provided number.
* If the value is already string, just returns it.
*
* @param value - A value to append `px` to.
*
* @return A string with the CSS unit.
*/
export function unit( value: number | string ): string {
return isString( value ) ? value : value ? `${ value }px` : '';
}