Chrome extension outside of web store not enabled

So I downloaded a crx file of a Chrome extension that is no longer available in the Chrome Web Store. I dragged the crx file into the chrome://extensions page and the message says “this extension may have been corrupted”. The extension was not enabled.

I tried the Windows Registry Editor and put the Extension ID under ExtensionInstallAllowlist but the extension still wasn’t enabled. The repair button next to it was no help either.

How can I load the data faster from cloud?

I created a Survey website wherein I render the Question and the Choices from a hosting site’s php-admin but the problem is it took too much time that is why even after getting the next question, I still need to wait for a second before it renders, and sometimes it’s not. I tried using loading state but it still lagging,

This is my logic.

const {id} = useParams()
            const navigate = useNavigate()
            const location = useLocation()
            const getSurveyPart = location.pathname.split('/')[1].split('part')[1].split('survey')[0]
            
            const {error, dispatch, user } = useContext(AuthContext);
            const currentCategory = user.user_category
            const currentNumber = user.user_number
            
            const initialState = {
                user_number: currentNumber,
                user_category: currentCategory,
                choice: []
            };
            const [answer,setAnswer] = useState(initialState)


            const [allQuestionPerModule, setAllQuestionPerModule] = useState([])
            const [currentQuestionNumber, setCurrentQuestionNumber] = useState(id);
            const [currentQuestion ,setCurrentQuestion] = useState()
            const [currentChoices, setCurrentChoices] = useState([])

            const [progress, setProgress] = useState(100)
            const [loading,setLoading] = useState(true)


            //Question Type
            
            const [getCurrentQuestionType, setCurrentQuestionType] = useState("")
            
            
            //Format of Question

            const [getGridQuestion, setGridQuestion] = useState()


            useEffect(() =>{

                const getCurrentQuestion = async () =>{
                    setLoading(true);
                    try {
                        //current Question
                        const res = await publicRequest.get(`/${currentCategory}/${currentCategory}${getSurveyPart}/questiontype/${id}`)
                        setCurrentQuestionType(res.data.type)
                        setCurrentQuestion(res.data)
            
                        //Total Questions
                        const totalQuestion = await publicRequest.get(`/${currentCategory}/${currentCategory}${getSurveyPart}/`)
                        setAllQuestionPerModule(totalQuestion.data)
            
                        //Current Choices
                        const currentChoice = await publicRequest.get(`${currentCategory}/listOfChoices?name=${res.data.question}&part=${currentCategory}questionpart${getSurveyPart}`)
                        console.log(currentChoice)
                        let column = 1;


                        //if column = 12, full width
                        //if column = 6, hati sa gitna
                        //if column = 4 , hati sa tatlo
                        //if column = 3,  hati sa apat
                        if(currentChoice.data.length < 6 ){
                            column = 12
                        }else if(currentChoice.data.length < 11){
                            column = 4;
                        }else if( currentCategory.data.length > 10){
                            column = 3
                        }

                        setGridQuestion(column)
                        setCurrentChoices(currentChoice.data)
            
                        //Progress Section
                        const getTotalQuestion = totalQuestion.data.length
                        const currentQuestionData = totalQuestion.data[id - 1]
                        const currentQuestionNumber = currentQuestionData.question_order
                        setCurrentQuestionNumber(currentQuestionNumber)
            
                        const progressPercentage = (currentQuestionNumber / getTotalQuestion) * 100
                        setProgress(progressPercentage)
            
                        setLoading(false)
                    } catch (error) {
                        setLoading(false)
                    }
                }
                
                getCurrentQuestion()
            },[setCurrentQuestionNumber, id, setAllQuestionPerModule,setCurrentChoices, setCurrentQuestion, setProgress])

And this is my UI.

