mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-14 15:00:07 +08:00
Simplify isSteamID
This commit is contained in:
parent
fd5ed31afa
commit
c7a8c676b7
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user