Function checkObject

  • Checks the object, if any one key's value is empty it returns false.

    Parameters

    • data: AnyObject

      The object to be checked for empty values.

    • keys: string[] = []

      An optional array of keys to check for empty values. Default is an empty array.

    Returns boolean

    • Returns true if all values in the object are non-empty, otherwise returns false.

    Example

    const payload = { id: 2, name: "John", address: { city: "bangalore" } }
    console.log(checkObject(payload, ["iddas"]));// false
    console.log(checkObject(payload, ["name"]));// true
    console.log(checkObject(payload, ["address.city"]));// true

Generated using TypeDoc