Function isValidData

  • Determine the validity of the data.

    Usage:

    const validData = {
    a: {
    b: {
    c: 413
    }
    }
    };
    const isValidDataResA = isValidData(validData, ['a', 'b', 'c'], 2333);
    const isValidDataResB = isValidData(validData, ['a', 'b', 'c'], 413);
    const isValidDataResC = isValidData(validData, ['d', 'd'], 413);
    console.log('isValidDataResA:', isValidDataResA);
    console.log('isValidDataResB:', isValidDataResB);
    console.log('isValidDataResC:', isValidDataResC);

    Output:

    isValidDataResA: false
    isValidDataResB: true
    isValidDataResC: false
    

    Parameters

    • data: any

      Original Data

    • attributes: string[]

      Data Attributes

    • validValue: SimpleType

      Given Value for verifying.

    Returns boolean

    Return TRUE if the data is valid.