All files / src/utils utils.ts

78.57% Statements 11/14
50% Branches 5/10
100% Functions 3/3
72.73% Lines 8/11

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 287x   7x 220x               7x 402x     7x 79x 79x                    
import { ValueMap, Environment } from '../types';
 
export const isDefined = (key: string, values: ValueMap) => {
    return (
        key in values &&
        values[key] !== undefined &&
        values[key] !== null &&
        values[key] !== ''
    );
};
 
export const isCallable = (arg: unknown): boolean => {
    return typeof arg === 'function';
};
 
export const getEnvironment = (): Environment => {
    Eif (typeof document !== 'undefined') {
        return Environment.ReactDom;
    }
    if (
        typeof navigator !== 'undefined' &&
        navigator.product === 'ReactNative'
    ) {
        return Environment.ReactNative;
    }
    return Environment.Node;
};