antonmedv/finder

Selector not found

amol-16 opened this issue · 6 comments

For some pages ->

  function sort(paths: Iterator<Path> & Iterable<Path>): Path[] {
    return Array.from(paths).sort((a, b) => penalty(a) - penalty(b))
  }

Output of "Array.from(paths)" is returning => [ ] (empty array)
Adding a polyfill substitute in this method is solving the issue ->
ex- code

function transformToArray <a>(a: Iterator<a>) {
  let result: a[] = []
  let current = a.next()
  while(current.done == false) {
    result.push(current.value)
    current = a.next()
  }
  return result
}

  function sort(paths: Iterator<Path> & Iterable<Path>): Path[] {
    return transformToArray(paths).sort((a, b) => penalty(a) - penalty(b))
  }

Let me know, I can raise a PR for the same.

Yes, let’s go a PR.

@antonmedv PR for above suggested change -> #63

For some pages ->

Can you link an example there I can check it?

added example page and screenshot of error object from library

Fixed via 67eb35c