Server IP : 172.67.158.161 / Your IP : 3.137.187.71 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/data/validation/ |
Upload File : |
/** * Internal dependencies */ import type { State } from './reducers'; /** * Gets a validation error by ID. * * @param { State } state The current state. * @param { string } errorId The error ID. * @return { string } The validation error. */ export const getValidationError = ( state: State, errorId: string ) => state[ errorId ]; /** * Gets a validation error ID for use in HTML which can be used as a CSS selector, or to reference an error message. * * @param { State } state The current state. * @param { string } errorId The error ID. * @return { string } The validation error ID. */ export const getValidationErrorId = ( state: State, errorId: string ) => { if ( ! state.hasOwnProperty( errorId ) || state[ errorId ].hidden ) { return; } return `validate-error-${ errorId }`; }; /** * Whether the store has validation errors. * * @param { State } state The current state. * @return { boolean } Whether the store has validation errors or not. */ export const hasValidationErrors = ( state: State ) => { return Object.keys( state ).length > 0; };