@ryusei/code
Version:
<div align="center"> <a href="https://code.ryuseijs.com"> <img alt="RyuseiCode" src="https://code.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
13 lines (10 loc) • 296 B
text/typescript
import { isString } from '../../type/type';
/**
* Appends `px` to the value.
* If the value is already string, just returns it.
*
* @param value - A value to append `px` to.
*/
export function unit( value: number | string ): string {
return isString( value ) ? value : `${ value }px`;
}