All files / utils pointer.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38        94x 94x       94x             94x 48x               94x 11x           94x          
/**
 * @module Utils
 */
 
import * as MC from "@lisn/globals/minification-constants";
import * as MH from "@lisn/globals/minification-helpers";
 
import { PointerAction } from "@lisn/globals/types";
 
import { isValidStrList } from "@lisn/utils/validation";
 
/**
 * Returns true if the given string is a valid pointer action.
 *
 * @category Validation
 */
export const isValidPointerAction = (action: string): action is PointerAction =>
  MH.includes(POINTER_ACTIONS, action);
 
/**
 * Returns true if the given string or array is a valid list of pointer
 * actions.
 *
 * @category Validation
 */
export const isValidPointerActionList = (actions: string | string[]) =>
  isValidStrList(actions, isValidPointerAction, false);
 
/**
 * @ignore
 * @internal
 */
export const POINTER_ACTIONS: PointerAction[] = [
  MC.S_CLICK,
  MC.S_HOVER,
  MC.S_PRESS,
] as const;