/**
 * @since Last modified: 2023-12-30 16:57:35
 * @function getLast
 * @description Get the last item of an array or the last key of an object.
 * @param {array|object} data - Array with length>0 or object with keys>0.
 * @returns  {*} - The last item of the array or the last key of the object.
 * @see {@link https://codepen.io/axui/pen/MWxwRqW|demo @ codepen}
 * @example
 * ax.getLast([0,1,2]);
 * <!--Return 2-->
 */
'use strict';
import getDataType from "./getDataType";
const getLast = (data) => {
    let dataType = getDataType(data), last = null;
    if (dataType === 'Array' && data.length > 0) {
        last = data.slice(-1)[0];
    }
    else if (dataType === 'Object' && Object.keys(data).length > 0) {
        last = Object.keys(data).slice(-1)[0];
    }
    return last;
};
export default getLast;
