File "unit.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/dom/unit/unit.ts
File size: 361 B (361 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

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` : '';
}