Reputation: 4357
In my Meteor App's server folder, I have server.js and helper.js
Inside helper.js I have for example:
import swisseph from 'swisseph'
SWISSEPH = {}
SWISSEPH.SWE_HOUSES_EX = Meteor.wrapAsync(swisseph.swe_houses_ex);
In my server.js file if I pass SWISSEPH.SWE_HOUSES_EX
directly inside a function
const calc_longitudes_of_upagrahas = ( SWISSEPH.SWE_HOUSES_EX, flag,latitude, longitude, array_of_juls , index, obj ) => {};
I get this error:
While processing files with ecmascript (for target os.osx.x86_64):
server/server.js:488:43: Invalid left-hand side in arrow function parameters (488:43)
But if I first set SWISSEPH.SWE_HOUSES_EX
inside another variable or const then it works:
const x = SWISSEPH.SWE_HOUSES_EX //don't know why if I use SWISSEPH.SWE_HOUSES_EX directly I get an error
const calc_longitudes_of_upagrahas = ( x, flag,latitude, longitude, array_of_juls , index, obj ) => {};
What is the reason for this? For me this is counterintuitive....
Upvotes: 0
Views: 62
Reputation: 6075
Your code does not call a function, but rather defines a new one:
const foo = (x, y, z) => {}
This syntax creates a new function named foo
which takes three parameters. So your second code example works because the x
is interpreted as a parameter; the first one fails because SWISSEPH.SWE_HOUSES_EX
is not a valid parameter name.
Upvotes: 3