0

I came across below syntax while I was writing test cases for one existing code base .

export function * downloadDataSaga({payload: {stateObject ,fieldObject}}){
//Some code 



}

Kindly help me in understanding this syntax where json type syntax is used as params in function.I.e which feature of JavaScript is this and what does this syntax mean ?

Rajeev Akotkar
  • 1,377
  • 4
  • 26
  • 46
  • 6
    That is not JSON. – Unmitigated Aug 09 '20 at 16:36
  • 1
    read about [function*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) (generator function) and [Destructuring assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) – fedesc Aug 09 '20 at 16:37
  • 2
    It is object destrucuring https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment – charlietfl Aug 09 '20 at 16:38
  • It's a generator function. Learn more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator – Sachin Singh Aug 09 '20 at 16:38

0 Answers0