<form onSubmit={getCurrentQuestionType === "Single" ? handleSingle : handleMultiple  }  sx={{height: '100%', width: '100%',}}>

    <Box sx={{ display: 'flex', alignItems: 'center', mt: 5, justifyContent: 'center', flexDirection: 'column', gap: 2 }}>
        <Typography fontWeight={700 } textAlign="center" variant="subtitle1">Demographic Profile of Respondent and Employment</Typography>
        <Box sx={{ width: '90%' }}>
        <LinearProgress variant="determinate" value={progress} sx={{ height: 10, borderRadius: '20px' }} />
        </Box>

    { loading ? (
    <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
    <CircularProgress />
    </Box>
    ) : (
    <>
        <Typography variant="h5" sx={{ fontWeight: 600 }}>Question #{currentQuestion?.question_order}</Typography>
        <Typography variant="h3" fontWeight={700} color="info.main">{currentQuestion?.question}</Typography>
            <Grid container spacing={2} justifyContent="center" alignItems="center" p={4}>
                {currentChoices.map((choice, index) => (
                <Grid item xs={getGridQuestion} key={index} >
                {getCurrentQuestionType  === 'Single' ? (
                <Button
                    onClick={() => handleClick(choice.question_choices)}
                    color="secondary"
                    variant={answer.choice === choice.question_choices ? 'contained' : 'outlined'}
                    component="label"
                    style={{
                    width: '100%',
                    padding: '10px',
                    fontSize: '20px',
                    fontWeight: 'bold',
                    }}
                    >
                    <input type="radio" name="choice" hidden value={choice.question_choices} />
                    {choice.question_choices}
                </Button>

                ):(
                <Button
                    onChange={handleCheck}
                    color="secondary"
                    variant={checked.includes(choice.question_choices) ? 'contained' : 'outlined'}
                    component="label"
                    style={{
                        width: '100%',
                        padding: '10px',
                        fontSize: '20px',
                        fontWeight: 'bold',
                    }}
                    >
                    <input
                        type="checkbox"
                        name="choice"
                        hidden
                        value={choice.question_choices}
                    />
                    {choice.question_choices}
                </Button>

                )}

            </Grid>
            ))}
            </Grid>
    </>
    )}

    <Box sx={{display:'flex', alignItems:'center', justifyContent:'center', gap:2}}>
    {currentQuestionNumber >1 && (
    <Button onClick={handlePreviousQuestion} color="error"  variant="contained">Back</Button>
    ) }
    <Button type="submit" variant="contained">Next</Button>
    </Box>

    </Box>
</form>

Sprite Looking Weird on iPhone Browser

I am looking to modify this project but the game renders weird when running on iPhone. When I run it on macOS or iPad it looks fine but when I try to load it on iPhone it runs into issues. I don’t think it’s a sizing thing or browser thing because it does the same thing with iOS chrome and safari and works completely fine on macOS and iPadOS safari and chrome. For sizing, I tried the chrome dev tools iPhone size and it did not have any issues working properly. Let me know if you have a solution I am very confused on how to solve this issue! Thanks!

Expected behavior: Expected behavior
Unexpected behavior: Unexpected behavior

Source code:
https://github.com/dominikgorczyca/Pac-Man

Game demo:
https://dominikgorczyca.github.io/Pac-Man/

I don’t know where to start to solve this issue. I’m expecting the map to generate properly on mobile devices but it does not. Some code that may be relevant from the GitHub repo for how it is supposed to generate the map:

#game-board {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    width: 56rem;
    height: 62rem;
    display: grid;
    grid-template-columns: repeat(28, 2rem);
}
/* GAME BOARD GENERAL */

#game-board > * {
    position: relative;
    box-sizing: border-box;
    width: 2rem;
    height: 2rem;
}

#start, #game-start {
    position: absolute;
    margin: auto;
    width: 100%;
    top: 54%;
    text-align: center;
    color: yellow;
    font-size: 2.4rem;
    z-index: 1;
    user-select: none;
}

/* OBJECTS AND WALLS  */
.wall {
    background-image: url("map.png");
    z-index: 1;
}
@media (max-width: 600px), (max-height: 700px) {
    .wall {
        background-image: url("small_map.png");
    }
}

.blank {
    background-color: black;
}

.wall > * {
    box-sizing: border-box;
    background-color: black;
    display: block;
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
    border: .2rem solid #161693;
    border-radius: 80%;
    z-index: 1;
}

.point,
.big-point {
    box-sizing: border-box;
    width: 2rem;
    height: 2rem;
    background-color: #ffb897;
    border-radius: 0;
    z-index: 10;
}

.point {
    border: .8rem solid black;
}

