Function toPixel

  • Convert a pixel string to number. We accept a number or a string like '123px'. If undefined, the first default value that is a number or a string ending with 'px' is returned.

    Example:

    let x = undefined;
    let y = "123px";
    const width = util.toPixel(x, y, 100); // returns 123

    Parameters

    • Rest ...defaults: (undefined | null | string | number)[]

    Returns number