Comments (5)
@alcohol sorry but I don't follow, what autocomplete? This is not a JS frontend library we would use for autocompletion, instead we use it in integration systems to lookup for appropriate country details based on user input. Therefore you can't just state that this is not a bug rather a feature, this is at least inappropriate!
IMO the return should be null
in this case or at least throw an exception.
from iso3166.
Aside from name()
, the other public methods implement guards. Perhaps the same could be done for name()
. Although I am not sure if this is really an issue to begin with. There is no contract or definition for what should be returned if you search for an empty string. Since name()
functions somewhat like an autocomplete, returning the first result from the set for an empty search string could be considered a graceful way to "fail".
from iso3166.
@alcohol so if I search for a string, should I also make sure that the country I end up with is actually the one I was looking for?
I'm afraid that approach seems like a recipe for messing things up without really trying.
from iso3166.
I do not follow. If you search for a string through the name()
method, you can expect a result in an autocomplete like manner. If you want to be sure of the returned value, I suggest working with alpha 2 or 3 codes instead. They always map 1:1 to their designated value.
from iso3166.
@alcohol
Following description of method.
@throws \League\ISO3166\Exception\OutOfBoundsException if key does not exist in dataset
I believe empty string is non-existing key, also any one letter key should then end up on that exception, as I'm quite sure it does not exist same as empty string. It should be strict behaviour.
from iso3166.
Related Issues (20)
- Aliases HOT 5
- Project Name? HOT 1
- shouldn't the main API be static? HOT 1
- "Czech Republic" or "Czechia" (Alias -feature request) HOT 4
- PHP 8.1 Deprecation message HOT 2
- Missed Netherlands Antilles (feature request) HOT 2
- Language to be used for default locales
- New release to prevent deprecations triggered on PHP 8.1 HOT 4
- Freezes downloading on Composer install HOT 1
- Missing entry for Canary Islands HOT 2
- Canary Islands is not present in the library HOT 1
- It will be nice if structure can return Nationality also
- Croatia currency updated in 2023 HOT 1
- Make ISO3166 more "extendable" HOT 1
- Multibyte string extension does not described in composer.json schema. HOT 1
- Use of the definite article (the) in country names HOT 5
- XK is missing HOT 1
- I suggest changing the source also to my repo where I keep the updated list from iso.org HOT 1
- Adding flags for EEC country members HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iso3166.