.big-point {
    border: .4rem solid black;
    border-radius: 45%;
    background-color: #ffb897;
}
.gate {
    background-color: #ffb897;
    border-top: .7rem solid black;
    border-bottom: .7rem solid black;
}

Using javascript in a calculator project, my backspace and my enter keys aren’t working correctly

i’ve started a calculator project along a course I’m doing on Javascript, however even though the code is identical to what they’ve done (or at least to what they taught) I’ve found trouble in replicating the same result.
What happens is that when I press enter the button that was previously clicked gets clicked again and I have no idea why. The backspace simply doesn’t work.

What was supposed to happen was clicking the enter key and the calculate() function being triggered,thus completing the calculation that was onscreen. The backspace key was supposed to delete one number from the display.

`function createCalculator(){

return {
    display: document.querySelector('.display'),
    btnClear: document.querySelector('.btn-clear'),




    // Methods go below, attributes above 


    start(){
        this.buttonClick();
        this.pressEnter();
        this.pressBackspace();
    },

    clearDisplay(){
        this.display.value = '';
    },
    
    pressEnter(){
        document.addEventListener('keyup', (e) => {
            const key = e.target
            if( key.keycode === 13) {
                this.calculate() }
        })
    },

    pressBackspace(){
        document.addEventListener('keyup', (e) => {
            const key = e.target
            if( key.keycode === 8) {
                this.deleteNumber() }
        })
    },


    deleteNumber(){
        this.display.value = this.display.value.slice(0, -1)
    },

    buttonClick(){
        document.addEventListener('click', function(e) {
            let element = e.target
            
            if ( element.classList.contains('btn-num')){
    
                this.btnForDisplay(element.innerText); 
            }

            if(element.classList.contains('btn-clear')){
                this.clearDisplay();
            }

            if(element.classList.contains('btn-del')){
                this.deleteNumber();
            }

            if(element.classList.contains('btn-eq')){
                this.calculate()
            }
        }.bind(this)) 
    },

    btnForDisplay(valor){
        this.display.value += valor;
    },

    // The function that allows the calculations to occur 
    calculate(){
        let conta = this.display.value
        try {
            conta = eval(conta) // I know using eval might be a security compromise
            if(typeof conta === "Nan" || typeof conta === "undefined" || typeof conta === "null"){
                alert("Conta inválida")
                return
            }
            this.display.value = String(conta)
        }catch (e){
            alert("Conta inválida")
            return
        }
    },
};

}

const calculator = createCalculator()
calculator.start()`

Trouble with http streaming from aiohttp backend to javascript/html frontend

I am having some trouble with http streaming using the aiohttp framework. I’m new most of this stuff web-based and as far as I can tell this code should serve an html page with embedded javascript that will console.log chunks received from the backend, however I am instead just getting a “GET http://0.0.0.0:8200/subscribe net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)” error in my browsers console. I’m hoping to get this working before setting up an Nginx server.

my aiohttp python server:

from aiohttp import web

class webserver():

    def __init__(self, webport):
        self.webport = webport
        self.start_web()

    def start_web(self):
        routes = web.RouteTableDef()

        @routes.get('/')
        async def index_handler(request):
            return self.html_response('./index.html')

        @routes.get('/subscribe')
        async def subscribe(request):
            """Process incoming HTTP request."""                                                                                                
            response = web.StreamResponse(headers={
                'Content-Type' : 'text/event-stream'
            })                                                                                                     
            # response.content_type = 'text/plain'                                                                                                
            await response.prepare(request)                                                                                                     
            for _ in range(100):                                                                                                                
                bts = bytearray('line %dn' % _, 'utf-8')                                                                                       
                print(bts)                                                                                                                      
                await response.write(bts)
                await asyncio.sleep(1)                                                                                                          
            print('resp')  
            return response 
    
        self.app = web.Application()
        self.app.add_routes(routes)
        web.run_app(self.app, port=self.webport)
        

    def html_response(self, document):
        s = open(document, "r")
        return web.Response(text=s.read(), content_type='text/html')
    

def main():
    server = webserver(8200)


if __name__ == '__main__':
    main()


