Marketto / codice-fiscale-utils

Utility to handle Italian Codice Fiscale
MIT License
25 stars 11 forks source link

Belfiore.findName("Sud Sudan") Returns null incorrectly #108

Closed allycdafc closed 5 months ago

allycdafc commented 5 months ago

Environment:

Platform [ ] nodeJs [ ] Web/Browser

Issue description: Describe the problem

When running the Belfiore.findName("Sud Sudan") This is due to an error in scanDataSourceIndex that does not properly handle the last element when the "|" is not present

Steps to reproduce the problem: Run test case describe("Belfiore.findByName()", () => { it("Should return Sud Sudan", () => { const place = Belfiore.findByName("Sud Sudan"); expect(place).to.be.ok; if (place) { place.name.should.be.equalIgnoreCase("SUD SUDAN"); } }); });

Add Pipe to end of cities-countries.ts after Sud Sudan and the test then passes

Expected behavior Belfiore.findByName("Sud Sudan") should return the Sud Sudan object

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Additional test shows that "Quero Vas" also does not return correctly

Marketto commented 5 months ago

Resolver with release 2.2.1