Simplify isSteamID

This commit is contained in:
Alex Corn 2021-07-30 00:26:11 -04:00
parent fd5ed31afa
commit c7a8c676b7
No known key found for this signature in database
GPG Key ID: E51989A3E7A27FDF

View File

@ -1,14 +1,12 @@
const EResult = require('../resources/EResult.js');
/**
* Make sure that a provided input is a valid SteamID object.
* @param {object} input
* @returns {boolean}
*/
exports.isSteamID = function(input) {
let keys = Object.keys(input);
if (keys.length != 4) {
return false;
}
// Make sure it has the keys we expect
keys.sort();
return keys.join(',') == 'accountid,instance,type,universe';
return ['universe', 'type', 'instance', 'accountid'].every(prop => typeof input[prop] == 'number' || typeof input[prop] == 'bigint');
};
exports.decodeSteamTime = function(time) {