and this is my html page with embedded javascript:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Roomio</title>
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
        <div id="toggleButton" class="button">OFF</div>
        <script>
            const button = document.getElementById('toggleButton');
            let isOn = false;

            button.addEventListener('click', () => {
                const source = new EventSource("/subscribe")
            
                console.log("Hello1")
                source.onmessage = (e) => {
                    console.log("Hello2")
                    console.log(`message: ${e.data}`)
                };
                console.log("Hello3")
                isOn = !isOn;
                button.textContent = isOn ? 'ON' : 'OFF';
                document.body.style.backgroundColor = isOn ? '#2ECC40' : '#FF4136';
            });
            
        </script>
    </body>
</html>

Ive ran through a few different iterations of this code and my backend /subscribe endpoint is being hit and I know because my backend is printing out the loop values successfully, however on my frontend browser console I get a periodic error message ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) along with the Hello1 and Hello2 messages. Ive also read through the both the javascript and aiohttp documentation found here and here. Thank you for the help in advance.

TinyMCE default font

I have a tinyMCE on my Razor page.

 <div class="form-group row">
              <div class="col">
            
                  @Html.TextAreaFor(model => model.SignatureField, new { @class = "form-control editorHtml" } ) 
            </div>
       </div>

I have the following font installed for TinyMCE:

<script type="text/javascript">
        tinymce.init({
            mode: "specific_textareas",
            menubar:false,
            statusbar:false,
            selector: "#SignatureField",
            toolbar: "undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent",
            fontsize_formats: '8pt 9pt 10pt 11pt 12pt',
            font_formats: "Georgia=georgia,palatino; Helvetica=helvetica;" ,

        });
    </script>

Now, I have the requirement that when end users starts typing in TinyMCE then they can only type in one particular font which is “Bradley Hand ITC Regular”. This font already exists in my fonts. below is the screen shot.

enter image description here

I added this font in font_formats like this:

font_formats: "Georgia=georgia,palatino; Helvetica=helvetica;;Bradley Hand ITC Regular" 

As soon as I added “Bradley Hand ITC” font in the font_formats, the tinyMCE disappeared from my screen. If I remove “Bradley Hand ITC ” then it starts working again. How can I add this font in the font_formats and when the user starts typing, they can only type in “Bradley Hand ITC” font and no other font.

How can add wait in cy.task() functions like validateZipFile and getZipFileSize in the cypress.config.js

How can add wait in following cy.task() functions like validateZipFile and getZipFileSize in the in the cypress.config.js file ?

test.spec.js

cy.get('button[type="submit"]').contains("Download").click({force:true});
helperFunctions.validateZip("Booking Results Resource Pack - Task");

// helperFunctions.js

validateZip (text) {
    const dfilename = text.replace(/-|_|s/g,"");
    const downloadedFilename = dfilename+"ZipFile.zip";
   
    cy.task('getZipFileSize', downloadedFilename)
    .should('eq', 6149237)

    cy.task('validateZipFile', downloadedFilename)
    .should('deep.eq', [
      '__Booking-Resource__Question-Cards__Booking_BW.pdf', 
      '__Booking-Resource__Question-Cards__Booking-Colour.pdf'
    ]);
    
  }

  

cypress.config.js

    const AdmZip = require("adm-zip");
    
    const { defineConfig } = require('cypress')
    
    module.exports = defineConfig({
       e2e: {
        setupNodeEvents(on, config) {
          .....
    
    
            on('task', {
            validateZipFile: filename => {
              const downloadsFolder = config.downloadsFolder
              return  validateZipFile(path.join(downloadsFolder, filename))
            },
            getZipFileSize: filename => {
              const downloadsFolder = config.downloadsFolder
              const stats = fs.statSync(path.join(downloadsFolder, filename))
              return stats.size
            }
          });
    
          return config;
        },
        baseUrl: "https://staging-qa.someurl.com/",
        specPattern: "cypress/e2e/**/*.spec.{js,jsx,ts,tsx}",
      },
    })

 function validateZipFile(filename) {
  const zip = new AdmZip(filename)
  const zipEntries = zip.getEntries()
  const names = zipEntries.map(entry => entry.entryName).sort()
  return names
}

Advanced dropdown box permanently down

