helpers.d.ts 888 B

1234567891011121314151617181920
  1. export declare const isPresent: (value: unknown) => boolean;
  2. export declare const round: (number: number, digits?: number, base?: number) => number;
  3. export declare const floor: (number: number, digits?: number, base?: number) => number;
  4. /**
  5. * Clamps a value between an upper and lower bound.
  6. * We use ternary operators because it makes the minified code
  7. * is 2 times shorter then `Math.min(Math.max(a,b),c)`
  8. * NaN is clamped to the lower bound
  9. */
  10. export declare const clamp: (number: number, min?: number, max?: number) => number;
  11. /**
  12. * Processes and clamps a degree (angle) value properly.
  13. * Any `NaN` or `Infinity` will be converted to `0`.
  14. * Examples: -1 => 359, 361 => 1
  15. */
  16. export declare const clampHue: (degrees: number) => number;
  17. /**
  18. * Converts a hue value to degrees from 0 to 360 inclusive.
  19. */
  20. export declare const parseHue: (value: string, unit?: string) => number;