yesterday @SuperSkunk soved this little problem for me: How to return settings from an object
I had this setup to retrieve values from stored settings:
myProject =
settings:
value1: one
value2: two
value3: three
getSetting: (key) ->
@settings[key]
So when i call getSetting('value1') i get one.
How can I change the code to pass n-Arguments to get n-Values? Thank you in advance!
You can use a splat and list comprehensions:
Now if you call
getSettings 'value1', 'value2'the result is the array['one', 'two'].To “return as they are” means probably simply to destructure on receiving the values
so taking the above example on the caller side you do