0

I've got an array of 220 objects in javascript. Each object is of the form like this...

var foo = {
    foo: string
    bar: string
    i: number
}

I want to be able to find all permutations where (starting at the second item in the list) bar == foo and if the original foo appears again, it will act upon that. Permutation chains could be of any size up to the length of the list.

I took a quick through some permutations libraries but nothing stood out to me.

Any ideas for libraries to use to do this?

Thanks

Joff
  • 11,247
  • 16
  • 60
  • 103
  • So you have 220 objects which are `{ foo: string, bar: string, i: number }`? And are you checking if all the contents are equal to another objects content? – A. L Jun 22 '17 at 05:38
  • not equal...the only condition is that for the second element onwards element 2 foo must equal previous element bar. and if the original element 1 foo is seen again it is considered complete – Joff Jun 22 '17 at 05:51
  • well, then that isn't 220 objects, that's 1 object with 220 elements lol. And make a short example, because it's hard to visualise – A. L Jun 22 '17 at 05:56
  • right...its one array of 220 Json objects – Joff Jun 22 '17 at 05:58
  • I think I kind of get it now, but an example would definitely clear/clarify things – A. L Jun 22 '17 at 05:59
  • ill type one out on my computer – Joff Jun 22 '17 at 06:00

0 Answers0