Function formatData

  • Formats data according to the provided rules.

    Parameters

    • data: {
          [key: string]: any;
      }

      The object where keys are field names and values are the data to format.

      • [key: string]: any
    • rules: IRules

      The object containing rules to use for formatting.

    Returns {
        [key: string]: any;
    }

    Returns a new object with formatted values.

    • [key: string]: any
    const result = formatData({ name: 'john' }, { name: ['string', ':upper'] })
    // => { name: 'JOHN' }