data_array-to-int.js

/**
 * @module arrayToInt
 * @description Converts all values of the specified array to int and returns the resulting array.
 *
 * @since 1.0.0
 *
 * @param {Array} arr The array to be converted.
 *
 * @return {Array} Returns a new array with all values converted to int.
 *
 * @example
 * import { arrayToInt } from "@gravityforms/utils";
 *
 * function Example() {
 * 	 let ary = [ '1', '2', '3.4' ];
 * 	 let intArray = arrayToInt( ary );
 * }
 *
 */
const arrayToInt = ( arr = [] ) => arr.map( ( x ) => parseInt( x, 10 ) );

export default arrayToInt;