UNPKG

laravel-form-validation

Version:
68 lines (67 loc) 1.45 kB
declare class Errors { private errors; /** * Create a new Errors instance. * * @param {Object} errors */ constructor(errors?: Object); /** * Get all of the messages in the bag. * * @return {object} */ all(): Object; /** * Determine if messages exist for the given key. * * @param {String} field * @return {Boolean} */ has(field: string): Boolean; /** * Get the first message from the bag for a given key. * * @param {String} field * @returns {String|null} */ first(field: string): String | null; /** * Get the first error from matching key * * @param fieldPattern */ firstWhere(fieldPattern: string): String | null; /** * Get all of the messages from the bag for a given key. * * @param {String} field * @returns {Array} */ get(field: string): Array<any>; /** * Determine if we have any errors. * * @return {Boolean} */ any(): Boolean; /** * Get all the errors in a flat array. * * @return {Array} */ flatten(): Array<any>; /** * Record the new errors. * * @param {Object} errors */ record(errors: Object): void; /** * Clear a specific field, object or all error fields. * * @param {String?} field */ clear(field?: string): void; } export default Errors;