Thanks for looking at my question.
In this javascript initialization code, on line 94, I am getting a syntax error: "Duplicate parameter name not allowed in this context". However, I am not duplicating any parameters. All of my functions' parameters names are unique within their scope.
The repository is at , and the script in question is at .js. The error is appearing on the function call to create_menu_items
. I carefully inspected this file for duplicate parameter names but found none. I tried changing the names of each of the 3 declared variables in the main function, along with changing the names of the parameters. Nothing seems to get rid of the syntax error, which is preventing my function from executing.
async function create_menu_items(filenames, directory, cat_names_to_ids) {
/// stuff
}
async function main() {
await create_menu_items(menu_item_filenames, menu_item_dir, categories_name_to_id);
}
[skyler@laptop server]$ npm start
[.....snip.....]
(node:6571) UnhandledPromiseRejectionWarning: SyntaxError: Duplicate parameter name not allowed in this context
As mentioned, this error keeps appearing and the function create_menu_items
doesn't run, even though I think it should, because none of the parameters appear to be in conflict with anything.
Thanks again for taking a look.
Thanks for looking at my question.
In this javascript initialization code, on line 94, I am getting a syntax error: "Duplicate parameter name not allowed in this context". However, I am not duplicating any parameters. All of my functions' parameters names are unique within their scope.
The repository is at https://github./allenchan3/foodproject/blob/c3442a3b8542e1f9cbcc5f3f78175765a292dd9a, and the script in question is at https://github./allenchan3/foodproject/blob/c3442a3b8542e1f9cbcc5f3f78175765a292dd9a/server/config/initialize.js. The error is appearing on the function call to create_menu_items
. I carefully inspected this file for duplicate parameter names but found none. I tried changing the names of each of the 3 declared variables in the main function, along with changing the names of the parameters. Nothing seems to get rid of the syntax error, which is preventing my function from executing.
async function create_menu_items(filenames, directory, cat_names_to_ids) {
/// stuff
}
async function main() {
await create_menu_items(menu_item_filenames, menu_item_dir, categories_name_to_id);
}
[skyler@laptop server]$ npm start
[.....snip.....]
(node:6571) UnhandledPromiseRejectionWarning: SyntaxError: Duplicate parameter name not allowed in this context
As mentioned, this error keeps appearing and the function create_menu_items
doesn't run, even though I think it should, because none of the parameters appear to be in conflict with anything.
Thanks again for taking a look.
Here's your problem
objects.reduce((prev_items,curr_items_obj,_,_)=>{
^ ^
It seems that you wanted to omit optional parameters this way, but you should just skip them like this:
objects.reduce((prev_items,curr_items_obj)=>{
If you really care to use _
for omited parameters, name the other one as __
(double underscore) to avoid duplicate parameter error, as such:
objects.reduce((prev_items,curr_items_obj,_,__)=>{