function maybeIntegerKey(val) {
    if (typeof val === "string") {
        var num = Number(val);
        if(isSafeInteger(num) && String(num) === val) {
            return num;
        }
    } else if (isSafeInteger(val)) {
        return val;
    }
}
Return number if argument is a number or can be cast to a number which
roundtrips to the same string, otherwise return undefined.