Repository: pedroslopez/whatsapp-web.js
File: src/Client.js (JavaScript)

Code before:
    */
    async resetState() {
        await this.pupPage.evaluate(() => {
            window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
        });
    }

    /**
     * Check if a given ID is registered in whatsapp
     * @param {string} id the whatsapp user's ID
     * @returns {Promise<Boolean>}
     */
    async isRegisteredUser(id) {
        if(!id.endsWith('@c.us')) {
            id += '@c.us';
        }
        if(!id.startsWith('+')) {
            id = '+' + id;
        }
        return await this.pupPage.evaluate(async (id) => {
            if(window.Store.Features.features.MD_BACKEND){
                id = window.Store.WidFactory.createWid(id);
                let handler = (new window.Store.USyncQuery).withContactProtocol();
                handler = handler.withUser((new window.Store.USyncUser).withId(id), handler.withDeviceProtocol(), 1);
                let result = await handler.execute();
                return result.list[0].devices.deviceList.length>0;
            }else{
                let result = await window.Store.Wap.queryExist(id);
                return result.jid !== undefined;
            }
        }, id);
    }

    /**
     * Get the registered WhatsApp ID for a number. 
     * Will return null if the number is not registered on WhatsApp.
     * @param {string} number Number or ID ("@c.us" will be automatically appended if not specified)
     * @returns {Promise<Object|null>}
     */
    async getNumberId(number) {
        if(!number.endsWith('@c.us')) {
            number += '@c.us';
        }
        if(!number.startsWith('+')) {
            number = '+' + number;
        }
        try {
            return await this.pupPage.evaluate(async numberId => {
                return window.WWebJS.getNumberId(numberId);
            }, number);
        } catch(_) {

Review comment (suggestion):
```suggestion
                return result.list[0].devices.deviceList.length > 0;
```
clean the code

Code after:
    */
    async resetState() {
        await this.pupPage.evaluate(() => {
            window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
        });
    }

    /**
     * Check if a given ID is registered in whatsapp
     * @param {string} id the whatsapp user's ID
     * @returns {Promise<Boolean>}
     */
    async isRegisteredUser(id) {
        if(!id.endsWith('@c.us')) {
            id += '@c.us';
        }
        if(!id.startsWith('+')) {
            id = '+' + id;
        }
        return await this.pupPage.evaluate(async (id) => {
            if(window.Store.Features.features.MD_BACKEND){
                id = window.Store.WidFactory.createWid(id);
                let handler = (new window.Store.USyncQuery).withContactProtocol();
                handler = handler.withUser((new window.Store.USyncUser).withId(id), handler.withDeviceProtocol(), 1);
                let result = await handler.execute();
                return result.list[0].devices.deviceList.length > 0;
            }else{
                let result = await window.Store.Wap.queryExist(id);
                return result.jid !== undefined;
            }
        }, id);
    }

    /**
     * Get the registered WhatsApp ID for a number. 
     * Will return null if the number is not registered on WhatsApp.
     * @param {string} number Number or ID ("@c.us" will be automatically appended if not specified)
     * @returns {Promise<Object|null>}
     */
    async getNumberId(number) {
        if(!number.endsWith('@c.us')) {
            number += '@c.us';
        }
        if(!number.startsWith('+')) {
            number = '+' + number;
        }
        try {
            return await this.pupPage.evaluate(async numberId => {
                return window.WWebJS.getNumberId(numberId);
            }, number);
        } catch(_) {