On a website I manage (https://bethelhistorical.org/catalog/) there is search box in the top right, and their is supposed to be a button to the left of the search button which opens up an advanced search menu. However, as of a few days ago, the button does not show and the advanced search menu is permanently open, blocking other things on the screen. I have made no changes and this just recently started happening. Any clues appreciated! Website uses PHP, CSS, and jquery.

Why Does onClick Function in React the way it Does?

Within my web application I am developing, I was designing a fun little interactive bit that changes the font of all the Typography components within the page functional component. I made the minor slip up of creating a re-render loop by setting the onClick prop of every button to changeCurrentFont(some_font) instead of () => {changeCurrentFont(some_font)}. While I understand this is due to the onClick function and how it works, but my question is why does the onClick function trigger a re-render before executing the function within the prop? Can someone explain the functionality with the onClick function in this code and why it has behavior that triggers a render loop.


const NewsForm = () => {
const classes = useStyles();

const query = useQuery();
const page = query.get('page') || 1;

const [newsPostData, setNewsPostData] = useState({ title: '', information: '', date: Date});
const [currentId, setCurrentId] = useState(0);
const newsPost = useSelector((state) => (currentId ? state.newsPosts.find((information) => information._id === currentId) : null));
const history = useHistory();
//handle button change for adding a new newsform

const dispatch = useDispatch();
dispatch(getNewsPosts(1));

const clear = () => {
    setCurrentId(0);
    setNewsPostData({ title: '', information: '', date: Date });
};

const handleSubmit = async (e) => {
    e.preventDefault();

    if (currentId === 0) {
        dispatch(createNewsPost({ ...newsPostData, date: new Date() }, history));
        console.log(`Newspost created at ${newsPostData.date}, form information: ${newsPostData}`);
        clear();
      } else {
        //TODO implement an updateNewsPost method
        //dispatch(updateNewsPost(currentId, { ...postData}));
        clear();
    }
}

return (
    <Paper className={[classes.newsPostPaper, classes.paper]}>
        <Typography variant={'h4'} align={'center'} className={['']}>Manage News Posts</Typography>
        <Grid container direction='column' spacing={2}>
            <Grid item lg={6}>
                <NewsPosts 
                            setCurrentId={setCurrentId} 
                            class='posts' 
                            postStyleOptions={{
                                body: 'newsbar-post-body font-consolas',
                                subtitle: 'newsbar-post-subtitle font-consolas',
                                title: 'newsbar-post-title swiss'
                            }}
                        />
            </Grid>

            <Grid item lg={6} className={`news-post-creation-form-outer`}>
                <Paper className={`news-post-creation-form-inner`}>

                    <form autoComplete="off" noValidate className={`${classes.root} ${classes.form}`} onSubmit={handleSubmit}>
                        <Typography variant='h6'>{currentId ? `Editing News Post "${newsPost.title}" from ${newsPost.date}` :  'Creating a News Post'}</Typography>
                        <TextField name="title" variant="outlined" label="Title" fullwidth value={newsPostData.title} onChange={(e) => setNewsPostData({...newsPostData, title: e.target.value })} />
                        <TextField name="information" variant="outline" label='Information' fullwidth value={newsPostData.information} onChange={(e) => setNewsPostData({...newsPostData, information: e.target.value})}/>
                        
                        <Input
                            id="input-for-date"
                            name="date"
                            startAdornment={
                                <InputAdornment>
                                    <Typography variant="body">Date: </Typography>
                                </InputAdornment>
                            }
                            variant="filled"
                            fullWidth
                            defaultValue={currentId ? newsPostData.date : new Date()}
                            contentEditable={false}
                            value={newsPostData.date}
                        />
                        
                    </form>

                </Paper>
            </Grid>
        </Grid>
    </Paper>
)

}

How to have a for loop create multiple eventListeners in JavaScript? [duplicate]

everyone.

I am trying to manipulate DOM so whenever the user clicks on the categories, I want their background to change to a pinkish color. I tried to add an eventListener to only the first of those categories (whose class is ‘.select’), and it worked fine. Then I tried to write code for a for loop that can add eventListeners for all of the options, and it didn’t work. Also when I run the code for the case in which only the first option gets impacted, its font color is still not changing. How do I fix these issues? Here are my code segments:

<div class="categorybox">
                <ul>
                    <li class="select"><a href="#">Love</a></li>
                    <li class="select"><a href="#">Health</a></li>
                    <li class="select"><a href="#">Beauty</a></li>
                    <li class="select"><a href="#">Gratitude</a></li>
                    <li class="select"><a href="#">Sleep</a></li>
                    <li class="select"><a href="#">Spiritual</a></li>
                    <li class="select"><a href="#">Happiness</a></li>
                    <li class="select"><a href="#">Money</a></li>
                    <li class="select"><a href="#">Blessing</a></li>
                </ul>
</div>
const category = document.querySelector(".select");

category.addEventListener("click", (e) => {
  e.preventDefault();
  category.style.background = "#eb3352";
  category.style.opacity = "0.7";
  category.style.color = "#fcfafa";
});

In the case above, my font color doesn’t change to the color I specified (#fcfafa).

Then I tried running the code below.

const categories = document.querySelectorAll(".select");

for (var i = 0; i < categories.length; i++){
  categories[i].addEventListener("click", (e) => {
    e.preventDefault();
    categories[i].style.background = "#eb3352";
    categories[i].style.opacity = "0.7";
    categories[i].style.color = "#fcfafa";
}});

In the case above, none of the selected list items changed.

This code should print each prime from numbers[] to the console once [closed]

Im new at coding, im trying to make it print each prime from the number[] array to the console. Ive been trying the whole day, im also working on my research skills, but here’s what i have so far:

let numbers = [...Array(100).keys()];
let primes = [];

// This code should print each prime from numbers[] to the console once.


console.log("Primes:", primes);

I expect to only print each prime number from that variable.
i tried this

function isPrime(numbers) {
/*
 * Checks if a given number is prime.
 */
if (numbers < 2) {
    return false;
}
for (let i = 2; i <= Math.sqrt(numbers); i++) {
    if (numbers % i === 0) {
        return false;
    }
}
return true;

}

TypeError: Cannot destructure property ‘createComponentInstance’ of ‘Vue.ssrUtils’ as it is undefined for nuxt and jest

I am trying to onboard the jest testing framework to my nuxt project but while doing this,

I got a major roadblock as I am not able to test the simple component. I am not able to find any proper solution related to this question, if anyone faced the same issue can you please help here.

The test spec file I wrote is:

import { mount } from '@vue/test-utils'
import test from '../pages/test.vue'
describe('test', () => {
test('is a Vue instance', () => {
const wrapper = mount(test)
expect(wrapper.vm).toBeTruthy()
})
})

Below is my package.json

{
 "name": "test",
 "version": "1.0.0",
 "description": "test",
 "private": true,
 "scripts": {
 "dev": "nuxt",
 "build": "nuxt build",
 "start": "nuxt start",
 "test": "jest -u - runInBand - coverage - passWithNoTests",
 "generate": "nuxt generate",
 "lint": "eslint - ext .js,.vue - ignore-path .gitignore .",
 "lint:fix": "eslint - fix - ext .js,.vue - ignore-path .gitignore .",
 "lint:css": "stylelint - fix ./**/*.{vue,scss,css}"
 },
 "lint-staged": {
 "*.{js,vue}": "npm run lint:fix",
 "*.{css,vue}": "npm run lint:css"
 },
 "husky": {
 "hooks": {
 "pre-commit": "lint-staged"
 }
 },
 "dependencies": {
 "@babel/core": "7.21.3",
 "@babel/preset-env": "7.20.2",
 "@nuxt/test-utils": "3.3.1",
 "@nuxtjs/axios": "⁵.12.2",
 "@nuxtjs/dotenv": "¹.4.0",
 "@nuxtjs/proxy": "².0.1",
 "@nuxtjs/pwa": "3.0.0–0",
 "@nuxtjs/vuetify": "1.11.3",
 "@vue/server-renderer": "3.2.47",
 "@vue/test-utils": "2.3.2",
 "axios": "⁰.21.0",
 "babel-jest": "26.6.0",
 "babel-polyfill": "⁶.26.0",
 "bootstrap-vue": "2.21.2",
 "cookie-universal-nuxt": "².1.4",
 "cross-env": "⁵.2.1",
 "file-exists": "⁵.0.1",
 "fs-extra": "¹¹.1.1",
 "jest": "26.6.0",
 "jest-circus": "26.6.0",
 "jest-resolve": "26.6.0",
 "jsonwebtoken": "⁸.5.1",
 "lodash": "⁴.17.20",
 "moment": "2.29.1",
 "nuxt": "2.0.0",
 "nuxt-i18n": "⁶.28.1",
 "vue-jest": "3.0.7",
 "vue-server-renderer": "2.7.14",
 "vuex-persist": "3.1.3"
 },
 "devDependencies": {
 "@nuxtjs/eslint-config": "².0.0",
 "@nuxtjs/eslint-module": "¹.0.0",
 "@nuxtjs/stylelint-module": "³.1.0",
 "babel-core": "⁷.0.0-bridge.0",
 "babel-eslint": "¹⁰.0.1",
 "eslint": "⁶.1.0",
 "eslint-plugin-nuxt": ">=0.4.2",
 "eslint-plugin-vue": "⁶.2.2",
 "lint-staged": "¹⁰.0.0",
 "node-sass": "⁶.0.1",
 "sass-loader": "¹⁰.3.1",
 "stylelint": "¹⁰.1.0",
 "stylelint-config-standard": "²⁰.0.0"
 },
 "config": {
 "nuxt": {
 "host": "0.0.0.0"
 }
 },
 "engines": {
 "node": "¹⁶.x"
 }
}

my jest config:

module.exports={
 moduleNameMapper: {
 '^@/(.*)$': '<rootDir>/components',
 '^~/(.*)$': '<rootDir>/pages',
 '^vue$': 'vue/dist/vue.common.js',
 
 },
 moduleFileExtensions: [
 'js',
 'vue',
 'json'
 ],
 transform: {
 '^.+\.js$': 'babel-jest',
 "^.+.js$": "babel-jest",
 ".*.(vue)$": 'vue-jest',
 '.*\.(vue)$': 'vue-jest',
 
 },
 testEnvironment: "jest-environment-jsdom",
 //testResultsProcessor: "jest-sonar-reporter",
 collectCoverage: true,
 collectCoverageFrom: [
 '<rootDir>/components/**/*.vue',
 '<rootDir>/pages/**/*.vue',
 '<rootDir>/pages/**/*.js',
 
 ],
 
}

enter image description here

rtk query typescript interface type issue

I’m attempting to pass a variable to an RTK Query API service that has a typescript interface:

const device_id: unique symbol = Symbol(props.id);
const {
    data: device,
    isFetching,
    isLoading,
} = useGetAssetsByIdQuery(device_id, {
    pollingInterval: 3000,
    refetchOnMountOrArgChange: true,
    skip: false,
})

As you can see I’m taking the props.id value (which is passed in as a string) and attempting to convert it to a unique symbol, which is required by the typescript definition of the useGetAssetsByIdQuery method.

I’m getting the following error:

TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'GetAssetsByIdApiArg | unique symbol'.

I don’t understand why, if I’m passing in a unique symbol it would still throw the error when the interface clearly specifies either GetAssetsByIdApiArg or unique symbol.

How do i convert a array of strings into array of objects [duplicate]

I have an array of strings like this:

    const array = [
       "date: 1679534340367, price: 27348.6178237571831766",
       "date: 1679534340367, price: 27348.6178237571831766",
       "date: 1679534340367, price: 27348.6178237571831766",
       "date: 1679534340367, price: 27348.6178237571831766",
       "date: 1679534340367, price: 27348.6178237571831766"
    ]

How can i convert it to an array of objects to look like this:

   const array = [
      {"date": 1679534340367, "price": 27348.6178237571831766},
      {"date": 1679534340367, "price": 27348.6178237571831766},
      {"date": 1679534340367, "price": 27348.6178237571831766},
      {"date": 1679534340367, "price": 27348.6178237571831766},
      {"date": 1679534340367, "price": 27348.6178237571831766},
   ]

React App Hosted Firebase: Failed to load resource: the server responded with a status of 400 Error

I’ve hosted the react app on Firebase. Done with all required steps as recommended. But on my hosting url I am getting a 400 error and blank page.
Here is the firebase.json file:
{ "hosting": { "public": "build", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } }